]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/notebook.h
68fc28013b66b72641687e6d6fd28c34ee348412
[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 WXDLLEXPORT 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 = "notebook"
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 = "notebook"
53 );
54
55 //
56 // Accessors
57 // ---------
58 // Get number of pages in the dialog
59 //
60 int 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(int nPage);
68
69 //
70 // Get the currently selected page
71 //
72 inline int GetSelection(void) const { return m_nSelection; }
73
74 //
75 // Set/Get the title of a page
76 //
77 bool SetPageText( int nPage
78 ,const wxString& sStrText
79 );
80 wxString GetPageText(int nPage) const;
81
82 //
83 // Image list stuff: each page may have an image associated with it. All
84 // the images belong to an image list, so you have to
85 // 1) create an image list
86 // 2) associate it with the notebook
87 // 3) set for each page it's image
88 // associate image list with a control
89 //
90 void SetImageList(wxImageList* pImageList);
91
92 //
93 // Sets/returns item's image index in the current image list
94 //
95 int GetPageImage(int nPage) const;
96 bool SetPageImage( int nPage
97 ,int nImage
98 );
99
100 //
101 // Currently it's always 1 because wxGTK doesn't support multi-row
102 // tab controls
103 //
104 int GetRowCount(void) const;
105
106 //
107 // control the appearance of the notebook pages
108 // set the size (the same for all pages)
109 //
110 void SetPageSize(const wxSize& rSize);
111
112 //
113 // Set the padding between tabs (in pixels)
114 //
115 void SetPadding(const wxSize& rPadding);
116
117 //
118 // Operations
119 // ----------
120 // Remove all pages
121 //
122 bool DeleteAllPages(void);
123
124 //
125 // Adds a new page to the notebook (it will be deleted ny the notebook,
126 // don't delete it yourself). If bSelect, this page becomes active.
127 //
128 bool AddPage( wxNotebookPage* pPage
129 ,const wxString& rsStrText
130 ,bool bSelect = FALSE
131 ,int nImageId = -1
132 );
133
134 //
135 // The same as AddPage(), but adds it at the specified position
136 //
137 bool InsertPage( int nPage
138 ,wxNotebookPage* pPage
139 ,const wxString& rsStrText
140 ,bool bSelect = FALSE
141 ,int nImageId = -1
142 );
143
144 //
145 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
146 // style.
147 //
148 void SetTabSize(const wxSize& rSize);
149
150 //
151 // Callbacks
152 // ---------
153 //
154 void OnSize(wxSizeEvent& rEvent);
155 void OnSelChange(wxNotebookEvent& rEvent);
156 void OnSetFocus(wxFocusEvent& rEvent);
157 void OnNavigationKey(wxNavigationKeyEvent& rEvent);
158
159 //
160 // Base class virtuals
161 // -------------------
162 //
163 virtual bool OS2OnScroll( int nOrientation
164 ,WXWORD wSBCode
165 ,WXWORD wPos
166 ,WXHWND hControl
167 );
168 virtual void SetConstraintSizes(bool bRecurse = TRUE);
169 virtual bool DoPhase(int nPhase);
170
171 protected:
172 //
173 // Common part of all ctors
174 //
175 void Init(void);
176
177 //
178 // Translate wxWin styles to the PM ones
179 //
180 virtual WXDWORD OS2GetStyle( long lFlags
181 ,WXDWORD* pwExstyle = NULL
182 ) const;
183
184 //
185 // Remove one page from the notebook, without deleting
186 //
187 virtual wxNotebookPage* DoRemovePage(int nPage);
188
189 //
190 // Helper functions
191 //
192 void ChangePage( int nOldSel
193 ,int nSel
194 ); // change pages
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
209