]>
Commit | Line | Data |
---|---|---|
53b28675 | 1 | ///////////////////////////////////////////////////////////////////////////// |
716b7364 RR |
2 | // Name: notebook.h |
3 | // Purpose: wxNotebook class | |
53b28675 RR |
4 | // Author: Robert Roebling |
5 | // Modified by: | |
6 | // RCS-ID: $Id$ | |
b2b3ccc5 | 7 | // Copyright: (c) Julian Smart and Robert Roebling |
371a5b4e | 8 | // Licence: wxWindows licence |
53b28675 RR |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
6ca41e57 RR |
11 | #ifndef __GTKNOTEBOOKH__ |
12 | #define __GTKNOTEBOOKH__ | |
53b28675 | 13 | |
12028905 | 14 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
6ca41e57 | 15 | #pragma interface |
53b28675 RR |
16 | #endif |
17 | ||
80a58c99 RR |
18 | //----------------------------------------------------------------------------- |
19 | // internal class | |
20 | //----------------------------------------------------------------------------- | |
21 | ||
22 | class wxGtkNotebookPage; | |
53b28675 | 23 | |
07b8d7ec VZ |
24 | #include "wx/list.h" |
25 | WX_DECLARE_LIST(wxGtkNotebookPage, wxGtkNotebookPagesList); | |
26 | ||
53b28675 | 27 | //----------------------------------------------------------------------------- |
ff829f3f | 28 | // wxNotebook |
53b28675 RR |
29 | //----------------------------------------------------------------------------- |
30 | ||
1e6feb95 | 31 | class wxNotebook : public wxNotebookBase |
53b28675 | 32 | { |
ff829f3f | 33 | public: |
8253c7fd RR |
34 | // default for dynamic class |
35 | wxNotebook(); | |
36 | // the same arguments as for wxControl | |
37 | wxNotebook(wxWindow *parent, | |
debe6624 | 38 | wxWindowID id, |
ff829f3f VZ |
39 | const wxPoint& pos = wxDefaultPosition, |
40 | const wxSize& size = wxDefaultSize, | |
debe6624 | 41 | long style = 0, |
401eb3de | 42 | const wxString& name = wxT("notebook")); |
8253c7fd RR |
43 | // Create() function |
44 | bool Create(wxWindow *parent, | |
debe6624 | 45 | wxWindowID id, |
ff829f3f VZ |
46 | const wxPoint& pos = wxDefaultPosition, |
47 | const wxSize& size = wxDefaultSize, | |
debe6624 | 48 | long style = 0, |
401eb3de | 49 | const wxString& name = wxT("notebook")); |
8253c7fd | 50 | // dtor |
07b8d7ec | 51 | virtual ~wxNotebook(); |
ff829f3f VZ |
52 | |
53 | // accessors | |
54 | // --------- | |
ff829f3f VZ |
55 | |
56 | // set the currently selected page, return the index of the previously | |
57 | // selected one (or -1 on error) | |
58 | // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events | |
15aad3b9 | 59 | int SetSelection(size_t nPage); |
ff829f3f VZ |
60 | // get the currently selected page |
61 | int GetSelection() const; | |
62 | ||
63 | // set/get the title of a page | |
15aad3b9 VZ |
64 | bool SetPageText(size_t nPage, const wxString& strText); |
65 | wxString GetPageText(size_t nPage) const; | |
ff829f3f | 66 | |
ff829f3f | 67 | // sets/returns item's image index in the current image list |
15aad3b9 VZ |
68 | int GetPageImage(size_t nPage) const; |
69 | bool SetPageImage(size_t nPage, int nImage); | |
ff829f3f | 70 | |
ff829f3f VZ |
71 | // control the appearance of the notebook pages |
72 | // set the size (the same for all pages) | |
73 | void SetPageSize(const wxSize& size); | |
74 | // set the padding between tabs (in pixels) | |
75 | void SetPadding(const wxSize& padding); | |
d8f2439c | 76 | // sets the size of the tabs (assumes all tabs are the same size) |
ca8b28f2 JS |
77 | void SetTabSize(const wxSize& sz); |
78 | ||
279b5e2e VZ |
79 | virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; |
80 | ||
ff829f3f VZ |
81 | // operations |
82 | // ---------- | |
83 | // remove one page from the notebook | |
15aad3b9 | 84 | bool DeletePage(size_t nPage); |
ff829f3f VZ |
85 | // remove all pages |
86 | bool DeleteAllPages(); | |
1e6feb95 | 87 | |
ff829f3f VZ |
88 | // adds a new page to the notebook (it will be deleted ny the notebook, |
89 | // don't delete it yourself). If bSelect, this page becomes active. | |
587ce561 | 90 | // the same as AddPage(), but adds it at the specified position |
789d0a3d | 91 | bool InsertPage( size_t position, |
80a58c99 RR |
92 | wxNotebookPage *win, |
93 | const wxString& strText, | |
94 | bool bSelect = FALSE, | |
95 | int imageId = -1 ); | |
ff829f3f | 96 | |
8253c7fd RR |
97 | // handler for tab navigation |
98 | // -------------------------- | |
99 | void OnNavigationKey(wxNavigationKeyEvent& event); | |
ed58dbea | 100 | |
db434467 RR |
101 | // implementation |
102 | // -------------- | |
d8f2439c | 103 | |
93d38175 | 104 | #if wxUSE_CONSTRAINTS |
db434467 RR |
105 | void SetConstraintSizes(bool recurse); |
106 | bool DoPhase(int phase); | |
93d38175 VS |
107 | #endif |
108 | ||
c077ee94 RR |
109 | // set all page's font |
110 | bool SetFont(const wxFont& font); | |
111 | ||
db434467 | 112 | void ApplyWidgetStyle(); |
ff829f3f | 113 | |
1e6feb95 | 114 | // report if window belongs to notebook |
db434467 | 115 | bool IsOwnGtkWindow( GdkWindow *window ); |
58d1c1ae | 116 | |
db434467 RR |
117 | // common part of all ctors |
118 | void Init(); | |
ff829f3f | 119 | |
db434467 | 120 | // helper function |
80a58c99 | 121 | wxGtkNotebookPage* GetNotebookPage(int page) const; |
ff829f3f | 122 | |
07b8d7ec VZ |
123 | // the additional page data (the pages themselves are in m_pages array) |
124 | wxGtkNotebookPagesList m_pagesData; | |
36202885 VZ |
125 | |
126 | // for reasons explained in gtk/notebook.cpp we store the current | |
127 | // selection internally instead of querying the notebook for it | |
07b8d7ec | 128 | int m_selection; |
53b28675 | 129 | |
2b5f62a0 VZ |
130 | // flag set to TRUE while we're inside "switch_page" callback |
131 | bool m_inSwitchPage; | |
132 | ||
1e6feb95 VZ |
133 | protected: |
134 | // remove one page from the notebook but do not destroy it | |
15aad3b9 | 135 | virtual wxNotebookPage *DoRemovePage(size_t nPage); |
1e6feb95 | 136 | |
db434467 | 137 | private: |
2b5f62a0 | 138 | // the padding set by SetPadding() |
b318dc42 JS |
139 | int m_padding; |
140 | ||
db434467 RR |
141 | DECLARE_DYNAMIC_CLASS(wxNotebook) |
142 | DECLARE_EVENT_TABLE() | |
53b28675 RR |
143 | }; |
144 | ||
53b28675 | 145 | #endif |
6ca41e57 | 146 | // __GTKNOTEBOOKH__ |