]>
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 // get pointer (may be NULL) to the associated image list
93 wxImageList
*GetImageList() const { return m_imageList
; }
95 // sets/returns item's image index in the current image list
96 int GetPageImage(int nPage
) const;
97 bool SetPageImage(int nPage
, int nImage
);
99 // currently it's always 1 because wxGTK doesn't support multi-row
101 int GetRowCount() const;
103 // control the appearance of the notebook pages
104 // set the size (the same for all pages)
105 void SetPageSize(const wxSize
& size
);
106 // set the padding between tabs (in pixels)
107 void SetPadding(const wxSize
& padding
);
108 // sets the size of the tabs (assumes all tabs are the same size)
109 void SetTabSize(const wxSize
& sz
);
113 // remove one page from the notebook but do not destroy it
114 bool RemovePage(int nPage
);
115 // remove one page from the notebook
116 bool DeletePage(int nPage
);
118 bool DeleteAllPages();
120 // adds a new page to the notebook (it will be deleted ny the notebook,
121 // don't delete it yourself). If bSelect, this page becomes active.
122 bool AddPage( wxNotebookPage
*win
,
123 const wxString
& strText
,
126 // the same as AddPage(), but adds it at the specified position
127 bool InsertPage( int position
,
129 const wxString
& strText
,
130 bool bSelect
= FALSE
,
133 // get the panel which represents the given page
134 wxNotebookPage
*GetPage(int nPage
) const;
136 // handler for tab navigation
137 // --------------------------
138 void OnNavigationKey(wxNavigationKeyEvent
& event
);
143 void SetConstraintSizes(bool recurse
);
144 bool DoPhase(int phase
);
145 void ApplyWidgetStyle();
147 // report if window belongs to notebook
148 bool IsOwnGtkWindow( GdkWindow
*window
);
150 // common part of all ctors
154 wxGtkNotebookPage
* GetNotebookPage(int page
) const;
156 wxImageList
* m_imageList
;
158 int m_lastSelection
; /* hack */
161 DECLARE_DYNAMIC_CLASS(wxNotebook
)
162 DECLARE_EVENT_TABLE()