]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/notebook.h
Added wxWindowBase::CentreOnParent to allow top level windows to be
[wxWidgets.git] / include / wx / gtk1 / notebook.h
CommitLineData
53b28675 1/////////////////////////////////////////////////////////////////////////////
716b7364
RR
2// Name: notebook.h
3// Purpose: wxNotebook class
53b28675
RR
4// Author: Robert Roebling
5// Modified by:
6// RCS-ID: $Id$
b2b3ccc5 7// Copyright: (c) Julian Smart and Robert Roebling
ff829f3f 8// Licence: wxWindows license
53b28675
RR
9/////////////////////////////////////////////////////////////////////////////
10
6ca41e57
RR
11#ifndef __GTKNOTEBOOKH__
12#define __GTKNOTEBOOKH__
53b28675
RR
13
14#ifdef __GNUG__
6ca41e57 15#pragma interface
53b28675
RR
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
27class wxImageList;
53b28675 28class wxNotebook;
8aadf227 29class wxNotebookPage;
53b28675 30
53b28675 31//-----------------------------------------------------------------------------
ff829f3f 32// wxNotebook
53b28675
RR
33//-----------------------------------------------------------------------------
34
ff829f3f 35class wxNotebook : public wxControl
53b28675 36{
ff829f3f
VZ
37public:
38 // ctors
39 // -----
40 // default for dynamic class
41 wxNotebook();
42 // the same arguments as for wxControl (@@@ any special styles?)
43 wxNotebook(wxWindow *parent,
debe6624 44 wxWindowID id,
ff829f3f
VZ
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize,
debe6624 47 long style = 0,
ff829f3f
VZ
48 const wxString& name = "notebook");
49 // Create() function
50 bool Create(wxWindow *parent,
debe6624 51 wxWindowID id,
ff829f3f
VZ
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
debe6624 54 long style = 0,
ff829f3f
VZ
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
d8f2439c 85 wxImageList *GetImageList() const { return m_imageList; }
ff829f3f
VZ
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);
d8f2439c 100 // sets the size of the tabs (assumes all tabs are the same size)
ca8b28f2
JS
101 void SetTabSize(const wxSize& sz);
102
ff829f3f
VZ
103 // operations
104 // ----------
fed46e72
RR
105 // remove one page from the notebook but do not destroy it
106 bool RemovePage(int nPage);
ff829f3f
VZ
107 // remove one page from the notebook
108 bool DeletePage(int nPage);
109 // remove all pages
110 bool DeleteAllPages();
587ce561 111
ff829f3f
VZ
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.
587ce561
RR
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 );
ff829f3f
VZ
124
125 // get the panel which represents the given page
126 wxWindow *GetPage(int nPage) const;
127
b98d804b 128 void OnNavigationKey(wxNavigationKeyEvent& event);
d8f2439c 129
5a8c929e 130 // implementation
d8f2439c 131
58614078
RR
132 void SetConstraintSizes(bool recurse);
133 bool DoPhase(int phase);
134 void ApplyWidgetStyle();
ff829f3f 135
58d1c1ae
RR
136 // report if window belongs to notebook
137 bool IsOwnGtkWindow( GdkWindow *window );
138
ff829f3f
VZ
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;
29f538ce 147 int m_lastSelection; /* hack */
53b28675 148
ff829f3f 149 DECLARE_DYNAMIC_CLASS(wxNotebook)
b98d804b 150 DECLARE_EVENT_TABLE()
53b28675
RR
151};
152
53b28675 153#endif
6ca41e57 154 // __GTKNOTEBOOKH__