]>
Commit | Line | Data |
---|---|---|
53b28675 | 1 | ///////////////////////////////////////////////////////////////////////////// |
716b7364 RR |
2 | // Name: notebook.h |
3 | // Purpose: wxNotebook class | |
53b28675 RR |
4 | // Author: Robert Roebling |
5 | // Modified by: | |
6 | // RCS-ID: $Id$ | |
b2b3ccc5 | 7 | // Copyright: (c) Julian Smart and Robert Roebling |
ff829f3f | 8 | // Licence: wxWindows license |
53b28675 RR |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
6ca41e57 RR |
11 | #ifndef __GTKNOTEBOOKH__ |
12 | #define __GTKNOTEBOOKH__ | |
53b28675 RR |
13 | |
14 | #ifdef __GNUG__ | |
6ca41e57 | 15 | #pragma interface |
53b28675 RR |
16 | #endif |
17 | ||
18 | #include "wx/defs.h" | |
dcf924a3 RR |
19 | |
20 | #if wxUSE_NOTEBOOK | |
21 | ||
53b28675 RR |
22 | #include "wx/object.h" |
23 | #include "wx/string.h" | |
24 | #include "wx/control.h" | |
25 | ||
26 | //----------------------------------------------------------------------------- | |
27 | // classes | |
28 | //----------------------------------------------------------------------------- | |
29 | ||
30 | class wxImageList; | |
53b28675 | 31 | class wxNotebook; |
80a58c99 RR |
32 | |
33 | typedef wxWindow wxNotebookPage; // so far, any window can be a page | |
34 | ||
35 | //----------------------------------------------------------------------------- | |
36 | // internal class | |
37 | //----------------------------------------------------------------------------- | |
38 | ||
39 | class wxGtkNotebookPage; | |
53b28675 | 40 | |
53b28675 | 41 | //----------------------------------------------------------------------------- |
ff829f3f | 42 | // wxNotebook |
53b28675 RR |
43 | //----------------------------------------------------------------------------- |
44 | ||
ff829f3f | 45 | class wxNotebook : public wxControl |
53b28675 | 46 | { |
ff829f3f | 47 | public: |
8253c7fd RR |
48 | // default for dynamic class |
49 | wxNotebook(); | |
50 | // the same arguments as for wxControl | |
51 | wxNotebook(wxWindow *parent, | |
debe6624 | 52 | wxWindowID id, |
ff829f3f VZ |
53 | const wxPoint& pos = wxDefaultPosition, |
54 | const wxSize& size = wxDefaultSize, | |
debe6624 | 55 | long style = 0, |
ff829f3f | 56 | const wxString& name = "notebook"); |
8253c7fd RR |
57 | // Create() function |
58 | bool Create(wxWindow *parent, | |
debe6624 | 59 | wxWindowID id, |
ff829f3f VZ |
60 | const wxPoint& pos = wxDefaultPosition, |
61 | const wxSize& size = wxDefaultSize, | |
debe6624 | 62 | long style = 0, |
ff829f3f | 63 | const wxString& name = "notebook"); |
8253c7fd RR |
64 | // dtor |
65 | ~wxNotebook(); | |
ff829f3f VZ |
66 | |
67 | // accessors | |
68 | // --------- | |
69 | // get number of pages in the dialog | |
70 | int GetPageCount() const; | |
71 | ||
72 | // set the currently selected page, return the index of the previously | |
73 | // selected one (or -1 on error) | |
74 | // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events | |
75 | int SetSelection(int nPage); | |
76 | // cycle thru the tabs | |
77 | void AdvanceSelection(bool bForward = TRUE); | |
78 | // get the currently selected page | |
79 | int GetSelection() const; | |
80 | ||
81 | // set/get the title of a page | |
82 | bool SetPageText(int nPage, const wxString& strText); | |
83 | wxString GetPageText(int nPage) const; | |
84 | ||
85 | // image list stuff: each page may have an image associated with it. All | |
86 | // the images belong to an image list, so you have to | |
87 | // 1) create an image list | |
88 | // 2) associate it with the notebook | |
89 | // 3) set for each page it's image | |
90 | // associate image list with a control | |
91 | void SetImageList(wxImageList* imageList); | |
92 | // get pointer (may be NULL) to the associated image list | |
d8f2439c | 93 | wxImageList *GetImageList() const { return m_imageList; } |
ff829f3f VZ |
94 | |
95 | // sets/returns item's image index in the current image list | |
96 | int GetPageImage(int nPage) const; | |
97 | bool SetPageImage(int nPage, int nImage); | |
98 | ||
99 | // currently it's always 1 because wxGTK doesn't support multi-row | |
100 | // tab controls | |
101 | int GetRowCount() const; | |
102 | ||
103 | // control the appearance of the notebook pages | |
104 | // set the size (the same for all pages) | |
105 | void SetPageSize(const wxSize& size); | |
106 | // set the padding between tabs (in pixels) | |
107 | void SetPadding(const wxSize& padding); | |
d8f2439c | 108 | // sets the size of the tabs (assumes all tabs are the same size) |
ca8b28f2 JS |
109 | void SetTabSize(const wxSize& sz); |
110 | ||
ff829f3f VZ |
111 | // operations |
112 | // ---------- | |
fed46e72 RR |
113 | // remove one page from the notebook but do not destroy it |
114 | bool RemovePage(int nPage); | |
ff829f3f VZ |
115 | // remove one page from the notebook |
116 | bool DeletePage(int nPage); | |
117 | // remove all pages | |
118 | bool DeleteAllPages(); | |
587ce561 | 119 | |
ff829f3f VZ |
120 | // adds a new page to the notebook (it will be deleted ny the notebook, |
121 | // don't delete it yourself). If bSelect, this page becomes active. | |
80a58c99 RR |
122 | bool AddPage( wxNotebookPage *win, |
123 | const wxString& strText, | |
124 | bool select = FALSE, | |
125 | int imageId = -1 ); | |
587ce561 | 126 | // the same as AddPage(), but adds it at the specified position |
80a58c99 RR |
127 | bool InsertPage( int position, |
128 | wxNotebookPage *win, | |
129 | const wxString& strText, | |
130 | bool bSelect = FALSE, | |
131 | int imageId = -1 ); | |
ff829f3f VZ |
132 | |
133 | // get the panel which represents the given page | |
80a58c99 | 134 | wxNotebookPage *GetPage(int nPage) const; |
ff829f3f | 135 | |
8253c7fd RR |
136 | // handler for tab navigation |
137 | // -------------------------- | |
138 | void OnNavigationKey(wxNavigationKeyEvent& event); | |
ed58dbea | 139 | |
db434467 RR |
140 | // implementation |
141 | // -------------- | |
d8f2439c | 142 | |
93d38175 | 143 | #if wxUSE_CONSTRAINTS |
db434467 RR |
144 | void SetConstraintSizes(bool recurse); |
145 | bool DoPhase(int phase); | |
93d38175 VS |
146 | #endif |
147 | ||
db434467 | 148 | void ApplyWidgetStyle(); |
ff829f3f | 149 | |
db434467 RR |
150 | // report if window belongs to notebook |
151 | bool IsOwnGtkWindow( GdkWindow *window ); | |
58d1c1ae | 152 | |
db434467 RR |
153 | // common part of all ctors |
154 | void Init(); | |
ff829f3f | 155 | |
db434467 | 156 | // helper function |
80a58c99 | 157 | wxGtkNotebookPage* GetNotebookPage(int page) const; |
ff829f3f | 158 | |
db434467 RR |
159 | wxImageList* m_imageList; |
160 | wxList m_pages; | |
161 | int m_lastSelection; /* hack */ | |
53b28675 | 162 | |
db434467 RR |
163 | private: |
164 | DECLARE_DYNAMIC_CLASS(wxNotebook) | |
165 | DECLARE_EVENT_TABLE() | |
53b28675 RR |
166 | }; |
167 | ||
dcf924a3 RR |
168 | #endif |
169 | ||
53b28675 | 170 | #endif |
6ca41e57 | 171 | // __GTKNOTEBOOKH__ |