]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/notebook.h
Notebook, Listbox, and Checklst updates
[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 #if wxUSE_NOTEBOOK
19
20 // ----------------------------------------------------------------------------
21 // headers
22 // ----------------------------------------------------------------------------
23
24 #include "wx/control.h"
25
26 // ----------------------------------------------------------------------------
27 // wxNotebook
28 // ----------------------------------------------------------------------------
29
30 class WXDLLEXPORT wxNotebook : public wxNotebookBase
31 {
32 public:
33 // ctors
34 // -----
35 // default for dynamic class
36 wxNotebook();
37 // the same arguments as for wxControl (@@@ any special styles?)
38 wxNotebook(wxWindow *parent,
39 wxWindowID id,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = 0,
43 const wxString& name = "notebook");
44 // Create() function
45 bool Create(wxWindow *parent,
46 wxWindowID id,
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
49 long style = 0,
50 const wxString& name = "notebook");
51
52 // accessors
53 // ---------
54 // get number of pages in the dialog
55 int GetPageCount() const;
56
57 // set the currently selected page, return the index of the previously
58 // selected one (or -1 on error)
59 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
60 int SetSelection(int nPage);
61 // get the currently selected page
62 int GetSelection() const { return m_nSelection; }
63
64 // set/get the title of a page
65 bool SetPageText(int nPage, const wxString& strText);
66 wxString GetPageText(int nPage) const;
67
68 // image list stuff: each page may have an image associated with it. All
69 // the images belong to an image list, so you have to
70 // 1) create an image list
71 // 2) associate it with the notebook
72 // 3) set for each page it's image
73 // associate image list with a control
74 void SetImageList(wxImageList* imageList);
75
76 // sets/returns item's image index in the current image list
77 int GetPageImage(int nPage) const;
78 bool SetPageImage(int nPage, int nImage);
79
80 // currently it's always 1 because wxGTK doesn't support multi-row
81 // tab controls
82 int GetRowCount() const;
83
84 // control the appearance of the notebook pages
85 // set the size (the same for all pages)
86 void SetPageSize(const wxSize& size);
87 // set the padding between tabs (in pixels)
88 void SetPadding(const wxSize& padding);
89
90 // operations
91 // ----------
92 // remove all pages
93 bool DeleteAllPages();
94 // adds a new page to the notebook (it will be deleted ny the notebook,
95 // don't delete it yourself). If bSelect, this page becomes active.
96 bool AddPage(wxNotebookPage *pPage,
97 const wxString& strText,
98 bool bSelect = FALSE,
99 int imageId = -1);
100 // the same as AddPage(), but adds it at the specified position
101 bool InsertPage(int nPage,
102 wxNotebookPage *pPage,
103 const wxString& strText,
104 bool bSelect = FALSE,
105 int imageId = -1);
106
107 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
108 // style.
109 void SetTabSize(const wxSize& sz);
110
111 // callbacks
112 // ---------
113 void OnSize(wxSizeEvent& event);
114 void OnSelChange(wxNotebookEvent& event);
115 void OnSetFocus(wxFocusEvent& event);
116 void OnNavigationKey(wxNavigationKeyEvent& event);
117
118 // base class virtuals
119 // -------------------
120 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
121 virtual bool MSWOnScroll(int orientation, WXWORD nSBCode,
122 WXWORD pos, WXHWND control);
123 virtual void SetConstraintSizes(bool recurse = TRUE);
124 virtual bool DoPhase(int nPhase);
125
126 protected:
127 // common part of all ctors
128 void Init();
129
130 // translate wxWin styles to the Windows ones
131 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
132
133 // remove one page from the notebook, without deleting
134 virtual wxNotebookPage *DoRemovePage(int nPage);
135
136 // helper functions
137 void ChangePage(int nOldSel, int nSel); // change pages
138
139 int m_nSelection; // the current selection (-1 if none)
140
141 DECLARE_DYNAMIC_CLASS(wxNotebook)
142 DECLARE_EVENT_TABLE()
143 };
144
145 #endif // wxUSE_NOTEBOOK
146
147 #endif // _NOTEBOOK_H