]>
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 Markus Holzem
8 // Licence: wxWindows license
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef __GTKNOTEBOOKH__
12 #define __GTKNOTEBOOKH__
19 #include "wx/object.h"
20 #include "wx/string.h"
21 #include "wx/control.h"
23 //-----------------------------------------------------------------------------
25 //-----------------------------------------------------------------------------
31 // ----------------------------------------------------------------------------
33 // ----------------------------------------------------------------------------
35 class wxNotebookEvent
: public wxCommandEvent
38 wxNotebookEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0,
39 int nSel
= -1, int nOldSel
= -1)
40 : wxCommandEvent(commandType
, id
) { m_nSel
= nSel
; m_nOldSel
= nOldSel
; }
43 int GetSelection() const { return m_nSel
; }
44 int GetOldSelection() const { return m_nOldSel
; }
47 int m_nSel
, // currently selected page
48 m_nOldSel
; // previously selected page
50 DECLARE_DYNAMIC_CLASS(wxNotebookEvent
)
53 //-----------------------------------------------------------------------------
55 //-----------------------------------------------------------------------------
57 class wxNotebook
: public wxControl
62 // default for dynamic class
64 // the same arguments as for wxControl (@@@ any special styles?)
65 wxNotebook(wxWindow
*parent
,
67 const wxPoint
& pos
= wxDefaultPosition
,
68 const wxSize
& size
= wxDefaultSize
,
70 const wxString
& name
= "notebook");
72 bool Create(wxWindow
*parent
,
74 const wxPoint
& pos
= wxDefaultPosition
,
75 const wxSize
& size
= wxDefaultSize
,
77 const wxString
& name
= "notebook");
83 // get number of pages in the dialog
84 int GetPageCount() const;
86 // set the currently selected page, return the index of the previously
87 // selected one (or -1 on error)
88 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
89 int SetSelection(int nPage
);
90 // cycle thru the tabs
91 void AdvanceSelection(bool bForward
= TRUE
);
92 // get the currently selected page
93 int GetSelection() const;
95 // set/get the title of a page
96 bool SetPageText(int nPage
, const wxString
& strText
);
97 wxString
GetPageText(int nPage
) const;
99 // image list stuff: each page may have an image associated with it. All
100 // the images belong to an image list, so you have to
101 // 1) create an image list
102 // 2) associate it with the notebook
103 // 3) set for each page it's image
104 // associate image list with a control
105 void SetImageList(wxImageList
* imageList
);
106 // get pointer (may be NULL) to the associated image list
107 wxImageList
* GetImageList() const { return m_imageList
; }
109 // sets/returns item's image index in the current image list
110 int GetPageImage(int nPage
) const;
111 bool SetPageImage(int nPage
, int nImage
);
113 // currently it's always 1 because wxGTK doesn't support multi-row
115 int GetRowCount() const;
117 // control the appearance of the notebook pages
118 // set the size (the same for all pages)
119 void SetPageSize(const wxSize
& size
);
120 // set the padding between tabs (in pixels)
121 void SetPadding(const wxSize
& padding
);
125 // remove one page from the notebook but do not destroy it
126 bool RemovePage(int nPage
);
127 // remove one page from the notebook
128 bool DeletePage(int nPage
);
130 bool DeleteAllPages();
131 // adds a new page to the notebook (it will be deleted ny the notebook,
132 // don't delete it yourself). If bSelect, this page becomes active.
133 bool AddPage(wxWindow
*pPage
,
134 const wxString
& strText
,
135 bool bSelect
= FALSE
,
137 // @@@@ VZ: I don't know how to implement InsertPage()
139 // get the panel which represents the given page
140 wxWindow
*GetPage(int nPage
) const;
145 void SetConstraintSizes(bool recurse
);
146 bool DoPhase(int phase
);
147 void ApplyWidgetStyle();
149 // common part of all ctors
153 wxNotebookPage
* GetNotebookPage(int page
) const;
155 wxImageList
* m_imageList
;
157 size_t m_idHandler
; // the change page handler id
159 DECLARE_DYNAMIC_CLASS(wxNotebook
)
162 // ----------------------------------------------------------------------------
164 // ----------------------------------------------------------------------------
165 typedef void (wxEvtHandler::*wxNotebookEventFunction
)(wxNotebookEvent
&);
167 #define EVT_NOTEBOOK_PAGE_CHANGED(id, fn) \
169 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, \
172 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
176 #define EVT_NOTEBOOK_PAGE_CHANGING(id, fn) \
178 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, \
181 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \