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 WXDLLIMPEXP_FWD_CORE wxListView
;
22 class WXDLLIMPEXP_FWD_CORE wxListEvent
;
24 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE
, wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED
, wxBookCtrlEvent
);
25 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE
, wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING
, wxBookCtrlEvent
);
28 #define wxLB_DEFAULT wxBK_DEFAULT
29 #define wxLB_TOP wxBK_TOP
30 #define wxLB_BOTTOM wxBK_BOTTOM
31 #define wxLB_LEFT wxBK_LEFT
32 #define wxLB_RIGHT wxBK_RIGHT
33 #define wxLB_ALIGN_MASK wxBK_ALIGN_MASK
35 // ----------------------------------------------------------------------------
37 // ----------------------------------------------------------------------------
39 class WXDLLIMPEXP_CORE wxListbook
: public wxBookCtrlBase
47 wxListbook(wxWindow
*parent
,
49 const wxPoint
& pos
= wxDefaultPosition
,
50 const wxSize
& size
= wxDefaultSize
,
52 const wxString
& name
= wxEmptyString
)
56 (void)Create(parent
, id
, pos
, size
, style
, name
);
60 bool Create(wxWindow
*parent
,
62 const wxPoint
& pos
= wxDefaultPosition
,
63 const wxSize
& size
= wxDefaultSize
,
65 const wxString
& name
= wxEmptyString
);
68 // overridden base class methods
69 virtual int GetSelection() const;
70 virtual bool SetPageText(size_t n
, const wxString
& strText
);
71 virtual wxString
GetPageText(size_t n
) const;
72 virtual int GetPageImage(size_t n
) const;
73 virtual bool SetPageImage(size_t n
, int imageId
);
74 virtual bool InsertPage(size_t n
,
79 virtual int SetSelection(size_t n
) { return DoSetSelection(n
, SetSelection_SendEvent
); }
80 virtual int ChangeSelection(size_t n
) { return DoSetSelection(n
); }
81 virtual int HitTest(const wxPoint
& pt
, long *flags
= NULL
) const;
82 virtual void SetImageList(wxImageList
*imageList
);
84 virtual bool DeleteAllPages();
86 wxListView
* GetListView() const { return (wxListView
*)m_bookctrl
; }
89 virtual wxWindow
*DoRemovePage(size_t page
);
91 void UpdateSelectedPage(size_t newsel
);
93 wxBookCtrlEvent
* CreatePageChangingEvent() const;
94 void MakeChangedEvent(wxBookCtrlEvent
&event
);
96 // get flags for different list control modes
97 long GetListCtrlIconViewFlags() const;
98 long GetListCtrlReportViewFlags() const;
101 void OnListSelected(wxListEvent
& event
);
102 void OnSize(wxSizeEvent
& event
);
104 // the currently selected page or wxNOT_FOUND if none
108 // common part of all constructors
111 // this should be called when we need to be relaid out
115 DECLARE_EVENT_TABLE()
116 DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook
)
119 // ----------------------------------------------------------------------------
120 // listbook event class and related stuff
121 // ----------------------------------------------------------------------------
123 // wxListbookEvent is obsolete and defined for compatibility only (notice that
124 // we use #define and not typedef to also keep compatibility with the existing
125 // code which forward declares it)
126 #define wxListbookEvent wxBookCtrlEvent
127 typedef wxBookCtrlEventFunction wxListbookEventFunction
;
128 #define wxListbookEventHandler(func) wxBookCtrlEventHandler(func)
130 #define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \
131 wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
133 #define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \
134 wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
136 #endif // wxUSE_LISTBOOK
138 #endif // _WX_LISTBOOK_H_