1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
4 // Author: Stefan Csomor
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_NOTEBOOK_H_
12 #define _WX_NOTEBOOK_H_
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
24 class WXDLLIMPEXP_FWD_CORE wxImageList
;
25 class WXDLLIMPEXP_FWD_CORE wxWindow
;
27 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
31 class WXDLLIMPEXP_CORE wxNotebook
: public wxNotebookBase
36 // default for dynamic class
38 // the same arguments as for wxControl (@@@ any special styles?)
39 wxNotebook(wxWindow
*parent
,
41 const wxPoint
& pos
= wxDefaultPosition
,
42 const wxSize
& size
= wxDefaultSize
,
44 const wxString
& name
= wxNotebookNameStr
);
46 bool Create(wxWindow
*parent
,
48 const wxPoint
& pos
= wxDefaultPosition
,
49 const wxSize
& size
= wxDefaultSize
,
51 const wxString
& name
= wxNotebookNameStr
);
53 virtual ~wxNotebook();
57 // set the currently selected page, return the index of the previously
58 // selected one (or -1 on error)
59 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
60 int SetSelection(size_t nPage
) { return DoSetSelection(nPage
, SetSelection_SendEvent
); }
61 // get the currently selected page
62 int GetSelection() const { return m_nSelection
; }
64 // changes selected page without sending events
65 int ChangeSelection(size_t nPage
) { return DoSetSelection(nPage
); }
67 // set/get the title of a page
68 bool SetPageText(size_t nPage
, const wxString
& strText
);
69 wxString
GetPageText(size_t nPage
) const;
71 // sets/returns item's image index in the current image list
72 int GetPageImage(size_t nPage
) const;
73 bool SetPageImage(size_t nPage
, int nImage
);
75 // control the appearance of the notebook pages
76 // set the size (the same for all pages)
77 virtual void SetPageSize(const wxSize
& size
);
78 // set the padding between tabs (in pixels)
79 virtual void SetPadding(const wxSize
& padding
);
80 // sets the size of the tabs (assumes all tabs are the same size)
81 virtual void SetTabSize(const wxSize
& sz
);
84 virtual int HitTest(const wxPoint
& pt
, long *flags
= NULL
) const;
86 // calculate size for wxNotebookSizer
87 wxSize
CalcSizeFromPage(const wxSize
& sizePage
) const;
88 wxRect
GetPageRect() const ;
93 bool DeleteAllPages();
94 // the same as AddPage(), but adds it at the specified position
95 bool InsertPage(size_t nPage
,
96 wxNotebookPage
*pPage
,
97 const wxString
& strText
,
103 void OnSize(wxSizeEvent
& event
);
104 void OnSelChange(wxNotebookEvent
& event
);
105 void OnSetFocus(wxFocusEvent
& event
);
106 void OnNavigationKey(wxNavigationKeyEvent
& event
);
111 #if wxUSE_CONSTRAINTS
112 virtual void SetConstraintSizes(bool recurse
= true);
113 virtual bool DoPhase(int nPhase
);
117 // base class virtuals
118 // -------------------
119 virtual void Command(wxCommandEvent
& event
);
120 virtual wxInt32
MacControlHit(WXEVENTHANDLERREF handler
, WXEVENTREF event
);
123 virtual wxNotebookPage
*DoRemovePage(size_t page
) ;
124 // common part of all ctors
128 void ChangePage(int nOldSel
, int nSel
); // change pages
131 int DoSetSelection(size_t nPage
, int flags
= 0);
136 int m_nSelection
; // the current selection (-1 if none)
138 DECLARE_DYNAMIC_CLASS(wxNotebook
)
139 DECLARE_EVENT_TABLE()
143 #endif // _WX_NOTEBOOK_H_