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