1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/gtk1/radiobox.h
3 // Purpose:
4 // Author:      Robert Roebling
5 // Id:          $Id: radiobox.h 38319 2006-03-23 22:05:23Z VZ $
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
wxRadioBox()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 unsigned int GetCount() const;
85 
86     virtual wxString GetString(unsigned int n) const;
87     virtual void SetString(unsigned 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(unsigned int n, bool show = true);
95     virtual bool Enable(unsigned int n, bool enable = true);
96 
97     virtual bool IsItemEnabled(unsigned int n) const;
98     virtual bool IsItemShown(unsigned 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     void DoApplyWidgetStyle(GtkRcStyle *style);
118 #if wxUSE_TOOLTIPS
119     void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
120 #endif // wxUSE_TOOLTIPS
121 
122     virtual void OnInternalIdle();
123 
124     bool             m_hasFocus,
125                      m_lostFocus;
126     wxList           m_boxes;
127 
128 protected:
129     // common part of all ctors
130     void Init();
131 
132 private:
133     DECLARE_DYNAMIC_CLASS(wxRadioBox)
134 };
135 
136 #endif // _WX_GTK_RADIOBOX_H_
137