1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxNotebook class
4 // Author: Robert Roebling
7 // Copyright: (c) Julian Smart and Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef __GTKNOTEBOOKH__
12 #define __GTKNOTEBOOKH__
14 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 class wxGtkNotebookPage
;
25 WX_DECLARE_LIST(wxGtkNotebookPage
, wxGtkNotebookPagesList
);
27 //-----------------------------------------------------------------------------
29 //-----------------------------------------------------------------------------
31 class wxNotebook
: public wxNotebookBase
34 // default for dynamic class
36 // the same arguments as for wxControl
37 wxNotebook(wxWindow
*parent
,
39 const wxPoint
& pos
= wxDefaultPosition
,
40 const wxSize
& size
= wxDefaultSize
,
42 const wxString
& name
= wxT("notebook"));
44 bool Create(wxWindow
*parent
,
46 const wxPoint
& pos
= wxDefaultPosition
,
47 const wxSize
& size
= wxDefaultSize
,
49 const wxString
& name
= wxT("notebook"));
51 virtual ~wxNotebook();
56 // set the currently selected page, return the index of the previously
57 // selected one (or -1 on error)
58 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
59 int SetSelection(int nPage
);
60 // get the currently selected page
61 int GetSelection() const;
63 // set/get the title of a page
64 bool SetPageText(int nPage
, const wxString
& strText
);
65 wxString
GetPageText(int nPage
) const;
67 // sets/returns item's image index in the current image list
68 int GetPageImage(int nPage
) const;
69 bool SetPageImage(int nPage
, int nImage
);
71 // control the appearance of the notebook pages
72 // set the size (the same for all pages)
73 void SetPageSize(const wxSize
& size
);
74 // set the padding between tabs (in pixels)
75 void SetPadding(const wxSize
& padding
);
76 // sets the size of the tabs (assumes all tabs are the same size)
77 void SetTabSize(const wxSize
& sz
);
81 // remove one page from the notebook
82 bool DeletePage(int nPage
);
84 bool DeleteAllPages();
86 // adds a new page to the notebook (it will be deleted ny the notebook,
87 // don't delete it yourself). If bSelect, this page becomes active.
88 // the same as AddPage(), but adds it at the specified position
89 bool InsertPage( int position
,
91 const wxString
& strText
,
95 // handler for tab navigation
96 // --------------------------
97 void OnNavigationKey(wxNavigationKeyEvent
& event
);
102 #if wxUSE_CONSTRAINTS
103 void SetConstraintSizes(bool recurse
);
104 bool DoPhase(int phase
);
107 void ApplyWidgetStyle();
109 // report if window belongs to notebook
110 bool IsOwnGtkWindow( GdkWindow
*window
);
112 // common part of all ctors
116 wxGtkNotebookPage
* GetNotebookPage(int page
) const;
118 // the additional page data (the pages themselves are in m_pages array)
119 wxGtkNotebookPagesList m_pagesData
;
121 // for reasons explained in gtk/notebook.cpp we store the current
122 // selection internally instead of querying the notebook for it
125 // flag set to TRUE while we're inside "switch_page" callback
129 // remove one page from the notebook but do not destroy it
130 virtual wxNotebookPage
*DoRemovePage(int nPage
);
133 // the padding set by SetPadding()
136 DECLARE_DYNAMIC_CLASS(wxNotebook
)
137 DECLARE_EVENT_TABLE()