]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/notebook.h
No real changes, just make wxWindow::CanScroll() virtual.
[wxWidgets.git] / include / wx / gtk1 / notebook.h
CommitLineData
53b28675 1/////////////////////////////////////////////////////////////////////////////
8ef94bfc 2// Name: wx/gtk1/notebook.h
716b7364 3// Purpose: wxNotebook class
53b28675
RR
4// Author: Robert Roebling
5// Modified by:
b2b3ccc5 6// Copyright: (c) Julian Smart and Robert Roebling
65571936 7// Licence: wxWindows licence
53b28675
RR
8/////////////////////////////////////////////////////////////////////////////
9
6ca41e57
RR
10#ifndef __GTKNOTEBOOKH__
11#define __GTKNOTEBOOKH__
53b28675 12
80a58c99
RR
13//-----------------------------------------------------------------------------
14// internal class
15//-----------------------------------------------------------------------------
16
b5dbe15d 17class WXDLLIMPEXP_FWD_CORE wxGtkNotebookPage;
53b28675 18
07b8d7ec
VZ
19#include "wx/list.h"
20WX_DECLARE_LIST(wxGtkNotebookPage, wxGtkNotebookPagesList);
21
53b28675 22//-----------------------------------------------------------------------------
ff829f3f 23// wxNotebook
53b28675
RR
24//-----------------------------------------------------------------------------
25
20123d49 26class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase
53b28675 27{
ff829f3f 28public:
8253c7fd
RR
29 // default for dynamic class
30 wxNotebook();
31 // the same arguments as for wxControl
32 wxNotebook(wxWindow *parent,
debe6624 33 wxWindowID id,
ff829f3f
VZ
34 const wxPoint& pos = wxDefaultPosition,
35 const wxSize& size = wxDefaultSize,
debe6624 36 long style = 0,
630ad6c6 37 const wxString& name = wxNotebookNameStr);
8253c7fd
RR
38 // Create() function
39 bool Create(wxWindow *parent,
debe6624 40 wxWindowID id,
ff829f3f
VZ
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
debe6624 43 long style = 0,
630ad6c6 44 const wxString& name = wxNotebookNameStr);
8253c7fd 45 // dtor
07b8d7ec 46 virtual ~wxNotebook();
ff829f3f
VZ
47
48 // accessors
49 // ---------
ff829f3f
VZ
50
51 // set the currently selected page, return the index of the previously
7e837615 52 // selected one (or wxNOT_FOUND on error)
ff829f3f 53 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
1d6fcbcc 54 int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); }
ff829f3f 55 // get the currently selected page
1d6fcbcc
VZ
56 int GetSelection() const;
57
58 // changes selected page without sending events
59 int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); }
ff829f3f
VZ
60
61 // set/get the title of a page
15aad3b9
VZ
62 bool SetPageText(size_t nPage, const wxString& strText);
63 wxString GetPageText(size_t nPage) const;
ff829f3f 64
ff829f3f 65 // sets/returns item's image index in the current image list
15aad3b9
VZ
66 int GetPageImage(size_t nPage) const;
67 bool SetPageImage(size_t nPage, int nImage);
ff829f3f 68
ff829f3f
VZ
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);
d8f2439c 74 // sets the size of the tabs (assumes all tabs are the same size)
ca8b28f2
JS
75 void SetTabSize(const wxSize& sz);
76
279b5e2e
VZ
77 virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
78
ff829f3f
VZ
79 // operations
80 // ----------
ff829f3f
VZ
81 // remove all pages
82 bool DeleteAllPages();
1e6feb95 83
90e572f1 84 // adds a new page to the notebook (it will be deleted by the notebook,
ff829f3f 85 // don't delete it yourself). If bSelect, this page becomes active.
587ce561 86 // the same as AddPage(), but adds it at the specified position
789d0a3d 87 bool InsertPage( size_t position,
80a58c99
RR
88 wxNotebookPage *win,
89 const wxString& strText,
630ad6c6 90 bool bSelect = false,
1871b9fa 91 int imageId = NO_IMAGE );
ff829f3f 92
8253c7fd
RR
93 // handler for tab navigation
94 // --------------------------
95 void OnNavigationKey(wxNavigationKeyEvent& event);
ed58dbea 96
9d522606
RD
97
98 static wxVisualAttributes
99 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
630ad6c6 100
db434467
RR
101 // implementation
102 // --------------
d8f2439c 103
93d38175 104#if wxUSE_CONSTRAINTS
db434467
RR
105 void SetConstraintSizes(bool recurse);
106 bool DoPhase(int phase);
93d38175
VS
107#endif
108
718e35a6 109 // set all page's attributes
f40fdaa3 110 void DoApplyWidgetStyle(GtkRcStyle *style);
ff829f3f 111
1e6feb95 112 // report if window belongs to notebook
db434467 113 bool IsOwnGtkWindow( GdkWindow *window );
58d1c1ae 114
db434467
RR
115 // common part of all ctors
116 void Init();
ff829f3f 117
db434467 118 // helper function
80a58c99 119 wxGtkNotebookPage* GetNotebookPage(int page) const;
ff829f3f 120
07b8d7ec
VZ
121 // the additional page data (the pages themselves are in m_pages array)
122 wxGtkNotebookPagesList m_pagesData;
36202885
VZ
123
124 // for reasons explained in gtk/notebook.cpp we store the current
125 // selection internally instead of querying the notebook for it
07b8d7ec 126 int m_selection;
53b28675 127
630ad6c6 128 // flag set to true while we're inside "switch_page" callback
2b5f62a0
VZ
129 bool m_inSwitchPage;
130
4c51a665 131 // flag set to true when the switch-page signal has been programmatically generated
1d6fcbcc
VZ
132 bool m_skipNextPageChangeEvent;
133
1e6feb95
VZ
134protected:
135 // remove one page from the notebook but do not destroy it
15aad3b9 136 virtual wxNotebookPage *DoRemovePage(size_t nPage);
1e6feb95 137
1d6fcbcc
VZ
138 int DoSetSelection(size_t nPage, int flags = 0);
139
db434467 140private:
2b5f62a0 141 // the padding set by SetPadding()
b318dc42
JS
142 int m_padding;
143
db434467
RR
144 DECLARE_DYNAMIC_CLASS(wxNotebook)
145 DECLARE_EVENT_TABLE()
53b28675
RR
146};
147
53b28675 148#endif
6ca41e57 149 // __GTKNOTEBOOKH__