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