]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/notebook.h
dynamic event types actually work with these changes, also corrected more
[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 license
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef __GTKNOTEBOOKH__
12 #define __GTKNOTEBOOKH__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "wx/defs.h"
19
20 #if wxUSE_NOTEBOOK
21
22 #include "wx/object.h"
23 #include "wx/string.h"
24 #include "wx/control.h"
25
26 //-----------------------------------------------------------------------------
27 // classes
28 //-----------------------------------------------------------------------------
29
30 class wxImageList;
31 class wxNotebook;
32
33 typedef wxWindow wxNotebookPage; // so far, any window can be a page
34
35 //-----------------------------------------------------------------------------
36 // internal class
37 //-----------------------------------------------------------------------------
38
39 class wxGtkNotebookPage;
40
41 //-----------------------------------------------------------------------------
42 // wxNotebook
43 //-----------------------------------------------------------------------------
44
45 class wxNotebook : public wxControl
46 {
47 public:
48 // default for dynamic class
49 wxNotebook();
50 // the same arguments as for wxControl
51 wxNotebook(wxWindow *parent,
52 wxWindowID id,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 long style = 0,
56 const wxString& name = "notebook");
57 // Create() function
58 bool Create(wxWindow *parent,
59 wxWindowID id,
60 const wxPoint& pos = wxDefaultPosition,
61 const wxSize& size = wxDefaultSize,
62 long style = 0,
63 const wxString& name = "notebook");
64 // dtor
65 ~wxNotebook();
66
67 // accessors
68 // ---------
69 // get number of pages in the dialog
70 int GetPageCount() const;
71
72 // set the currently selected page, return the index of the previously
73 // selected one (or -1 on error)
74 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
75 int SetSelection(int nPage);
76 // cycle thru the tabs
77 void AdvanceSelection(bool bForward = TRUE);
78 // get the currently selected page
79 int GetSelection() const;
80
81 // set/get the title of a page
82 bool SetPageText(int nPage, const wxString& strText);
83 wxString GetPageText(int nPage) const;
84
85 // image list stuff: each page may have an image associated with it. All
86 // the images belong to an image list, so you have to
87 // 1) create an image list
88 // 2) associate it with the notebook
89 // 3) set for each page it's image
90 // associate image list with a control
91 void SetImageList(wxImageList* imageList);
92 void AssignImageList(wxImageList* imageList);
93 // get pointer (may be NULL) to the associated image list
94 wxImageList *GetImageList() const { return m_imageList; }
95
96 // sets/returns item's image index in the current image list
97 int GetPageImage(int nPage) const;
98 bool SetPageImage(int nPage, int nImage);
99
100 // currently it's always 1 because wxGTK doesn't support multi-row
101 // tab controls
102 int GetRowCount() const;
103
104 // control the appearance of the notebook pages
105 // set the size (the same for all pages)
106 void SetPageSize(const wxSize& size);
107 // set the padding between tabs (in pixels)
108 void SetPadding(const wxSize& padding);
109 // sets the size of the tabs (assumes all tabs are the same size)
110 void SetTabSize(const wxSize& sz);
111
112 // operations
113 // ----------
114 // remove one page from the notebook but do not destroy it
115 bool RemovePage(int nPage);
116 // remove one page from the notebook
117 bool DeletePage(int nPage);
118 // remove all pages
119 bool DeleteAllPages();
120
121 // adds a new page to the notebook (it will be deleted ny the notebook,
122 // don't delete it yourself). If bSelect, this page becomes active.
123 bool AddPage( wxNotebookPage *win,
124 const wxString& strText,
125 bool select = FALSE,
126 int imageId = -1 );
127 // the same as AddPage(), but adds it at the specified position
128 bool InsertPage( int position,
129 wxNotebookPage *win,
130 const wxString& strText,
131 bool bSelect = FALSE,
132 int imageId = -1 );
133
134 // get the panel which represents the given page
135 wxNotebookPage *GetPage(int nPage) const;
136
137 // handler for tab navigation
138 // --------------------------
139 void OnNavigationKey(wxNavigationKeyEvent& event);
140
141 // implementation
142 // --------------
143
144 #if wxUSE_CONSTRAINTS
145 void SetConstraintSizes(bool recurse);
146 bool DoPhase(int phase);
147 #endif
148
149 void ApplyWidgetStyle();
150
151 // report if window belongs to notebook
152 bool IsOwnGtkWindow( GdkWindow *window );
153
154 // common part of all ctors
155 void Init();
156
157 // helper function
158 wxGtkNotebookPage* GetNotebookPage(int page) const;
159
160 wxImageList* m_imageList;
161 bool m_ownsImageList;
162 wxList m_pages;
163 int m_lastSelection; /* hack */
164
165 private:
166 DECLARE_DYNAMIC_CLASS(wxNotebook)
167 DECLARE_EVENT_TABLE()
168 };
169
170 #endif
171
172 #endif
173 // __GTKNOTEBOOKH__