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