]> git.saurik.com Git - wxWidgets.git/blame - include/wx/listbook.h
define WXMAKINGDLL_QA when WXMAKINGDLL is defined (patch 1502015)
[wxWidgets.git] / include / wx / listbook.h
CommitLineData
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"
20
21class WXDLLEXPORT wxListView;
22class WXDLLEXPORT wxListEvent;
ef0120c1 23
e9c0df38
VZ
24// ----------------------------------------------------------------------------
25// wxListbook
26// ----------------------------------------------------------------------------
27
61c083e7 28class WXDLLEXPORT wxListbook : public wxBookCtrlBase
e9c0df38
VZ
29{
30public:
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
fbd11d30
RD
71 virtual bool DeleteAllPages();
72
d8fd7acb 73 wxListView* GetListView() const { return (wxListView*)m_bookctrl; }
e572631f 74
e9c0df38
VZ
75protected:
76 virtual wxWindow *DoRemovePage(size_t page);
77
e9c0df38 78 // get the size which the list control should have
d8fd7acb 79 virtual wxSize GetControllerSize() const;
e9c0df38 80
851b88c3
VZ
81 // return the page corresponding to the tab at the specified position
82 virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
83
e9c0df38 84 // event handlers
e9c0df38 85 void OnListSelected(wxListEvent& event);
d8fd7acb 86 void OnSize(wxSizeEvent& event);
e9c0df38
VZ
87
88 // the currently selected page or wxNOT_FOUND if none
89 int m_selection;
90
33ebfc3b
VZ
91private:
92 // common part of all constructors
93 void Init();
e9c0df38
VZ
94
95 DECLARE_EVENT_TABLE()
96 DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook)
97};
98
99// ----------------------------------------------------------------------------
100// listbook event class and related stuff
101// ----------------------------------------------------------------------------
102
61c083e7 103class WXDLLEXPORT wxListbookEvent : public wxBookCtrlBaseEvent
e9c0df38
VZ
104{
105public:
106 wxListbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
bb08a4a1 107 int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND)
61c083e7 108 : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel)
e9c0df38
VZ
109 {
110 }
111
75865c8d
VZ
112 wxListbookEvent(const wxListbookEvent& event)
113 : wxBookCtrlBaseEvent(event)
114 {
115 }
116
117 virtual wxEvent *Clone() const { return new wxListbookEvent(*this); }
118
e9c0df38 119private:
75865c8d 120 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListbookEvent)
e9c0df38
VZ
121};
122
123extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED;
124extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING;
125
126typedef void (wxEvtHandler::*wxListbookEventFunction)(wxListbookEvent&);
127
8bc3ec1f
WS
128#define wxListbookEventHandler(func) \
129 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxListbookEventFunction, &func)
130
131#define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \
132 wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxListbookEventHandler(fn))
133
134#define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \
135 wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxListbookEventHandler(fn))
e9c0df38
VZ
136
137#endif // wxUSE_LISTBOOK
138
139#endif // _WX_LISTBOOK_H_