]>
Commit | Line | Data |
---|---|---|
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 | ||
10 | ||
11 | #ifndef __GTKRADIOBOXH__ | |
12 | #define __GTKRADIOBOXH__ | |
13 | ||
12028905 | 14 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
c801d85f KB |
15 | #pragma interface |
16 | #endif | |
17 | ||
c801d85f KB |
18 | #include "wx/bitmap.h" |
19 | ||
c801d85f KB |
20 | //----------------------------------------------------------------------------- |
21 | // wxRadioBox | |
22 | //----------------------------------------------------------------------------- | |
23 | ||
24 | class wxRadioBox: public wxControl | |
25 | { | |
0de9b5b2 | 26 | public: |
f6bcfd97 BP |
27 | wxRadioBox() { Init(); } |
28 | wxRadioBox(wxWindow *parent, | |
29 | wxWindowID id, | |
30 | const wxString& title, | |
31 | const wxPoint& pos = wxDefaultPosition, | |
32 | const wxSize& size = wxDefaultSize, | |
33 | int n = 0, | |
34 | const wxString choices[] = (const wxString *) NULL, | |
35 | int majorDim = 1, | |
36 | long style = wxRA_HORIZONTAL, | |
c8531822 | 37 | const wxValidator& val = wxDefaultValidator, |
f6bcfd97 | 38 | const wxString& name = wxRadioBoxNameStr) |
6de97a3b | 39 | { |
f6bcfd97 BP |
40 | Init(); |
41 | ||
42 | Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name ); | |
6de97a3b | 43 | } |
584ad2a3 MB |
44 | wxRadioBox(wxWindow *parent, |
45 | wxWindowID id, | |
46 | const wxString& title, | |
47 | const wxPoint& pos, | |
48 | const wxSize& size, | |
49 | const wxArrayString& choices, | |
50 | int majorDim = 1, | |
51 | long style = wxRA_HORIZONTAL, | |
52 | const wxValidator& val = wxDefaultValidator, | |
53 | const wxString& name = wxRadioBoxNameStr) | |
54 | { | |
55 | Init(); | |
56 | ||
57 | Create( parent, id, title, pos, size, choices, majorDim, style, val, name ); | |
58 | } | |
f6bcfd97 | 59 | |
6b0d8a01 | 60 | virtual ~wxRadioBox(); |
f6bcfd97 BP |
61 | bool Create(wxWindow *parent, |
62 | wxWindowID id, | |
63 | const wxString& title, | |
64 | const wxPoint& pos = wxDefaultPosition, | |
65 | const wxSize& size = wxDefaultSize, | |
66 | int n = 0, | |
67 | const wxString choices[] = (const wxString *) NULL, | |
68 | int majorDim = 0, | |
69 | long style = wxRA_HORIZONTAL, | |
c8531822 | 70 | const wxValidator& val = wxDefaultValidator, |
f6bcfd97 | 71 | const wxString& name = wxRadioBoxNameStr); |
584ad2a3 MB |
72 | bool Create(wxWindow *parent, |
73 | wxWindowID id, | |
74 | const wxString& title, | |
75 | const wxPoint& pos, | |
76 | const wxSize& size, | |
77 | const wxArrayString& choices, | |
78 | int majorDim = 0, | |
79 | long style = wxRA_HORIZONTAL, | |
80 | const wxValidator& val = wxDefaultValidator, | |
81 | const wxString& name = wxRadioBoxNameStr); | |
f6bcfd97 | 82 | |
c801d85f | 83 | int FindString( const wxString& s) const; |
debe6624 | 84 | void SetSelection( int n ); |
0de9b5b2 | 85 | int GetSelection() const; |
c8531822 | 86 | |
debe6624 | 87 | wxString GetString( int n ) const; |
0b06ac1f | 88 | void SetString( int n, const wxString& label ); |
c8531822 | 89 | |
0de9b5b2 | 90 | void Show( int item, bool show ); |
debe6624 | 91 | void Enable( int item, bool enable ); |
c8531822 | 92 | |
0de9b5b2 | 93 | virtual wxString GetStringSelection() const; |
c801d85f | 94 | virtual bool SetStringSelection( const wxString& s ); |
c8531822 VZ |
95 | |
96 | int GetCount() const; | |
c8531822 VZ |
97 | |
98 | // for compatibility only, don't use these methods in new code! | |
99 | #if WXWIN_COMPATIBILITY_2_2 | |
100 | int Number() const { return GetCount(); } | |
101 | wxString GetLabel(int n) const { return GetString(n); } | |
0b06ac1f VZ |
102 | void SetLabel( int item, const wxString& label ) |
103 | { SetString(item, label); } | |
c8531822 VZ |
104 | #endif // WXWIN_COMPATIBILITY_2_2 |
105 | ||
106 | // we have to override those to avoid virtual function name hiding | |
6b0d8a01 VZ |
107 | virtual wxString GetLabel() const { return wxControl::GetLabel(); } |
108 | virtual void SetLabel( const wxString& label ); | |
109 | virtual bool Show( bool show = TRUE ); | |
110 | virtual bool Enable( bool enable = TRUE ); | |
c8531822 | 111 | |
9d522606 RD |
112 | static wxVisualAttributes |
113 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
114 | ||
72a7edf0 RR |
115 | // implementation |
116 | // -------------- | |
c8531822 | 117 | |
72a7edf0 RR |
118 | void SetFocus(); |
119 | void GtkDisableEvents(); | |
120 | void GtkEnableEvents(); | |
b4071e91 | 121 | bool IsOwnGtkWindow( GdkWindow *window ); |
f40fdaa3 | 122 | void DoApplyWidgetStyle(GtkRcStyle *style); |
72a7edf0 RR |
123 | #if wxUSE_TOOLTIPS |
124 | void ApplyToolTip( GtkTooltips *tips, const wxChar *tip ); | |
125 | #endif // wxUSE_TOOLTIPS | |
c4ca49cd VZ |
126 | |
127 | // reposition the radio buttons correctly unless justCalc == true and | |
34621cc5 | 128 | // return the total size needed to accommodate them |
c4ca49cd | 129 | wxSize LayoutItems(bool justCalc) const; |
f6bcfd97 BP |
130 | |
131 | virtual void DoSetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO ); | |
132 | virtual void OnInternalIdle(); | |
c8531822 | 133 | |
f6bcfd97 BP |
134 | bool m_hasFocus, |
135 | m_lostFocus; | |
d3b4d113 | 136 | int m_majorDim; |
d6d1892b | 137 | wxList m_boxes; |
f6bcfd97 BP |
138 | |
139 | protected: | |
c4ca49cd VZ |
140 | // implement some base class methods |
141 | virtual wxSize DoGetBestSize() const; | |
142 | ||
f6bcfd97 BP |
143 | // common part of all ctors |
144 | void Init(); | |
145 | ||
54517652 RR |
146 | private: |
147 | DECLARE_DYNAMIC_CLASS(wxRadioBox) | |
c801d85f KB |
148 | }; |
149 | ||
150 | #endif // __GTKRADIOBOXH__ |