]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/notebook.h
fixed: text.rc was datafile => copied to build dir
[wxWidgets.git] / include / wx / gtk1 / 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 // get pointer (may be NULL) to the associated image list
93 wxImageList *GetImageList() const { return m_imageList; }
94
95 // sets/returns item's image index in the current image list
96 int GetPageImage(int nPage) const;
97 bool SetPageImage(int nPage, int nImage);
98
99 // currently it's always 1 because wxGTK doesn't support multi-row
100 // tab controls
101 int GetRowCount() const;
102
103 // control the appearance of the notebook pages
104 // set the size (the same for all pages)
105 void SetPageSize(const wxSize& size);
106 // set the padding between tabs (in pixels)
107 void SetPadding(const wxSize& padding);
108 // sets the size of the tabs (assumes all tabs are the same size)
109 void SetTabSize(const wxSize& sz);
110
111 // operations
112 // ----------
113 // remove one page from the notebook but do not destroy it
114 bool RemovePage(int nPage);
115 // remove one page from the notebook
116 bool DeletePage(int nPage);
117 // remove all pages
118 bool DeleteAllPages();
119
120 // adds a new page to the notebook (it will be deleted ny the notebook,
121 // don't delete it yourself). If bSelect, this page becomes active.
122 bool AddPage( wxNotebookPage *win,
123 const wxString& strText,
124 bool select = FALSE,
125 int imageId = -1 );
126 // the same as AddPage(), but adds it at the specified position
127 bool InsertPage( int position,
128 wxNotebookPage *win,
129 const wxString& strText,
130 bool bSelect = FALSE,
131 int imageId = -1 );
132
133 // get the panel which represents the given page
134 wxNotebookPage *GetPage(int nPage) const;
135
136 // handler for tab navigation
137 // --------------------------
138 void OnNavigationKey(wxNavigationKeyEvent& event);
139
140 // implementation
141 // --------------
142
143 void SetConstraintSizes(bool recurse);
144 bool DoPhase(int phase);
145 void ApplyWidgetStyle();
146
147 // report if window belongs to notebook
148 bool IsOwnGtkWindow( GdkWindow *window );
149
150 // common part of all ctors
151 void Init();
152
153 // helper function
154 wxGtkNotebookPage* GetNotebookPage(int page) const;
155
156 wxImageList* m_imageList;
157 wxList m_pages;
158 int m_lastSelection; /* hack */
159
160 private:
161 DECLARE_DYNAMIC_CLASS(wxNotebook)
162 DECLARE_EVENT_TABLE()
163 };
164
165 #endif
166
167 #endif
168 // __GTKNOTEBOOKH__