]>
Commit | Line | Data |
---|---|---|
0e320a79 | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/os2/notebook.h |
0e320a79 | 3 | // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) |
cdf1e714 | 4 | // Author: David Webster |
0e320a79 DW |
5 | // Modified by: |
6 | // RCS-ID: $Id$ | |
cdf1e714 | 7 | // Copyright: (c) David Webster |
65571936 | 8 | // Licence: wxWindows licence |
0e320a79 DW |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
f289196b DW |
11 | #ifndef _NOTEBOOK_H |
12 | #define _NOTEBOOK_H | |
0e320a79 | 13 | |
f289196b | 14 | #if wxUSE_NOTEBOOK |
0e320a79 DW |
15 | |
16 | // ---------------------------------------------------------------------------- | |
f289196b | 17 | // headers |
0e320a79 DW |
18 | // ---------------------------------------------------------------------------- |
19 | ||
f289196b | 20 | #include "wx/control.h" |
0e320a79 | 21 | |
0e320a79 DW |
22 | // ---------------------------------------------------------------------------- |
23 | // wxNotebook | |
24 | // ---------------------------------------------------------------------------- | |
25 | ||
53a2db12 | 26 | class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase |
0e320a79 DW |
27 | { |
28 | public: | |
f289196b DW |
29 | // |
30 | // Ctors | |
31 | // ----- | |
32 | // Default for dynamic class | |
33 | // | |
34 | wxNotebook(); | |
35 | ||
36 | // | |
37 | // the same arguments as for wxControl | |
38 | // | |
39 | wxNotebook( wxWindow* pParent | |
40 | ,wxWindowID vId | |
41 | ,const wxPoint& rPos = wxDefaultPosition | |
42 | ,const wxSize& rSize = wxDefaultSize | |
43 | ,long lStyle = 0 | |
630ad6c6 | 44 | ,const wxString& rsName = wxNotebookNameStr |
f289196b DW |
45 | ); |
46 | ||
47 | bool Create( wxWindow* pParent | |
48 | ,wxWindowID vId | |
49 | ,const wxPoint& rPos = wxDefaultPosition | |
50 | ,const wxSize& rSize = wxDefaultSize | |
51 | ,long lStyle = 0 | |
630ad6c6 | 52 | ,const wxString& rsName = wxNotebookNameStr |
f289196b DW |
53 | ); |
54 | ||
55 | // | |
56 | // Accessors | |
57 | // --------- | |
58 | // Get number of pages in the dialog | |
59 | // | |
3979bf6b | 60 | virtual size_t GetPageCount(void) const; |
f289196b DW |
61 | |
62 | // | |
63 | // Set the currently selected page, return the index of the previously | |
7e837615 | 64 | // selected one (or wxNOT_FOUND on error) |
0e320a79 | 65 | // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events |
f289196b | 66 | // |
3979bf6b | 67 | int SetSelection(size_t nPage); |
f289196b | 68 | |
1d6fcbcc VZ |
69 | // changes selected page without sending events |
70 | int ChangeSelection(size_t nPage); | |
71 | ||
f289196b DW |
72 | // |
73 | // Set/Get the title of a page | |
74 | // | |
3979bf6b SN |
75 | bool SetPageText( size_t nPage |
76 | ,const wxString& sStrText | |
77 | ); | |
78 | wxString GetPageText(size_t nPage) const; | |
f289196b DW |
79 | |
80 | // | |
81 | // Image list stuff: each page may have an image associated with it. All | |
82 | // the images belong to an image list, so you have to | |
83 | // 1) create an image list | |
84 | // 2) associate it with the notebook | |
85 | // 3) set for each page it's image | |
0e320a79 | 86 | // associate image list with a control |
f289196b DW |
87 | // |
88 | void SetImageList(wxImageList* pImageList); | |
89 | ||
90 | // | |
91 | // Sets/returns item's image index in the current image list | |
92 | // | |
3979bf6b SN |
93 | int GetPageImage(size_t nPage) const; |
94 | bool SetPageImage( size_t nPage | |
95 | ,int nImage | |
96 | ); | |
f289196b DW |
97 | |
98 | // | |
99 | // Currently it's always 1 because wxGTK doesn't support multi-row | |
0e320a79 | 100 | // tab controls |
f289196b DW |
101 | // |
102 | int GetRowCount(void) const; | |
0e320a79 | 103 | |
f289196b DW |
104 | // |
105 | // control the appearance of the notebook pages | |
0e320a79 | 106 | // set the size (the same for all pages) |
f289196b DW |
107 | // |
108 | void SetPageSize(const wxSize& rSize); | |
109 | ||
110 | // | |
111 | // Set the padding between tabs (in pixels) | |
112 | // | |
113 | void SetPadding(const wxSize& rPadding); | |
114 | ||
115 | // | |
116 | // Operations | |
117 | // ---------- | |
118 | // Remove all pages | |
119 | // | |
120 | bool DeleteAllPages(void); | |
121 | ||
122 | // | |
123 | // Adds a new page to the notebook (it will be deleted ny the notebook, | |
0e320a79 | 124 | // don't delete it yourself). If bSelect, this page becomes active. |
f289196b DW |
125 | // |
126 | bool AddPage( wxNotebookPage* pPage | |
127 | ,const wxString& rsStrText | |
630ad6c6 | 128 | ,bool bSelect = false |
f289196b DW |
129 | ,int nImageId = -1 |
130 | ); | |
131 | ||
132 | // | |
133 | // The same as AddPage(), but adds it at the specified position | |
134 | // | |
3979bf6b SN |
135 | bool InsertPage( size_t nPage |
136 | ,wxNotebookPage* pPage | |
137 | ,const wxString& rsStrText | |
630ad6c6 | 138 | ,bool bSelect = false |
3979bf6b SN |
139 | ,int nImageId = -1 |
140 | ); | |
f289196b DW |
141 | |
142 | // | |
cdf1e714 DW |
143 | // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH |
144 | // style. | |
f289196b DW |
145 | // |
146 | void SetTabSize(const wxSize& rSize); | |
147 | ||
148 | // | |
149 | // Callbacks | |
150 | // --------- | |
151 | // | |
152 | void OnSize(wxSizeEvent& rEvent); | |
3e97a905 | 153 | void OnSelChange(wxBookCtrlEvent& rEvent); |
f289196b DW |
154 | void OnSetFocus(wxFocusEvent& rEvent); |
155 | void OnNavigationKey(wxNavigationKeyEvent& rEvent); | |
156 | ||
157 | // | |
158 | // Base class virtuals | |
159 | // ------------------- | |
160 | // | |
161 | virtual bool OS2OnScroll( int nOrientation | |
162 | ,WXWORD wSBCode | |
163 | ,WXWORD wPos | |
164 | ,WXHWND hControl | |
165 | ); | |
630ad6c6 | 166 | virtual void SetConstraintSizes(bool bRecurse = true); |
f289196b DW |
167 | virtual bool DoPhase(int nPhase); |
168 | ||
169 | protected: | |
170 | // | |
171 | // Common part of all ctors | |
172 | // | |
173 | void Init(void); | |
cdf1e714 | 174 | |
f289196b DW |
175 | // |
176 | // Translate wxWin styles to the PM ones | |
177 | // | |
178 | virtual WXDWORD OS2GetStyle( long lFlags | |
179 | ,WXDWORD* pwExstyle = NULL | |
180 | ) const; | |
cdf1e714 | 181 | |
f289196b DW |
182 | // |
183 | // Remove one page from the notebook, without deleting | |
184 | // | |
3979bf6b | 185 | virtual wxNotebookPage* DoRemovePage(size_t nPage); |
0e320a79 | 186 | |
f289196b DW |
187 | // |
188 | // Helper functions | |
189 | // | |
f289196b | 190 | |
f289196b DW |
191 | private: |
192 | wxArrayLong m_alPageId; | |
193 | int m_nTabSize; // holds the largest tab size | |
0e320a79 | 194 | |
f289196b DW |
195 | DECLARE_DYNAMIC_CLASS(wxNotebook) |
196 | DECLARE_EVENT_TABLE() | |
197 | }; // end of CLASS wxNotebook | |
0e320a79 | 198 | |
f289196b | 199 | #endif // wxUSE_NOTEBOOK |
0e320a79 | 200 | |
f289196b | 201 | #endif // _NOTEBOOK_H |