1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxChoicebook: wxChoice and wxNotebook combination
4 // Author: Vadim Zeitlin
5 // Modified by: Wlodzimierz ABX Skiba from wx/listbook.h
8 // Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CHOICEBOOK_H_
13 #define _WX_CHOICEBOOK_H_
19 #include "wx/bookctrl.h"
21 class WXDLLEXPORT wxChoice
;
23 // ----------------------------------------------------------------------------
25 // ----------------------------------------------------------------------------
27 class WXDLLEXPORT wxChoicebook
: public wxBookCtrlBase
35 wxChoicebook(wxWindow
*parent
,
37 const wxPoint
& pos
= wxDefaultPosition
,
38 const wxSize
& size
= wxDefaultSize
,
40 const wxString
& name
= wxEmptyString
)
44 (void)Create(parent
, id
, pos
, size
, style
, name
);
48 bool Create(wxWindow
*parent
,
50 const wxPoint
& pos
= wxDefaultPosition
,
51 const wxSize
& size
= wxDefaultSize
,
53 const wxString
& name
= wxEmptyString
);
56 virtual int GetSelection() const;
57 virtual bool SetPageText(size_t n
, const wxString
& strText
);
58 virtual wxString
GetPageText(size_t n
) const;
59 virtual int GetPageImage(size_t n
) const;
60 virtual bool SetPageImage(size_t n
, int imageId
);
61 virtual wxSize
CalcSizeFromPage(const wxSize
& sizePage
) const;
62 virtual bool InsertPage(size_t n
,
67 virtual int SetSelection(size_t n
);
68 virtual void SetImageList(wxImageList
*imageList
);
70 virtual bool DeleteAllPages();
72 // returns the choice control
73 wxChoice
* GetChoiceCtrl() const { return (wxChoice
*)m_bookctrl
; }
76 virtual wxWindow
*DoRemovePage(size_t page
);
78 // get the size which the choice control should have
79 virtual wxSize
GetControllerSize() const;
82 void OnChoiceSelected(wxCommandEvent
& event
);
84 // the currently selected page or wxNOT_FOUND if none
88 // common part of all constructors
92 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook
)
95 // ----------------------------------------------------------------------------
96 // choicebook event class and related stuff
97 // ----------------------------------------------------------------------------
99 class WXDLLEXPORT wxChoicebookEvent
: public wxBookCtrlBaseEvent
102 wxChoicebookEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0,
103 int nSel
= -1, int nOldSel
= -1)
104 : wxBookCtrlBaseEvent(commandType
, id
, nSel
, nOldSel
)
108 wxChoicebookEvent(const wxChoicebookEvent
& event
)
109 : wxBookCtrlBaseEvent(event
)
113 virtual wxEvent
*Clone() const { return new wxChoicebookEvent(*this); }
116 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChoicebookEvent
)
119 extern WXDLLIMPEXP_CORE
const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED
;
120 extern WXDLLIMPEXP_CORE
const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING
;
122 typedef void (wxEvtHandler::*wxChoicebookEventFunction
)(wxChoicebookEvent
&);
124 #define wxChoicebookEventHandler(func) \
125 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChoicebookEventFunction, &func)
127 #define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \
128 wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxChoicebookEventHandler(fn))
130 #define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \
131 wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxChoicebookEventHandler(fn))
133 #endif // wxUSE_CHOICEBOOK
135 #endif // _WX_CHOICEBOOK_H_