]>
Commit | Line | Data |
---|---|---|
b5f2afe5 VZ |
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$ | |
371a5b4e JS |
7 | // Copyright: (c) Julian Smart |
8 | // Licence: wxWindows licence | |
b5f2afe5 VZ |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _NOTEBOOK_H | |
12 | #define _NOTEBOOK_H | |
13 | ||
12028905 | 14 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
b5f2afe5 VZ |
15 | #pragma interface "notebook.h" |
16 | #endif | |
17 | ||
1e6feb95 VZ |
18 | #if wxUSE_NOTEBOOK |
19 | ||
b5f2afe5 VZ |
20 | // ---------------------------------------------------------------------------- |
21 | // headers | |
22 | // ---------------------------------------------------------------------------- | |
74b31181 | 23 | |
7c0ea335 | 24 | #include "wx/control.h" |
b5f2afe5 | 25 | |
b5f2afe5 VZ |
26 | // ---------------------------------------------------------------------------- |
27 | // wxNotebook | |
28 | // ---------------------------------------------------------------------------- | |
29 | ||
1e6feb95 | 30 | class WXDLLEXPORT wxNotebook : public wxNotebookBase |
b5f2afe5 VZ |
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, | |
35eca07c | 39 | wxWindowID id, |
b5f2afe5 VZ |
40 | const wxPoint& pos = wxDefaultPosition, |
41 | const wxSize& size = wxDefaultSize, | |
debe6624 | 42 | long style = 0, |
2b5f62a0 | 43 | const wxString& name = wxNOTEBOOK_NAME); |
b5f2afe5 VZ |
44 | // Create() function |
45 | bool Create(wxWindow *parent, | |
35eca07c | 46 | wxWindowID id, |
b5f2afe5 VZ |
47 | const wxPoint& pos = wxDefaultPosition, |
48 | const wxSize& size = wxDefaultSize, | |
debe6624 | 49 | long style = 0, |
2b5f62a0 | 50 | const wxString& name = wxNOTEBOOK_NAME); |
b5f2afe5 VZ |
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); | |
b5f2afe5 VZ |
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); | |
b5f2afe5 VZ |
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 | ||
b5f2afe5 VZ |
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 | ||
85b43fbf JS |
90 | // Windows only: attempts to get colour for UX theme page background |
91 | wxColour GetThemeBackgroundColour(); | |
92 | ||
b5f2afe5 VZ |
93 | // operations |
94 | // ---------- | |
b5f2afe5 VZ |
95 | // remove all pages |
96 | bool DeleteAllPages(); | |
e450aa69 | 97 | |
efa14cf2 | 98 | // inserts a new page to the notebook (it will be deleted ny the notebook, |
b5f2afe5 | 99 | // don't delete it yourself). If bSelect, this page becomes active. |
b5f2afe5 VZ |
100 | bool InsertPage(int nPage, |
101 | wxNotebookPage *pPage, | |
102 | const wxString& strText, | |
103 | bool bSelect = FALSE, | |
8a33ea62 | 104 | int imageId = -1); |
b5f2afe5 | 105 | |
58a8ab88 JS |
106 | // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH |
107 | // style. | |
108 | void SetTabSize(const wxSize& sz); | |
109 | ||
85b43fbf JS |
110 | // Windows only: attempts to apply the UX theme page background to this page |
111 | void ApplyThemeBackground(wxWindow* window, const wxColour& colour); | |
17816c2e | 112 | |
e450aa69 VZ |
113 | // hit test |
114 | virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; | |
115 | ||
116 | // calculate the size of the notebook from the size of its page | |
2ce7af35 JS |
117 | virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; |
118 | ||
b5f2afe5 VZ |
119 | // callbacks |
120 | // --------- | |
9026ad85 | 121 | void OnSize(wxSizeEvent& event); |
b5f2afe5 | 122 | void OnSelChange(wxNotebookEvent& event); |
8a33ea62 VZ |
123 | void OnSetFocus(wxFocusEvent& event); |
124 | void OnNavigationKey(wxNavigationKeyEvent& event); | |
35eca07c | 125 | |
b5f2afe5 VZ |
126 | // base class virtuals |
127 | // ------------------- | |
0b481c72 | 128 | |
a23fd0e1 | 129 | virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); |
0df3fbd7 VZ |
130 | virtual bool MSWOnScroll(int orientation, WXWORD nSBCode, |
131 | WXWORD pos, WXHWND control); | |
0b481c72 VZ |
132 | |
133 | #if wxUSE_CONSTRAINTS | |
5475b960 VZ |
134 | virtual void SetConstraintSizes(bool recurse = TRUE); |
135 | virtual bool DoPhase(int nPhase); | |
0b481c72 | 136 | #endif // wxUSE_CONSTRAINTS |
b5f2afe5 VZ |
137 | |
138 | protected: | |
139 | // common part of all ctors | |
140 | void Init(); | |
141 | ||
0df3fbd7 VZ |
142 | // translate wxWin styles to the Windows ones |
143 | virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; | |
144 | ||
1e6feb95 VZ |
145 | // remove one page from the notebook, without deleting |
146 | virtual wxNotebookPage *DoRemovePage(int nPage); | |
147 | ||
2015f2b3 VZ |
148 | // set the size of the given page to fit in the notebook |
149 | void AdjustPageSize(wxNotebookPage *page); | |
150 | ||
c02e5a31 JS |
151 | // override WndProc |
152 | virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); | |
2015f2b3 | 153 | |
2b5f62a0 VZ |
154 | // the current selection (-1 if none) |
155 | int m_nSelection; | |
b5f2afe5 | 156 | |
2015f2b3 | 157 | |
fc7a2a60 | 158 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook) |
b5f2afe5 VZ |
159 | DECLARE_EVENT_TABLE() |
160 | }; | |
161 | ||
1e6feb95 VZ |
162 | #endif // wxUSE_NOTEBOOK |
163 | ||
b5f2afe5 | 164 | #endif // _NOTEBOOK_H |