]> git.saurik.com Git - wxWidgets.git/blob - include/wx/listbook.h
renamed wxComboControl to wxComboCtrl and related wxUSE_XXX and configure switches...
[wxWidgets.git] / include / wx / listbook.h
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$
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_LISTBOOK_H_
13 #define _WX_LISTBOOK_H_
14
15 #include "wx/defs.h"
16
17 #if wxUSE_LISTBOOK
18
19 #include "wx/bookctrl.h"
20
21 class WXDLLEXPORT wxListView;
22 class WXDLLEXPORT wxListEvent;
23
24 // ----------------------------------------------------------------------------
25 // wxListbook
26 // ----------------------------------------------------------------------------
27
28 class WXDLLEXPORT wxListbook : public wxBookCtrlBase
29 {
30 public:
31 wxListbook()
32 {
33 Init();
34 }
35
36 wxListbook(wxWindow *parent,
37 wxWindowID id,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize,
40 long style = 0,
41 const wxString& name = wxEmptyString)
42 {
43 Init();
44
45 (void)Create(parent, id, pos, size, style, name);
46 }
47
48 // quasi ctor
49 bool Create(wxWindow *parent,
50 wxWindowID id,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 long style = 0,
54 const wxString& name = wxEmptyString);
55
56
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,
64 wxWindow *page,
65 const wxString& text,
66 bool bSelect = false,
67 int imageId = -1);
68 virtual int SetSelection(size_t n);
69 virtual void SetImageList(wxImageList *imageList);
70
71 virtual bool DeleteAllPages();
72
73 wxListView* GetListView() const { return (wxListView*)m_bookctrl; }
74
75 protected:
76 virtual wxWindow *DoRemovePage(size_t page);
77
78 // get the size which the list control should have
79 virtual wxSize GetControllerSize() const;
80
81 // event handlers
82 void OnListSelected(wxListEvent& event);
83 void OnSize(wxSizeEvent& event);
84
85 // the currently selected page or wxNOT_FOUND if none
86 int m_selection;
87
88 private:
89 // common part of all constructors
90 void Init();
91
92 DECLARE_EVENT_TABLE()
93 DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook)
94 };
95
96 // ----------------------------------------------------------------------------
97 // listbook event class and related stuff
98 // ----------------------------------------------------------------------------
99
100 class WXDLLEXPORT wxListbookEvent : public wxBookCtrlBaseEvent
101 {
102 public:
103 wxListbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
104 int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND)
105 : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel)
106 {
107 }
108
109 wxListbookEvent(const wxListbookEvent& event)
110 : wxBookCtrlBaseEvent(event)
111 {
112 }
113
114 virtual wxEvent *Clone() const { return new wxListbookEvent(*this); }
115
116 private:
117 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListbookEvent)
118 };
119
120 extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED;
121 extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING;
122
123 typedef void (wxEvtHandler::*wxListbookEventFunction)(wxListbookEvent&);
124
125 #define wxListbookEventHandler(func) \
126 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxListbookEventFunction, &func)
127
128 #define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \
129 wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxListbookEventHandler(fn))
130
131 #define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \
132 wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxListbookEventHandler(fn))
133
134 #endif // wxUSE_LISTBOOK
135
136 #endif // _WX_LISTBOOK_H_