]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: radiobox.h | |
3 | // Purpose: wxRadioBox class | |
cdf1e714 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
cdf1e714 | 6 | // Created: 10/12/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
cdf1e714 DW |
8 | // Copyright: (c) David Webster |
9 | // Licence: wxWindows licence | |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_RADIOBOX_H_ | |
13 | #define _WX_RADIOBOX_H_ | |
14 | ||
54da4255 | 15 | WXDLLEXPORT_DATA(extern const char*) wxRadioBoxNameStr; |
0e320a79 DW |
16 | |
17 | // List box item | |
54da4255 | 18 | class WXDLLEXPORT wxBitmap ; |
0e320a79 | 19 | |
210a651b | 20 | class WXDLLEXPORT wxRadioBox: public wxControl, public wxRadioBoxBase |
0e320a79 | 21 | { |
54da4255 | 22 | DECLARE_DYNAMIC_CLASS(wxRadioBox) |
0e320a79 | 23 | public: |
54da4255 DW |
24 | wxRadioBox(); |
25 | ||
26 | inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, | |
27 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
28 | int n = 0, const wxString choices[] = NULL, | |
29 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
57c4d796 | 30 | #if wxUSE_VALIDATORS |
54da4255 | 31 | const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr) |
57c4d796 | 32 | #endif |
54da4255 DW |
33 | { |
34 | Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); | |
35 | } | |
36 | ||
37 | ~wxRadioBox(); | |
38 | ||
39 | bool Create(wxWindow *parent, wxWindowID id, const wxString& title, | |
40 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
41 | int n = 0, const wxString choices[] = NULL, | |
42 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
57c4d796 | 43 | #if wxUSE_VALIDATORS |
54da4255 | 44 | const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); |
57c4d796 | 45 | #endif |
54da4255 | 46 | |
cdf1e714 | 47 | virtual bool OS2Command(WXUINT param, WXWORD id); |
11e59d47 DW |
48 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, |
49 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
cdf1e714 | 50 | |
54da4255 DW |
51 | int FindString(const wxString& s) const; |
52 | void SetSelection(int N); | |
53 | int GetSelection() const; | |
210a651b | 54 | virtual int GetCount() const; |
54da4255 | 55 | wxString GetString(int N) const; |
210a651b DW |
56 | virtual void SetString(int n, const wxString& label); |
57 | virtual int GetColumnCount() const; | |
58 | virtual int GetRowCount() const; | |
cdf1e714 | 59 | |
54da4255 DW |
60 | void GetSize(int *x, int *y) const; |
61 | void GetPosition(int *x, int *y) const; | |
cdf1e714 | 62 | |
11e59d47 DW |
63 | void SetLabel(int item, const wxString& label); |
64 | void SetLabel(int item, wxBitmap *bitmap); | |
54da4255 DW |
65 | wxString GetLabel(int item) const; |
66 | bool Show(bool show); | |
67 | void SetFocus(); | |
68 | bool Enable(bool enable); | |
69 | void Enable(int item, bool enable); | |
70 | void Show(int item, bool show) ; | |
71 | inline void SetLabelFont(const wxFont& WXUNUSED(font)) {}; | |
72 | inline void SetButtonFont(const wxFont& font) { SetFont(font); } | |
73 | ||
74 | virtual wxString GetStringSelection() const; | |
75 | virtual bool SetStringSelection(const wxString& s); | |
76 | inline virtual int Number() const { return m_noItems; } ; | |
77 | void Command(wxCommandEvent& event); | |
78 | ||
79 | inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } | |
80 | inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } | |
0e320a79 | 81 | |
11e59d47 DW |
82 | // implementation only from now on |
83 | // ------------------------------- | |
84 | ||
85 | WXHWND *GetRadioButtons() const { return m_radioButtons; } | |
86 | bool ContainsHWND(WXHWND hWnd) const; | |
87 | void SendNotificationEvent(); | |
88 | ||
89 | // get the number of buttons per column/row | |
90 | int GetNumVer() const; | |
91 | int GetNumHor() const; | |
92 | ||
93 | #if WXWIN_COMPATIBILITY | |
94 | wxRadioBox(wxWindow *parent, wxFunction func, const char *title, | |
95 | int x = -1, int y = -1, int width = -1, int height = -1, | |
96 | int n = 0, char **choices = NULL, | |
97 | int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr); | |
98 | #endif // WXWIN_COMPATIBILITY | |
99 | ||
0e320a79 | 100 | protected: |
cdf1e714 DW |
101 | void SubclassRadioButton(WXHWND hWndBtn); |
102 | ||
54da4255 | 103 | WXHWND * m_radioButtons; |
54da4255 | 104 | int m_majorDim ; |
cdf1e714 DW |
105 | int * m_radioWidth; // for bitmaps |
106 | int * m_radioHeight; | |
107 | ||
54da4255 DW |
108 | int m_noItems; |
109 | int m_noRowsOrCols; | |
110 | int m_selectedButton; | |
0e320a79 | 111 | |
cdf1e714 DW |
112 | virtual void DoSetSize(int x, int y, |
113 | int width, int height, | |
114 | int sizeFlags = wxSIZE_AUTO); | |
11e59d47 DW |
115 | private: |
116 | virtual void SetLabel(const wxString& label) | |
117 | { wxWindowBase::SetLabel(label); } | |
118 | wxString GetLabel() const | |
119 | { return(wxWindowBase::GetLabel()); } | |
0e320a79 DW |
120 | }; |
121 | ||
122 | #endif | |
123 | // _WX_RADIOBOX_H_ |