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