]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/gtk/radiobox.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Id: $Id$ | |
6 | // Copyright: (c) 1998 Robert Roebling | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef _WX_GTK_RADIOBOX_H_ | |
11 | #define _WX_GTK_RADIOBOX_H_ | |
12 | ||
13 | #include "wx/bitmap.h" | |
14 | ||
15 | //----------------------------------------------------------------------------- | |
16 | // wxRadioBox | |
17 | //----------------------------------------------------------------------------- | |
18 | ||
19 | class WXDLLIMPEXP_CORE wxRadioBox : public wxControl, | |
20 | public wxRadioBoxBase | |
21 | { | |
22 | public: | |
23 | // ctors and dtor | |
24 | wxRadioBox() { Init(); } | |
25 | wxRadioBox(wxWindow *parent, | |
26 | wxWindowID id, | |
27 | const wxString& title, | |
28 | const wxPoint& pos = wxDefaultPosition, | |
29 | const wxSize& size = wxDefaultSize, | |
30 | int n = 0, | |
31 | const wxString choices[] = (const wxString *) NULL, | |
32 | int majorDim = 1, | |
33 | long style = wxRA_HORIZONTAL, | |
34 | const wxValidator& val = wxDefaultValidator, | |
35 | const wxString& name = wxRadioBoxNameStr) | |
36 | { | |
37 | Init(); | |
38 | ||
39 | Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name ); | |
40 | } | |
41 | ||
42 | wxRadioBox(wxWindow *parent, | |
43 | wxWindowID id, | |
44 | const wxString& title, | |
45 | const wxPoint& pos, | |
46 | const wxSize& size, | |
47 | const wxArrayString& choices, | |
48 | int majorDim = 1, | |
49 | long style = wxRA_HORIZONTAL, | |
50 | const wxValidator& val = wxDefaultValidator, | |
51 | const wxString& name = wxRadioBoxNameStr) | |
52 | { | |
53 | Init(); | |
54 | ||
55 | Create( parent, id, title, pos, size, choices, majorDim, style, val, name ); | |
56 | } | |
57 | ||
58 | bool Create(wxWindow *parent, | |
59 | wxWindowID id, | |
60 | const wxString& title, | |
61 | const wxPoint& pos = wxDefaultPosition, | |
62 | const wxSize& size = wxDefaultSize, | |
63 | int n = 0, | |
64 | const wxString choices[] = (const wxString *) NULL, | |
65 | int majorDim = 0, | |
66 | long style = wxRA_HORIZONTAL, | |
67 | const wxValidator& val = wxDefaultValidator, | |
68 | const wxString& name = wxRadioBoxNameStr); | |
69 | bool Create(wxWindow *parent, | |
70 | wxWindowID id, | |
71 | const wxString& title, | |
72 | const wxPoint& pos, | |
73 | const wxSize& size, | |
74 | const wxArrayString& choices, | |
75 | int majorDim = 0, | |
76 | long style = wxRA_HORIZONTAL, | |
77 | const wxValidator& val = wxDefaultValidator, | |
78 | const wxString& name = wxRadioBoxNameStr); | |
79 | ||
80 | virtual ~wxRadioBox(); | |
81 | ||
82 | ||
83 | // implement wxItemContainerImmutable methods | |
84 | virtual size_t GetCount() const; | |
85 | ||
86 | virtual wxString GetString(int n) const; | |
87 | virtual void SetString(int n, const wxString& s); | |
88 | ||
89 | virtual void SetSelection(int n); | |
90 | virtual int GetSelection() const; | |
91 | ||
92 | ||
93 | // implement wxRadioBoxBase methods | |
94 | virtual bool Show(int n, bool show = true); | |
95 | virtual bool Enable(int n, bool enable = true); | |
96 | ||
97 | virtual bool IsItemEnabled(int n) const; | |
98 | virtual bool IsItemShown(int n) const; | |
99 | ||
100 | ||
101 | // override some base class methods to operate on radiobox itself too | |
102 | virtual bool Show( bool show = true ); | |
103 | virtual bool Enable( bool enable = true ); | |
104 | ||
105 | virtual void SetLabel( const wxString& label ); | |
106 | ||
107 | static wxVisualAttributes | |
108 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
109 | ||
110 | // implementation | |
111 | // -------------- | |
112 | ||
113 | void SetFocus(); | |
114 | void GtkDisableEvents(); | |
115 | void GtkEnableEvents(); | |
116 | bool IsOwnGtkWindow( GdkWindow *window ); | |
117 | #if wxUSE_TOOLTIPS | |
118 | void ApplyToolTip( GtkTooltips *tips, const wxChar *tip ); | |
119 | #endif // wxUSE_TOOLTIPS | |
120 | ||
121 | virtual void OnInternalIdle(); | |
122 | ||
123 | bool m_hasFocus, | |
124 | m_lostFocus; | |
125 | wxList m_boxes; | |
126 | ||
127 | protected: | |
128 | void DoApplyWidgetStyle(GtkRcStyle *style); | |
129 | ||
130 | virtual bool GTKWidgetNeedsMnemonic() const; | |
131 | virtual void GTKWidgetDoSetMnemonic(GtkWidget* w); | |
132 | ||
133 | // common part of all ctors | |
134 | void Init(); | |
135 | ||
136 | private: | |
137 | DECLARE_DYNAMIC_CLASS(wxRadioBox) | |
138 | }; | |
139 | ||
140 | #endif // _WX_GTK_RADIOBOX_H_ |