]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/notebook.h
*** empty log message ***
[wxWidgets.git] / include / wx / gtk1 / notebook.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: notebook.h
3 // Purpose: wxNotebook class
4 // Author: Robert Roebling
5 // Modified by:
6 // RCS-ID: $Id$
7 // Copyright: (c) Julian Smart and Robert Roebling
8 // Licence: wxWindows license
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef __GTKNOTEBOOKH__
12 #define __GTKNOTEBOOKH__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "wx/defs.h"
19
20 #if wxUSE_NOTEBOOK
21
22 #include "wx/object.h"
23 #include "wx/string.h"
24 #include "wx/control.h"
25
26 //-----------------------------------------------------------------------------
27 // classes
28 //-----------------------------------------------------------------------------
29
30 class wxImageList;
31 class wxNotebook;
32 class wxNotebookPage;
33
34 //-----------------------------------------------------------------------------
35 // wxNotebook
36 //-----------------------------------------------------------------------------
37
38 class wxNotebook : public wxControl
39 {
40 public:
41 // ctors
42 // -----
43 // default for dynamic class
44 wxNotebook();
45 // the same arguments as for wxControl (@@@ any special styles?)
46 wxNotebook(wxWindow *parent,
47 wxWindowID id,
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 long style = 0,
51 const wxString& name = "notebook");
52 // Create() function
53 bool Create(wxWindow *parent,
54 wxWindowID id,
55 const wxPoint& pos = wxDefaultPosition,
56 const wxSize& size = wxDefaultSize,
57 long style = 0,
58 const wxString& name = "notebook");
59 // dtor
60 ~wxNotebook();
61
62 // accessors
63 // ---------
64 // get number of pages in the dialog
65 int GetPageCount() const;
66
67 // set the currently selected page, return the index of the previously
68 // selected one (or -1 on error)
69 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
70 int SetSelection(int nPage);
71 // cycle thru the tabs
72 void AdvanceSelection(bool bForward = TRUE);
73 // get the currently selected page
74 int GetSelection() const;
75
76 // set/get the title of a page
77 bool SetPageText(int nPage, const wxString& strText);
78 wxString GetPageText(int nPage) const;
79
80 // image list stuff: each page may have an image associated with it. All
81 // the images belong to an image list, so you have to
82 // 1) create an image list
83 // 2) associate it with the notebook
84 // 3) set for each page it's image
85 // associate image list with a control
86 void SetImageList(wxImageList* imageList);
87 // get pointer (may be NULL) to the associated image list
88 wxImageList *GetImageList() const { return m_imageList; }
89
90 // sets/returns item's image index in the current image list
91 int GetPageImage(int nPage) const;
92 bool SetPageImage(int nPage, int nImage);
93
94 // currently it's always 1 because wxGTK doesn't support multi-row
95 // tab controls
96 int GetRowCount() const;
97
98 // control the appearance of the notebook pages
99 // set the size (the same for all pages)
100 void SetPageSize(const wxSize& size);
101 // set the padding between tabs (in pixels)
102 void SetPadding(const wxSize& padding);
103 // sets the size of the tabs (assumes all tabs are the same size)
104 void SetTabSize(const wxSize& sz);
105
106 // operations
107 // ----------
108 // remove one page from the notebook but do not destroy it
109 bool RemovePage(int nPage);
110 // remove one page from the notebook
111 bool DeletePage(int nPage);
112 // remove all pages
113 bool DeleteAllPages();
114
115 // adds a new page to the notebook (it will be deleted ny the notebook,
116 // don't delete it yourself). If bSelect, this page becomes active.
117 bool AddPage( wxWindow *win,
118 const wxString& strText,
119 bool select = FALSE,
120 int imageId = -1 );
121 // the same as AddPage(), but adds it at the specified position
122 bool InsertPage( int position,
123 wxWindow *win,
124 const wxString& strText,
125 bool bSelect = FALSE,
126 int imageId = -1 );
127
128 // get the panel which represents the given page
129 wxWindow *GetPage(int nPage) const;
130
131 void OnNavigationKey(wxNavigationKeyEvent& event);
132
133 // implementation
134
135 void SetConstraintSizes(bool recurse);
136 bool DoPhase(int phase);
137 void ApplyWidgetStyle();
138
139 // report if window belongs to notebook
140 bool IsOwnGtkWindow( GdkWindow *window );
141
142 // common part of all ctors
143 void Init();
144
145 // helper function
146 wxNotebookPage* GetNotebookPage(int page) const;
147
148 wxImageList* m_imageList;
149 wxList m_pages;
150 int m_lastSelection; /* hack */
151
152 DECLARE_DYNAMIC_CLASS(wxNotebook)
153 DECLARE_EVENT_TABLE()
154 };
155
156 #endif
157
158 #endif
159 // __GTKNOTEBOOKH__