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"
20 #include "wx/choice.h"
22 class WXDLLIMPEXP_FWD_CORE wxChoice
;
24 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE
, wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED
, wxBookCtrlEvent
);
25 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE
, wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING
, wxBookCtrlEvent
);
28 #define wxCHB_DEFAULT wxBK_DEFAULT
29 #define wxCHB_TOP wxBK_TOP
30 #define wxCHB_BOTTOM wxBK_BOTTOM
31 #define wxCHB_LEFT wxBK_LEFT
32 #define wxCHB_RIGHT wxBK_RIGHT
33 #define wxCHB_ALIGN_MASK wxBK_ALIGN_MASK
35 // ----------------------------------------------------------------------------
37 // ----------------------------------------------------------------------------
39 class WXDLLIMPEXP_CORE wxChoicebook
: public wxBookCtrlBase
44 wxChoicebook(wxWindow
*parent
,
46 const wxPoint
& pos
= wxDefaultPosition
,
47 const wxSize
& size
= wxDefaultSize
,
49 const wxString
& name
= wxEmptyString
)
51 (void)Create(parent
, id
, pos
, size
, style
, name
);
55 bool Create(wxWindow
*parent
,
57 const wxPoint
& pos
= wxDefaultPosition
,
58 const wxSize
& size
= wxDefaultSize
,
60 const wxString
& name
= wxEmptyString
);
63 virtual bool SetPageText(size_t n
, const wxString
& strText
);
64 virtual wxString
GetPageText(size_t n
) const;
65 virtual int GetPageImage(size_t n
) const;
66 virtual bool SetPageImage(size_t n
, int imageId
);
67 virtual bool InsertPage(size_t n
,
72 virtual int SetSelection(size_t n
)
73 { return DoSetSelection(n
, SetSelection_SendEvent
); }
74 virtual int ChangeSelection(size_t n
) { return DoSetSelection(n
); }
75 virtual void SetImageList(wxImageList
*imageList
);
77 virtual bool DeleteAllPages();
79 // returns the choice control
80 wxChoice
* GetChoiceCtrl() const { return (wxChoice
*)m_bookctrl
; }
82 // Override this to return true because the part of parent window
83 // background between our controlling wxChoice and the page area should
85 virtual bool HasTransparentBackground() { return true; }
88 virtual void DoSetWindowVariant(wxWindowVariant variant
);
90 virtual wxWindow
*DoRemovePage(size_t page
);
92 void UpdateSelectedPage(size_t newsel
)
94 m_selection
= static_cast<int>(newsel
);
95 GetChoiceCtrl()->Select(m_selection
);
98 wxBookCtrlEvent
* CreatePageChangingEvent() const;
99 void MakeChangedEvent(wxBookCtrlEvent
&event
);
102 void OnChoiceSelected(wxCommandEvent
& event
);
105 DECLARE_EVENT_TABLE()
106 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook
)
109 // ----------------------------------------------------------------------------
110 // choicebook event class and related stuff
111 // ----------------------------------------------------------------------------
113 // wxChoicebookEvent is obsolete and defined for compatibility only
114 typedef wxBookCtrlEvent wxChoicebookEvent
;
115 typedef wxBookCtrlEventFunction wxChoicebookEventFunction
;
116 #define wxChoicebookEventHandler(func) wxBookCtrlEventHandler(func)
118 #define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \
119 wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
121 #define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \
122 wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
124 #endif // wxUSE_CHOICEBOOK
126 #endif // _WX_CHOICEBOOK_H_