]>
Commit | Line | Data |
---|---|---|
53b28675 | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/gtk/notebook.h |
716b7364 | 3 | // Purpose: wxNotebook class |
53b28675 RR |
4 | // Author: Robert Roebling |
5 | // Modified by: | |
b2b3ccc5 | 6 | // Copyright: (c) Julian Smart and Robert Roebling |
65571936 | 7 | // Licence: wxWindows licence |
53b28675 RR |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
48200154 PC |
10 | #ifndef _WX_GTKNOTEBOOK_H_ |
11 | #define _WX_GTKNOTEBOOK_H_ | |
53b28675 | 12 | |
80a58c99 RR |
13 | //----------------------------------------------------------------------------- |
14 | // internal class | |
15 | //----------------------------------------------------------------------------- | |
16 | ||
b5dbe15d | 17 | class WXDLLIMPEXP_FWD_CORE wxGtkNotebookPage; |
53b28675 | 18 | |
07b8d7ec VZ |
19 | #include "wx/list.h" |
20 | WX_DECLARE_LIST(wxGtkNotebookPage, wxGtkNotebookPagesList); | |
21 | ||
53b28675 | 22 | //----------------------------------------------------------------------------- |
ff829f3f | 23 | // wxNotebook |
53b28675 RR |
24 | //----------------------------------------------------------------------------- |
25 | ||
20123d49 | 26 | class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase |
53b28675 | 27 | { |
ff829f3f | 28 | public: |
8253c7fd RR |
29 | // default for dynamic class |
30 | wxNotebook(); | |
31 | // the same arguments as for wxControl | |
32 | wxNotebook(wxWindow *parent, | |
debe6624 | 33 | wxWindowID id, |
ff829f3f VZ |
34 | const wxPoint& pos = wxDefaultPosition, |
35 | const wxSize& size = wxDefaultSize, | |
debe6624 | 36 | long style = 0, |
630ad6c6 | 37 | const wxString& name = wxNotebookNameStr); |
8253c7fd RR |
38 | // Create() function |
39 | bool Create(wxWindow *parent, | |
debe6624 | 40 | wxWindowID id, |
ff829f3f VZ |
41 | const wxPoint& pos = wxDefaultPosition, |
42 | const wxSize& size = wxDefaultSize, | |
debe6624 | 43 | long style = 0, |
630ad6c6 | 44 | const wxString& name = wxNotebookNameStr); |
8253c7fd | 45 | // dtor |
07b8d7ec | 46 | virtual ~wxNotebook(); |
ff829f3f VZ |
47 | |
48 | // accessors | |
49 | // --------- | |
ff829f3f VZ |
50 | |
51 | // set the currently selected page, return the index of the previously | |
7e837615 | 52 | // selected one (or wxNOT_FOUND on error) |
ff829f3f | 53 | // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events |
1d6fcbcc | 54 | int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); } |
ff829f3f VZ |
55 | // get the currently selected page |
56 | int GetSelection() const; | |
57 | ||
1d6fcbcc VZ |
58 | // changes selected page without sending events |
59 | int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); } | |
60 | ||
ff829f3f | 61 | // set/get the title of a page |
15aad3b9 VZ |
62 | bool SetPageText(size_t nPage, const wxString& strText); |
63 | wxString GetPageText(size_t nPage) const; | |
ff829f3f | 64 | |
ff829f3f | 65 | // sets/returns item's image index in the current image list |
15aad3b9 VZ |
66 | int GetPageImage(size_t nPage) const; |
67 | bool SetPageImage(size_t nPage, int nImage); | |
ff829f3f | 68 | |
ff829f3f | 69 | // control the appearance of the notebook pages |
ff829f3f VZ |
70 | // set the padding between tabs (in pixels) |
71 | void SetPadding(const wxSize& padding); | |
d8f2439c | 72 | // sets the size of the tabs (assumes all tabs are the same size) |
ca8b28f2 JS |
73 | void SetTabSize(const wxSize& sz); |
74 | ||
864181f4 VZ |
75 | // geometry |
76 | virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; | |
279b5e2e VZ |
77 | virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; |
78 | ||
ff829f3f VZ |
79 | // operations |
80 | // ---------- | |
ff829f3f VZ |
81 | // remove all pages |
82 | bool DeleteAllPages(); | |
1e6feb95 | 83 | |
90e572f1 | 84 | // adds a new page to the notebook (it will be deleted by the notebook, |
ff829f3f | 85 | // don't delete it yourself). If bSelect, this page becomes active. |
587ce561 | 86 | // the same as AddPage(), but adds it at the specified position |
789d0a3d | 87 | bool InsertPage( size_t position, |
80a58c99 RR |
88 | wxNotebookPage *win, |
89 | const wxString& strText, | |
630ad6c6 | 90 | bool bSelect = false, |
1871b9fa | 91 | int imageId = NO_IMAGE ); |
ff829f3f | 92 | |
8253c7fd RR |
93 | // handler for tab navigation |
94 | // -------------------------- | |
95 | void OnNavigationKey(wxNavigationKeyEvent& event); | |
ed58dbea | 96 | |
9d522606 RD |
97 | |
98 | static wxVisualAttributes | |
99 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
630ad6c6 | 100 | |
db434467 RR |
101 | // implementation |
102 | // -------------- | |
d8f2439c | 103 | |
93d38175 | 104 | #if wxUSE_CONSTRAINTS |
db434467 RR |
105 | void SetConstraintSizes(bool recurse); |
106 | bool DoPhase(int phase); | |
93d38175 | 107 | #endif |
58d1c1ae | 108 | |
681be2ef VZ |
109 | // Called by GTK event handler when the current page is definitely changed. |
110 | void GTKOnPageChanged(); | |
111 | ||
db434467 | 112 | // helper function |
80a58c99 | 113 | wxGtkNotebookPage* GetNotebookPage(int page) const; |
ff829f3f | 114 | |
07b8d7ec VZ |
115 | // the additional page data (the pages themselves are in m_pages array) |
116 | wxGtkNotebookPagesList m_pagesData; | |
36202885 | 117 | |
c9882624 RR |
118 | // we need to store the old selection since there |
119 | // is no other way to know about it at the time | |
120 | // of the change selection event | |
121 | int m_oldSelection; | |
1d6fcbcc | 122 | |
1e6feb95 | 123 | protected: |
6f02a879 | 124 | // set all page's attributes |
ef5c70f9 VZ |
125 | virtual void DoApplyWidgetStyle(GtkRcStyle *style); |
126 | virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; | |
6f02a879 | 127 | |
1e6feb95 | 128 | // remove one page from the notebook but do not destroy it |
15aad3b9 | 129 | virtual wxNotebookPage *DoRemovePage(size_t nPage); |
1e6feb95 | 130 | |
1d6fcbcc VZ |
131 | int DoSetSelection(size_t nPage, int flags = 0); |
132 | ||
db434467 | 133 | private: |
2b5f62a0 | 134 | // the padding set by SetPadding() |
b318dc42 JS |
135 | int m_padding; |
136 | ||
95dc31e0 | 137 | void Init(); |
48200154 PC |
138 | virtual void AddChildGTK(wxWindowGTK* child); |
139 | ||
db434467 RR |
140 | DECLARE_DYNAMIC_CLASS(wxNotebook) |
141 | DECLARE_EVENT_TABLE() | |
53b28675 RR |
142 | }; |
143 | ||
48200154 | 144 | #endif // _WX_GTKNOTEBOOK_H_ |