wxAuiNotebook bitmaps working now
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43198 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -57,239 +57,7 @@ enum wxAuiNotebookOption
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// tab art class
|
// aui notebook event class
|
||||||
|
|
||||||
class WXDLLIMPEXP_AUI wxAuiTabArt
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
wxAuiTabArt() { }
|
|
||||||
virtual ~wxAuiTabArt() { }
|
|
||||||
|
|
||||||
virtual wxAuiTabArt* Clone() = 0;
|
|
||||||
virtual void SetFlags(unsigned int flags) = 0;
|
|
||||||
|
|
||||||
virtual void SetSizingInfo(const wxSize& tab_ctrl_size,
|
|
||||||
size_t tab_count) = 0;
|
|
||||||
|
|
||||||
virtual void SetNormalFont(const wxFont& font) = 0;
|
|
||||||
virtual void SetSelectedFont(const wxFont& font) = 0;
|
|
||||||
virtual void SetMeasuringFont(const wxFont& font) = 0;
|
|
||||||
|
|
||||||
virtual void DrawBackground(
|
|
||||||
wxDC& dc,
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxRect& rect) = 0;
|
|
||||||
|
|
||||||
virtual void DrawTab(wxDC& dc,
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxRect& in_rect,
|
|
||||||
const wxString& caption,
|
|
||||||
bool active,
|
|
||||||
int close_button_state,
|
|
||||||
wxRect* out_tab_rect,
|
|
||||||
wxRect* out_button_rect,
|
|
||||||
int* x_extent) = 0;
|
|
||||||
|
|
||||||
virtual void DrawButton(
|
|
||||||
wxDC& dc,
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxRect& in_rect,
|
|
||||||
int bitmap_id,
|
|
||||||
int button_state,
|
|
||||||
int orientation,
|
|
||||||
const wxBitmap& bitmap_override,
|
|
||||||
wxRect* out_rect) = 0;
|
|
||||||
|
|
||||||
virtual int GetIndentSize() = 0;
|
|
||||||
|
|
||||||
virtual wxSize GetTabSize(
|
|
||||||
wxDC& dc,
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxString& caption,
|
|
||||||
bool active,
|
|
||||||
int close_button_state,
|
|
||||||
int* x_extent) = 0;
|
|
||||||
|
|
||||||
virtual int ShowWindowList(
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxArrayString& items,
|
|
||||||
int active_idx) = 0;
|
|
||||||
|
|
||||||
virtual int GetBestTabCtrlSize(wxWindow* wnd) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_AUI wxAuiSimpleTabArt : public wxAuiTabArt
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
wxAuiSimpleTabArt();
|
|
||||||
virtual ~wxAuiSimpleTabArt();
|
|
||||||
|
|
||||||
wxAuiTabArt* Clone();
|
|
||||||
void SetFlags(unsigned int flags);
|
|
||||||
|
|
||||||
void SetSizingInfo(const wxSize& tab_ctrl_size,
|
|
||||||
size_t tab_count);
|
|
||||||
|
|
||||||
void SetNormalFont(const wxFont& font);
|
|
||||||
void SetSelectedFont(const wxFont& font);
|
|
||||||
void SetMeasuringFont(const wxFont& font);
|
|
||||||
|
|
||||||
void DrawBackground(
|
|
||||||
wxDC& dc,
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxRect& rect);
|
|
||||||
|
|
||||||
void DrawTab(wxDC& dc,
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxRect& in_rect,
|
|
||||||
const wxString& caption,
|
|
||||||
bool active,
|
|
||||||
int close_button_state,
|
|
||||||
wxRect* out_tab_rect,
|
|
||||||
wxRect* out_button_rect,
|
|
||||||
int* x_extent);
|
|
||||||
|
|
||||||
void DrawButton(
|
|
||||||
wxDC& dc,
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxRect& in_rect,
|
|
||||||
int bitmap_id,
|
|
||||||
int button_state,
|
|
||||||
int orientation,
|
|
||||||
const wxBitmap& bitmap_override,
|
|
||||||
wxRect* out_rect);
|
|
||||||
|
|
||||||
int GetIndentSize();
|
|
||||||
|
|
||||||
wxSize GetTabSize(
|
|
||||||
wxDC& dc,
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxString& caption,
|
|
||||||
bool active,
|
|
||||||
int close_button_state,
|
|
||||||
int* x_extent);
|
|
||||||
|
|
||||||
int ShowWindowList(
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxArrayString& items,
|
|
||||||
int active_idx);
|
|
||||||
|
|
||||||
int GetBestTabCtrlSize(wxWindow* wnd);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
wxFont m_normal_font;
|
|
||||||
wxFont m_selected_font;
|
|
||||||
wxFont m_measuring_font;
|
|
||||||
wxPen m_normal_bkpen;
|
|
||||||
wxPen m_selected_bkpen;
|
|
||||||
wxBrush m_normal_bkbrush;
|
|
||||||
wxBrush m_selected_bkbrush;
|
|
||||||
wxBrush m_bkbrush;
|
|
||||||
wxBitmap m_active_close_bmp;
|
|
||||||
wxBitmap m_disabled_close_bmp;
|
|
||||||
wxBitmap m_active_left_bmp;
|
|
||||||
wxBitmap m_disabled_left_bmp;
|
|
||||||
wxBitmap m_active_right_bmp;
|
|
||||||
wxBitmap m_disabled_right_bmp;
|
|
||||||
wxBitmap m_active_windowlist_bmp;
|
|
||||||
wxBitmap m_disabled_windowlist_bmp;
|
|
||||||
|
|
||||||
int m_fixed_tab_width;
|
|
||||||
unsigned int m_flags;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_AUI wxAuiDefaultTabArt : public wxAuiTabArt
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
wxAuiDefaultTabArt();
|
|
||||||
virtual ~wxAuiDefaultTabArt();
|
|
||||||
|
|
||||||
wxAuiTabArt* Clone();
|
|
||||||
void SetFlags(unsigned int flags);
|
|
||||||
void SetSizingInfo(const wxSize& tab_ctrl_size,
|
|
||||||
size_t tab_count);
|
|
||||||
|
|
||||||
void SetNormalFont(const wxFont& font);
|
|
||||||
void SetSelectedFont(const wxFont& font);
|
|
||||||
void SetMeasuringFont(const wxFont& font);
|
|
||||||
|
|
||||||
void DrawBackground(
|
|
||||||
wxDC& dc,
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxRect& rect);
|
|
||||||
|
|
||||||
void DrawTab(wxDC& dc,
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxRect& in_rect,
|
|
||||||
const wxString& caption,
|
|
||||||
bool active,
|
|
||||||
int close_button_state,
|
|
||||||
wxRect* out_tab_rect,
|
|
||||||
wxRect* out_button_rect,
|
|
||||||
int* x_extent);
|
|
||||||
|
|
||||||
void DrawButton(
|
|
||||||
wxDC& dc,
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxRect& in_rect,
|
|
||||||
int bitmap_id,
|
|
||||||
int button_state,
|
|
||||||
int orientation,
|
|
||||||
const wxBitmap& bitmap_override,
|
|
||||||
wxRect* out_rect);
|
|
||||||
|
|
||||||
int GetIndentSize();
|
|
||||||
|
|
||||||
wxSize GetTabSize(
|
|
||||||
wxDC& dc,
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxString& caption,
|
|
||||||
bool active,
|
|
||||||
int close_button_state,
|
|
||||||
int* x_extent);
|
|
||||||
|
|
||||||
int ShowWindowList(
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxArrayString& items,
|
|
||||||
int active_idx);
|
|
||||||
|
|
||||||
int GetBestTabCtrlSize(wxWindow* wnd);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
wxFont m_normal_font;
|
|
||||||
wxFont m_selected_font;
|
|
||||||
wxFont m_measuring_font;
|
|
||||||
wxPen m_normal_bkpen;
|
|
||||||
wxPen m_selected_bkpen;
|
|
||||||
wxBrush m_normal_bkbrush;
|
|
||||||
wxBrush m_selected_bkbrush;
|
|
||||||
wxBrush m_bkbrush;
|
|
||||||
wxBitmap m_active_close_bmp;
|
|
||||||
wxBitmap m_disabled_close_bmp;
|
|
||||||
wxBitmap m_active_left_bmp;
|
|
||||||
wxBitmap m_disabled_left_bmp;
|
|
||||||
wxBitmap m_active_right_bmp;
|
|
||||||
wxBitmap m_disabled_right_bmp;
|
|
||||||
wxBitmap m_active_windowlist_bmp;
|
|
||||||
wxBitmap m_disabled_windowlist_bmp;
|
|
||||||
|
|
||||||
int m_fixed_tab_width;
|
|
||||||
unsigned int m_flags;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// event declarations/classes
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_AUI wxAuiNotebookEvent : public wxNotifyEvent
|
class WXDLLIMPEXP_AUI wxAuiNotebookEvent : public wxNotifyEvent
|
||||||
{
|
{
|
||||||
@@ -333,9 +101,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_AUI wxAuiNotebookPage
|
class WXDLLIMPEXP_AUI wxAuiNotebookPage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -365,6 +130,253 @@ WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiTabContainerButton, wxAuiTabContainerButt
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// tab art class
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_AUI wxAuiTabArt
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxAuiTabArt() { }
|
||||||
|
virtual ~wxAuiTabArt() { }
|
||||||
|
|
||||||
|
virtual wxAuiTabArt* Clone() = 0;
|
||||||
|
virtual void SetFlags(unsigned int flags) = 0;
|
||||||
|
|
||||||
|
virtual void SetSizingInfo(const wxSize& tab_ctrl_size,
|
||||||
|
size_t tab_count) = 0;
|
||||||
|
|
||||||
|
virtual void SetNormalFont(const wxFont& font) = 0;
|
||||||
|
virtual void SetSelectedFont(const wxFont& font) = 0;
|
||||||
|
virtual void SetMeasuringFont(const wxFont& font) = 0;
|
||||||
|
|
||||||
|
virtual void DrawBackground(
|
||||||
|
wxDC& dc,
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxRect& rect) = 0;
|
||||||
|
|
||||||
|
virtual void DrawTab(wxDC& dc,
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxRect& in_rect,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
bool active,
|
||||||
|
int close_button_state,
|
||||||
|
wxRect* out_tab_rect,
|
||||||
|
wxRect* out_button_rect,
|
||||||
|
int* x_extent) = 0;
|
||||||
|
|
||||||
|
virtual void DrawButton(
|
||||||
|
wxDC& dc,
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxRect& in_rect,
|
||||||
|
int bitmap_id,
|
||||||
|
int button_state,
|
||||||
|
int orientation,
|
||||||
|
const wxBitmap& bitmap_override,
|
||||||
|
wxRect* out_rect) = 0;
|
||||||
|
|
||||||
|
virtual int GetIndentSize() = 0;
|
||||||
|
|
||||||
|
virtual wxSize GetTabSize(
|
||||||
|
wxDC& dc,
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
bool active,
|
||||||
|
int close_button_state,
|
||||||
|
int* x_extent) = 0;
|
||||||
|
|
||||||
|
virtual int ShowWindowList(
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxArrayString& items,
|
||||||
|
int active_idx) = 0;
|
||||||
|
|
||||||
|
virtual int GetBestTabCtrlSize(wxWindow* wnd,
|
||||||
|
wxAuiNotebookPageArray& pages) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_AUI wxAuiDefaultTabArt : public wxAuiTabArt
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxAuiDefaultTabArt();
|
||||||
|
virtual ~wxAuiDefaultTabArt();
|
||||||
|
|
||||||
|
wxAuiTabArt* Clone();
|
||||||
|
void SetFlags(unsigned int flags);
|
||||||
|
void SetSizingInfo(const wxSize& tab_ctrl_size,
|
||||||
|
size_t tab_count);
|
||||||
|
|
||||||
|
void SetNormalFont(const wxFont& font);
|
||||||
|
void SetSelectedFont(const wxFont& font);
|
||||||
|
void SetMeasuringFont(const wxFont& font);
|
||||||
|
|
||||||
|
void DrawBackground(
|
||||||
|
wxDC& dc,
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxRect& rect);
|
||||||
|
|
||||||
|
void DrawTab(wxDC& dc,
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxRect& in_rect,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
bool active,
|
||||||
|
int close_button_state,
|
||||||
|
wxRect* out_tab_rect,
|
||||||
|
wxRect* out_button_rect,
|
||||||
|
int* x_extent);
|
||||||
|
|
||||||
|
void DrawButton(
|
||||||
|
wxDC& dc,
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxRect& in_rect,
|
||||||
|
int bitmap_id,
|
||||||
|
int button_state,
|
||||||
|
int orientation,
|
||||||
|
const wxBitmap& bitmap_override,
|
||||||
|
wxRect* out_rect);
|
||||||
|
|
||||||
|
int GetIndentSize();
|
||||||
|
|
||||||
|
wxSize GetTabSize(
|
||||||
|
wxDC& dc,
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
bool active,
|
||||||
|
int close_button_state,
|
||||||
|
int* x_extent);
|
||||||
|
|
||||||
|
int ShowWindowList(
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxArrayString& items,
|
||||||
|
int active_idx);
|
||||||
|
|
||||||
|
int GetBestTabCtrlSize(wxWindow* wnd,
|
||||||
|
wxAuiNotebookPageArray& pages);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
wxFont m_normal_font;
|
||||||
|
wxFont m_selected_font;
|
||||||
|
wxFont m_measuring_font;
|
||||||
|
wxPen m_normal_bkpen;
|
||||||
|
wxPen m_selected_bkpen;
|
||||||
|
wxBrush m_normal_bkbrush;
|
||||||
|
wxBrush m_selected_bkbrush;
|
||||||
|
wxBrush m_bkbrush;
|
||||||
|
wxBitmap m_active_close_bmp;
|
||||||
|
wxBitmap m_disabled_close_bmp;
|
||||||
|
wxBitmap m_active_left_bmp;
|
||||||
|
wxBitmap m_disabled_left_bmp;
|
||||||
|
wxBitmap m_active_right_bmp;
|
||||||
|
wxBitmap m_disabled_right_bmp;
|
||||||
|
wxBitmap m_active_windowlist_bmp;
|
||||||
|
wxBitmap m_disabled_windowlist_bmp;
|
||||||
|
|
||||||
|
int m_fixed_tab_width;
|
||||||
|
int m_tab_ctrl_height;
|
||||||
|
unsigned int m_flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_AUI wxAuiSimpleTabArt : public wxAuiTabArt
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxAuiSimpleTabArt();
|
||||||
|
virtual ~wxAuiSimpleTabArt();
|
||||||
|
|
||||||
|
wxAuiTabArt* Clone();
|
||||||
|
void SetFlags(unsigned int flags);
|
||||||
|
|
||||||
|
void SetSizingInfo(const wxSize& tab_ctrl_size,
|
||||||
|
size_t tab_count);
|
||||||
|
|
||||||
|
void SetNormalFont(const wxFont& font);
|
||||||
|
void SetSelectedFont(const wxFont& font);
|
||||||
|
void SetMeasuringFont(const wxFont& font);
|
||||||
|
|
||||||
|
void DrawBackground(
|
||||||
|
wxDC& dc,
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxRect& rect);
|
||||||
|
|
||||||
|
void DrawTab(wxDC& dc,
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxRect& in_rect,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
bool active,
|
||||||
|
int close_button_state,
|
||||||
|
wxRect* out_tab_rect,
|
||||||
|
wxRect* out_button_rect,
|
||||||
|
int* x_extent);
|
||||||
|
|
||||||
|
void DrawButton(
|
||||||
|
wxDC& dc,
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxRect& in_rect,
|
||||||
|
int bitmap_id,
|
||||||
|
int button_state,
|
||||||
|
int orientation,
|
||||||
|
const wxBitmap& bitmap_override,
|
||||||
|
wxRect* out_rect);
|
||||||
|
|
||||||
|
int GetIndentSize();
|
||||||
|
|
||||||
|
wxSize GetTabSize(
|
||||||
|
wxDC& dc,
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
bool active,
|
||||||
|
int close_button_state,
|
||||||
|
int* x_extent);
|
||||||
|
|
||||||
|
int ShowWindowList(
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxArrayString& items,
|
||||||
|
int active_idx);
|
||||||
|
|
||||||
|
int GetBestTabCtrlSize(wxWindow* wnd,
|
||||||
|
wxAuiNotebookPageArray& pages);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
wxFont m_normal_font;
|
||||||
|
wxFont m_selected_font;
|
||||||
|
wxFont m_measuring_font;
|
||||||
|
wxPen m_normal_bkpen;
|
||||||
|
wxPen m_selected_bkpen;
|
||||||
|
wxBrush m_normal_bkbrush;
|
||||||
|
wxBrush m_selected_bkbrush;
|
||||||
|
wxBrush m_bkbrush;
|
||||||
|
wxBitmap m_active_close_bmp;
|
||||||
|
wxBitmap m_disabled_close_bmp;
|
||||||
|
wxBitmap m_active_left_bmp;
|
||||||
|
wxBitmap m_disabled_left_bmp;
|
||||||
|
wxBitmap m_active_right_bmp;
|
||||||
|
wxBitmap m_disabled_right_bmp;
|
||||||
|
wxBitmap m_active_windowlist_bmp;
|
||||||
|
wxBitmap m_disabled_windowlist_bmp;
|
||||||
|
|
||||||
|
int m_fixed_tab_width;
|
||||||
|
unsigned int m_flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_AUI wxAuiTabContainer
|
class WXDLLIMPEXP_AUI wxAuiTabContainer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -510,12 +522,19 @@ public:
|
|||||||
size_t GetPageCount() const;
|
size_t GetPageCount() const;
|
||||||
wxWindow* GetPage(size_t page_idx) const;
|
wxWindow* GetPage(size_t page_idx) const;
|
||||||
|
|
||||||
|
|
||||||
void SetArtProvider(wxAuiTabArt* art);
|
void SetArtProvider(wxAuiTabArt* art);
|
||||||
wxAuiTabArt* GetArtProvider();
|
wxAuiTabArt* GetArtProvider();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// these can be overridden
|
||||||
|
virtual void SetTabCtrlHeight(int height);
|
||||||
|
virtual int CalculateTabCtrlHeight();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void DoSizing();
|
||||||
|
void InitNotebook(long style);
|
||||||
wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt);
|
wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt);
|
||||||
wxWindow* GetTabFrameFromTabCtrl(wxWindow* tab_ctrl);
|
wxWindow* GetTabFrameFromTabCtrl(wxWindow* tab_ctrl);
|
||||||
wxAuiTabCtrl* GetActiveTabCtrl();
|
wxAuiTabCtrl* GetActiveTabCtrl();
|
||||||
@@ -524,8 +543,6 @@ protected:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void DoSizing();
|
|
||||||
void InitNotebook(long style);
|
|
||||||
|
|
||||||
void OnChildFocus(wxChildFocusEvent& evt);
|
void OnChildFocus(wxChildFocusEvent& evt);
|
||||||
void OnRender(wxAuiManagerEvent& evt);
|
void OnRender(wxAuiManagerEvent& evt);
|
||||||
|
@@ -1448,8 +1448,10 @@ wxAuiNotebook* MyFrame::CreateNotebook()
|
|||||||
wxPoint(client_size.x, client_size.y),
|
wxPoint(client_size.x, client_size.y),
|
||||||
wxSize(430,200),
|
wxSize(430,200),
|
||||||
m_notebook_style);
|
m_notebook_style);
|
||||||
|
|
||||||
|
wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
|
||||||
|
|
||||||
ctrl->AddPage(CreateHTMLCtrl(ctrl), wxT("Welcome to wxAUI"));
|
ctrl->AddPage(CreateHTMLCtrl(ctrl), wxT("Welcome to wxAUI") , false, page_bmp);
|
||||||
|
|
||||||
wxPanel *panel = new wxPanel( ctrl, wxID_ANY );
|
wxPanel *panel = new wxPanel( ctrl, wxID_ANY );
|
||||||
wxFlexGridSizer *flex = new wxFlexGridSizer( 2 );
|
wxFlexGridSizer *flex = new wxFlexGridSizer( 2 );
|
||||||
@@ -1465,10 +1467,10 @@ wxAuiNotebook* MyFrame::CreateNotebook()
|
|||||||
wxSP_ARROW_KEYS, 5, 50, 5 ), 0, wxALL|wxALIGN_CENTRE, 5 );
|
wxSP_ARROW_KEYS, 5, 50, 5 ), 0, wxALL|wxALIGN_CENTRE, 5 );
|
||||||
flex->Add( 5,5 ); flex->Add( 5,5 );
|
flex->Add( 5,5 ); flex->Add( 5,5 );
|
||||||
panel->SetSizer( flex );
|
panel->SetSizer( flex );
|
||||||
ctrl->AddPage( panel, wxT("wxPanel") );
|
ctrl->AddPage( panel, wxT("wxPanel"), false, page_bmp );
|
||||||
|
|
||||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some text"),
|
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some text"),
|
||||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 1") );
|
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 1"), false, page_bmp );
|
||||||
|
|
||||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
|
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
|
||||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 2") );
|
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 2") );
|
||||||
|
@@ -221,6 +221,7 @@ wxAuiDefaultTabArt::wxAuiDefaultTabArt()
|
|||||||
m_measuring_font = m_selected_font;
|
m_measuring_font = m_selected_font;
|
||||||
|
|
||||||
m_fixed_tab_width = 100;
|
m_fixed_tab_width = 100;
|
||||||
|
m_tab_ctrl_height = 0;
|
||||||
|
|
||||||
wxColour base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
wxColour base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
||||||
|
|
||||||
@@ -284,6 +285,8 @@ void wxAuiDefaultTabArt::SetSizingInfo(const wxSize& tab_ctrl_size,
|
|||||||
|
|
||||||
if (m_fixed_tab_width > 220)
|
if (m_fixed_tab_width > 220)
|
||||||
m_fixed_tab_width = 220;
|
m_fixed_tab_width = 220;
|
||||||
|
|
||||||
|
m_tab_ctrl_height = tab_ctrl_size.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -316,6 +319,7 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
|
|||||||
wxWindow* wnd,
|
wxWindow* wnd,
|
||||||
const wxRect& in_rect,
|
const wxRect& in_rect,
|
||||||
const wxString& caption_text,
|
const wxString& caption_text,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
bool active,
|
bool active,
|
||||||
int close_button_state,
|
int close_button_state,
|
||||||
wxRect* out_tab_rect,
|
wxRect* out_tab_rect,
|
||||||
@@ -338,9 +342,15 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
|
|||||||
dc.GetTextExtent(caption, &normal_textx, &normal_texty);
|
dc.GetTextExtent(caption, &normal_textx, &normal_texty);
|
||||||
|
|
||||||
// figure out the size of the tab
|
// figure out the size of the tab
|
||||||
wxSize tab_size = GetTabSize(dc, wnd, caption, active, close_button_state, x_extent);
|
wxSize tab_size = GetTabSize(dc,
|
||||||
|
wnd,
|
||||||
|
caption,
|
||||||
|
bitmap,
|
||||||
|
active,
|
||||||
|
close_button_state,
|
||||||
|
x_extent);
|
||||||
|
|
||||||
wxCoord tab_height = tab_size.y;
|
wxCoord tab_height = m_tab_ctrl_height - 3;
|
||||||
wxCoord tab_width = tab_size.x;
|
wxCoord tab_width = tab_size.x;
|
||||||
wxCoord tab_x = in_rect.x;
|
wxCoord tab_x = in_rect.x;
|
||||||
wxCoord tab_y = in_rect.y + in_rect.height - tab_height;
|
wxCoord tab_y = in_rect.y + in_rect.height - tab_height;
|
||||||
@@ -388,6 +398,9 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
|
|||||||
points[5].x = tab_x + tab_width;
|
points[5].x = tab_x + tab_width;
|
||||||
points[5].y = tab_y + tab_height - 4;
|
points[5].y = tab_y + tab_height - 4;
|
||||||
|
|
||||||
|
int drawn_tab_yoff = points[1].y;
|
||||||
|
int drawn_tab_height = points[0].y - points[1].y;
|
||||||
|
|
||||||
|
|
||||||
// draw gradient background
|
// draw gradient background
|
||||||
if (active)
|
if (active)
|
||||||
@@ -423,17 +436,33 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
|
|||||||
dc.DrawLine(points[0].x, points[0].y, points[5].x+1, points[5].y);
|
dc.DrawLine(points[0].x, points[0].y, points[5].x+1, points[5].y);
|
||||||
}
|
}
|
||||||
|
|
||||||
int text_offset;
|
|
||||||
|
|
||||||
|
int text_offset = tab_x + 8;
|
||||||
int close_button_width = 0;
|
int close_button_width = 0;
|
||||||
|
|
||||||
if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
|
if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
|
||||||
{
|
{
|
||||||
close_button_width = m_active_close_bmp.GetWidth();
|
close_button_width = m_active_close_bmp.GetWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
text_offset = tab_x + 8;
|
|
||||||
|
|
||||||
|
if (bitmap.IsOk())
|
||||||
|
{
|
||||||
|
int bitmap_offset = tab_x + 8;
|
||||||
|
|
||||||
|
// draw bitmap
|
||||||
|
dc.DrawBitmap(bitmap,
|
||||||
|
bitmap_offset,
|
||||||
|
drawn_tab_yoff + (drawn_tab_height/2) - (bitmap.GetHeight()/2) + 1,
|
||||||
|
true);
|
||||||
|
|
||||||
|
text_offset = bitmap_offset + bitmap.GetWidth();
|
||||||
|
text_offset += 3; // bitmap padding
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text_offset = tab_x + 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString draw_text = ChopText(dc,
|
wxString draw_text = ChopText(dc,
|
||||||
caption,
|
caption,
|
||||||
@@ -442,7 +471,7 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
|
|||||||
// draw tab text
|
// draw tab text
|
||||||
dc.DrawText(draw_text,
|
dc.DrawText(draw_text,
|
||||||
text_offset,
|
text_offset,
|
||||||
(tab_y + tab_height)/2 - (texty/2));
|
drawn_tab_yoff + (drawn_tab_height)/2 - (texty/2) - 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -481,6 +510,7 @@ int wxAuiDefaultTabArt::GetIndentSize()
|
|||||||
wxSize wxAuiDefaultTabArt::GetTabSize(wxDC& dc,
|
wxSize wxAuiDefaultTabArt::GetTabSize(wxDC& dc,
|
||||||
wxWindow* WXUNUSED(wnd),
|
wxWindow* WXUNUSED(wnd),
|
||||||
const wxString& caption,
|
const wxString& caption,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
bool WXUNUSED(active),
|
bool WXUNUSED(active),
|
||||||
int close_button_state,
|
int close_button_state,
|
||||||
int* x_extent)
|
int* x_extent)
|
||||||
@@ -493,12 +523,24 @@ wxSize wxAuiDefaultTabArt::GetTabSize(wxDC& dc,
|
|||||||
dc.GetTextExtent(wxT("ABCDEFXj"), &tmp, &measured_texty);
|
dc.GetTextExtent(wxT("ABCDEFXj"), &tmp, &measured_texty);
|
||||||
|
|
||||||
// add padding around the text
|
// add padding around the text
|
||||||
wxCoord tab_width = measured_textx + 16;
|
wxCoord tab_width = measured_textx;
|
||||||
wxCoord tab_height = measured_texty + 10;
|
wxCoord tab_height = measured_texty;
|
||||||
|
|
||||||
|
// if the close button is showing, add space for it
|
||||||
if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
|
if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
|
||||||
tab_width += m_active_close_bmp.GetWidth() + 3;
|
tab_width += m_active_close_bmp.GetWidth() + 3;
|
||||||
|
|
||||||
|
// if there's a bitmap, add space for it
|
||||||
|
if (bitmap.IsOk())
|
||||||
|
{
|
||||||
|
tab_width += bitmap.GetWidth();
|
||||||
|
tab_width += 3; // right side bitmap padding
|
||||||
|
tab_height = wxMax(tab_height, bitmap.GetHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
// add padding
|
||||||
|
tab_width += 16;
|
||||||
|
tab_height += 10;
|
||||||
|
|
||||||
if (m_flags & wxAUI_NB_TAB_FIXED_WIDTH)
|
if (m_flags & wxAUI_NB_TAB_FIXED_WIDTH)
|
||||||
{
|
{
|
||||||
@@ -627,18 +669,34 @@ int wxAuiDefaultTabArt::ShowWindowList(wxWindow* wnd,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxAuiDefaultTabArt::GetBestTabCtrlSize(wxWindow* wnd)
|
int wxAuiDefaultTabArt::GetBestTabCtrlSize(wxWindow* wnd,
|
||||||
|
wxAuiNotebookPageArray& pages)
|
||||||
{
|
{
|
||||||
wxClientDC dc(wnd);
|
wxClientDC dc(wnd);
|
||||||
dc.SetFont(m_measuring_font);
|
dc.SetFont(m_measuring_font);
|
||||||
int x_ext = 0;
|
|
||||||
wxSize s = GetTabSize(dc,
|
int max_y = 0;
|
||||||
wnd,
|
size_t i, page_count = pages.GetCount();
|
||||||
wxT("ABCDEFGHIj"),
|
for (i = 0; i < page_count; ++i)
|
||||||
true,
|
{
|
||||||
wxAUI_BUTTON_STATE_HIDDEN,
|
wxAuiNotebookPage& page = pages.Item(i);
|
||||||
&x_ext);
|
|
||||||
return s.y+3;
|
// we don't use the caption text because we don't
|
||||||
|
// want tab heights to be different in the case
|
||||||
|
// of a very short piece of text on one tab and a very
|
||||||
|
// tall piece of text on another tab
|
||||||
|
int x_ext = 0;
|
||||||
|
wxSize s = GetTabSize(dc,
|
||||||
|
wnd,
|
||||||
|
wxT("ABCDEFGHIj"),
|
||||||
|
page.bitmap,
|
||||||
|
true,
|
||||||
|
wxAUI_BUTTON_STATE_HIDDEN,
|
||||||
|
&x_ext);
|
||||||
|
max_y = wxMax(max_y, s.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
return max_y+2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxAuiDefaultTabArt::SetNormalFont(const wxFont& font)
|
void wxAuiDefaultTabArt::SetNormalFont(const wxFont& font)
|
||||||
@@ -760,6 +818,7 @@ void wxAuiSimpleTabArt::DrawTab(wxDC& dc,
|
|||||||
wxWindow* wnd,
|
wxWindow* wnd,
|
||||||
const wxRect& in_rect,
|
const wxRect& in_rect,
|
||||||
const wxString& caption_text,
|
const wxString& caption_text,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
bool active,
|
bool active,
|
||||||
int close_button_state,
|
int close_button_state,
|
||||||
wxRect* out_tab_rect,
|
wxRect* out_tab_rect,
|
||||||
@@ -782,7 +841,13 @@ void wxAuiSimpleTabArt::DrawTab(wxDC& dc,
|
|||||||
dc.GetTextExtent(caption, &normal_textx, &normal_texty);
|
dc.GetTextExtent(caption, &normal_textx, &normal_texty);
|
||||||
|
|
||||||
// figure out the size of the tab
|
// figure out the size of the tab
|
||||||
wxSize tab_size = GetTabSize(dc, wnd, caption, active, close_button_state, x_extent);
|
wxSize tab_size = GetTabSize(dc,
|
||||||
|
wnd,
|
||||||
|
caption,
|
||||||
|
bitmap,
|
||||||
|
active,
|
||||||
|
close_button_state,
|
||||||
|
x_extent);
|
||||||
|
|
||||||
wxCoord tab_height = tab_size.y;
|
wxCoord tab_height = tab_size.y;
|
||||||
wxCoord tab_width = tab_size.x;
|
wxCoord tab_width = tab_size.x;
|
||||||
@@ -898,6 +963,7 @@ int wxAuiSimpleTabArt::GetIndentSize()
|
|||||||
wxSize wxAuiSimpleTabArt::GetTabSize(wxDC& dc,
|
wxSize wxAuiSimpleTabArt::GetTabSize(wxDC& dc,
|
||||||
wxWindow* WXUNUSED(wnd),
|
wxWindow* WXUNUSED(wnd),
|
||||||
const wxString& caption,
|
const wxString& caption,
|
||||||
|
const wxBitmap& WXUNUSED(bitmap),
|
||||||
bool WXUNUSED(active),
|
bool WXUNUSED(active),
|
||||||
int close_button_state,
|
int close_button_state,
|
||||||
int* x_extent)
|
int* x_extent)
|
||||||
@@ -1040,7 +1106,8 @@ int wxAuiSimpleTabArt::ShowWindowList(wxWindow* wnd,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxAuiSimpleTabArt::GetBestTabCtrlSize(wxWindow* wnd)
|
int wxAuiSimpleTabArt::GetBestTabCtrlSize(wxWindow* wnd,
|
||||||
|
wxAuiNotebookPageArray& WXUNUSED(pages))
|
||||||
{
|
{
|
||||||
wxClientDC dc(wnd);
|
wxClientDC dc(wnd);
|
||||||
dc.SetFont(m_measuring_font);
|
dc.SetFont(m_measuring_font);
|
||||||
@@ -1048,6 +1115,7 @@ int wxAuiSimpleTabArt::GetBestTabCtrlSize(wxWindow* wnd)
|
|||||||
wxSize s = GetTabSize(dc,
|
wxSize s = GetTabSize(dc,
|
||||||
wnd,
|
wnd,
|
||||||
wxT("ABCDEFGHIj"),
|
wxT("ABCDEFGHIj"),
|
||||||
|
wxNullBitmap,
|
||||||
true,
|
true,
|
||||||
wxAUI_BUTTON_STATE_HIDDEN,
|
wxAUI_BUTTON_STATE_HIDDEN,
|
||||||
&x_ext);
|
&x_ext);
|
||||||
@@ -1440,6 +1508,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
|
|||||||
wxSize size = m_art->GetTabSize(dc,
|
wxSize size = m_art->GetTabSize(dc,
|
||||||
wnd,
|
wnd,
|
||||||
page.caption,
|
page.caption,
|
||||||
|
page.bitmap,
|
||||||
page.active,
|
page.active,
|
||||||
close_button ?
|
close_button ?
|
||||||
wxAUI_BUTTON_STATE_NORMAL :
|
wxAUI_BUTTON_STATE_NORMAL :
|
||||||
@@ -1645,6 +1714,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
|
|||||||
wnd,
|
wnd,
|
||||||
rect,
|
rect,
|
||||||
page.caption,
|
page.caption,
|
||||||
|
page.bitmap,
|
||||||
page.active,
|
page.active,
|
||||||
tab_button.cur_state,
|
tab_button.cur_state,
|
||||||
&page.rect,
|
&page.rect,
|
||||||
@@ -1681,6 +1751,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
|
|||||||
wnd,
|
wnd,
|
||||||
active_rect,
|
active_rect,
|
||||||
page.caption,
|
page.caption,
|
||||||
|
page.bitmap,
|
||||||
page.active,
|
page.active,
|
||||||
tab_button.cur_state,
|
tab_button.cur_state,
|
||||||
&page.rect,
|
&page.rect,
|
||||||
@@ -2263,25 +2334,44 @@ void wxAuiNotebook::SetArtProvider(wxAuiTabArt* art)
|
|||||||
{
|
{
|
||||||
m_tabs.SetArtProvider(art);
|
m_tabs.SetArtProvider(art);
|
||||||
|
|
||||||
// choose a default for the tab height
|
SetTabCtrlHeight(CalculateTabCtrlHeight());
|
||||||
m_tab_ctrl_height = art->GetBestTabCtrlSize(this);
|
|
||||||
|
|
||||||
wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
|
|
||||||
size_t i, pane_count = all_panes.GetCount();
|
|
||||||
for (i = 0; i < pane_count; ++i)
|
|
||||||
{
|
|
||||||
wxAuiPaneInfo& pane = all_panes.Item(i);
|
|
||||||
if (pane.name == wxT("dummy"))
|
|
||||||
continue;
|
|
||||||
wxTabFrame* tab_frame = (wxTabFrame*)pane.window;
|
|
||||||
wxAuiTabCtrl* tabctrl = tab_frame->m_tabs;
|
|
||||||
tab_frame->SetTabCtrlHeight(m_tab_ctrl_height);
|
|
||||||
tabctrl->SetArtProvider(art->Clone());
|
|
||||||
tab_frame->DoSizing();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxAuiNotebook::SetTabCtrlHeight(int height)
|
||||||
|
{
|
||||||
|
// if the tab control height needs to change, update
|
||||||
|
// all of our tab controls with the new height
|
||||||
|
if (m_tab_ctrl_height != height)
|
||||||
|
{
|
||||||
|
wxAuiTabArt* art = m_tabs.GetArtProvider();
|
||||||
|
|
||||||
|
m_tab_ctrl_height = height;
|
||||||
|
|
||||||
|
wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
|
||||||
|
size_t i, pane_count = all_panes.GetCount();
|
||||||
|
for (i = 0; i < pane_count; ++i)
|
||||||
|
{
|
||||||
|
wxAuiPaneInfo& pane = all_panes.Item(i);
|
||||||
|
if (pane.name == wxT("dummy"))
|
||||||
|
continue;
|
||||||
|
wxTabFrame* tab_frame = (wxTabFrame*)pane.window;
|
||||||
|
wxAuiTabCtrl* tabctrl = tab_frame->m_tabs;
|
||||||
|
tab_frame->SetTabCtrlHeight(m_tab_ctrl_height);
|
||||||
|
tabctrl->SetArtProvider(art->Clone());
|
||||||
|
tab_frame->DoSizing();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxAuiNotebook::CalculateTabCtrlHeight()
|
||||||
|
{
|
||||||
|
// find out new best tab height
|
||||||
|
wxAuiTabArt* art = m_tabs.GetArtProvider();
|
||||||
|
|
||||||
|
return art->GetBestTabCtrlSize(this, m_tabs.GetPages());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
wxAuiTabArt* wxAuiNotebook::GetArtProvider()
|
wxAuiTabArt* wxAuiNotebook::GetArtProvider()
|
||||||
{
|
{
|
||||||
return m_tabs.GetArtProvider();
|
return m_tabs.GetArtProvider();
|
||||||
@@ -2347,6 +2437,7 @@ bool wxAuiNotebook::InsertPage(size_t page_idx,
|
|||||||
else
|
else
|
||||||
active_tabctrl->InsertPage(page, info, page_idx);
|
active_tabctrl->InsertPage(page, info, page_idx);
|
||||||
|
|
||||||
|
SetTabCtrlHeight(CalculateTabCtrlHeight());
|
||||||
DoSizing();
|
DoSizing();
|
||||||
active_tabctrl->DoShowHide();
|
active_tabctrl->DoShowHide();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user