X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4107600f205d9d4951c0ffaa4aadb1bc2b75dcf2..d34ad9ea8910361e3d8443ddda0ee5554dc6480d:/include/wx/aui/auibook.h?ds=sidebyside diff --git a/include/wx/aui/auibook.h b/include/wx/aui/auibook.h index 5c0b00f549..94d5bfef24 100644 --- a/include/wx/aui/auibook.h +++ b/include/wx/aui/auibook.h @@ -27,6 +27,110 @@ #include "wx/control.h" +// tab art class + + +class WXDLLIMPEXP_AUI wxTabArt +{ +public: + + wxTabArt() { } + virtual ~wxTabArt() { } + + 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, + const wxRect& rect) = 0; + + virtual void DrawTab(wxDC* dc, + const wxRect& in_rect, + const wxString& caption, + bool active, + wxRect* out_rect, + int* x_extent) = 0; + + virtual void DrawButton( + wxDC* dc, + const wxRect& in_rect, + int bitmap_id, + int button_state, + int orientation, + const wxBitmap& bitmap_override, + wxRect* out_rect) = 0; + + virtual wxSize GetTabSize( + wxDC* dc, + const wxString& caption, + bool active, + int* x_extent) = 0; + + virtual int GetBestTabCtrlSize(wxWindow* wnd) = 0; +}; + + +class WXDLLIMPEXP_AUI wxDefaultTabArt : public wxTabArt +{ + +public: + + wxDefaultTabArt(); + virtual ~wxDefaultTabArt(); + + void SetNormalFont(const wxFont& font); + void SetSelectedFont(const wxFont& font); + void SetMeasuringFont(const wxFont& font); + + void DrawBackground( + wxDC* dc, + const wxRect& rect); + + void DrawTab(wxDC* dc, + const wxRect& in_rect, + const wxString& caption, + bool active, + wxRect* out_rect, + int* x_extent); + + void DrawButton( + wxDC* dc, + const wxRect& in_rect, + int bitmap_id, + int button_state, + int orientation, + const wxBitmap& bitmap_override, + wxRect* out_rect); + + wxSize GetTabSize( + wxDC* dc, + const wxString& caption, + bool active, + int* x_extent); + + int GetBestTabCtrlSize(wxWindow* wnd); + +private: + + 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; +}; + + + // event declarations/classes class WXDLLIMPEXP_AUI wxAuiNotebookEvent : public wxNotifyEvent @@ -79,8 +183,10 @@ class WXDLLIMPEXP_AUI wxAuiTabContainerButton { public: int id; // button's id - int cur_state; // current state (normal, hover, pressed) - wxBitmap bitmap; // button's bitmap + int cur_state; // current state (normal, hover, pressed, etc.) + int location; // buttons location (wxLEFT or wxRIGHT) + wxBitmap bitmap; // button's hover bitmap + wxBitmap dis_bitmap; // button's disabled bitmap wxRect rect; // button's hit rectangle }; @@ -98,6 +204,9 @@ public: wxAuiTabContainer(); virtual ~wxAuiTabContainer(); + void SetArtProvider(wxTabArt* art); + wxTabArt* GetArtProvider(); + bool AddPage(wxWindow* page, const wxAuiNotebookPage& info); bool InsertPage(wxWindow* page, const wxAuiNotebookPage& info, size_t idx); bool RemovePage(wxWindow* page); @@ -117,31 +226,25 @@ public: void SetMeasuringFont(const wxFont& measuring_font); void DoShowHide(); void SetRect(const wxRect& rect); - void AddButton(int id, const wxBitmap& bmp); - + void AddButton(int id, + int location, + const wxBitmap& normal_bitmap = wxNullBitmap, + const wxBitmap& disabled_bitmap = wxNullBitmap); + + size_t GetTabOffset() const; + void SetTabOffset(size_t offset); + protected: virtual void Render(wxDC* dc); - virtual void DrawTab(wxDC* dc, - const wxRect& in_rect, - const wxString& caption, - bool active, - wxRect* out_rect, - int* x_extent); private: + wxTabArt* m_art; wxAuiNotebookPageArray m_pages; wxAuiTabContainerButtonArray m_buttons; wxRect m_rect; - 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; + size_t m_tab_offset; }; @@ -166,7 +269,9 @@ protected: void OnLeftUp(wxMouseEvent& evt); void OnMotion(wxMouseEvent& evt); void OnLeaveWindow(wxMouseEvent& evt); + void OnButton(wxAuiNotebookEvent& evt); + protected: wxPoint m_click_pt; @@ -223,6 +328,9 @@ public: size_t GetPageCount() const; wxWindow* GetPage(size_t page_idx) const; + void SetArtProvider(wxTabArt* art); + wxTabArt* GetArtProvider(); + protected: wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt); @@ -245,7 +353,7 @@ protected: void OnTabDragMotion(wxCommandEvent& evt); void OnTabEndDrag(wxCommandEvent& evt); void OnTabButton(wxCommandEvent& evt); - + protected: wxFrameManager m_mgr; @@ -288,7 +396,7 @@ typedef void (wxEvtHandler::*wxAuiNotebookEventFunction)(wxAuiNotebookEvent&); wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, winid, wxAuiNotebookEventHandler(fn)) #define EVT_AUINOTEBOOK_PAGE_CHANGING(winid, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, winid, wxAuiNotebookEventHandler(fn)) -#define EVT_AUINOTEBOOK_PAGE_BUTTON(winid, fn) \ +#define EVT_AUINOTEBOOK_BUTTON(winid, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, winid, wxAuiNotebookEventHandler(fn)) #define EVT_AUINOTEBOOK_BEGIN_DRAG(winid, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, winid, wxAuiNotebookEventHandler(fn))