]>
Commit | Line | Data |
---|---|---|
e9c0df38 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/listbook.h | |
3 | // Purpose: wxListbook: wxListCtrl and wxNotebook combination | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 19.08.03 | |
7 | // RCS-ID: $Id$ | |
77ffb593 | 8 | // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> |
65571936 | 9 | // Licence: wxWindows licence |
e9c0df38 VZ |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_LISTBOOK_H_ | |
13 | #define _WX_LISTBOOK_H_ | |
14 | ||
e9c0df38 VZ |
15 | #include "wx/defs.h" |
16 | ||
17 | #if wxUSE_LISTBOOK | |
18 | ||
19 | #include "wx/bookctrl.h" | |
28e42e02 | 20 | #include "wx/containr.h" |
e9c0df38 | 21 | |
b5dbe15d VS |
22 | class WXDLLIMPEXP_FWD_CORE wxListView; |
23 | class WXDLLIMPEXP_FWD_CORE wxListEvent; | |
ef0120c1 | 24 | |
9b11752c VZ |
25 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, wxBookCtrlEvent ); |
26 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, wxBookCtrlEvent ); | |
1d6fcbcc | 27 | |
90c0f63a VZ |
28 | // wxListbook flags |
29 | #define wxLB_DEFAULT wxBK_DEFAULT | |
30 | #define wxLB_TOP wxBK_TOP | |
31 | #define wxLB_BOTTOM wxBK_BOTTOM | |
32 | #define wxLB_LEFT wxBK_LEFT | |
33 | #define wxLB_RIGHT wxBK_RIGHT | |
34 | #define wxLB_ALIGN_MASK wxBK_ALIGN_MASK | |
35 | ||
e9c0df38 VZ |
36 | // ---------------------------------------------------------------------------- |
37 | // wxListbook | |
38 | // ---------------------------------------------------------------------------- | |
39 | ||
28e42e02 | 40 | class WXDLLIMPEXP_CORE wxListbook : public wxNavigationEnabled<wxBookCtrlBase> |
e9c0df38 VZ |
41 | { |
42 | public: | |
681be2ef | 43 | wxListbook() { } |
e9c0df38 VZ |
44 | |
45 | wxListbook(wxWindow *parent, | |
46 | wxWindowID id, | |
47 | const wxPoint& pos = wxDefaultPosition, | |
48 | const wxSize& size = wxDefaultSize, | |
49 | long style = 0, | |
50 | const wxString& name = wxEmptyString) | |
51 | { | |
e9c0df38 VZ |
52 | (void)Create(parent, id, pos, size, style, name); |
53 | } | |
54 | ||
55 | // quasi ctor | |
56 | bool Create(wxWindow *parent, | |
57 | wxWindowID id, | |
58 | const wxPoint& pos = wxDefaultPosition, | |
59 | const wxSize& size = wxDefaultSize, | |
60 | long style = 0, | |
61 | const wxString& name = wxEmptyString); | |
62 | ||
63 | ||
bcbec865 | 64 | // overridden base class methods |
e9c0df38 VZ |
65 | virtual bool SetPageText(size_t n, const wxString& strText); |
66 | virtual wxString GetPageText(size_t n) const; | |
67 | virtual int GetPageImage(size_t n) const; | |
68 | virtual bool SetPageImage(size_t n, int imageId); | |
e9c0df38 VZ |
69 | virtual bool InsertPage(size_t n, |
70 | wxWindow *page, | |
71 | const wxString& text, | |
72 | bool bSelect = false, | |
1871b9fa | 73 | int imageId = NO_IMAGE); |
1d6fcbcc VZ |
74 | virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); } |
75 | virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } | |
bcbec865 | 76 | virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; |
e9c0df38 VZ |
77 | virtual void SetImageList(wxImageList *imageList); |
78 | ||
fbd11d30 RD |
79 | virtual bool DeleteAllPages(); |
80 | ||
d8fd7acb | 81 | wxListView* GetListView() const { return (wxListView*)m_bookctrl; } |
e572631f | 82 | |
e9c0df38 VZ |
83 | protected: |
84 | virtual wxWindow *DoRemovePage(size_t page); | |
85 | ||
1d6fcbcc VZ |
86 | void UpdateSelectedPage(size_t newsel); |
87 | ||
3e97a905 VZ |
88 | wxBookCtrlEvent* CreatePageChangingEvent() const; |
89 | void MakeChangedEvent(wxBookCtrlEvent &event); | |
1d6fcbcc | 90 | |
e9c0df38 | 91 | // event handlers |
e9c0df38 | 92 | void OnListSelected(wxListEvent& event); |
d8fd7acb | 93 | void OnSize(wxSizeEvent& event); |
e9c0df38 | 94 | |
33ebfc3b | 95 | private: |
eaad096e VZ |
96 | // this should be called when we need to be relaid out |
97 | void UpdateSize(); | |
98 | ||
99 | ||
e9c0df38 VZ |
100 | DECLARE_EVENT_TABLE() |
101 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook) | |
102 | }; | |
103 | ||
104 | // ---------------------------------------------------------------------------- | |
105 | // listbook event class and related stuff | |
106 | // ---------------------------------------------------------------------------- | |
107 | ||
856b41f9 VZ |
108 | // wxListbookEvent is obsolete and defined for compatibility only (notice that |
109 | // we use #define and not typedef to also keep compatibility with the existing | |
110 | // code which forward declares it) | |
111 | #define wxListbookEvent wxBookCtrlEvent | |
3e97a905 VZ |
112 | typedef wxBookCtrlEventFunction wxListbookEventFunction; |
113 | #define wxListbookEventHandler(func) wxBookCtrlEventHandler(func) | |
8bc3ec1f WS |
114 | |
115 | #define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \ | |
3e97a905 | 116 | wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) |
8bc3ec1f WS |
117 | |
118 | #define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \ | |
3e97a905 | 119 | wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) |
e9c0df38 VZ |
120 | |
121 | #endif // wxUSE_LISTBOOK | |
122 | ||
123 | #endif // _WX_LISTBOOK_H_ |