]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/notebook.h
Removed overloaded DoMenuUpdates function since it duplicated
[wxWidgets.git] / include / wx / generic / notebook.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: notebook.h
3 // Purpose: wxNotebook class (a.k.a. property sheet, tabbed dialog)
4 // Author: Julian Smart
5 // Modified by:
6 // RCS-ID: $Id$
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_NOTEBOOK_H_
12 #define _WX_NOTEBOOK_H_
13
14 #if defined(__GNUG__) && !defined(__APPLE__)
15 #pragma interface "notebook.h"
16 #endif
17
18 // ----------------------------------------------------------------------------
19 // headers
20 // ----------------------------------------------------------------------------
21 #include "wx/event.h"
22 #include "wx/control.h"
23
24 // ----------------------------------------------------------------------------
25 // types
26 // ----------------------------------------------------------------------------
27
28 // fwd declarations
29 class WXDLLEXPORT wxImageList;
30 class WXDLLEXPORT wxWindow;
31 class WXDLLEXPORT wxTabView;
32
33 // ----------------------------------------------------------------------------
34 // wxNotebook
35 // ----------------------------------------------------------------------------
36
37 class wxNotebook : public wxNotebookBase
38 {
39 public:
40 // ctors
41 // -----
42 // default for dynamic class
43 wxNotebook();
44 // the same arguments as for wxControl (@@@ any special styles?)
45 wxNotebook(wxWindow *parent,
46 wxWindowID id,
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
49 long style = 0,
50 const wxString& name = "notebook");
51 // Create() function
52 bool Create(wxWindow *parent,
53 wxWindowID id,
54 const wxPoint& pos = wxDefaultPosition,
55 const wxSize& size = wxDefaultSize,
56 long style = 0,
57 const wxString& name = "notebook");
58 // dtor
59 ~wxNotebook();
60
61 // accessors
62 // ---------
63 // Find the position of the wxNotebookPage, -1 if not found.
64 int FindPagePosition(wxNotebookPage* page) const;
65
66 // set the currently selected page, return the index of the previously
67 // selected one (or -1 on error)
68 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
69 int SetSelection(int nPage);
70 // cycle thru the tabs
71 // void AdvanceSelection(bool bForward = TRUE);
72 // get the currently selected page
73 int GetSelection() const { return m_nSelection; }
74
75 // set/get the title of a page
76 bool SetPageText(int nPage, const wxString& strText);
77 wxString GetPageText(int nPage) const;
78
79 // get the number of rows for a control with wxNB_MULTILINE style (not all
80 // versions support it - they will always return 1 then)
81 virtual int GetRowCount() const ;
82
83 // sets/returns item's image index in the current image list
84 int GetPageImage(int nPage) const;
85 bool SetPageImage(int nPage, int nImage);
86
87 // control the appearance of the notebook pages
88 // set the size (the same for all pages)
89 void SetPageSize(const wxSize& size);
90 // set the padding between tabs (in pixels)
91 void SetPadding(const wxSize& padding);
92
93 // Sets the size of the tabs (assumes all tabs are the same size)
94 void SetTabSize(const wxSize& sz);
95
96 // operations
97 // ----------
98 // remove one page from the notebook, and delete the page.
99 bool DeletePage(int nPage);
100 bool DeletePage(wxNotebookPage* page);
101 // remove one page from the notebook, without deleting the page.
102 bool RemovePage(int nPage);
103 bool RemovePage(wxNotebookPage* page);
104 // remove all pages
105 bool DeleteAllPages();
106 // the same as AddPage(), but adds it at the specified position
107 bool InsertPage(int nPage,
108 wxNotebookPage *pPage,
109 const wxString& strText,
110 bool bSelect = FALSE,
111 int imageId = -1);
112
113 // callbacks
114 // ---------
115 void OnSize(wxSizeEvent& event);
116 void OnIdle(wxIdleEvent& event);
117 void OnSelChange(wxNotebookEvent& event);
118 void OnSetFocus(wxFocusEvent& event);
119 void OnNavigationKey(wxNavigationKeyEvent& event);
120
121 // base class virtuals
122 // -------------------
123 virtual void Command(wxCommandEvent& event);
124 virtual void SetConstraintSizes(bool recurse = TRUE);
125 virtual bool DoPhase(int nPhase);
126
127 // Implementation
128
129 // wxNotebook on Motif uses a generic wxTabView to implement itself.
130 wxTabView *GetTabView() const { return m_tabView; }
131 void SetTabView(wxTabView *v) { m_tabView = v; }
132
133 void OnMouseEvent(wxMouseEvent& event);
134 void OnPaint(wxPaintEvent& event);
135
136 virtual wxRect GetAvailableClientSize();
137
138 // Implementation: calculate the layout of the view rect
139 // and resize the children if required
140 bool RefreshLayout(bool force = TRUE);
141
142 protected:
143 // common part of all ctors
144 void Init();
145
146 // helper functions
147 void ChangePage(int nOldSel, int nSel); // change pages
148
149 int m_nSelection; // the current selection (-1 if none)
150
151 wxTabView* m_tabView;
152
153 DECLARE_DYNAMIC_CLASS(wxNotebook)
154 DECLARE_EVENT_TABLE()
155 };
156
157 #endif // _WX_NOTEBOOK_H_