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