]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/notebook.h
The rounded corners look really dumb at this size.
[wxWidgets.git] / include / wx / os2 / notebook.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/notebook.h
3 // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
4 // Author: David Webster
5 // Modified by:
6 // Copyright: (c) David Webster
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _NOTEBOOK_H
11 #define _NOTEBOOK_H
12
13 #if wxUSE_NOTEBOOK
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 #include "wx/control.h"
20
21 // ----------------------------------------------------------------------------
22 // wxNotebook
23 // ----------------------------------------------------------------------------
24
25 class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase
26 {
27 public:
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
43 ,const wxString& rsName = wxNotebookNameStr
44 );
45
46 bool Create( wxWindow* pParent
47 ,wxWindowID vId
48 ,const wxPoint& rPos = wxDefaultPosition
49 ,const wxSize& rSize = wxDefaultSize
50 ,long lStyle = 0
51 ,const wxString& rsName = wxNotebookNameStr
52 );
53
54 //
55 // Accessors
56 // ---------
57 // Get number of pages in the dialog
58 //
59 virtual size_t GetPageCount(void) const;
60
61 //
62 // Set the currently selected page, return the index of the previously
63 // selected one (or wxNOT_FOUND on error)
64 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
65 //
66 int SetSelection(size_t nPage);
67
68 // changes selected page without sending events
69 int ChangeSelection(size_t nPage);
70
71 //
72 // Set/Get the title of a page
73 //
74 bool SetPageText( size_t nPage
75 ,const wxString& sStrText
76 );
77 wxString GetPageText(size_t nPage) const;
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
85 // associate image list with a control
86 //
87 void SetImageList(wxImageList* pImageList);
88
89 //
90 // Sets/returns item's image index in the current image list
91 //
92 int GetPageImage(size_t nPage) const;
93 bool SetPageImage( size_t nPage
94 ,int nImage
95 );
96
97 //
98 // Currently it's always 1 because wxGTK doesn't support multi-row
99 // tab controls
100 //
101 int GetRowCount(void) const;
102
103 //
104 // control the appearance of the notebook pages
105 // set the size (the same for all pages)
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,
123 // don't delete it yourself). If bSelect, this page becomes active.
124 //
125 bool AddPage( wxNotebookPage* pPage
126 ,const wxString& rsStrText
127 ,bool bSelect = false
128 ,int nImageId = -1
129 );
130
131 //
132 // The same as AddPage(), but adds it at the specified position
133 //
134 bool InsertPage( size_t nPage
135 ,wxNotebookPage* pPage
136 ,const wxString& rsStrText
137 ,bool bSelect = false
138 ,int nImageId = -1
139 );
140
141 //
142 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
143 // style.
144 //
145 void SetTabSize(const wxSize& rSize);
146
147 //
148 // Callbacks
149 // ---------
150 //
151 void OnSize(wxSizeEvent& rEvent);
152 void OnSelChange(wxBookCtrlEvent& rEvent);
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 );
165 virtual void SetConstraintSizes(bool bRecurse = true);
166 virtual bool DoPhase(int nPhase);
167
168 protected:
169 //
170 // Common part of all ctors
171 //
172 void Init(void);
173
174 //
175 // Translate wxWin styles to the PM ones
176 //
177 virtual WXDWORD OS2GetStyle( long lFlags
178 ,WXDWORD* pwExstyle = NULL
179 ) const;
180
181 //
182 // Remove one page from the notebook, without deleting
183 //
184 virtual wxNotebookPage* DoRemovePage(size_t nPage);
185
186 //
187 // Helper functions
188 //
189
190 private:
191 wxArrayLong m_alPageId;
192 int m_nTabSize; // holds the largest tab size
193
194 DECLARE_DYNAMIC_CLASS(wxNotebook)
195 DECLARE_EVENT_TABLE()
196 }; // end of CLASS wxNotebook
197
198 #endif // wxUSE_NOTEBOOK
199
200 #endif // _NOTEBOOK_H