]> git.saurik.com Git - wxWidgets.git/blame - include/wx/choicebk.h
fix wxBitmapComboBox Gtk-CRITICAL assertion `GTK_IS_ENTRY (entry)' failed
[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"
cc66bf5a 20#include "wx/choice.h"
28e42e02 21#include "wx/containr.h"
f5e0b4bc 22
b5dbe15d 23class WXDLLIMPEXP_FWD_CORE wxChoice;
f5e0b4bc 24
9b11752c
VZ
25wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, wxBookCtrlEvent );
26wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, wxBookCtrlEvent );
1d6fcbcc 27
90c0f63a
VZ
28// wxChoicebook flags
29#define wxCHB_DEFAULT wxBK_DEFAULT
30#define wxCHB_TOP wxBK_TOP
31#define wxCHB_BOTTOM wxBK_BOTTOM
32#define wxCHB_LEFT wxBK_LEFT
33#define wxCHB_RIGHT wxBK_RIGHT
34#define wxCHB_ALIGN_MASK wxBK_ALIGN_MASK
1d6fcbcc 35
f5e0b4bc
WS
36// ----------------------------------------------------------------------------
37// wxChoicebook
38// ----------------------------------------------------------------------------
39
28e42e02 40class WXDLLIMPEXP_CORE wxChoicebook : public wxNavigationEnabled<wxBookCtrlBase>
f5e0b4bc
WS
41{
42public:
681be2ef 43 wxChoicebook() { }
f5e0b4bc
WS
44
45 wxChoicebook(wxWindow *parent,
46 wxWindowID id,
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
49 long style = 0,
50 const wxString& name = wxEmptyString)
51 {
f5e0b4bc
WS
52 (void)Create(parent, id, pos, size, style, name);
53 }
54
55 // quasi ctor
56 bool Create(wxWindow *parent,
57 wxWindowID id,
58 const wxPoint& pos = wxDefaultPosition,
59 const wxSize& size = wxDefaultSize,
60 long style = 0,
61 const wxString& name = wxEmptyString);
62
63
f5e0b4bc
WS
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);
f5e0b4bc
WS
68 virtual bool InsertPage(size_t n,
69 wxWindow *page,
70 const wxString& text,
71 bool bSelect = false,
1871b9fa 72 int imageId = NO_IMAGE);
64c38b4b
VZ
73 virtual int SetSelection(size_t n)
74 { return DoSetSelection(n, SetSelection_SendEvent); }
1d6fcbcc 75 virtual int ChangeSelection(size_t n) { return DoSetSelection(n); }
f5e0b4bc
WS
76 virtual void SetImageList(wxImageList *imageList);
77
f5e0b4bc
WS
78 virtual bool DeleteAllPages();
79
c9ab63f4 80 // returns the choice control
d8fd7acb 81 wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; }
c9ab63f4 82
6cab632f
VZ
83 // Override this to return true because the part of parent window
84 // background between our controlling wxChoice and the page area should
85 // show through.
86 virtual bool HasTransparentBackground() { return true; }
87
f5e0b4bc 88protected:
64c38b4b
VZ
89 virtual void DoSetWindowVariant(wxWindowVariant variant);
90
f5e0b4bc
WS
91 virtual wxWindow *DoRemovePage(size_t page);
92
1d6fcbcc
VZ
93 void UpdateSelectedPage(size_t newsel)
94 {
e79d4945 95 m_selection = static_cast<int>(newsel);
c2566575 96 GetChoiceCtrl()->Select(m_selection);
1d6fcbcc
VZ
97 }
98
3e97a905
VZ
99 wxBookCtrlEvent* CreatePageChangingEvent() const;
100 void MakeChangedEvent(wxBookCtrlEvent &event);
1d6fcbcc 101
f5e0b4bc 102 // event handlers
f5e0b4bc
WS
103 void OnChoiceSelected(wxCommandEvent& event);
104
bb08a4a1 105private:
f5e0b4bc
WS
106 DECLARE_EVENT_TABLE()
107 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook)
108};
109
110// ----------------------------------------------------------------------------
111// choicebook event class and related stuff
112// ----------------------------------------------------------------------------
113
3e97a905 114// wxChoicebookEvent is obsolete and defined for compatibility only
586bed94 115#define wxChoicebookEvent wxBookCtrlEvent
3e97a905
VZ
116typedef wxBookCtrlEventFunction wxChoicebookEventFunction;
117#define wxChoicebookEventHandler(func) wxBookCtrlEventHandler(func)
7fa03f04 118
d94c09cd 119#define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \
3e97a905 120 wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
7fa03f04 121
d94c09cd 122#define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \
3e97a905 123 wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
f5e0b4bc
WS
124
125#endif // wxUSE_CHOICEBOOK
126
127#endif // _WX_CHOICEBOOK_H_