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