| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: radiobox.h |
| 3 | // Purpose: |
| 4 | // Author: Robert Roebling |
| 5 | // Id: $Id$ |
| 6 | // Copyright: (c) 1998 Robert Roebling |
| 7 | // Licence: wxWindows licence |
| 8 | ///////////////////////////////////////////////////////////////////////////// |
| 9 | |
| 10 | |
| 11 | #ifndef __GTKRADIOBOXH__ |
| 12 | #define __GTKRADIOBOXH__ |
| 13 | |
| 14 | #ifdef __GNUG__ |
| 15 | #pragma interface |
| 16 | #endif |
| 17 | |
| 18 | #include "wx/defs.h" |
| 19 | #include "wx/object.h" |
| 20 | #include "wx/list.h" |
| 21 | #include "wx/control.h" |
| 22 | #include "wx/bitmap.h" |
| 23 | |
| 24 | //----------------------------------------------------------------------------- |
| 25 | // classes |
| 26 | //----------------------------------------------------------------------------- |
| 27 | |
| 28 | class wxRadioBox; |
| 29 | |
| 30 | //----------------------------------------------------------------------------- |
| 31 | // global data |
| 32 | //----------------------------------------------------------------------------- |
| 33 | |
| 34 | extern const char *wxRadioBoxNameStr; |
| 35 | |
| 36 | //----------------------------------------------------------------------------- |
| 37 | // wxRadioBox |
| 38 | //----------------------------------------------------------------------------- |
| 39 | |
| 40 | class wxRadioBox: public wxControl |
| 41 | { |
| 42 | |
| 43 | DECLARE_DYNAMIC_CLASS(wxRadioBox) |
| 44 | |
| 45 | public: |
| 46 | |
| 47 | wxRadioBox(void); |
| 48 | inline wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title, |
| 49 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
| 50 | int n = 0, const wxString choices[] = (const wxString *) NULL, |
| 51 | int majorDim = 0, long style = wxRA_HORIZONTAL, |
| 52 | const wxValidator& val = wxDefaultValidator, |
| 53 | const wxString& name = wxRadioBoxNameStr ) |
| 54 | { |
| 55 | Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name ); |
| 56 | } |
| 57 | ~wxRadioBox(void); |
| 58 | bool Create( wxWindow *parent, wxWindowID id, const wxString& title, |
| 59 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
| 60 | int n = 0, const wxString choices[] = (const wxString *) NULL, |
| 61 | int majorDim = 0, long style = wxRA_HORIZONTAL, |
| 62 | const wxValidator& val = wxDefaultValidator, |
| 63 | const wxString& name = wxRadioBoxNameStr ); |
| 64 | int FindString( const wxString& s) const; |
| 65 | void SetSelection( int n ); |
| 66 | int GetSelection(void) const; |
| 67 | wxString GetString( int n ) const; |
| 68 | void SetLabel( const wxString& label ); |
| 69 | void SetLabel( int item, const wxString& label ); |
| 70 | void SetLabel( int item, wxBitmap *bitmap ); |
| 71 | wxString GetLabel( int item ) const; |
| 72 | bool Show( bool show ); |
| 73 | void Enable( bool enable ); |
| 74 | void Enable( int item, bool enable ); |
| 75 | void Show( int item, bool show ); |
| 76 | virtual wxString GetStringSelection(void) const; |
| 77 | virtual bool SetStringSelection( const wxString& s ); |
| 78 | virtual int Number(void) const; |
| 79 | int GetNumberOfRowsOrCols(void) const; |
| 80 | void SetNumberOfRowsOrCols( int n ); |
| 81 | |
| 82 | void OnSize( wxSizeEvent &event ); |
| 83 | void SetFocus(); |
| 84 | |
| 85 | // implementation |
| 86 | |
| 87 | bool IsOwnGtkWindow( GdkWindow *window ); |
| 88 | void ApplyWidgetStyle(); |
| 89 | wxSize LayoutItems(); |
| 90 | |
| 91 | bool m_alreadySent; |
| 92 | int m_majorDim; |
| 93 | wxList m_boxes; |
| 94 | |
| 95 | DECLARE_EVENT_TABLE() |
| 96 | }; |
| 97 | |
| 98 | #endif // __GTKRADIOBOXH__ |