]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/notebook.h
Added and corrected a few more html makefiles,
[wxWidgets.git] / include / wx / msw / notebook.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: msw/notebook.h
3 // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
4 // Author: Robert Roebling
5 // Modified by: Vadim Zeitlin for Windows version
6 // RCS-ID: $Id$
7 // Copyright: (c) Julian Smart and Markus Holzem
8 // Licence: wxWindows license
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _NOTEBOOK_H
12 #define _NOTEBOOK_H
13
14 #ifdef __GNUG__
15 #pragma interface "notebook.h"
16 #endif
17
18 // ----------------------------------------------------------------------------
19 // headers
20 // ----------------------------------------------------------------------------
21 #ifndef _DYNARRAY_H
22 #include <wx/dynarray.h>
23 #endif //_DYNARRAY_H
24
25 // ----------------------------------------------------------------------------
26 // types
27 // ----------------------------------------------------------------------------
28
29 // fwd declarations
30 class WXDLLEXPORT wxImageList;
31 class WXDLLEXPORT wxWindow;
32
33 // array of notebook pages
34 typedef wxWindow WXDLLEXPORT wxNotebookPage; // so far, any window can be a page
35
36 WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayPages);
37
38 // ----------------------------------------------------------------------------
39 // wxNotebook
40 // ----------------------------------------------------------------------------
41
42 // FIXME this class should really derive from wxTabCtrl, but the interface is not
43 // exactly the same, so I can't do it right now and instead we reimplement
44 // part of wxTabCtrl here
45 class WXDLLEXPORT wxNotebook : public wxControl
46 {
47 public:
48 // ctors
49 // -----
50 // default for dynamic class
51 wxNotebook();
52 // the same arguments as for wxControl (@@@ any special styles?)
53 wxNotebook(wxWindow *parent,
54 wxWindowID id,
55 const wxPoint& pos = wxDefaultPosition,
56 const wxSize& size = wxDefaultSize,
57 long style = 0,
58 const wxString& name = "notebook");
59 // Create() function
60 bool Create(wxWindow *parent,
61 wxWindowID id,
62 const wxPoint& pos = wxDefaultPosition,
63 const wxSize& size = wxDefaultSize,
64 long style = 0,
65 const wxString& name = "notebook");
66 // dtor
67 ~wxNotebook();
68
69 // accessors
70 // ---------
71 // get number of pages in the dialog
72 int GetPageCount() const;
73
74 // set the currently selected page, return the index of the previously
75 // selected one (or -1 on error)
76 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
77 int SetSelection(int nPage);
78 // cycle thru the tabs
79 void AdvanceSelection(bool bForward = TRUE);
80 // get the currently selected page
81 int GetSelection() const { return m_nSelection; }
82
83 // set/get the title of a page
84 bool SetPageText(int nPage, const wxString& strText);
85 wxString GetPageText(int nPage) const;
86
87 // image list stuff: each page may have an image associated with it. All
88 // the images belong to an image list, so you have to
89 // 1) create an image list
90 // 2) associate it with the notebook
91 // 3) set for each page it's image
92 // associate image list with a control
93 void SetImageList(wxImageList* imageList);
94 // get pointer (may be NULL) to the associated image list
95 wxImageList* GetImageList() const { return m_pImageList; }
96
97 // sets/returns item's image index in the current image list
98 int GetPageImage(int nPage) const;
99 bool SetPageImage(int nPage, int nImage);
100
101 // currently it's always 1 because wxGTK doesn't support multi-row
102 // tab controls
103 int GetRowCount() const;
104
105 // control the appearance of the notebook pages
106 // set the size (the same for all pages)
107 void SetPageSize(const wxSize& size);
108 // set the padding between tabs (in pixels)
109 void SetPadding(const wxSize& padding);
110
111 // operations
112 // ----------
113 // remove one page from the notebook
114 bool DeletePage(int nPage);
115 // remove one page from the notebook, without deleting
116 bool RemovePage(int nPage);
117 // remove all pages
118 bool DeleteAllPages();
119 // adds a new page to the notebook (it will be deleted ny the notebook,
120 // don't delete it yourself). If bSelect, this page becomes active.
121 bool AddPage(wxNotebookPage *pPage,
122 const wxString& strText,
123 bool bSelect = FALSE,
124 int imageId = -1);
125 // the same as AddPage(), but adds it at the specified position
126 bool InsertPage(int nPage,
127 wxNotebookPage *pPage,
128 const wxString& strText,
129 bool bSelect = FALSE,
130 int imageId = -1);
131 // get the panel which represents the given page
132 wxNotebookPage *GetPage(int nPage) { return m_aPages[nPage]; }
133
134 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
135 // style.
136 void SetTabSize(const wxSize& sz);
137
138 // callbacks
139 // ---------
140 void OnSize(wxSizeEvent& event);
141 void OnSelChange(wxNotebookEvent& event);
142 void OnSetFocus(wxFocusEvent& event);
143 void OnNavigationKey(wxNavigationKeyEvent& event);
144
145 // base class virtuals
146 // -------------------
147 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
148 virtual void SetConstraintSizes(bool recurse = TRUE);
149 virtual bool DoPhase(int nPhase);
150
151 protected:
152 // common part of all ctors
153 void Init();
154
155 // helper functions
156 void ChangePage(int nOldSel, int nSel); // change pages
157
158 wxImageList *m_pImageList; // we can have an associated image list
159 wxArrayPages m_aPages; // array of pages
160
161 int m_nSelection; // the current selection (-1 if none)
162
163 DECLARE_DYNAMIC_CLASS(wxNotebook)
164 DECLARE_EVENT_TABLE()
165 };
166
167 #endif // _NOTEBOOK_H