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
)
45 { Create( parent
, id
, pos
, size
, style
, name
); }
47 bool Create(wxWindow
*parent
,
49 const wxPoint
& pos
= wxDefaultPosition
,
50 const wxSize
& size
= wxDefaultSize
,
52 const wxString
& name
= wxNotebookNameStr
);
54 virtual ~wxNotebook();
58 // set the currently selected page, return the index of the previously
59 // selected one (or wxNOT_FOUND on error)
60 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
61 int SetSelection(size_t nPage
) { return DoSetSelection(nPage
, SetSelection_SendEvent
); }
63 // changes selected page without sending events
64 int ChangeSelection(size_t nPage
) { return DoSetSelection(nPage
); }
66 // set/get the title of a page
67 bool SetPageText(size_t nPage
, const wxString
& strText
);
68 wxString
GetPageText(size_t nPage
) const;
70 // sets/returns item's image index in the current image list
71 int GetPageImage(size_t nPage
) const;
72 bool SetPageImage(size_t nPage
, int nImage
);
74 // control the appearance of the notebook pages
75 // set the size (the same for all pages)
76 virtual void SetPageSize(const wxSize
& size
);
77 // set the padding between tabs (in pixels)
78 virtual void SetPadding(const wxSize
& padding
);
79 // sets the size of the tabs (assumes all tabs are the same size)
80 virtual void SetTabSize(const wxSize
& sz
);
83 virtual int HitTest(const wxPoint
& pt
, long *flags
= NULL
) const;
85 // calculate size for wxNotebookSizer
86 wxSize
CalcSizeFromPage(const wxSize
& sizePage
) const;
87 wxRect
GetPageRect() const ;
92 bool DeleteAllPages();
93 // the same as AddPage(), but adds it at the specified position
94 bool InsertPage(size_t nPage
,
95 wxNotebookPage
*pPage
,
96 const wxString
& strText
,
102 void OnSize(wxSizeEvent
& event
);
103 void OnSelChange(wxBookCtrlEvent
& event
);
104 void OnSetFocus(wxFocusEvent
& event
);
105 void OnNavigationKey(wxNavigationKeyEvent
& event
);
110 #if wxUSE_CONSTRAINTS
111 virtual void SetConstraintSizes(bool recurse
= true);
112 virtual bool DoPhase(int nPhase
);
116 // base class virtuals
117 // -------------------
118 virtual void Command(wxCommandEvent
& event
);
119 // osx specific event handling common for all osx-ports
121 virtual bool OSXHandleClicked( double timestampsec
);
124 virtual wxNotebookPage
*DoRemovePage(size_t page
) ;
125 // common part of all ctors
129 void ChangePage(int nOldSel
, int nSel
); // change pages
132 int DoSetSelection(size_t nPage
, int flags
= 0);
137 DECLARE_DYNAMIC_CLASS(wxNotebook
)
138 DECLARE_EVENT_TABLE()
142 #endif // _WX_NOTEBOOK_H_