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