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_
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "choicebook.h"
23 #include "wx/bookctrl.h"
25 class WXDLLEXPORT wxChoice
;
27 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
31 class WXDLLEXPORT wxChoicebook
: public wxBookCtrlBase
39 wxChoicebook(wxWindow
*parent
,
41 const wxPoint
& pos
= wxDefaultPosition
,
42 const wxSize
& size
= wxDefaultSize
,
44 const wxString
& name
= wxEmptyString
)
48 (void)Create(parent
, id
, pos
, size
, style
, name
);
52 bool Create(wxWindow
*parent
,
54 const wxPoint
& pos
= wxDefaultPosition
,
55 const wxSize
& size
= wxDefaultSize
,
57 const wxString
& name
= wxEmptyString
);
60 virtual int GetSelection() const;
61 virtual bool SetPageText(size_t n
, const wxString
& strText
);
62 virtual wxString
GetPageText(size_t n
) const;
63 virtual int GetPageImage(size_t n
) const;
64 virtual bool SetPageImage(size_t n
, int imageId
);
65 virtual wxSize
CalcSizeFromPage(const wxSize
& sizePage
) const;
66 virtual bool InsertPage(size_t n
,
71 virtual int SetSelection(size_t n
);
72 virtual void SetImageList(wxImageList
*imageList
);
74 // returns true if we have wxCHB_TOP or wxCHB_BOTTOM style
75 bool IsVertical() const { return HasFlag(wxCHB_BOTTOM
| wxCHB_TOP
); }
77 virtual bool DeleteAllPages();
79 // returns the choice control
80 wxChoice
* GetChoiceCtrl() const { return m_choice
; }
83 virtual wxWindow
*DoRemovePage(size_t page
);
85 // get the size which the choice control should have
86 wxSize
GetChoiceSize() const;
89 wxRect
GetPageRect() const;
92 void OnSize(wxSizeEvent
& event
);
93 void OnChoiceSelected(wxCommandEvent
& event
);
95 // the choice control we use for showing the pages index
98 // the currently selected page or wxNOT_FOUND if none
102 // common part of all constructors
105 DECLARE_EVENT_TABLE()
106 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook
)
109 // ----------------------------------------------------------------------------
110 // choicebook event class and related stuff
111 // ----------------------------------------------------------------------------
113 class WXDLLEXPORT wxChoicebookEvent
: public wxBookCtrlBaseEvent
116 wxChoicebookEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0,
117 int nSel
= -1, int nOldSel
= -1)
118 : wxBookCtrlBaseEvent(commandType
, id
, nSel
, nOldSel
)
123 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebookEvent
)
126 extern WXDLLIMPEXP_CORE
const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED
;
127 extern WXDLLIMPEXP_CORE
const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING
;
129 typedef void (wxEvtHandler::*wxChoicebookEventFunction
)(wxChoicebookEvent
&);
131 #define wxChoicebookEventHandler(func) \
132 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChoicebookEventFunction, &func)
134 #define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \
135 wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxChoicebookEventHandler(fn))
137 #define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \
138 wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxChoicebookEventHandler(fn))
140 #endif // wxUSE_CHOICEBOOK
142 #endif // _WX_CHOICEBOOK_H_