]> git.saurik.com Git - wxWidgets.git/blob - include/wx/toolbook.h
no changes, just remove #if'd out code
[wxWidgets.git] / include / wx / toolbook.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/toolbook.h
3 // Purpose: wxToolbook: wxToolBar and wxNotebook combination
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 2006-01-29
7 // RCS-ID: $Id$
8 // Copyright: (c) 2006 Julian Smart
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_TOOLBOOK_H_
13 #define _WX_TOOLBOOK_H_
14
15 #include "wx/defs.h"
16
17 #if wxUSE_TOOLBOOK
18
19 #include "wx/bookctrl.h"
20
21 class WXDLLIMPEXP_FWD_CORE wxToolBarBase;
22 class WXDLLIMPEXP_FWD_CORE wxCommandEvent;
23
24 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED, wxBookCtrlEvent );
25 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, wxBookCtrlEvent );
26
27
28 // Use wxButtonToolBar
29 #define wxTBK_BUTTONBAR 0x0100
30
31 // Use wxTB_HORZ_LAYOUT style for the controlling toolbar
32 #define wxTBK_HORZ_LAYOUT 0x8000
33
34 // deprecated synonym, don't use
35 #if WXWIN_COMPATIBILITY_2_8
36 #define wxBK_BUTTONBAR wxTBK_BUTTONBAR
37 #endif
38
39 // ----------------------------------------------------------------------------
40 // wxToolbook
41 // ----------------------------------------------------------------------------
42
43 class WXDLLIMPEXP_CORE wxToolbook : public wxBookCtrlBase
44 {
45 public:
46 wxToolbook()
47 {
48 Init();
49 }
50
51 wxToolbook(wxWindow *parent,
52 wxWindowID id,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 long style = 0,
56 const wxString& name = wxEmptyString)
57 {
58 Init();
59
60 (void)Create(parent, id, pos, size, style, name);
61 }
62
63 // quasi ctor
64 bool Create(wxWindow *parent,
65 wxWindowID id,
66 const wxPoint& pos = wxDefaultPosition,
67 const wxSize& size = wxDefaultSize,
68 long style = 0,
69 const wxString& name = wxEmptyString);
70
71
72 // implement base class virtuals
73 virtual int GetSelection() const;
74 virtual bool SetPageText(size_t n, const wxString& strText);
75 virtual wxString GetPageText(size_t n) const;
76 virtual int GetPageImage(size_t n) const;
77 virtual bool SetPageImage(size_t n, int imageId);
78 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
79 virtual bool InsertPage(size_t n,
80 wxWindow *page,
81 const wxString& text,
82 bool bSelect = false,
83 int imageId = -1);
84 virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); }
85 virtual int ChangeSelection(size_t n) { return DoSetSelection(n); }
86 virtual void SetImageList(wxImageList *imageList);
87
88 virtual bool DeleteAllPages();
89 virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
90
91
92 // methods which are not part of base wxBookctrl API
93
94 // get the underlying toolbar
95 wxToolBarBase* GetToolBar() const { return (wxToolBarBase*)m_bookctrl; }
96
97 // must be called in OnIdle or by application to realize the toolbar and
98 // select the initial page.
99 void Realize();
100
101 protected:
102 virtual wxWindow *DoRemovePage(size_t page);
103
104 // get the size which the list control should have
105 virtual wxSize GetControllerSize() const;
106
107 // event handlers
108 void OnToolSelected(wxCommandEvent& event);
109 void OnSize(wxSizeEvent& event);
110 void OnIdle(wxIdleEvent& event);
111
112 void UpdateSelectedPage(size_t newsel);
113
114 wxBookCtrlEvent* CreatePageChangingEvent() const;
115 void MakeChangedEvent(wxBookCtrlEvent &event);
116
117 // the currently selected page or wxNOT_FOUND if none
118 int m_selection;
119
120 // whether the toolbar needs to be realized
121 bool m_needsRealizing;
122
123 // maximum bitmap size
124 wxSize m_maxBitmapSize;
125
126 private:
127 // common part of all constructors
128 void Init();
129
130 DECLARE_EVENT_TABLE()
131 DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolbook)
132 };
133
134 // ----------------------------------------------------------------------------
135 // listbook event class and related stuff
136 // ----------------------------------------------------------------------------
137
138 // wxToolbookEvent is obsolete and defined for compatibility only
139 typedef wxBookCtrlEvent wxToolbookEvent;
140 typedef wxBookCtrlEventFunction wxToolbookEventFunction;
141 #define wxToolbookEventHandler(func) wxBookCtrlEventHandler(func)
142
143
144 #define EVT_TOOLBOOK_PAGE_CHANGED(winid, fn) \
145 wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
146
147 #define EVT_TOOLBOOK_PAGE_CHANGING(winid, fn) \
148 wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
149
150 #endif // wxUSE_TOOLBOOK
151
152 #endif // _WX_TOOLBOOK_H_