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 WXDLLEXPORT wxImageList
;
25 class WXDLLEXPORT wxWindow
;
27 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
31 class 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
);
61 // get the currently selected page
62 int GetSelection() const { return m_nSelection
; }
64 // set/get the title of a page
65 bool SetPageText(size_t nPage
, const wxString
& strText
);
66 wxString
GetPageText(size_t nPage
) const;
68 // sets/returns item's image index in the current image list
69 int GetPageImage(size_t nPage
) const;
70 bool SetPageImage(size_t nPage
, int nImage
);
72 // control the appearance of the notebook pages
73 // set the size (the same for all pages)
74 virtual void SetPageSize(const wxSize
& size
);
75 // set the padding between tabs (in pixels)
76 virtual void SetPadding(const wxSize
& padding
);
77 // sets the size of the tabs (assumes all tabs are the same size)
78 virtual void SetTabSize(const wxSize
& sz
);
81 virtual int HitTest(const wxPoint
& pt
, long *flags
= NULL
) const;
83 // calculate size for wxNotebookSizer
84 wxSize
CalcSizeFromPage(const wxSize
& sizePage
) const;
85 wxRect
GetPageRect() const ;
90 bool DeleteAllPages();
91 // the same as AddPage(), but adds it at the specified position
92 bool InsertPage(size_t nPage
,
93 wxNotebookPage
*pPage
,
94 const wxString
& strText
,
100 void OnSize(wxSizeEvent
& event
);
101 void OnSelChange(wxNotebookEvent
& event
);
102 void OnSetFocus(wxFocusEvent
& event
);
103 void OnNavigationKey(wxNavigationKeyEvent
& event
);
108 #if wxUSE_CONSTRAINTS
109 virtual void SetConstraintSizes(bool recurse
= true);
110 virtual bool DoPhase(int nPhase
);
114 // base class virtuals
115 // -------------------
116 virtual void Command(wxCommandEvent
& event
);
117 virtual wxInt32
MacControlHit(WXEVENTHANDLERREF handler
, WXEVENTREF event
);
120 virtual wxNotebookPage
*DoRemovePage(size_t page
) ;
121 // common part of all ctors
125 void ChangePage(int nOldSel
, int nSel
); // change pages
131 int m_nSelection
; // the current selection (-1 if none)
133 DECLARE_DYNAMIC_CLASS(wxNotebook
)
134 DECLARE_EVENT_TABLE()
138 #endif // _WX_NOTEBOOK_H_