]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/notebook.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxNotebook class
4 // Author: Robert Roebling
7 // Copyright: (c) Julian Smart and Robert Roebling
8 // Licence: wxWindows license
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef __GTKNOTEBOOKH__
12 #define __GTKNOTEBOOKH__
22 #include "wx/object.h"
23 #include "wx/string.h"
24 #include "wx/control.h"
26 //-----------------------------------------------------------------------------
28 //-----------------------------------------------------------------------------
33 typedef wxWindow wxNotebookPage
; // so far, any window can be a page
35 //-----------------------------------------------------------------------------
37 //-----------------------------------------------------------------------------
39 class wxGtkNotebookPage
;
41 //-----------------------------------------------------------------------------
43 //-----------------------------------------------------------------------------
45 class wxNotebook
: public wxControl
48 // default for dynamic class
50 // the same arguments as for wxControl
51 wxNotebook(wxWindow
*parent
,
53 const wxPoint
& pos
= wxDefaultPosition
,
54 const wxSize
& size
= wxDefaultSize
,
56 const wxString
& name
= "notebook");
58 bool Create(wxWindow
*parent
,
60 const wxPoint
& pos
= wxDefaultPosition
,
61 const wxSize
& size
= wxDefaultSize
,
63 const wxString
& name
= "notebook");
69 // get number of pages in the dialog
70 int GetPageCount() const;
72 // set the currently selected page, return the index of the previously
73 // selected one (or -1 on error)
74 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
75 int SetSelection(int nPage
);
76 // cycle thru the tabs
77 void AdvanceSelection(bool bForward
= TRUE
);
78 // get the currently selected page
79 int GetSelection() const;
81 // set/get the title of a page
82 bool SetPageText(int nPage
, const wxString
& strText
);
83 wxString
GetPageText(int nPage
) const;
85 // image list stuff: each page may have an image associated with it. All
86 // the images belong to an image list, so you have to
87 // 1) create an image list
88 // 2) associate it with the notebook
89 // 3) set for each page it's image
90 // associate image list with a control
91 void SetImageList(wxImageList
* imageList
);
92 void AssignImageList(wxImageList
* imageList
);
93 // get pointer (may be NULL) to the associated image list
94 wxImageList
*GetImageList() const { return m_imageList
; }
96 // sets/returns item's image index in the current image list
97 int GetPageImage(int nPage
) const;
98 bool SetPageImage(int nPage
, int nImage
);
100 // currently it's always 1 because wxGTK doesn't support multi-row
102 int GetRowCount() const;
104 // control the appearance of the notebook pages
105 // set the size (the same for all pages)
106 void SetPageSize(const wxSize
& size
);
107 // set the padding between tabs (in pixels)
108 void SetPadding(const wxSize
& padding
);
109 // sets the size of the tabs (assumes all tabs are the same size)
110 void SetTabSize(const wxSize
& sz
);
114 // remove one page from the notebook but do not destroy it
115 bool RemovePage(int nPage
);
116 // remove one page from the notebook
117 bool DeletePage(int nPage
);
119 bool DeleteAllPages();
121 // adds a new page to the notebook (it will be deleted ny the notebook,
122 // don't delete it yourself). If bSelect, this page becomes active.
123 bool AddPage( wxNotebookPage
*win
,
124 const wxString
& strText
,
127 // the same as AddPage(), but adds it at the specified position
128 bool InsertPage( int position
,
130 const wxString
& strText
,
131 bool bSelect
= FALSE
,
134 // get the panel which represents the given page
135 wxNotebookPage
*GetPage(int nPage
) const;
137 // handler for tab navigation
138 // --------------------------
139 void OnNavigationKey(wxNavigationKeyEvent
& event
);
144 #if wxUSE_CONSTRAINTS
145 void SetConstraintSizes(bool recurse
);
146 bool DoPhase(int phase
);
149 void ApplyWidgetStyle();
151 // report if window belongs to notebook
152 bool IsOwnGtkWindow( GdkWindow
*window
);
154 // common part of all ctors
158 wxGtkNotebookPage
* GetNotebookPage(int page
) const;
160 wxImageList
* m_imageList
;
161 bool m_ownsImageList
;
164 // for reasons explained in gtk/notebook.cpp we store the current
165 // selection internally instead of querying the notebook for it
169 DECLARE_DYNAMIC_CLASS(wxNotebook
)
170 DECLARE_EVENT_TABLE()