1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/notebook.h
3 // Purpose: wxNotebook class (a.k.a. property sheet, tabbed dialog)
4 // Author: Julian Smart
6 // Copyright: (c) Julian Smart
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_NOTEBOOK_H_
11 #define _WX_NOTEBOOK_H_
13 // ----------------------------------------------------------------------------
15 // ----------------------------------------------------------------------------
17 #include "wx/control.h"
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
24 class WXDLLIMPEXP_FWD_CORE wxImageList
;
25 class WXDLLIMPEXP_FWD_CORE wxWindow
;
26 class WXDLLIMPEXP_FWD_CORE wxTabView
;
28 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
32 class WXDLLIMPEXP_CORE wxNotebook
: public wxNotebookBase
37 // default for dynamic class
39 // the same arguments as for wxControl (@@@ any special styles?)
40 wxNotebook(wxWindow
*parent
,
42 const wxPoint
& pos
= wxDefaultPosition
,
43 const wxSize
& size
= wxDefaultSize
,
45 const wxString
& name
= wxNotebookNameStr
);
47 bool Create(wxWindow
*parent
,
49 const wxPoint
& pos
= wxDefaultPosition
,
50 const wxSize
& size
= wxDefaultSize
,
52 const wxString
& name
= wxNotebookNameStr
);
54 virtual ~wxNotebook();
58 // Find the position of the wxNotebookPage, wxNOT_FOUND if not found.
59 int FindPagePosition(wxNotebookPage
* page
) const;
61 // set the currently selected page, return the index of the previously
62 // selected one (or wxNOT_FOUND on error)
63 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
64 int SetSelection(size_t nPage
);
65 // cycle thru the tabs
66 // void AdvanceSelection(bool bForward = true);
68 // changes selected page without sending events
69 int ChangeSelection(size_t nPage
);
71 // set/get the title of a page
72 bool SetPageText(size_t nPage
, const wxString
& strText
);
73 wxString
GetPageText(size_t nPage
) const;
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 ;
79 // sets/returns item's image index in the current image list
80 int GetPageImage(size_t nPage
) const;
81 bool SetPageImage(size_t nPage
, int nImage
);
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
);
89 // Sets the size of the tabs (assumes all tabs are the same size)
90 void SetTabSize(const wxSize
& sz
);
94 // remove one page from the notebook, and delete the page.
95 bool DeletePage(size_t nPage
);
96 bool DeletePage(wxNotebookPage
* page
);
97 // remove one page from the notebook, without deleting the page.
98 bool RemovePage(size_t nPage
);
99 bool RemovePage(wxNotebookPage
* page
);
100 virtual wxWindow
* DoRemovePage(size_t nPage
);
103 bool DeleteAllPages();
104 // the same as AddPage(), but adds it at the specified position
105 bool InsertPage(size_t nPage
,
106 wxNotebookPage
*pPage
,
107 const wxString
& strText
,
108 bool bSelect
= false,
109 int imageId
= NO_IMAGE
);
113 void OnSize(wxSizeEvent
& event
);
114 void OnInternalIdle();
115 void OnSelChange(wxBookCtrlEvent
& event
);
116 void OnSetFocus(wxFocusEvent
& event
);
117 void OnNavigationKey(wxNavigationKeyEvent
& event
);
119 // base class virtuals
120 // -------------------
121 virtual void Command(wxCommandEvent
& event
);
122 virtual void SetConstraintSizes(bool recurse
= true);
123 virtual bool DoPhase(int nPhase
);
125 virtual wxSize
CalcSizeFromPage(const wxSize
& sizePage
) const;
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
; }
133 void OnMouseEvent(wxMouseEvent
& event
);
134 void OnPaint(wxPaintEvent
& event
);
136 virtual wxRect
GetAvailableClientSize();
138 // Implementation: calculate the layout of the view rect
139 // and resize the children if required
140 bool RefreshLayout(bool force
= true);
143 // common part of all ctors
147 void ChangePage(int nOldSel
, int nSel
); // change pages
149 wxTabView
* m_tabView
;
151 DECLARE_DYNAMIC_CLASS(wxNotebook
)
152 DECLARE_EVENT_TABLE()
155 #endif // _WX_NOTEBOOK_H_