]>
Commit | Line | Data |
---|---|---|
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 wxChar*) wxRadioBoxNameStr; | |
22 | ||
23 | class WXDLLEXPORT wxBitmap; | |
24 | ||
25 | class WXDLLEXPORT wxRadioBox : public wxControl | |
26 | { | |
27 | DECLARE_DYNAMIC_CLASS(wxRadioBox) | |
28 | ||
29 | public: | |
30 | wxRadioBox(); | |
31 | ||
32 | wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, | |
33 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
34 | int n = 0, const wxString choices[] = NULL, | |
35 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
36 | const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr) | |
37 | { | |
38 | Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); | |
39 | } | |
40 | ||
41 | ~wxRadioBox(); | |
42 | ||
43 | bool Create(wxWindow *parent, wxWindowID id, const wxString& title, | |
44 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
45 | int n = 0, const wxString choices[] = NULL, | |
46 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
47 | const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); | |
48 | ||
49 | virtual bool MSWCommand(WXUINT param, WXWORD id); | |
50 | ||
51 | int FindString(const wxString& s) const; | |
52 | void SetSelection(int N); | |
53 | int GetSelection() const; | |
54 | wxString GetString(int N) const; | |
55 | ||
56 | void GetSize(int *x, int *y) const; | |
57 | void GetPosition(int *x, int *y) const; | |
58 | ||
59 | void SetLabel(int item, const wxString& label); | |
60 | void SetLabel(int item, wxBitmap *bitmap); | |
61 | wxString GetLabel(int item) const; | |
62 | bool Show(bool show); | |
63 | void SetFocus(); | |
64 | bool Enable(bool enable); | |
65 | void Enable(int item, bool enable); | |
66 | void Show(int item, bool show); | |
67 | void SetLabelFont(const wxFont& WXUNUSED(font)) {}; | |
68 | void SetButtonFont(const wxFont& font) { SetFont(font); } | |
69 | ||
70 | virtual wxString GetStringSelection() const; | |
71 | virtual bool SetStringSelection(const wxString& s); | |
72 | virtual int Number() const { return m_noItems; }; | |
73 | void Command(wxCommandEvent& event); | |
74 | ||
75 | int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } | |
76 | void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } | |
77 | ||
78 | // implementation only from now on | |
79 | // ------------------------------- | |
80 | ||
81 | virtual bool SetFont(const wxFont& font); | |
82 | ||
83 | long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); | |
84 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, | |
85 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
86 | WXHWND *GetRadioButtons() const { return m_radioButtons; } | |
87 | bool ContainsHWND(WXHWND hWnd) const; | |
88 | void SendNotificationEvent(); | |
89 | ||
90 | // get the number of buttons per column/row | |
91 | int GetNumVer() const; | |
92 | int GetNumHor() const; | |
93 | ||
94 | // compatibility ctor | |
95 | #if WXWIN_COMPATIBILITY | |
96 | wxRadioBox(wxWindow *parent, wxFunction func, const char *title, | |
97 | int x = -1, int y = -1, int width = -1, int height = -1, | |
98 | int n = 0, char **choices = NULL, | |
99 | int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr); | |
100 | #endif // WXWIN_COMPATIBILITY | |
101 | ||
102 | protected: | |
103 | // subclass one radio button | |
104 | void SubclassRadioButton(WXHWND hWndBtn); | |
105 | ||
106 | // get the max size of radio buttons | |
107 | wxSize GetMaxButtonSize() const; | |
108 | ||
109 | // get the total size occupied by the radio box buttons | |
110 | wxSize GetTotalButtonSize(const wxSize& sizeBtn) const; | |
111 | ||
112 | WXHWND * m_radioButtons; | |
113 | int m_majorDim; | |
114 | int * m_radioWidth; // for bitmaps | |
115 | int * m_radioHeight; | |
116 | ||
117 | int m_noItems; | |
118 | int m_noRowsOrCols; | |
119 | int m_selectedButton; | |
120 | ||
121 | virtual void DoSetSize(int x, int y, | |
122 | int width, int height, | |
123 | int sizeFlags = wxSIZE_AUTO); | |
124 | virtual wxSize DoGetBestSize() const; | |
125 | }; | |
126 | ||
127 | #endif | |
128 | // _WX_RADIOBOX_H_ |