]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/notebook.h
wxMGL revitalised with OpenWatcom.
[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 = 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 //
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( size_t nPage
78 ,const wxString& sStrText
79 );
80 wxString GetPageText(size_t 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(size_t nPage) const;
96 bool SetPageImage( size_t 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( size_t 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(size_t nPage);
188
189 //
190 // Helper functions
191 //
192
193 int m_nSelection; // The current selection (-1 if none)
194
195 private:
196 wxArrayLong m_alPageId;
197 int m_nTabSize; // holds the largest tab size
198
199 DECLARE_DYNAMIC_CLASS(wxNotebook)
200 DECLARE_EVENT_TABLE()
201 }; // end of CLASS wxNotebook
202
203 #endif // wxUSE_NOTEBOOK
204
205 #endif // _NOTEBOOK_H