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