1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/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 _WX_GTKNOTEBOOK_H_
11 #define _WX_GTKNOTEBOOK_H_
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 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
);
76 virtual wxSize
CalcSizeFromPage(const wxSize
& sizePage
) const;
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 // Called by GTK event handler when the current page is definitely changed.
110 void GTKOnPageChanged();
113 wxGtkNotebookPage
* GetNotebookPage(int page
) const;
115 // the additional page data (the pages themselves are in m_pages array)
116 wxGtkNotebookPagesList m_pagesData
;
118 // we need to store the old selection since there
119 // is no other way to know about it at the time
120 // of the change selection event
124 // set all page's attributes
125 virtual void DoApplyWidgetStyle(GtkRcStyle
*style
);
126 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
128 // remove one page from the notebook but do not destroy it
129 virtual wxNotebookPage
*DoRemovePage(size_t nPage
);
131 int DoSetSelection(size_t nPage
, int flags
= 0);
134 // the padding set by SetPadding()
138 virtual void AddChildGTK(wxWindowGTK
* child
);
140 DECLARE_DYNAMIC_CLASS(wxNotebook
)
141 DECLARE_EVENT_TABLE()
144 #endif // _WX_GTKNOTEBOOK_H_