]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/notebook.h
derived new setup.h include from wxMSW after wxUniv merge
[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 //-----------------------------------------------------------------------------
19 // internal class
20 //-----------------------------------------------------------------------------
21
22 class wxGtkNotebookPage;
23
24 //-----------------------------------------------------------------------------
25 // wxNotebook
26 //-----------------------------------------------------------------------------
27
28 class wxNotebook : public wxNotebookBase
29 {
30 public:
31 // default for dynamic class
32 wxNotebook();
33 // the same arguments as for wxControl
34 wxNotebook(wxWindow *parent,
35 wxWindowID id,
36 const wxPoint& pos = wxDefaultPosition,
37 const wxSize& size = wxDefaultSize,
38 long style = 0,
39 const wxString& name = "notebook");
40 // Create() function
41 bool Create(wxWindow *parent,
42 wxWindowID id,
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize,
45 long style = 0,
46 const wxString& name = "notebook");
47 // dtor
48 ~wxNotebook();
49
50 // accessors
51 // ---------
52
53 // set the currently selected page, return the index of the previously
54 // selected one (or -1 on error)
55 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
56 int SetSelection(int nPage);
57 // get the currently selected page
58 int GetSelection() const;
59
60 // set/get the title of a page
61 bool SetPageText(int nPage, const wxString& strText);
62 wxString GetPageText(int nPage) const;
63
64 // image list stuff: each page may have an image associated with it. All
65 // the images belong to an image list, so you have to
66 // 1) create an image list
67 // 2) associate it with the notebook
68 // 3) set for each page it's image
69 // associate image list with a control
70 void SetImageList(wxImageList* imageList);
71 void AssignImageList(wxImageList* imageList);
72
73 // sets/returns item's image index in the current image list
74 int GetPageImage(int nPage) const;
75 bool SetPageImage(int nPage, int nImage);
76
77 // control the appearance of the notebook pages
78 // set the size (the same for all pages)
79 void SetPageSize(const wxSize& size);
80 // set the padding between tabs (in pixels)
81 void SetPadding(const wxSize& padding);
82 // sets the size of the tabs (assumes all tabs are the same size)
83 void SetTabSize(const wxSize& sz);
84
85 // operations
86 // ----------
87 // remove one page from the notebook
88 bool DeletePage(int nPage);
89 // remove all pages
90 bool DeleteAllPages();
91
92 // adds a new page to the notebook (it will be deleted ny the notebook,
93 // don't delete it yourself). If bSelect, this page becomes active.
94 bool AddPage( wxNotebookPage *win,
95 const wxString& strText,
96 bool select = FALSE,
97 int imageId = -1 );
98 // the same as AddPage(), but adds it at the specified position
99 bool InsertPage( int position,
100 wxNotebookPage *win,
101 const wxString& strText,
102 bool bSelect = FALSE,
103 int imageId = -1 );
104
105 // handler for tab navigation
106 // --------------------------
107 void OnNavigationKey(wxNavigationKeyEvent& event);
108
109 // implementation
110 // --------------
111
112 #if wxUSE_CONSTRAINTS
113 void SetConstraintSizes(bool recurse);
114 bool DoPhase(int phase);
115 #endif
116
117 void ApplyWidgetStyle();
118
119 // report if window belongs to notebook
120 bool IsOwnGtkWindow( GdkWindow *window );
121
122 // common part of all ctors
123 void Init();
124
125 // helper function
126 wxGtkNotebookPage* GetNotebookPage(int page) const;
127
128 bool m_ownsImageList;
129 wxList m_pages;
130
131 // for reasons explained in gtk/notebook.cpp we store the current
132 // selection internally instead of querying the notebook for it
133 int m_selection;
134
135 protected:
136 // remove one page from the notebook but do not destroy it
137 virtual wxNotebookPage *DoRemovePage(int nPage);
138
139 private:
140 DECLARE_DYNAMIC_CLASS(wxNotebook)
141 DECLARE_EVENT_TABLE()
142 };
143
144 #endif
145 // __GTKNOTEBOOKH__