1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxListbook: wxListCtrl and wxNotebook combination
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_LISTBOOK_H_
13 #define _WX_LISTBOOK_H_
19 #include "wx/bookctrl.h"
21 class WXDLLEXPORT wxListView
;
22 class WXDLLEXPORT wxListEvent
;
24 // ----------------------------------------------------------------------------
26 // ----------------------------------------------------------------------------
28 class WXDLLEXPORT wxListbook
: public wxBookCtrlBase
36 wxListbook(wxWindow
*parent
,
38 const wxPoint
& pos
= wxDefaultPosition
,
39 const wxSize
& size
= wxDefaultSize
,
41 const wxString
& name
= wxEmptyString
)
45 (void)Create(parent
, id
, pos
, size
, style
, name
);
49 bool Create(wxWindow
*parent
,
51 const wxPoint
& pos
= wxDefaultPosition
,
52 const wxSize
& size
= wxDefaultSize
,
54 const wxString
& name
= wxEmptyString
);
57 virtual int GetSelection() const;
58 virtual bool SetPageText(size_t n
, const wxString
& strText
);
59 virtual wxString
GetPageText(size_t n
) const;
60 virtual int GetPageImage(size_t n
) const;
61 virtual bool SetPageImage(size_t n
, int imageId
);
62 virtual wxSize
CalcSizeFromPage(const wxSize
& sizePage
) const;
63 virtual bool InsertPage(size_t n
,
68 virtual int SetSelection(size_t n
);
69 virtual void SetImageList(wxImageList
*imageList
);
71 virtual bool DeleteAllPages();
73 wxListView
* GetListView() const { return (wxListView
*)m_bookctrl
; }
76 virtual wxWindow
*DoRemovePage(size_t page
);
78 // get the size which the list control should have
79 virtual wxSize
GetControllerSize() const;
82 void OnListSelected(wxListEvent
& event
);
83 void OnSize(wxSizeEvent
& event
);
85 // the currently selected page or wxNOT_FOUND if none
89 // common part of all constructors
93 DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook
)
96 // ----------------------------------------------------------------------------
97 // listbook event class and related stuff
98 // ----------------------------------------------------------------------------
100 class WXDLLEXPORT wxListbookEvent
: public wxBookCtrlBaseEvent
103 wxListbookEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0,
104 int nSel
= wxNOT_FOUND
, int nOldSel
= wxNOT_FOUND
)
105 : wxBookCtrlBaseEvent(commandType
, id
, nSel
, nOldSel
)
110 DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbookEvent
)
113 extern WXDLLIMPEXP_CORE
const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED
;
114 extern WXDLLIMPEXP_CORE
const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING
;
116 typedef void (wxEvtHandler::*wxListbookEventFunction
)(wxListbookEvent
&);
118 #define wxListbookEventHandler(func) \
119 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxListbookEventFunction, &func)
121 #define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \
122 wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxListbookEventHandler(fn))
124 #define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \
125 wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxListbookEventHandler(fn))
127 #endif // wxUSE_LISTBOOK
129 #endif // _WX_LISTBOOK_H_