]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/notebook.h
define WXGTK12 for GTK+ 1.2.7+ as well
[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
80a58c99
RR
18//-----------------------------------------------------------------------------
19// internal class
20//-----------------------------------------------------------------------------
21
22class wxGtkNotebookPage;
53b28675 23
53b28675 24//-----------------------------------------------------------------------------
ff829f3f 25// wxNotebook
53b28675
RR
26//-----------------------------------------------------------------------------
27
1e6feb95 28class wxNotebook : public wxNotebookBase
53b28675 29{
ff829f3f 30public:
8253c7fd
RR
31 // default for dynamic class
32 wxNotebook();
33 // the same arguments as for wxControl
34 wxNotebook(wxWindow *parent,
debe6624 35 wxWindowID id,
ff829f3f
VZ
36 const wxPoint& pos = wxDefaultPosition,
37 const wxSize& size = wxDefaultSize,
debe6624 38 long style = 0,
ff829f3f 39 const wxString& name = "notebook");
8253c7fd
RR
40 // Create() function
41 bool Create(wxWindow *parent,
debe6624 42 wxWindowID id,
ff829f3f
VZ
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize,
debe6624 45 long style = 0,
ff829f3f 46 const wxString& name = "notebook");
8253c7fd
RR
47 // dtor
48 ~wxNotebook();
ff829f3f
VZ
49
50 // accessors
51 // ---------
ff829f3f
VZ
52
53 // set the currently selected page, return the index of the previously
54 // selected one (or -1 on error)
55 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
56 int SetSelection(int nPage);
ff829f3f
VZ
57 // get the currently selected page
58 int GetSelection() const;
59
60 // set/get the title of a page
61 bool SetPageText(int nPage, const wxString& strText);
62 wxString GetPageText(int nPage) const;
63
64 // image list stuff: each page may have an image associated with it. All
65 // the images belong to an image list, so you have to
66 // 1) create an image list
67 // 2) associate it with the notebook
68 // 3) set for each page it's image
69 // associate image list with a control
70 void SetImageList(wxImageList* imageList);
b656febd 71 void AssignImageList(wxImageList* imageList);
ff829f3f
VZ
72
73 // sets/returns item's image index in the current image list
74 int GetPageImage(int nPage) const;
75 bool SetPageImage(int nPage, int nImage);
76
ff829f3f
VZ
77 // control the appearance of the notebook pages
78 // set the size (the same for all pages)
79 void SetPageSize(const wxSize& size);
80 // set the padding between tabs (in pixels)
81 void SetPadding(const wxSize& padding);
d8f2439c 82 // sets the size of the tabs (assumes all tabs are the same size)
ca8b28f2
JS
83 void SetTabSize(const wxSize& sz);
84
ff829f3f
VZ
85 // operations
86 // ----------
87 // remove one page from the notebook
88 bool DeletePage(int nPage);
89 // remove all pages
90 bool DeleteAllPages();
1e6feb95 91
ff829f3f
VZ
92 // adds a new page to the notebook (it will be deleted ny the notebook,
93 // don't delete it yourself). If bSelect, this page becomes active.
80a58c99
RR
94 bool AddPage( wxNotebookPage *win,
95 const wxString& strText,
96 bool select = FALSE,
97 int imageId = -1 );
587ce561 98 // the same as AddPage(), but adds it at the specified position
80a58c99
RR
99 bool InsertPage( int position,
100 wxNotebookPage *win,
101 const wxString& strText,
102 bool bSelect = FALSE,
103 int imageId = -1 );
ff829f3f 104
8253c7fd
RR
105 // handler for tab navigation
106 // --------------------------
107 void OnNavigationKey(wxNavigationKeyEvent& event);
ed58dbea 108
db434467
RR
109 // implementation
110 // --------------
d8f2439c 111
93d38175 112#if wxUSE_CONSTRAINTS
db434467
RR
113 void SetConstraintSizes(bool recurse);
114 bool DoPhase(int phase);
93d38175
VS
115#endif
116
db434467 117 void ApplyWidgetStyle();
ff829f3f 118
1e6feb95 119 // report if window belongs to notebook
db434467 120 bool IsOwnGtkWindow( GdkWindow *window );
58d1c1ae 121
db434467
RR
122 // common part of all ctors
123 void Init();
ff829f3f 124
db434467 125 // helper function
80a58c99 126 wxGtkNotebookPage* GetNotebookPage(int page) const;
ff829f3f 127
b656febd 128 bool m_ownsImageList;
db434467 129 wxList m_pages;
36202885
VZ
130
131 // for reasons explained in gtk/notebook.cpp we store the current
132 // selection internally instead of querying the notebook for it
133 int m_selection;
53b28675 134
1e6feb95
VZ
135protected:
136 // remove one page from the notebook but do not destroy it
137 virtual wxNotebookPage *DoRemovePage(int nPage);
138
db434467
RR
139private:
140 DECLARE_DYNAMIC_CLASS(wxNotebook)
141 DECLARE_EVENT_TABLE()
53b28675
RR
142};
143
53b28675 144#endif
6ca41e57 145 // __GTKNOTEBOOKH__