1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/notebook.h
3 // Purpose: wxNotebook class
4 // Author: Robert Roebling
7 // Copyright: (c) Julian Smart and Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_GTKNOTEBOOK_H_
12 #define _WX_GTKNOTEBOOK_H_
14 //-----------------------------------------------------------------------------
16 //-----------------------------------------------------------------------------
18 class WXDLLIMPEXP_FWD_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 wxNOT_FOUND on error)
54 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
55 int SetSelection(size_t nPage
) { return DoSetSelection(nPage
, SetSelection_SendEvent
); }
56 // get the currently selected page
57 int GetSelection() const;
59 // changes selected page without sending events
60 int ChangeSelection(size_t nPage
) { return DoSetSelection(nPage
); }
62 // set/get the title of a page
63 bool SetPageText(size_t nPage
, const wxString
& strText
);
64 wxString
GetPageText(size_t nPage
) const;
66 // sets/returns item's image index in the current image list
67 int GetPageImage(size_t nPage
) const;
68 bool SetPageImage(size_t nPage
, int nImage
);
70 // control the appearance of the notebook pages
71 // set the size (the same for all pages)
72 void SetPageSize(const wxSize
& size
);
73 // set the padding between tabs (in pixels)
74 void SetPadding(const wxSize
& padding
);
75 // sets the size of the tabs (assumes all tabs are the same size)
76 void SetTabSize(const wxSize
& sz
);
78 virtual int HitTest(const wxPoint
& pt
, long *flags
= NULL
) const;
83 bool DeleteAllPages();
85 // adds a new page to the notebook (it will be deleted by the notebook,
86 // don't delete it yourself). If bSelect, this page becomes active.
87 // the same as AddPage(), but adds it at the specified position
88 bool InsertPage( size_t position
,
90 const wxString
& strText
,
94 // handler for tab navigation
95 // --------------------------
96 void OnNavigationKey(wxNavigationKeyEvent
& event
);
99 static wxVisualAttributes
100 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
105 #if wxUSE_CONSTRAINTS
106 void SetConstraintSizes(bool recurse
);
107 bool DoPhase(int phase
);
110 // common part of all ctors
113 // Called by GTK event handler when the current page is definitely changed.
114 void GTKOnPageChanged();
117 wxGtkNotebookPage
* GetNotebookPage(int page
) const;
119 // the additional page data (the pages themselves are in m_pages array)
120 wxGtkNotebookPagesList m_pagesData
;
122 // we need to store the old selection since there
123 // is no other way to know about it at the time
124 // of the change selection event
128 // set all page's attributes
129 virtual void DoApplyWidgetStyle(GtkRcStyle
*style
);
130 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
132 // remove one page from the notebook but do not destroy it
133 virtual wxNotebookPage
*DoRemovePage(size_t nPage
);
135 int DoSetSelection(size_t nPage
, int flags
= 0);
138 // the padding set by SetPadding()
141 virtual void AddChildGTK(wxWindowGTK
* child
);
143 DECLARE_DYNAMIC_CLASS(wxNotebook
)
144 DECLARE_EVENT_TABLE()
147 #endif // _WX_GTKNOTEBOOK_H_