]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/radiobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/radiobox.h
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #ifndef __GTKRADIOBOXH__
12 #define __GTKRADIOBOXH__
14 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
18 #include "wx/bitmap.h"
20 //-----------------------------------------------------------------------------
22 //-----------------------------------------------------------------------------
24 class wxRadioBox
: public wxControl
27 wxRadioBox() { Init(); }
28 wxRadioBox(wxWindow
*parent
,
30 const wxString
& title
,
31 const wxPoint
& pos
= wxDefaultPosition
,
32 const wxSize
& size
= wxDefaultSize
,
34 const wxString choices
[] = (const wxString
*) NULL
,
36 long style
= wxRA_HORIZONTAL
,
37 const wxValidator
& val
= wxDefaultValidator
,
38 const wxString
& name
= wxRadioBoxNameStr
)
42 Create( parent
, id
, title
, pos
, size
, n
, choices
, majorDim
, style
, val
, name
);
44 wxRadioBox(wxWindow
*parent
,
46 const wxString
& title
,
49 const wxArrayString
& choices
,
51 long style
= wxRA_HORIZONTAL
,
52 const wxValidator
& val
= wxDefaultValidator
,
53 const wxString
& name
= wxRadioBoxNameStr
)
57 Create( parent
, id
, title
, pos
, size
, choices
, majorDim
, style
, val
, name
);
60 virtual ~wxRadioBox();
61 bool Create(wxWindow
*parent
,
63 const wxString
& title
,
64 const wxPoint
& pos
= wxDefaultPosition
,
65 const wxSize
& size
= wxDefaultSize
,
67 const wxString choices
[] = (const wxString
*) NULL
,
69 long style
= wxRA_HORIZONTAL
,
70 const wxValidator
& val
= wxDefaultValidator
,
71 const wxString
& name
= wxRadioBoxNameStr
);
72 bool Create(wxWindow
*parent
,
74 const wxString
& title
,
77 const wxArrayString
& choices
,
79 long style
= wxRA_HORIZONTAL
,
80 const wxValidator
& val
= wxDefaultValidator
,
81 const wxString
& name
= wxRadioBoxNameStr
);
83 int FindString( const wxString
& s
) const;
84 void SetSelection( int n
);
85 int GetSelection() const;
87 wxString
GetString( int n
) const;
88 void SetString( int n
, const wxString
& label
);
90 void Show( int item
, bool show
);
91 void Enable( int item
, bool enable
);
93 virtual wxString
GetStringSelection() const;
94 virtual bool SetStringSelection( const wxString
& s
);
97 int GetNumberOfRowsOrCols() const;
98 void SetNumberOfRowsOrCols( int n
);
100 // for compatibility only, don't use these methods in new code!
101 #if WXWIN_COMPATIBILITY_2_2
102 int Number() const { return GetCount(); }
103 wxString
GetLabel(int n
) const { return GetString(n
); }
104 void SetLabel( int item
, const wxString
& label
)
105 { SetString(item
, label
); }
106 #endif // WXWIN_COMPATIBILITY_2_2
108 // we have to override those to avoid virtual function name hiding
109 virtual wxString
GetLabel() const { return wxControl::GetLabel(); }
110 virtual void SetLabel( const wxString
& label
);
111 virtual bool Show( bool show
= TRUE
);
112 virtual bool Enable( bool enable
= TRUE
);
114 static wxVisualAttributes
115 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
121 void GtkDisableEvents();
122 void GtkEnableEvents();
123 bool IsOwnGtkWindow( GdkWindow
*window
);
124 void DoApplyWidgetStyle(GtkRcStyle
*style
);
126 void ApplyToolTip( GtkTooltips
*tips
, const wxChar
*tip
);
127 #endif // wxUSE_TOOLTIPS
129 // reposition the radio buttons correctly unless justCalc == true and
130 // return the total size needed to accommodate them
131 wxSize
LayoutItems(bool justCalc
) const;
133 virtual void DoSetSize( int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
134 virtual void OnInternalIdle();
142 // implement some base class methods
143 virtual wxSize
DoGetBestSize() const;
145 // common part of all ctors
149 DECLARE_DYNAMIC_CLASS(wxRadioBox
)
152 #endif // __GTKRADIOBOXH__