]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/notebook.h
Temporary fix for link error to ~wxZipOutputStream()
[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
65571936 8// Licence: wxWindows licence
1e6d9499
JS
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_NOTEBOOK_H_
12#define _WX_NOTEBOOK_H_
13
12028905 14#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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,
630ad6c6 50 const wxString& name = wxNotebookNameStr);
1e6d9499
JS
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,
630ad6c6 57 const wxString& name = wxNotebookNameStr);
1e6d9499
JS
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
15aad3b9 69 int SetSelection(size_t nPage);
1e6d9499 70 // cycle thru the tabs
ca65c044 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
15aad3b9
VZ
76 bool SetPageText(size_t nPage, const wxString& strText);
77 wxString GetPageText(size_t nPage) const;
1e6d9499 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
15aad3b9
VZ
84 int GetPageImage(size_t nPage) const;
85 bool SetPageImage(size_t nPage, int nImage);
1e6d9499 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.
15aad3b9 99 bool DeletePage(size_t nPage);
1e6d9499
JS
100 bool DeletePage(wxNotebookPage* page);
101 // remove one page from the notebook, without deleting the page.
15aad3b9 102 bool RemovePage(size_t nPage);
1e6d9499 103 bool RemovePage(wxNotebookPage* page);
64b090c7
MB
104 virtual wxWindow* DoRemovePage(size_t nPage);
105
1e6d9499
JS
106 // remove all pages
107 bool DeleteAllPages();
1e6d9499 108 // the same as AddPage(), but adds it at the specified position
15aad3b9 109 bool InsertPage(size_t nPage,
1e6d9499
JS
110 wxNotebookPage *pPage,
111 const wxString& strText,
ca65c044 112 bool bSelect = false,
1e6d9499 113 int imageId = -1);
1e6d9499
JS
114
115 // callbacks
116 // ---------
117 void OnSize(wxSizeEvent& event);
5180055b 118 void OnInternalIdle();
1e6d9499
JS
119 void OnSelChange(wxNotebookEvent& event);
120 void OnSetFocus(wxFocusEvent& event);
121 void OnNavigationKey(wxNavigationKeyEvent& event);
af0bb3b1 122
1e6d9499
JS
123 // base class virtuals
124 // -------------------
125 virtual void Command(wxCommandEvent& event);
ca65c044 126 virtual void SetConstraintSizes(bool recurse = true);
1e6d9499
JS
127 virtual bool DoPhase(int nPhase);
128
af0bb3b1 129 // Implementation
1e6d9499
JS
130
131 // wxNotebook on Motif uses a generic wxTabView to implement itself.
af0bb3b1
VZ
132 wxTabView *GetTabView() const { return m_tabView; }
133 void SetTabView(wxTabView *v) { m_tabView = v; }
134
1e6d9499
JS
135 void OnMouseEvent(wxMouseEvent& event);
136 void OnPaint(wxPaintEvent& event);
137
138 virtual wxRect GetAvailableClientSize();
139
140 // Implementation: calculate the layout of the view rect
141 // and resize the children if required
ca65c044 142 bool RefreshLayout(bool force = true);
1e6d9499
JS
143
144protected:
145 // common part of all ctors
146 void Init();
147
148 // helper functions
149 void ChangePage(int nOldSel, int nSel); // change pages
150
1e6d9499
JS
151 int m_nSelection; // the current selection (-1 if none)
152
153 wxTabView* m_tabView;
154
155 DECLARE_DYNAMIC_CLASS(wxNotebook)
156 DECLARE_EVENT_TABLE()
157};
158
1e6d9499 159#endif // _WX_NOTEBOOK_H_