]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/notebook.h
Add support for auto-orientable toolbars to AUI.
[wxWidgets.git] / include / wx / gtk / notebook.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: notebook.h
3 // Purpose: wxNotebook class
4 // Author: Robert Roebling
5 // Modified by:
6 // RCS-ID: $Id$
7 // Copyright: (c) Julian Smart and Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_GTKNOTEBOOK_H_
12 #define _WX_GTKNOTEBOOK_H_
13
14 //-----------------------------------------------------------------------------
15 // internal class
16 //-----------------------------------------------------------------------------
17
18 class WXDLLIMPEXP_FWD_CORE wxGtkNotebookPage;
19
20 #include "wx/list.h"
21 WX_DECLARE_LIST(wxGtkNotebookPage, wxGtkNotebookPagesList);
22
23 //-----------------------------------------------------------------------------
24 // wxNotebook
25 //-----------------------------------------------------------------------------
26
27 class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase
28 {
29 public:
30 // default for dynamic class
31 wxNotebook();
32 // the same arguments as for wxControl
33 wxNotebook(wxWindow *parent,
34 wxWindowID id,
35 const wxPoint& pos = wxDefaultPosition,
36 const wxSize& size = wxDefaultSize,
37 long style = 0,
38 const wxString& name = wxNotebookNameStr);
39 // Create() function
40 bool Create(wxWindow *parent,
41 wxWindowID id,
42 const wxPoint& pos = wxDefaultPosition,
43 const wxSize& size = wxDefaultSize,
44 long style = 0,
45 const wxString& name = wxNotebookNameStr);
46 // dtor
47 virtual ~wxNotebook();
48
49 // accessors
50 // ---------
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
55 int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); }
56 // get the currently selected page
57 int GetSelection() const;
58
59 // changes selected page without sending events
60 int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); }
61
62 // set/get the title of a page
63 bool SetPageText(size_t nPage, const wxString& strText);
64 wxString GetPageText(size_t nPage) const;
65
66 // sets/returns item's image index in the current image list
67 int GetPageImage(size_t nPage) const;
68 bool SetPageImage(size_t nPage, int nImage);
69
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);
75 // sets the size of the tabs (assumes all tabs are the same size)
76 void SetTabSize(const wxSize& sz);
77
78 virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
79
80 // operations
81 // ----------
82 // remove all pages
83 bool DeleteAllPages();
84
85 // adds a new page to the notebook (it will be deleted by the notebook,
86 // don't delete it yourself). If bSelect, this page becomes active.
87 // the same as AddPage(), but adds it at the specified position
88 bool InsertPage( size_t position,
89 wxNotebookPage *win,
90 const wxString& strText,
91 bool bSelect = false,
92 int imageId = -1 );
93
94 // handler for tab navigation
95 // --------------------------
96 void OnNavigationKey(wxNavigationKeyEvent& event);
97
98
99 static wxVisualAttributes
100 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
101
102 // implementation
103 // --------------
104
105 #if wxUSE_CONSTRAINTS
106 void SetConstraintSizes(bool recurse);
107 bool DoPhase(int phase);
108 #endif
109
110 // common part of all ctors
111 void Init();
112
113 // helper function
114 wxGtkNotebookPage* GetNotebookPage(int page) const;
115
116 // the additional page data (the pages themselves are in m_pages array)
117 wxGtkNotebookPagesList m_pagesData;
118
119 // we need to store the old selection since there
120 // is no other way to know about it at the time
121 // of the change selection event
122 int m_oldSelection;
123
124 protected:
125 // set all page's attributes
126 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
127 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
128
129 // remove one page from the notebook but do not destroy it
130 virtual wxNotebookPage *DoRemovePage(size_t nPage);
131
132 int DoSetSelection(size_t nPage, int flags = 0);
133
134 private:
135 // the padding set by SetPadding()
136 int m_padding;
137
138 virtual void AddChildGTK(wxWindowGTK* child);
139
140 DECLARE_DYNAMIC_CLASS(wxNotebook)
141 DECLARE_EVENT_TABLE()
142 };
143
144 #endif // _WX_GTKNOTEBOOK_H_