1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/notebook.h
3 // Purpose: wxNotebook class
4 // Author: Robert Roebling
6 // Copyright: (c) Julian Smart and Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef __GTKNOTEBOOKH__
11 #define __GTKNOTEBOOKH__
13 //-----------------------------------------------------------------------------
15 //-----------------------------------------------------------------------------
17 class WXDLLIMPEXP_FWD_CORE wxGtkNotebookPage
;
20 WX_DECLARE_LIST(wxGtkNotebookPage
, wxGtkNotebookPagesList
);
22 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
26 class WXDLLIMPEXP_CORE wxNotebook
: public wxNotebookBase
29 // default for dynamic class
31 // the same arguments as for wxControl
32 wxNotebook(wxWindow
*parent
,
34 const wxPoint
& pos
= wxDefaultPosition
,
35 const wxSize
& size
= wxDefaultSize
,
37 const wxString
& name
= wxNotebookNameStr
);
39 bool Create(wxWindow
*parent
,
41 const wxPoint
& pos
= wxDefaultPosition
,
42 const wxSize
& size
= wxDefaultSize
,
44 const wxString
& name
= wxNotebookNameStr
);
46 virtual ~wxNotebook();
51 // set the currently selected page, return the index of the previously
52 // selected one (or wxNOT_FOUND on error)
53 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
54 int SetSelection(size_t nPage
) { return DoSetSelection(nPage
, SetSelection_SendEvent
); }
55 // get the currently selected page
56 int GetSelection() const;
58 // changes selected page without sending events
59 int ChangeSelection(size_t nPage
) { return DoSetSelection(nPage
); }
61 // set/get the title of a page
62 bool SetPageText(size_t nPage
, const wxString
& strText
);
63 wxString
GetPageText(size_t nPage
) const;
65 // sets/returns item's image index in the current image list
66 int GetPageImage(size_t nPage
) const;
67 bool SetPageImage(size_t nPage
, int nImage
);
69 // control the appearance of the notebook pages
70 // set the size (the same for all pages)
71 void SetPageSize(const wxSize
& size
);
72 // set the padding between tabs (in pixels)
73 void SetPadding(const wxSize
& padding
);
74 // sets the size of the tabs (assumes all tabs are the same size)
75 void SetTabSize(const wxSize
& sz
);
77 virtual int HitTest(const wxPoint
& pt
, long *flags
= NULL
) const;
82 bool DeleteAllPages();
84 // adds a new page to the notebook (it will be deleted by the notebook,
85 // don't delete it yourself). If bSelect, this page becomes active.
86 // the same as AddPage(), but adds it at the specified position
87 bool InsertPage( size_t position
,
89 const wxString
& strText
,
91 int imageId
= NO_IMAGE
);
93 // handler for tab navigation
94 // --------------------------
95 void OnNavigationKey(wxNavigationKeyEvent
& event
);
98 static wxVisualAttributes
99 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
104 #if wxUSE_CONSTRAINTS
105 void SetConstraintSizes(bool recurse
);
106 bool DoPhase(int phase
);
109 // set all page's attributes
110 void DoApplyWidgetStyle(GtkRcStyle
*style
);
112 // report if window belongs to notebook
113 bool IsOwnGtkWindow( GdkWindow
*window
);
115 // common part of all ctors
119 wxGtkNotebookPage
* GetNotebookPage(int page
) const;
121 // the additional page data (the pages themselves are in m_pages array)
122 wxGtkNotebookPagesList m_pagesData
;
124 // for reasons explained in gtk/notebook.cpp we store the current
125 // selection internally instead of querying the notebook for it
128 // flag set to true while we're inside "switch_page" callback
131 // flag set to true when the switch-page signal has been programmatically generated
132 bool m_skipNextPageChangeEvent
;
135 // remove one page from the notebook but do not destroy it
136 virtual wxNotebookPage
*DoRemovePage(size_t nPage
);
138 int DoSetSelection(size_t nPage
, int flags
= 0);
141 // the padding set by SetPadding()
144 DECLARE_DYNAMIC_CLASS(wxNotebook
)
145 DECLARE_EVENT_TABLE()