]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/notebook.h
Fix wxMotif build.
[wxWidgets.git] / include / wx / generic / notebook.h
CommitLineData
1e6d9499
JS
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
af0bb3b1 8// Licence: wxWindows licence
1e6d9499
JS
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_NOTEBOOK_H_
12#define _WX_NOTEBOOK_H_
13
af49c4b8 14#if defined(__GNUG__) && !defined(__APPLE__)
1e6d9499
JS
15#pragma interface "notebook.h"
16#endif
17
18// ----------------------------------------------------------------------------
19// headers
20// ----------------------------------------------------------------------------
1e6d9499
JS
21#include "wx/event.h"
22#include "wx/control.h"
1e6d9499
JS
23
24// ----------------------------------------------------------------------------
25// types
26// ----------------------------------------------------------------------------
27
28// fwd declarations
29class WXDLLEXPORT wxImageList;
30class WXDLLEXPORT wxWindow;
00dd3b18 31class WXDLLEXPORT wxTabView;
1e6d9499 32
1e6d9499
JS
33// ----------------------------------------------------------------------------
34// wxNotebook
35// ----------------------------------------------------------------------------
36
45f22d48 37class wxNotebook : public wxNotebookBase
1e6d9499
JS
38{
39public:
40 // ctors
41 // -----
42 // default for dynamic class
43 wxNotebook();
44 // the same arguments as for wxControl (@@@ any special styles?)
45 wxNotebook(wxWindow *parent,
af0bb3b1 46 wxWindowID id,
1e6d9499
JS
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,
af0bb3b1 53 wxWindowID id,
1e6d9499
JS
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 // ---------
1e6d9499
JS
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
45f22d48 71 // void AdvanceSelection(bool bForward = TRUE);
1e6d9499
JS
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
45f22d48
JS
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 ;
1e6d9499
JS
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
1e6d9499
JS
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
ca8b28f2
JS
93 // Sets the size of the tabs (assumes all tabs are the same size)
94 void SetTabSize(const wxSize& sz);
95
1e6d9499
JS
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();
1e6d9499
JS
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);
1e6d9499
JS
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);
af0bb3b1 120
1e6d9499
JS
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
af0bb3b1 127 // Implementation
1e6d9499
JS
128
129 // wxNotebook on Motif uses a generic wxTabView to implement itself.
af0bb3b1
VZ
130 wxTabView *GetTabView() const { return m_tabView; }
131 void SetTabView(wxTabView *v) { m_tabView = v; }
132
1e6d9499
JS
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
142protected:
143 // common part of all ctors
144 void Init();
145
146 // helper functions
147 void ChangePage(int nOldSel, int nSel); // change pages
148
1e6d9499
JS
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
1e6d9499 157#endif // _WX_NOTEBOOK_H_