]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/radiobox.h
new options: wxUSE_OLE (on by default except for some compilers),
[wxWidgets.git] / include / wx / msw / radiobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: radiobox.h
3 // Purpose: wxRadioBox class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_RADIOBOX_H_
13 #define _WX_RADIOBOX_H_
14
15 #ifdef __GNUG__
16 #pragma interface "radiobox.h"
17 #endif
18
19 #include "wx/control.h"
20
21 WXDLLEXPORT_DATA(extern const char*) wxRadioBoxNameStr;
22
23 // List box item
24 class WXDLLEXPORT wxBitmap ;
25
26 class WXDLLEXPORT wxRadioBox : public wxControl
27 {
28 DECLARE_DYNAMIC_CLASS(wxRadioBox)
29
30 public:
31 wxRadioBox();
32
33 #if WXWIN_COMPATIBILITY
34 wxRadioBox(wxWindow *parent, wxFunction func, const char *title,
35 int x = -1, int y = -1, int width = -1, int height = -1,
36 int n = 0, char **choices = NULL,
37 int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr);
38
39 /*
40 inline wxRadioBox(wxWindow *parent, wxFunction func, const char *title,
41 int x, int y, int width, int height,
42 int n, wxBitmap **choices,
43 int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr)
44 {
45 Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), n, (const wxBitmap **)choices, majorDim, style,
46 wxDefaultValidator, name);
47 Callback(func);
48 }
49 */
50 #endif // WXWIN_COMPATIBILITY
51
52 wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
53 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
54 int n = 0, const wxString choices[] = NULL,
55 int majorDim = 0, long style = wxRA_HORIZONTAL,
56 const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr)
57 {
58 Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
59 }
60
61 /*
62 wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
63 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
64 int n = 0, const wxBitmap *choices[] = NULL,
65 int majorDim = 0, long style = wxRA_HORIZONTAL,
66 const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr)
67 {
68 Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
69 }
70 */
71
72 ~wxRadioBox();
73
74 bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
75 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
76 int n = 0, const wxString choices[] = NULL,
77 int majorDim = 0, long style = wxRA_HORIZONTAL,
78 const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
79
80 /*
81 bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
82 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
83 int n = 0, const wxBitmap *choices[] = NULL,
84 int majorDim = 0, long style = wxRA_HORIZONTAL,
85 const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
86 */
87
88 virtual bool MSWCommand(WXUINT param, WXWORD id);
89 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
90 WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
91
92 int FindString(const wxString& s) const;
93 void SetSelection(int N);
94 int GetSelection() const;
95 wxString GetString(int N) const;
96
97 void GetSize(int *x, int *y) const;
98 void GetPosition(int *x, int *y) const;
99
100 wxString GetLabel() const;
101 void SetLabel(const wxString& label);
102 void SetLabel(int item, const wxString& label) ;
103 void SetLabel(int item, wxBitmap *bitmap) ;
104 wxString GetLabel(int item) const;
105 bool Show(bool show);
106 void SetFocus();
107 void Enable(bool enable);
108 void Enable(int item, bool enable);
109 void Show(int item, bool show) ;
110 void SetLabelFont(const wxFont& WXUNUSED(font)) {};
111 void SetButtonFont(const wxFont& font) { SetFont(font); }
112
113 virtual wxString GetStringSelection() const;
114 virtual bool SetStringSelection(const wxString& s);
115 virtual int Number() const { return m_noItems; } ;
116 void Command(wxCommandEvent& event);
117
118 int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
119 void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
120
121 // Implementation
122 WXHWND *GetRadioButtons() const { return m_radioButtons; }
123 bool ContainsHWND(WXHWND hWnd) const ;
124
125 long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
126
127 protected:
128 WXHWND * m_radioButtons;
129 int m_majorDim ;
130 int * m_radioWidth ; // for bitmaps
131 int * m_radioHeight ;
132
133 int m_noItems;
134 int m_noRowsOrCols;
135 int m_selectedButton;
136
137 virtual void DoSetSize(int x, int y,
138 int width, int height,
139 int sizeFlags = wxSIZE_AUTO);
140 };
141
142 #endif
143 // _WX_RADIOBOX_H_