]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/radiobox.h
Applied patch [ 837515 ] wxIPaddress + docs patch
[wxWidgets.git] / include / wx / msw / radiobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "radiobox.h"
17 #endif
18
19 class WXDLLEXPORT wxBitmap;
20
21 // ----------------------------------------------------------------------------
22 // wxRadioBox
23 // ----------------------------------------------------------------------------
24
25 class WXDLLEXPORT wxRadioBox : public wxControl, public wxRadioBoxBase
26 {
27 public:
28 wxRadioBox();
29
30 wxRadioBox(wxWindow *parent,
31 wxWindowID id,
32 const wxString& title,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 int n = 0, const wxString choices[] = NULL,
36 int majorDim = 0,
37 long style = wxRA_HORIZONTAL,
38 const wxValidator& val = wxDefaultValidator,
39 const wxString& name = wxRadioBoxNameStr);
40
41 ~wxRadioBox();
42
43 bool Create(wxWindow *parent,
44 wxWindowID id,
45 const wxString& title,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize,
48 int n = 0, const wxString choices[] = NULL,
49 int majorDim = 0,
50 long style = wxRA_HORIZONTAL,
51 const wxValidator& val = wxDefaultValidator,
52 const wxString& name = wxRadioBoxNameStr);
53
54 // implement the radiobox interface
55 virtual void SetSelection(int n);
56 virtual int GetSelection() const;
57 virtual int GetCount() const;
58 virtual wxString GetString(int n) const;
59 virtual void SetString(int n, const wxString& label);
60 virtual void Enable(int n, bool enable = TRUE);
61 virtual void Show(int n, bool show = TRUE);
62 virtual int GetColumnCount() const;
63 virtual int GetRowCount() const;
64
65 virtual bool Show(bool show = TRUE);
66 void SetFocus();
67 virtual bool Enable(bool enable = TRUE);
68 void SetLabelFont(const wxFont& WXUNUSED(font)) {};
69 void SetButtonFont(const wxFont& font) { SetFont(font); }
70
71 void Command(wxCommandEvent& event);
72
73 int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
74 void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
75
76 // implementation only from now on
77 // -------------------------------
78
79 virtual bool MSWCommand(WXUINT param, WXWORD id);
80
81 // FIXME: are they used? missing "Do" prefix?
82 void GetSize(int *x, int *y) const;
83 void GetPosition(int *x, int *y) const;
84
85 virtual bool SetFont(const wxFont& font);
86
87 long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
88 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
89 WXUINT message,
90 WXWPARAM wParam, WXLPARAM lParam);
91 WXHWND *GetRadioButtons() const { return m_radioButtons; }
92 bool ContainsHWND(WXHWND hWnd) const;
93 void SendNotificationEvent();
94
95 // get the number of buttons per column/row
96 int GetNumVer() const;
97 int GetNumHor() const;
98
99 protected:
100 // subclass one radio button
101 void SubclassRadioButton(WXHWND hWndBtn);
102
103 // get the max size of radio buttons
104 wxSize GetMaxButtonSize() const;
105
106 // get the total size occupied by the radio box buttons
107 wxSize GetTotalButtonSize(const wxSize& sizeBtn) const;
108
109 WXHWND * m_radioButtons;
110 int m_majorDim;
111 int * m_radioWidth; // for bitmaps
112 int * m_radioHeight;
113
114 int m_noItems;
115 int m_noRowsOrCols;
116 int m_selectedButton;
117
118 virtual void DoSetSize(int x, int y,
119 int width, int height,
120 int sizeFlags = wxSIZE_AUTO);
121 virtual wxSize DoGetBestSize() const;
122
123 private:
124 DECLARE_DYNAMIC_CLASS(wxRadioBox)
125 DECLARE_NO_COPY_CLASS(wxRadioBox)
126 };
127
128 #endif
129 // _WX_RADIOBOX_H_