]> git.saurik.com Git - wxWidgets.git/blame - include/wx/choicebk.h
Added wxDataViewBitmapCell
[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
f5e0b4bc
WS
15#include "wx/defs.h"
16
17#if wxUSE_CHOICEBOOK
18
19#include "wx/bookctrl.h"
20
21class WXDLLEXPORT wxChoice;
22
f5e0b4bc
WS
23// ----------------------------------------------------------------------------
24// wxChoicebook
25// ----------------------------------------------------------------------------
26
61c083e7 27class WXDLLEXPORT wxChoicebook : public wxBookCtrlBase
f5e0b4bc
WS
28{
29public:
30 wxChoicebook()
31 {
32 Init();
33 }
34
35 wxChoicebook(wxWindow *parent,
36 wxWindowID id,
37 const wxPoint& pos = wxDefaultPosition,
38 const wxSize& size = wxDefaultSize,
39 long style = 0,
40 const wxString& name = wxEmptyString)
41 {
42 Init();
43
44 (void)Create(parent, id, pos, size, style, name);
45 }
46
47 // quasi ctor
48 bool Create(wxWindow *parent,
49 wxWindowID id,
50 const wxPoint& pos = wxDefaultPosition,
51 const wxSize& size = wxDefaultSize,
52 long style = 0,
53 const wxString& name = wxEmptyString);
54
55
56 virtual int GetSelection() const;
57 virtual bool SetPageText(size_t n, const wxString& strText);
58 virtual wxString GetPageText(size_t n) const;
59 virtual int GetPageImage(size_t n) const;
60 virtual bool SetPageImage(size_t n, int imageId);
61 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
62 virtual bool InsertPage(size_t n,
63 wxWindow *page,
64 const wxString& text,
65 bool bSelect = false,
66 int imageId = -1);
67 virtual int SetSelection(size_t n);
68 virtual void SetImageList(wxImageList *imageList);
69
f5e0b4bc
WS
70 virtual bool DeleteAllPages();
71
c9ab63f4 72 // returns the choice control
d8fd7acb 73 wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; }
c9ab63f4 74
f5e0b4bc
WS
75protected:
76 virtual wxWindow *DoRemovePage(size_t page);
77
f5e0b4bc 78 // get the size which the choice control should have
d8fd7acb 79 virtual wxSize GetControllerSize() const;
f5e0b4bc
WS
80
81 // event handlers
f5e0b4bc
WS
82 void OnChoiceSelected(wxCommandEvent& event);
83
f5e0b4bc
WS
84 // the currently selected page or wxNOT_FOUND if none
85 int m_selection;
86
bb08a4a1
WS
87private:
88 // common part of all constructors
89 void Init();
f5e0b4bc
WS
90
91 DECLARE_EVENT_TABLE()
92 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook)
93};
94
95// ----------------------------------------------------------------------------
96// choicebook event class and related stuff
97// ----------------------------------------------------------------------------
98
61c083e7 99class WXDLLEXPORT wxChoicebookEvent : public wxBookCtrlBaseEvent
f5e0b4bc
WS
100{
101public:
102 wxChoicebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
103 int nSel = -1, int nOldSel = -1)
61c083e7 104 : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel)
f5e0b4bc
WS
105 {
106 }
107
87355003
WS
108 wxChoicebookEvent(const wxChoicebookEvent& event)
109 : wxBookCtrlBaseEvent(event)
110 {
111 }
112
113 virtual wxEvent *Clone() const { return new wxChoicebookEvent(*this); }
114
f5e0b4bc 115private:
87355003 116 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChoicebookEvent)
f5e0b4bc
WS
117};
118
119extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED;
120extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING;
121
122typedef void (wxEvtHandler::*wxChoicebookEventFunction)(wxChoicebookEvent&);
123
7fa03f04 124#define wxChoicebookEventHandler(func) \
d94c09cd 125 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChoicebookEventFunction, &func)
7fa03f04 126
d94c09cd
WS
127#define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \
128 wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxChoicebookEventHandler(fn))
7fa03f04 129
d94c09cd
WS
130#define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \
131 wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxChoicebookEventHandler(fn))
f5e0b4bc
WS
132
133#endif // wxUSE_CHOICEBOOK
134
135#endif // _WX_CHOICEBOOK_H_