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