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