]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/radiobox.h
Warning fix (instead of silencing int->short with typecast, have the same type intern...
[wxWidgets.git] / include / wx / gtk1 / radiobox.h
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 __GTKRADIOBOXH__
11 #define __GTKRADIOBOXH__
12
13 #include "wx/bitmap.h"
14
15 //-----------------------------------------------------------------------------
16 // wxRadioBox
17 //-----------------------------------------------------------------------------
18
19 class WXDLLIMPEXP_CORE wxRadioBox: public wxControl
20 {
21 public:
22 wxRadioBox() { Init(); }
23 wxRadioBox(wxWindow *parent,
24 wxWindowID id,
25 const wxString& title,
26 const wxPoint& pos = wxDefaultPosition,
27 const wxSize& size = wxDefaultSize,
28 int n = 0,
29 const wxString choices[] = (const wxString *) NULL,
30 int majorDim = 1,
31 long style = wxRA_HORIZONTAL,
32 const wxValidator& val = wxDefaultValidator,
33 const wxString& name = wxRadioBoxNameStr)
34 {
35 Init();
36
37 Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
38 }
39 wxRadioBox(wxWindow *parent,
40 wxWindowID id,
41 const wxString& title,
42 const wxPoint& pos,
43 const wxSize& size,
44 const wxArrayString& choices,
45 int majorDim = 1,
46 long style = wxRA_HORIZONTAL,
47 const wxValidator& val = wxDefaultValidator,
48 const wxString& name = wxRadioBoxNameStr)
49 {
50 Init();
51
52 Create( parent, id, title, pos, size, choices, majorDim, style, val, name );
53 }
54
55 virtual ~wxRadioBox();
56 bool Create(wxWindow *parent,
57 wxWindowID id,
58 const wxString& title,
59 const wxPoint& pos = wxDefaultPosition,
60 const wxSize& size = wxDefaultSize,
61 int n = 0,
62 const wxString choices[] = (const wxString *) NULL,
63 int majorDim = 0,
64 long style = wxRA_HORIZONTAL,
65 const wxValidator& val = wxDefaultValidator,
66 const wxString& name = wxRadioBoxNameStr);
67 bool Create(wxWindow *parent,
68 wxWindowID id,
69 const wxString& title,
70 const wxPoint& pos,
71 const wxSize& size,
72 const wxArrayString& choices,
73 int majorDim = 0,
74 long style = wxRA_HORIZONTAL,
75 const wxValidator& val = wxDefaultValidator,
76 const wxString& name = wxRadioBoxNameStr);
77
78 virtual int FindString(const wxString& s, bool bCase = false) const;
79 void SetSelection( int n );
80 int GetSelection() const;
81
82 wxString GetString( int n ) const;
83 void SetString( int n, const wxString& label );
84
85 virtual bool Show( int item, bool show = true );
86 virtual bool Enable( int item, bool enable = true );
87
88 virtual wxString GetStringSelection() const;
89 virtual bool SetStringSelection( const wxString& s );
90
91 int GetCount() const;
92
93 // we have to override those to avoid virtual function name hiding
94 virtual wxString GetLabel() const { return wxControl::GetLabel(); }
95 virtual void SetLabel( const wxString& label );
96 virtual bool Show( bool show = true );
97 virtual bool Enable( bool enable = true );
98
99 static wxVisualAttributes
100 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
101
102 // implementation
103 // --------------
104
105 void SetFocus();
106 void GtkDisableEvents();
107 void GtkEnableEvents();
108 bool IsOwnGtkWindow( GdkWindow *window );
109 void DoApplyWidgetStyle(GtkRcStyle *style);
110 #if wxUSE_TOOLTIPS
111 void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
112 #endif // wxUSE_TOOLTIPS
113
114 virtual void OnInternalIdle();
115
116 bool m_hasFocus,
117 m_lostFocus;
118 int m_majorDim;
119 wxList m_boxes;
120
121 protected:
122 // common part of all ctors
123 void Init();
124
125 // check that the index is valid
126 // FIXME: remove once GTK will derive from wxRadioBoxBase
127 inline bool IsValid(int n) const { return n >= 0 && n < GetCount(); }
128
129 private:
130 DECLARE_DYNAMIC_CLASS(wxRadioBox)
131 };
132
133 #endif // __GTKRADIOBOXH__