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 //-----------------------------------------------------------------------------
16 //-----------------------------------------------------------------------------
18 class WXDLLIMPEXP_CORE wxGtkNotebookPage
;
21 WX_DECLARE_LIST(wxGtkNotebookPage
, wxGtkNotebookPagesList
);
23 //-----------------------------------------------------------------------------
25 //-----------------------------------------------------------------------------
27 class WXDLLIMPEXP_CORE wxNotebook
: public wxNotebookBase
30 // default for dynamic class
32 // the same arguments as for wxControl
33 wxNotebook(wxWindow
*parent
,
35 const wxPoint
& pos
= wxDefaultPosition
,
36 const wxSize
& size
= wxDefaultSize
,
38 const wxString
& name
= wxNotebookNameStr
);
40 bool Create(wxWindow
*parent
,
42 const wxPoint
& pos
= wxDefaultPosition
,
43 const wxSize
& size
= wxDefaultSize
,
45 const wxString
& name
= wxNotebookNameStr
);
47 virtual ~wxNotebook();
52 // set the currently selected page, return the index of the previously
53 // selected one (or -1 on error)
54 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
55 int SetSelection(size_t nPage
);
56 // get the currently selected page
57 int GetSelection() const;
59 // set/get the title of a page
60 bool SetPageText(size_t nPage
, const wxString
& strText
);
61 wxString
GetPageText(size_t nPage
) const;
63 // sets/returns item's image index in the current image list
64 int GetPageImage(size_t nPage
) const;
65 bool SetPageImage(size_t nPage
, int nImage
);
67 // control the appearance of the notebook pages
68 // set the size (the same for all pages)
69 void SetPageSize(const wxSize
& size
);
70 // set the padding between tabs (in pixels)
71 void SetPadding(const wxSize
& padding
);
72 // sets the size of the tabs (assumes all tabs are the same size)
73 void SetTabSize(const wxSize
& sz
);
75 virtual int HitTest(const wxPoint
& pt
, long *flags
= NULL
) const;
80 bool DeleteAllPages();
82 // adds a new page to the notebook (it will be deleted ny the notebook,
83 // don't delete it yourself). If bSelect, this page becomes active.
84 // the same as AddPage(), but adds it at the specified position
85 bool InsertPage( size_t position
,
87 const wxString
& strText
,
91 // handler for tab navigation
92 // --------------------------
93 void OnNavigationKey(wxNavigationKeyEvent
& event
);
96 static wxVisualAttributes
97 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
102 #if wxUSE_CONSTRAINTS
103 void SetConstraintSizes(bool recurse
);
104 bool DoPhase(int phase
);
107 // set all page's attributes
108 void DoApplyWidgetStyle(GtkRcStyle
*style
);
110 // report if window belongs to notebook
111 bool IsOwnGtkWindow( GdkWindow
*window
);
113 // common part of all ctors
117 wxGtkNotebookPage
* GetNotebookPage(int page
) const;
119 // the additional page data (the pages themselves are in m_pages array)
120 wxGtkNotebookPagesList m_pagesData
;
122 // for reasons explained in gtk/notebook.cpp we store the current
123 // selection internally instead of querying the notebook for it
126 // flag set to true while we're inside "switch_page" callback
130 // remove one page from the notebook but do not destroy it
131 virtual wxNotebookPage
*DoRemovePage(size_t nPage
);
134 // the padding set by SetPadding()
137 DECLARE_DYNAMIC_CLASS(wxNotebook
)
138 DECLARE_EVENT_TABLE()