]>
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 | |
6b0d8a01 | 7 | // Licence: wxWindows licence |
c801d85f KB |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
10 | ||
11 | #ifndef __GTKRADIOBOXH__ | |
12 | #define __GTKRADIOBOXH__ | |
13 | ||
ab7ce33c | 14 | #if defined(__GNUG__) && !defined(__APPLE__) |
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 | } |
f6bcfd97 | 44 | |
6b0d8a01 | 45 | virtual ~wxRadioBox(); |
f6bcfd97 BP |
46 | bool Create(wxWindow *parent, |
47 | wxWindowID id, | |
48 | const wxString& title, | |
49 | const wxPoint& pos = wxDefaultPosition, | |
50 | const wxSize& size = wxDefaultSize, | |
51 | int n = 0, | |
52 | const wxString choices[] = (const wxString *) NULL, | |
53 | int majorDim = 0, | |
54 | long style = wxRA_HORIZONTAL, | |
c8531822 | 55 | const wxValidator& val = wxDefaultValidator, |
f6bcfd97 BP |
56 | const wxString& name = wxRadioBoxNameStr); |
57 | ||
c801d85f | 58 | int FindString( const wxString& s) const; |
debe6624 | 59 | void SetSelection( int n ); |
0de9b5b2 | 60 | int GetSelection() const; |
c8531822 | 61 | |
debe6624 | 62 | wxString GetString( int n ) const; |
0b06ac1f | 63 | void SetString( int n, const wxString& label ); |
c8531822 | 64 | |
0de9b5b2 | 65 | void Show( int item, bool show ); |
debe6624 | 66 | void Enable( int item, bool enable ); |
c8531822 | 67 | |
0de9b5b2 | 68 | virtual wxString GetStringSelection() const; |
c801d85f | 69 | virtual bool SetStringSelection( const wxString& s ); |
c8531822 VZ |
70 | |
71 | int GetCount() const; | |
0de9b5b2 | 72 | int GetNumberOfRowsOrCols() const; |
debe6624 | 73 | void SetNumberOfRowsOrCols( int n ); |
c8531822 VZ |
74 | |
75 | // for compatibility only, don't use these methods in new code! | |
76 | #if WXWIN_COMPATIBILITY_2_2 | |
77 | int Number() const { return GetCount(); } | |
78 | wxString GetLabel(int n) const { return GetString(n); } | |
0b06ac1f VZ |
79 | void SetLabel( int item, const wxString& label ) |
80 | { SetString(item, label); } | |
c8531822 VZ |
81 | #endif // WXWIN_COMPATIBILITY_2_2 |
82 | ||
83 | // we have to override those to avoid virtual function name hiding | |
6b0d8a01 VZ |
84 | virtual wxString GetLabel() const { return wxControl::GetLabel(); } |
85 | virtual void SetLabel( const wxString& label ); | |
86 | virtual bool Show( bool show = TRUE ); | |
87 | virtual bool Enable( bool enable = TRUE ); | |
c8531822 | 88 | |
72a7edf0 RR |
89 | // implementation |
90 | // -------------- | |
c8531822 | 91 | |
72a7edf0 RR |
92 | void SetFocus(); |
93 | void GtkDisableEvents(); | |
94 | void GtkEnableEvents(); | |
b4071e91 | 95 | bool IsOwnGtkWindow( GdkWindow *window ); |
58614078 | 96 | void ApplyWidgetStyle(); |
72a7edf0 RR |
97 | #if wxUSE_TOOLTIPS |
98 | void ApplyToolTip( GtkTooltips *tips, const wxChar *tip ); | |
99 | #endif // wxUSE_TOOLTIPS | |
d3b4d113 | 100 | wxSize LayoutItems(); |
f6bcfd97 BP |
101 | |
102 | virtual void DoSetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO ); | |
103 | virtual void OnInternalIdle(); | |
c8531822 | 104 | |
f6bcfd97 BP |
105 | bool m_hasFocus, |
106 | m_lostFocus; | |
d3b4d113 | 107 | int m_majorDim; |
d6d1892b | 108 | wxList m_boxes; |
f6bcfd97 BP |
109 | |
110 | protected: | |
111 | // common part of all ctors | |
112 | void Init(); | |
113 | ||
54517652 RR |
114 | private: |
115 | DECLARE_DYNAMIC_CLASS(wxRadioBox) | |
c801d85f KB |
116 | }; |
117 | ||
118 | #endif // __GTKRADIOBOXH__ |