1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
4 // Author: David Webster
7 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #include "wx/control.h"
22 // ----------------------------------------------------------------------------
24 // ----------------------------------------------------------------------------
26 class WXDLLIMPEXP_CORE wxNotebook
: public wxNotebookBase
32 // Default for dynamic class
37 // the same arguments as for wxControl
39 wxNotebook( wxWindow
* pParent
41 ,const wxPoint
& rPos
= wxDefaultPosition
42 ,const wxSize
& rSize
= wxDefaultSize
44 ,const wxString
& rsName
= wxNotebookNameStr
47 bool Create( wxWindow
* pParent
49 ,const wxPoint
& rPos
= wxDefaultPosition
50 ,const wxSize
& rSize
= wxDefaultSize
52 ,const wxString
& rsName
= wxNotebookNameStr
58 // Get number of pages in the dialog
60 virtual size_t GetPageCount(void) const;
63 // Set the currently selected page, return the index of the previously
64 // selected one (or wxNOT_FOUND on error)
65 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
67 int SetSelection(size_t nPage
);
69 // changes selected page without sending events
70 int ChangeSelection(size_t nPage
);
73 // Set/Get the title of a page
75 bool SetPageText( size_t nPage
76 ,const wxString
& sStrText
78 wxString
GetPageText(size_t nPage
) const;
81 // Image list stuff: each page may have an image associated with it. All
82 // the images belong to an image list, so you have to
83 // 1) create an image list
84 // 2) associate it with the notebook
85 // 3) set for each page it's image
86 // associate image list with a control
88 void SetImageList(wxImageList
* pImageList
);
91 // Sets/returns item's image index in the current image list
93 int GetPageImage(size_t nPage
) const;
94 bool SetPageImage( size_t nPage
99 // Currently it's always 1 because wxGTK doesn't support multi-row
102 int GetRowCount(void) const;
105 // control the appearance of the notebook pages
106 // set the size (the same for all pages)
108 void SetPageSize(const wxSize
& rSize
);
111 // Set the padding between tabs (in pixels)
113 void SetPadding(const wxSize
& rPadding
);
120 bool DeleteAllPages(void);
123 // Adds a new page to the notebook (it will be deleted ny the notebook,
124 // don't delete it yourself). If bSelect, this page becomes active.
126 bool AddPage( wxNotebookPage
* pPage
127 ,const wxString
& rsStrText
128 ,bool bSelect
= false
133 // The same as AddPage(), but adds it at the specified position
135 bool InsertPage( size_t nPage
136 ,wxNotebookPage
* pPage
137 ,const wxString
& rsStrText
138 ,bool bSelect
= false
143 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
146 void SetTabSize(const wxSize
& rSize
);
152 void OnSize(wxSizeEvent
& rEvent
);
153 void OnSelChange(wxBookCtrlEvent
& rEvent
);
154 void OnSetFocus(wxFocusEvent
& rEvent
);
155 void OnNavigationKey(wxNavigationKeyEvent
& rEvent
);
158 // Base class virtuals
159 // -------------------
161 virtual bool OS2OnScroll( int nOrientation
166 virtual void SetConstraintSizes(bool bRecurse
= true);
167 virtual bool DoPhase(int nPhase
);
171 // Common part of all ctors
176 // Translate wxWin styles to the PM ones
178 virtual WXDWORD
OS2GetStyle( long lFlags
179 ,WXDWORD
* pwExstyle
= NULL
183 // Remove one page from the notebook, without deleting
185 virtual wxNotebookPage
* DoRemovePage(size_t nPage
);
192 wxArrayLong m_alPageId
;
193 int m_nTabSize
; // holds the largest tab size
195 DECLARE_DYNAMIC_CLASS(wxNotebook
)
196 DECLARE_EVENT_TABLE()
197 }; // end of CLASS wxNotebook
199 #endif // wxUSE_NOTEBOOK
201 #endif // _NOTEBOOK_H