]>
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 |
65571936 | 8 | // Licence: wxWindows licence |
53b28675 RR |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
6ca41e57 RR |
11 | #ifndef __GTKNOTEBOOKH__ |
12 | #define __GTKNOTEBOOKH__ | |
53b28675 | 13 | |
80a58c99 RR |
14 | //----------------------------------------------------------------------------- |
15 | // internal class | |
16 | //----------------------------------------------------------------------------- | |
17 | ||
20123d49 | 18 | class WXDLLIMPEXP_CORE wxGtkNotebookPage; |
53b28675 | 19 | |
07b8d7ec VZ |
20 | #include "wx/list.h" |
21 | WX_DECLARE_LIST(wxGtkNotebookPage, wxGtkNotebookPagesList); | |
22 | ||
53b28675 | 23 | //----------------------------------------------------------------------------- |
ff829f3f | 24 | // wxNotebook |
53b28675 RR |
25 | //----------------------------------------------------------------------------- |
26 | ||
20123d49 | 27 | class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase |
53b28675 | 28 | { |
ff829f3f | 29 | public: |
8253c7fd RR |
30 | // default for dynamic class |
31 | wxNotebook(); | |
32 | // the same arguments as for wxControl | |
33 | wxNotebook(wxWindow *parent, | |
debe6624 | 34 | wxWindowID id, |
ff829f3f VZ |
35 | const wxPoint& pos = wxDefaultPosition, |
36 | const wxSize& size = wxDefaultSize, | |
debe6624 | 37 | long style = 0, |
630ad6c6 | 38 | const wxString& name = wxNotebookNameStr); |
8253c7fd RR |
39 | // Create() function |
40 | bool Create(wxWindow *parent, | |
debe6624 | 41 | wxWindowID id, |
ff829f3f VZ |
42 | const wxPoint& pos = wxDefaultPosition, |
43 | const wxSize& size = wxDefaultSize, | |
debe6624 | 44 | long style = 0, |
630ad6c6 | 45 | const wxString& name = wxNotebookNameStr); |
8253c7fd | 46 | // dtor |
07b8d7ec | 47 | virtual ~wxNotebook(); |
ff829f3f VZ |
48 | |
49 | // accessors | |
50 | // --------- | |
ff829f3f VZ |
51 | |
52 | // set the currently selected page, return the index of the previously | |
53 | // selected one (or -1 on error) | |
54 | // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events | |
1d6fcbcc | 55 | int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); } |
ff829f3f VZ |
56 | // get the currently selected page |
57 | int GetSelection() const; | |
58 | ||
1d6fcbcc VZ |
59 | // changes selected page without sending events |
60 | int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); } | |
61 | ||
ff829f3f | 62 | // set/get the title of a page |
15aad3b9 VZ |
63 | bool SetPageText(size_t nPage, const wxString& strText); |
64 | wxString GetPageText(size_t nPage) const; | |
ff829f3f | 65 | |
ff829f3f | 66 | // sets/returns item's image index in the current image list |
15aad3b9 VZ |
67 | int GetPageImage(size_t nPage) const; |
68 | bool SetPageImage(size_t nPage, int nImage); | |
ff829f3f | 69 | |
ff829f3f VZ |
70 | // control the appearance of the notebook pages |
71 | // set the size (the same for all pages) | |
72 | void SetPageSize(const wxSize& size); | |
73 | // set the padding between tabs (in pixels) | |
74 | void SetPadding(const wxSize& padding); | |
d8f2439c | 75 | // sets the size of the tabs (assumes all tabs are the same size) |
ca8b28f2 JS |
76 | void SetTabSize(const wxSize& sz); |
77 | ||
279b5e2e VZ |
78 | virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; |
79 | ||
ff829f3f VZ |
80 | // operations |
81 | // ---------- | |
ff829f3f VZ |
82 | // remove all pages |
83 | bool DeleteAllPages(); | |
1e6feb95 | 84 | |
90e572f1 | 85 | // adds a new page to the notebook (it will be deleted by the notebook, |
ff829f3f | 86 | // don't delete it yourself). If bSelect, this page becomes active. |
587ce561 | 87 | // the same as AddPage(), but adds it at the specified position |
789d0a3d | 88 | bool InsertPage( size_t position, |
80a58c99 RR |
89 | wxNotebookPage *win, |
90 | const wxString& strText, | |
630ad6c6 | 91 | bool bSelect = false, |
80a58c99 | 92 | int imageId = -1 ); |
ff829f3f | 93 | |
8253c7fd RR |
94 | // handler for tab navigation |
95 | // -------------------------- | |
96 | void OnNavigationKey(wxNavigationKeyEvent& event); | |
ed58dbea | 97 | |
9d522606 RD |
98 | |
99 | static wxVisualAttributes | |
100 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
630ad6c6 | 101 | |
db434467 RR |
102 | // implementation |
103 | // -------------- | |
d8f2439c | 104 | |
93d38175 | 105 | #if wxUSE_CONSTRAINTS |
db434467 RR |
106 | void SetConstraintSizes(bool recurse); |
107 | bool DoPhase(int phase); | |
93d38175 | 108 | #endif |
58d1c1ae | 109 | |
db434467 RR |
110 | // common part of all ctors |
111 | void Init(); | |
ff829f3f | 112 | |
db434467 | 113 | // helper function |
80a58c99 | 114 | wxGtkNotebookPage* GetNotebookPage(int page) const; |
ff829f3f | 115 | |
07b8d7ec VZ |
116 | // the additional page data (the pages themselves are in m_pages array) |
117 | wxGtkNotebookPagesList m_pagesData; | |
36202885 VZ |
118 | |
119 | // for reasons explained in gtk/notebook.cpp we store the current | |
120 | // selection internally instead of querying the notebook for it | |
07b8d7ec | 121 | int m_selection; |
53b28675 | 122 | |
630ad6c6 | 123 | // flag set to true while we're inside "switch_page" callback |
2b5f62a0 VZ |
124 | bool m_inSwitchPage; |
125 | ||
1d6fcbcc VZ |
126 | // flag set to true when the switch-page signal has been programatically generated |
127 | bool m_skipNextPageChangeEvent; | |
128 | ||
1e6feb95 | 129 | protected: |
6f02a879 | 130 | // set all page's attributes |
ef5c70f9 VZ |
131 | virtual void DoApplyWidgetStyle(GtkRcStyle *style); |
132 | virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; | |
6f02a879 | 133 | |
1e6feb95 | 134 | // remove one page from the notebook but do not destroy it |
15aad3b9 | 135 | virtual wxNotebookPage *DoRemovePage(size_t nPage); |
1e6feb95 | 136 | |
1d6fcbcc VZ |
137 | int DoSetSelection(size_t nPage, int flags = 0); |
138 | ||
db434467 | 139 | private: |
2b5f62a0 | 140 | // the padding set by SetPadding() |
b318dc42 JS |
141 | int m_padding; |
142 | ||
db434467 RR |
143 | DECLARE_DYNAMIC_CLASS(wxNotebook) |
144 | DECLARE_EVENT_TABLE() | |
53b28675 RR |
145 | }; |
146 | ||
53b28675 | 147 | #endif |
6ca41e57 | 148 | // __GTKNOTEBOOKH__ |