]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/radiobox.h
fix memory leak as Dimitri suggested
[wxWidgets.git] / include / wx / os2 / radiobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: radiobox.h
3 // Purpose: wxRadioBox class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/12/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_RADIOBOX_H_
13 #define _WX_RADIOBOX_H_
14
15 // List box item
16 class WXDLLEXPORT wxBitmap ;
17
18 class WXDLLEXPORT wxRadioBox: public wxControl, public wxRadioBoxBase
19 {
20 public:
21 wxRadioBox();
22
23 inline wxRadioBox( wxWindow* pParent
24 ,wxWindowID vId
25 ,const wxString& rsTitle
26 ,const wxPoint& rPos = wxDefaultPosition
27 ,const wxSize& rSize = wxDefaultSize
28 ,int nNum = 0
29 ,const wxString asChoices[] = NULL
30 ,int nMajorDim = 0
31 ,long lStyle = wxRA_HORIZONTAL
32 ,const wxValidator& rVal = wxDefaultValidator
33 ,const wxString& rsName = wxRadioBoxNameStr
34 )
35 {
36 Create( pParent
37 ,vId
38 ,rsTitle
39 ,rPos
40 ,rSize
41 ,nNum
42 ,asChoices
43 ,nMajorDim
44 ,lStyle
45 ,rVal
46 ,rsName
47 );
48 }
49
50 ~wxRadioBox();
51
52 bool Create( wxWindow* pParent
53 ,wxWindowID vId
54 ,const wxString& rsTitle
55 ,const wxPoint& rPos = wxDefaultPosition
56 ,const wxSize& rSize = wxDefaultSize
57 ,int nNum = 0
58 ,const wxString asChoices[] = NULL
59 ,int nMajorDim = 0
60 ,long lStyle = wxRA_HORIZONTAL
61 ,const wxValidator& rVal = wxDefaultValidator
62 ,const wxString& rsName = wxRadioBoxNameStr
63 );
64
65 void Command(wxCommandEvent& rEvent);
66 bool ContainsHWND(WXHWND hWnd) const;
67 virtual bool Enable(bool bEnable = TRUE);
68 void Enable( int nItem
69 ,bool bEnable
70 );
71 int FindString(const wxString& sStr) const;
72
73 virtual WXHBRUSH OnCtlColor( WXHDC hDC
74 ,WXHWND hWnd
75 ,WXUINT uCtlColor
76 ,WXUINT uMessage
77 ,WXWPARAM wParam
78 ,WXLPARAM lParam
79 );
80 virtual bool OS2Command( WXUINT uParam
81 ,WXWORD wId
82 );
83 void SendNotificationEvent(void);
84 virtual void Show( int nItem
85 ,bool bShow = TRUE
86 ) ;
87 bool Show(bool bShow);
88 MRESULT WindowProc( WXUINT uMsg
89 ,WXWPARAM wParam
90 ,WXLPARAM lParam
91 );
92
93
94
95
96 virtual int GetColumnCount(void) const;
97 virtual int GetCount(void) const;
98 inline int GetNumberOfRowsOrCols(void) const { return m_nNoRowsOrCols; }
99 int GetNumHor(void) const;
100 int GetNumVer(void) const;
101 void GetPosition( int* pnX
102 ,int* pnY
103 ) const;
104 inline WXHWND* GetRadioButtons(void) const { return m_ahRadioButtons; }
105 virtual int GetRowCount(void) const;
106 int GetSelection(void) const;
107 void GetSize( int* pnX
108 ,int* pnY
109 ) const;
110 inline int GetSizeFlags(void) const { return m_nSizeFlags; }
111 void AdjustButtons( int nX
112 ,int nY
113 ,int nWidth
114 ,int nHeight
115 ,int nSizeFlags
116 );
117 wxString GetString(int nIndex) const;
118 virtual wxString GetStringSelection(void) const;
119
120 inline void SetButtonFont(const wxFont& rFont) { SetFont(rFont); }
121 void SetFocus(void);
122 virtual bool SetFont(const wxFont& rFont);
123 inline void SetLabelFont(const wxFont& WXUNUSED(font)) {};
124 inline void SetNumberOfRowsOrCols(int nNum) { m_nNoRowsOrCols = nNum; }
125 void SetSelection(int nIndex);
126 virtual void SetString( int nNum
127 ,const wxString& rsLabel
128 );
129 virtual bool SetStringSelection(const wxString& rsStr);
130
131 void SetLabel( int nItem
132 ,const wxString& rsLabel
133 );
134 void SetLabel( int item
135 ,wxBitmap* pBitmap
136 );
137 wxString GetLabel(int nItem) const;
138
139
140 protected:
141 virtual wxSize DoGetBestSize(void) const;
142 virtual void DoSetSize( int nX
143 ,int nY
144 ,int nWidth
145 ,int nHeight
146 ,int nSizeFlags = wxSIZE_AUTO
147 );
148 wxSize GetMaxButtonSize(void) const;
149 wxSize GetTotalButtonSize(const wxSize& rSizeBtn) const;
150 void SubclassRadioButton(WXHWND hWndBtn);
151
152
153 WXHWND* m_ahRadioButtons;
154 int m_nMajorDim ;
155 int* m_pnRadioWidth; // for bitmaps
156 int* m_pnRadioHeight;
157 int m_nNoItems;
158 int m_nNoRowsOrCols;
159 int m_nSelectedButton;
160 int m_nSizeFlags;
161
162 private:
163 inline wxString GetLabel() const
164 { return wxWindowBase::GetLabel(); }
165 inline void SetLabel(const wxString& rsLabel)
166 { wxWindowBase::SetLabel(rsLabel); }
167
168 DECLARE_DYNAMIC_CLASS(wxRadioBox)
169 }; // end of wxRadioBox
170
171 #endif
172 // _WX_RADIOBOX_H_