]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/choicebk.h
Reduced deprecation warning frequency
[wxWidgets.git] / include / wx / choicebk.h
... / ...
CommitLineData
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#include "wx/defs.h"
16
17#if wxUSE_CHOICEBOOK
18
19#include "wx/bookctrl.h"
20
21class WXDLLEXPORT wxChoice;
22
23// ----------------------------------------------------------------------------
24// wxChoicebook
25// ----------------------------------------------------------------------------
26
27class WXDLLEXPORT wxChoicebook : public wxBookCtrlBase
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
70 virtual bool DeleteAllPages();
71
72 // returns the choice control
73 wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; }
74
75protected:
76 virtual wxWindow *DoRemovePage(size_t page);
77
78 // get the size which the choice control should have
79 virtual wxSize GetControllerSize() const;
80
81 // event handlers
82 void OnChoiceSelected(wxCommandEvent& event);
83
84 // the currently selected page or wxNOT_FOUND if none
85 int m_selection;
86
87private:
88 // common part of all constructors
89 void Init();
90
91 DECLARE_EVENT_TABLE()
92 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook)
93};
94
95// ----------------------------------------------------------------------------
96// choicebook event class and related stuff
97// ----------------------------------------------------------------------------
98
99class WXDLLEXPORT wxChoicebookEvent : public wxBookCtrlBaseEvent
100{
101public:
102 wxChoicebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
103 int nSel = -1, int nOldSel = -1)
104 : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel)
105 {
106 }
107
108 wxChoicebookEvent(const wxChoicebookEvent& event)
109 : wxBookCtrlBaseEvent(event)
110 {
111 }
112
113 virtual wxEvent *Clone() const { return new wxChoicebookEvent(*this); }
114
115private:
116 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChoicebookEvent)
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
124#define wxChoicebookEventHandler(func) \
125 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChoicebookEventFunction, &func)
126
127#define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \
128 wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxChoicebookEventHandler(fn))
129
130#define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \
131 wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxChoicebookEventHandler(fn))
132
133#endif // wxUSE_CHOICEBOOK
134
135#endif // _WX_CHOICEBOOK_H_