]> git.saurik.com Git - wxWidgets.git/blame - include/wx/choicebk.h
Add wxABI_VERSION wrappers
[wxWidgets.git] / include / wx / choicebk.h
CommitLineData
f5e0b4bc
WS
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/choicebk.h
3// Purpose: wxChoicebook: wxChoice and wxNotebook combination
4// Author: Vadim Zeitlin
5// Modified by: Wlodzimierz ABX Skiba from wx/listbook.h
6// Created: 15.09.04
7// RCS-ID: $Id$
8// Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_CHOICEBOOK_H_
13#define _WX_CHOICEBOOK_H_
14
15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "choicebook.h"
17#endif
18
19#include "wx/defs.h"
20
21#if wxUSE_CHOICEBOOK
22
23#include "wx/bookctrl.h"
24
25class WXDLLEXPORT wxChoice;
26
f5e0b4bc
WS
27// ----------------------------------------------------------------------------
28// wxChoicebook
29// ----------------------------------------------------------------------------
30
61c083e7 31class WXDLLEXPORT wxChoicebook : public wxBookCtrlBase
f5e0b4bc
WS
32{
33public:
34 wxChoicebook()
35 {
36 Init();
37 }
38
39 wxChoicebook(wxWindow *parent,
40 wxWindowID id,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
43 long style = 0,
44 const wxString& name = wxEmptyString)
45 {
46 Init();
47
48 (void)Create(parent, id, pos, size, style, name);
49 }
50
51 // quasi ctor
52 bool Create(wxWindow *parent,
53 wxWindowID id,
54 const wxPoint& pos = wxDefaultPosition,
55 const wxSize& size = wxDefaultSize,
56 long style = 0,
57 const wxString& name = wxEmptyString);
58
59
60 virtual int GetSelection() const;
61 virtual bool SetPageText(size_t n, const wxString& strText);
62 virtual wxString GetPageText(size_t n) const;
63 virtual int GetPageImage(size_t n) const;
64 virtual bool SetPageImage(size_t n, int imageId);
65 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
66 virtual bool InsertPage(size_t n,
67 wxWindow *page,
68 const wxString& text,
69 bool bSelect = false,
70 int imageId = -1);
71 virtual int SetSelection(size_t n);
72 virtual void SetImageList(wxImageList *imageList);
73
74 // returns true if we have wxCHB_TOP or wxCHB_BOTTOM style
75 bool IsVertical() const { return HasFlag(wxCHB_BOTTOM | wxCHB_TOP); }
76
77 virtual bool DeleteAllPages();
78
c9ab63f4
JS
79 // returns the choice control
80 wxChoice* GetChoiceCtrl() const { return m_choice; }
81
f5e0b4bc
WS
82protected:
83 virtual wxWindow *DoRemovePage(size_t page);
84
f5e0b4bc
WS
85 // get the size which the choice control should have
86 wxSize GetChoiceSize() const;
87
88 // get the page area
89 wxRect GetPageRect() const;
90
91 // event handlers
92 void OnSize(wxSizeEvent& event);
93 void OnChoiceSelected(wxCommandEvent& event);
94
f5e0b4bc
WS
95 // the choice control we use for showing the pages index
96 wxChoice *m_choice;
97
98 // the currently selected page or wxNOT_FOUND if none
99 int m_selection;
100
bb08a4a1
WS
101private:
102 // common part of all constructors
103 void Init();
f5e0b4bc
WS
104
105 DECLARE_EVENT_TABLE()
106 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook)
107};
108
109// ----------------------------------------------------------------------------
110// choicebook event class and related stuff
111// ----------------------------------------------------------------------------
112
61c083e7 113class WXDLLEXPORT wxChoicebookEvent : public wxBookCtrlBaseEvent
f5e0b4bc
WS
114{
115public:
116 wxChoicebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
117 int nSel = -1, int nOldSel = -1)
61c083e7 118 : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel)
f5e0b4bc
WS
119 {
120 }
121
122private:
123 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebookEvent)
124};
125
126extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED;
127extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING;
128
129typedef void (wxEvtHandler::*wxChoicebookEventFunction)(wxChoicebookEvent&);
130
7fa03f04 131#define wxChoicebookEventHandler(func) \
d94c09cd 132 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChoicebookEventFunction, &func)
7fa03f04 133
d94c09cd
WS
134#define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \
135 wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxChoicebookEventHandler(fn))
7fa03f04 136
d94c09cd
WS
137#define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \
138 wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxChoicebookEventHandler(fn))
f5e0b4bc
WS
139
140#endif // wxUSE_CHOICEBOOK
141
142#endif // _WX_CHOICEBOOK_H_