]> git.saurik.com Git - wxWidgets.git/blob - include/wx/listbook.h
Use /bin/echo for creation of Mac OS X PkgInfo files.
[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 WXDLLIMPEXP_FWD_CORE wxListView;
22 class WXDLLIMPEXP_FWD_CORE wxListEvent;
23
24 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, wxBookCtrlEvent );
25 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, wxBookCtrlEvent );
26
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
35 // ----------------------------------------------------------------------------
36 // wxListbook
37 // ----------------------------------------------------------------------------
38
39 class WXDLLIMPEXP_CORE wxListbook : public wxBookCtrlBase
40 {
41 public:
42 wxListbook() { }
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 {
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
63 // overridden base class methods
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);
68 virtual bool InsertPage(size_t n,
69 wxWindow *page,
70 const wxString& text,
71 bool bSelect = false,
72 int imageId = NO_IMAGE);
73 virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); }
74 virtual int ChangeSelection(size_t n) { return DoSetSelection(n); }
75 virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
76 virtual void SetImageList(wxImageList *imageList);
77
78 virtual bool DeleteAllPages();
79
80 wxListView* GetListView() const { return (wxListView*)m_bookctrl; }
81
82 protected:
83 virtual wxWindow *DoRemovePage(size_t page);
84
85 void UpdateSelectedPage(size_t newsel);
86
87 wxBookCtrlEvent* CreatePageChangingEvent() const;
88 void MakeChangedEvent(wxBookCtrlEvent &event);
89
90 // get flags for different list control modes
91 long GetListCtrlIconViewFlags() const;
92 long GetListCtrlReportViewFlags() const;
93
94 // event handlers
95 void OnListSelected(wxListEvent& event);
96 void OnSize(wxSizeEvent& event);
97
98 private:
99 // this should be called when we need to be relaid out
100 void UpdateSize();
101
102
103 DECLARE_EVENT_TABLE()
104 DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook)
105 };
106
107 // ----------------------------------------------------------------------------
108 // listbook event class and related stuff
109 // ----------------------------------------------------------------------------
110
111 // wxListbookEvent is obsolete and defined for compatibility only (notice that
112 // we use #define and not typedef to also keep compatibility with the existing
113 // code which forward declares it)
114 #define wxListbookEvent wxBookCtrlEvent
115 typedef wxBookCtrlEventFunction wxListbookEventFunction;
116 #define wxListbookEventHandler(func) wxBookCtrlEventHandler(func)
117
118 #define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \
119 wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
120
121 #define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \
122 wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
123
124 #endif // wxUSE_LISTBOOK
125
126 #endif // _WX_LISTBOOK_H_