]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/radiobox.h
use common AllocExclusive, rather than custom code
[wxWidgets.git] / include / wx / gtk / radiobox.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
6b0d8a01 2// Name: wx/gtk/radiobox.h
c801d85f
KB
3// Purpose:
4// Author: Robert Roebling
58614078
RR
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
65571936 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
27c78e45
VZ
10#ifndef _WX_GTK_RADIOBOX_H_
11#define _WX_GTK_RADIOBOX_H_
c801d85f 12
c801d85f
KB
13#include "wx/bitmap.h"
14
dc26eeb3
VZ
15class WXDLLIMPEXP_CORE wxGTKRadioButtonInfo;
16
17#include "wx/list.h"
18
a10a31ce 19WX_DECLARE_EXPORTED_LIST(wxGTKRadioButtonInfo, wxRadioBoxButtonsInfoList);
dc26eeb3
VZ
20
21
c801d85f
KB
22//-----------------------------------------------------------------------------
23// wxRadioBox
24//-----------------------------------------------------------------------------
25
27c78e45
VZ
26class WXDLLIMPEXP_CORE wxRadioBox : public wxControl,
27 public wxRadioBoxBase
c801d85f 28{
0de9b5b2 29public:
27c78e45 30 // ctors and dtor
f6bcfd97
BP
31 wxRadioBox() { Init(); }
32 wxRadioBox(wxWindow *parent,
33 wxWindowID id,
34 const wxString& title,
35 const wxPoint& pos = wxDefaultPosition,
36 const wxSize& size = wxDefaultSize,
37 int n = 0,
38 const wxString choices[] = (const wxString *) NULL,
39 int majorDim = 1,
40 long style = wxRA_HORIZONTAL,
c8531822 41 const wxValidator& val = wxDefaultValidator,
f6bcfd97 42 const wxString& name = wxRadioBoxNameStr)
6de97a3b 43 {
f6bcfd97
BP
44 Init();
45
46 Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
6de97a3b 47 }
27c78e45 48
584ad2a3
MB
49 wxRadioBox(wxWindow *parent,
50 wxWindowID id,
51 const wxString& title,
52 const wxPoint& pos,
53 const wxSize& size,
54 const wxArrayString& choices,
55 int majorDim = 1,
56 long style = wxRA_HORIZONTAL,
57 const wxValidator& val = wxDefaultValidator,
58 const wxString& name = wxRadioBoxNameStr)
59 {
60 Init();
61
62 Create( parent, id, title, pos, size, choices, majorDim, style, val, name );
63 }
f6bcfd97 64
f6bcfd97
BP
65 bool Create(wxWindow *parent,
66 wxWindowID id,
67 const wxString& title,
68 const wxPoint& pos = wxDefaultPosition,
69 const wxSize& size = wxDefaultSize,
70 int n = 0,
71 const wxString choices[] = (const wxString *) NULL,
72 int majorDim = 0,
73 long style = wxRA_HORIZONTAL,
c8531822 74 const wxValidator& val = wxDefaultValidator,
f6bcfd97 75 const wxString& name = wxRadioBoxNameStr);
584ad2a3
MB
76 bool Create(wxWindow *parent,
77 wxWindowID id,
78 const wxString& title,
79 const wxPoint& pos,
80 const wxSize& size,
81 const wxArrayString& choices,
82 int majorDim = 0,
83 long style = wxRA_HORIZONTAL,
84 const wxValidator& val = wxDefaultValidator,
85 const wxString& name = wxRadioBoxNameStr);
f6bcfd97 86
27c78e45
VZ
87 virtual ~wxRadioBox();
88
c8531822 89
27c78e45 90 // implement wxItemContainerImmutable methods
aa61d352 91 virtual unsigned int GetCount() const;
c8531822 92
aa61d352
VZ
93 virtual wxString GetString(unsigned int n) const;
94 virtual void SetString(unsigned int n, const wxString& s);
c8531822 95
27c78e45
VZ
96 virtual void SetSelection(int n);
97 virtual int GetSelection() const;
c8531822 98
c8531822 99
27c78e45 100 // implement wxRadioBoxBase methods
aa61d352
VZ
101 virtual bool Show(unsigned int n, bool show = true);
102 virtual bool Enable(unsigned int n, bool enable = true);
27c78e45 103
aa61d352
VZ
104 virtual bool IsItemEnabled(unsigned int n) const;
105 virtual bool IsItemShown(unsigned int n) const;
27c78e45
VZ
106
107
108 // override some base class methods to operate on radiobox itself too
b4efc9b9
WS
109 virtual bool Show( bool show = true );
110 virtual bool Enable( bool enable = true );
c8531822 111
27c78e45
VZ
112 virtual void SetLabel( const wxString& label );
113
9d522606
RD
114 static wxVisualAttributes
115 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
116
dc26eeb3
VZ
117 virtual int GetItemFromPoint( const wxPoint& pt ) const;
118#if wxUSE_HELP
119 // override virtual wxWindow::GetHelpTextAtPoint to use common platform independent
120 // wxRadioBoxBase::DoGetHelpTextAtPoint from the platform independent
121 // base class-interface wxRadioBoxBase.
122 virtual wxString GetHelpTextAtPoint(const wxPoint & pt, wxHelpEvent::Origin origin) const
123 {
124 return wxRadioBoxBase::DoGetHelpTextAtPoint( this, pt, origin );
125 }
126#endif // wxUSE_HELP
127
72a7edf0
RR
128 // implementation
129 // --------------
c8531822 130
72a7edf0
RR
131 void SetFocus();
132 void GtkDisableEvents();
133 void GtkEnableEvents();
72a7edf0
RR
134#if wxUSE_TOOLTIPS
135 void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
136#endif // wxUSE_TOOLTIPS
c4ca49cd 137
f6bcfd97 138 virtual void OnInternalIdle();
c8531822 139
dc26eeb3
VZ
140 bool m_hasFocus,
141 m_lostFocus;
142 wxRadioBoxButtonsInfoList m_buttonsInfo;
f6bcfd97
BP
143
144protected:
aa1e6de9
VZ
145#if wxUSE_TOOLTIPS
146 virtual void DoSetItemToolTip(unsigned int n, wxToolTip *tooltip);
147#endif
148
ef5c70f9
VZ
149 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
150 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
6f02a879 151
2e1f5012
VZ
152 virtual bool GTKWidgetNeedsMnemonic() const;
153 virtual void GTKWidgetDoSetMnemonic(GtkWidget* w);
154
f6bcfd97
BP
155 // common part of all ctors
156 void Init();
157
54517652
RR
158private:
159 DECLARE_DYNAMIC_CLASS(wxRadioBox)
c801d85f
KB
160};
161
27c78e45 162#endif // _WX_GTK_RADIOBOX_H_