]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/notebook.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxTabCtrl class
4 // Author: Robert Roebling
7 // Copyright: (c) Julian Smart and Markus Holzem
8 // Licence: wxWindows license
9 /////////////////////////////////////////////////////////////////////////////
15 #pragma interface "notebook.h"
19 #include "wx/object.h"
20 #include "wx/string.h"
21 #include "wx/control.h"
23 //-----------------------------------------------------------------------------
25 //-----------------------------------------------------------------------------
31 // ----------------------------------------------------------------------------
33 // ----------------------------------------------------------------------------
34 class wxNotebookEvent
: public wxCommandEvent
37 wxNotebookEvent(WXTYPE commandType
= 0, int id
= 0,
38 int nSel
= -1, int nOldSel
= -1)
39 : wxCommandEvent(commandType
, id
) { m_nSel
= nSel
; m_nOldSel
= nOldSel
; }
42 int GetSelection() const { return m_nSel
; }
43 int GetOldSelection() const { return m_nOldSel
; }
46 int m_nSel
, // currently selected page
47 m_nOldSel
; // previously selected page
49 DECLARE_DYNAMIC_CLASS(wxNotebookEvent
)
52 //-----------------------------------------------------------------------------
54 //-----------------------------------------------------------------------------
56 class wxNotebook
: public wxControl
61 // default for dynamic class
63 // the same arguments as for wxControl (@@@ any special styles?)
64 wxNotebook(wxWindow
*parent
,
66 const wxPoint
& pos
= wxDefaultPosition
,
67 const wxSize
& size
= wxDefaultSize
,
69 const wxString
& name
= "notebook");
71 bool Create(wxWindow
*parent
,
73 const wxPoint
& pos
= wxDefaultPosition
,
74 const wxSize
& size
= wxDefaultSize
,
76 const wxString
& name
= "notebook");
82 // get number of pages in the dialog
83 int GetPageCount() const;
85 // set the currently selected page, return the index of the previously
86 // selected one (or -1 on error)
87 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
88 int SetSelection(int nPage
);
89 // cycle thru the tabs
90 void AdvanceSelection(bool bForward
= TRUE
);
91 // get the currently selected page
92 int GetSelection() const;
94 // set/get the title of a page
95 bool SetPageText(int nPage
, const wxString
& strText
);
96 wxString
GetPageText(int nPage
) const;
98 // image list stuff: each page may have an image associated with it. All
99 // the images belong to an image list, so you have to
100 // 1) create an image list
101 // 2) associate it with the notebook
102 // 3) set for each page it's image
103 // associate image list with a control
104 void SetImageList(wxImageList
* imageList
);
105 // get pointer (may be NULL) to the associated image list
106 wxImageList
* GetImageList() const { return m_imageList
; }
108 // sets/returns item's image index in the current image list
109 int GetPageImage(int nPage
) const;
110 bool SetPageImage(int nPage
, int nImage
);
112 // currently it's always 1 because wxGTK doesn't support multi-row
114 int GetRowCount() const;
116 // control the appearance of the notebook pages
117 // set the size (the same for all pages)
118 void SetPageSize(const wxSize
& size
);
119 // set the padding between tabs (in pixels)
120 void SetPadding(const wxSize
& padding
);
124 // remove one page from the notebook
125 bool DeletePage(int nPage
);
127 bool DeleteAllPages();
128 // adds a new page to the notebook (it will be deleted ny the notebook,
129 // don't delete it yourself). If bSelect, this page becomes active.
130 bool AddPage(wxWindow
*pPage
,
131 const wxString
& strText
,
132 bool bSelect
= FALSE
,
134 // @@@@ VZ: I don't know how to implement InsertPage()
136 // get the panel which represents the given page
137 wxWindow
*GetPage(int nPage
) const;
139 // base class virtuals
140 virtual void AddChild(wxWindow
*child
);
144 void OnSize(wxSizeEvent
& event
);
147 // common part of all ctors
151 wxNotebookPage
* GetNotebookPage(int page
) const;
153 wxImageList
* m_imageList
;
155 uint m_idHandler
; // the change page handler id
157 DECLARE_DYNAMIC_CLASS(wxNotebook
)
158 DECLARE_EVENT_TABLE()
161 // ----------------------------------------------------------------------------
163 // ----------------------------------------------------------------------------
164 typedef void (wxEvtHandler::*wxNotebookEventFunction
)(wxNotebookEvent
&);
166 #define EVT_NOTEBOOK_PAGE_CHANGED(id, fn) \
168 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, \
171 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
175 #define EVT_NOTEBOOK_PAGE_CHANGING(id, fn) \
177 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, \ \
180 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \