]> git.saurik.com Git - wxWidgets.git/blob - src/msw/radiobox.cpp
Cured SetString/GetSelection interaction; incorporated Chris's changes to wxDC:Blit
[wxWidgets.git] / src / msw / radiobox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: radiobox.cpp
3 // Purpose: wxRadioBox
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "radiobox.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #ifndef WX_PRECOMP
24 #include <stdio.h>
25 #include "wx/setup.h"
26 #include "wx/radiobox.h"
27 #endif
28
29 #include "wx/msw/private.h"
30
31 #if !USE_SHARED_LIBRARY
32 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
33 #endif
34
35 bool wxRadioBox::MSWCommand(WXUINT param, WXWORD id)
36 {
37 if (param == BN_CLICKED)
38 {
39 #ifdef __WIN32__
40 int i;
41 for (i = 0; i < m_noItems; i++)
42 if (id == GetWindowLong((HWND) m_radioButtons[i], GWL_ID))
43 m_selectedButton = i;
44 #else
45 int i;
46 for (i = 0; i < m_noItems; i++)
47 if (id == GetWindowWord((HWND) m_radioButtons[i], GWW_ID))
48 m_selectedButton = i;
49 #endif
50
51 wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId);
52 event.SetInt( m_selectedButton );
53 event.SetEventObject( this );
54 ProcessCommand(event);
55 return TRUE;
56 }
57 else return FALSE;
58 }
59
60 #if WXWIN_COMPATIBILITY
61 wxRadioBox::wxRadioBox(wxWindow *parent, wxFunction func, const char *title,
62 int x, int y, int width, int height,
63 int n, char **choices,
64 int majorDim, long style, const char *name)
65 {
66 wxString *choices2 = new wxString[n];
67 for ( int i = 0; i < n; i ++) choices2[i] = choices[i];
68 Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), n, choices2, majorDim, style,
69 wxDefaultValidator, name);
70 Callback(func);
71 delete choices2;
72 }
73
74 #endif
75
76 // Radio box item
77 wxRadioBox::wxRadioBox(void)
78 {
79 m_selectedButton = -1;
80 m_noItems = 0;
81 m_noRowsOrCols = 0;
82 m_radioButtons = NULL;
83 m_majorDim = 0 ;
84 m_radioWidth = NULL ;
85 m_radioHeight = NULL ;
86 }
87
88 bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
89 const wxPoint& pos, const wxSize& size,
90 int n, const wxString choices[],
91 int majorDim, long style,
92 const wxValidator& val, const wxString& name)
93 {
94 m_selectedButton = -1;
95 m_noItems = n;
96
97 SetName(name);
98 SetValidator(val);
99
100 parent->AddChild(this);
101 m_backgroundColour = parent->GetDefaultBackgroundColour() ;
102 m_foregroundColour = parent->GetDefaultForegroundColour() ;
103
104 m_windowStyle = (long&)style;
105
106 int x = pos.x;
107 int y = pos.y;
108 int width = size.x;
109 int height = size.y;
110
111 if (id == -1)
112 m_windowId = NewControlId();
113 else
114 m_windowId = id;
115
116 m_noRowsOrCols = majorDim;
117 if (majorDim==0)
118 m_majorDim = n ;
119 else // Seemed to make sense to put this 'else' here... (RD)
120 m_majorDim = majorDim ;
121
122 long msStyle = GROUP_FLAGS;
123
124 bool want3D;
125 WXDWORD exStyle = Determine3DEffects(0, &want3D) ;
126 // Even with extended styles, need to combine with WS_BORDER
127 // for them to look right.
128 if (want3D && ((m_windowStyle & wxSIMPLE_BORDER) || (m_windowStyle & wxRAISED_BORDER) ||
129 (m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER)))
130 msStyle |= WS_BORDER;
131
132
133 m_hWnd = (WXHWND) CreateWindowEx((DWORD) exStyle, GROUP_CLASS, (title == "" ? NULL : (const char *)title),
134 msStyle,
135 0,0,0,0,
136 (HWND) parent->GetHWND(), (HMENU) m_windowId, wxGetInstance(), NULL) ;
137
138 HWND the_handle = (HWND) parent->GetHWND() ;
139
140 #if CTL3D
141 if (want3D)
142 {
143 Ctl3dSubclassCtl((HWND) m_hWnd);
144 m_useCtl3D = TRUE;
145 }
146 #endif
147
148 SetFont(* parent->GetFont());
149
150 // Subclass again for purposes of dialog editing mode
151 SubclassWin((WXHWND)m_hWnd);
152
153 /* Label will be the same as button font now.
154 if (labelFont)
155 {
156 labelFont->RealizeResource();
157 if (labelFont->GetResourceHandle())
158 SendMessage(ms_handle,WM_SETFONT,
159 (WPARAM)labelFont->GetResourceHandle(),0L);
160 }
161 */
162
163 // Some radio boxes test consecutive id.
164 (void)NewControlId() ;
165 m_radioButtons = new WXHWND[n];
166 m_radioWidth = new int[n] ;
167 m_radioHeight = new int[n] ;
168 int i;
169 for (i = 0; i < n; i++)
170 {
171 m_radioWidth[i] = m_radioHeight[i] = -1 ;
172 long groupStyle = 0;
173 if (i == 0 && style==0)
174 groupStyle = WS_GROUP;
175 long newId = NewControlId();
176 long msStyle = groupStyle | RADIO_FLAGS;
177
178 m_radioButtons[i] = (WXHWND) CreateWindowEx(exStyle, RADIO_CLASS, choices[i],
179 msStyle,0,0,0,0,
180 the_handle, (HMENU)newId, wxGetInstance(), NULL);
181 #if CTL3D
182 if (want3D)
183 {
184 Ctl3dSubclassCtl((HWND) m_hWnd);
185 m_useCtl3D = TRUE;
186 }
187 #endif
188 if (GetFont())
189 {
190 SendMessage((HWND)m_radioButtons[i],WM_SETFONT,
191 (WPARAM)GetFont()->GetResourceHandle(),0L);
192 }
193 m_subControls.Append((wxObject *)newId);
194 }
195
196 // Create a dummy radio control to end the group.
197 (void)CreateWindowEx(0, RADIO_CLASS, "", WS_GROUP|RADIO_FLAGS, 0,0,0,0, the_handle, (HMENU)NewControlId(), wxGetInstance(), NULL);
198
199 SetSelection(0);
200
201 SetSize(x, y, width, height);
202
203 return TRUE;
204 }
205
206 #if 0
207 bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
208 const wxPoint& pos, const wxSize& size,
209 int n, const wxBitmap *choices[],
210 int majorDim, long style,
211 const wxValidator& val, const wxString& name)
212 {
213 m_selectedButton = -1;
214 m_noRowsOrCols = 0;
215 m_noItems = n;
216
217 SetName(name);
218 SetValidator(val);
219
220 parent->AddChild(this);
221 m_backgroundColour = parent->GetDefaultBackgroundColour() ;
222 m_foregroundColour = parent->GetDefaultForegroundColour() ;
223
224 m_windowStyle = (long&)style;
225
226 int x = pos.x;
227 int y = pos.y;
228 int width = size.x;
229 int height = size.y;
230
231 if (id == -1)
232 m_windowId = NewControlId();
233 else
234 m_windowId = id;
235
236
237 m_noRowsOrCols = majorDim;
238 if (majorDim==0)
239 m_majorDim = n ;
240 m_majorDim = majorDim ;
241 HWND the_handle ;
242
243 long msStyle = GROUP_FLAGS;
244
245 bool want3D;
246 WXDWORD exStyle = Determine3DEffects(0, &want3D) ;
247 // Even with extended styles, need to combine with WS_BORDER
248 // for them to look right.
249 if (want3D && ((m_windowStyle & wxSIMPLE_BORDER) || (m_windowStyle & wxRAISED_BORDER) ||
250 (m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER)))
251 msStyle |= WS_BORDER;
252
253 m_hWnd = (WXHWND) CreateWindowEx((DWORD) exStyle, GROUP_CLASS, (title == "" ? NULL : (const char *)title),
254 msStyle,
255 0,0,0,0,
256 (HWND) parent->GetHWND(), (HMENU) m_windowId, wxGetInstance(), NULL) ;
257
258 /*
259 if (labelFont)
260 {
261 labelFont->RealizeResource();
262 if (labelFont->GetResourceHandle())
263 SendMessage(ms_handle,WM_SETFONT,
264 (WPARAM)labelFont->GetResourceHandle(),0L);
265 }
266 */
267 the_handle = (HWND) parent->GetHWND();
268
269 #if CTL3D
270 if (want3D)
271 {
272 Ctl3dSubclassCtl((HWND) m_hWnd);
273 m_useCtl3D = TRUE;
274 }
275 #endif
276
277 SetFont(* parent->GetFont());
278
279 // Subclass again for purposes of dialog editing mode
280 SubclassWin((WXHWND)m_hWnd);
281
282 (void)NewControlId() ;
283 m_radioButtons = new WXHWND[n];
284 m_radioWidth = new int[n] ;
285 m_radioHeight = new int[n] ;
286
287 int i;
288 for (i = 0; i < n; i++)
289 {
290 long groupStyle = 0;
291 if (i == 0 && style==0)
292 groupStyle = WS_GROUP;
293 long newId = NewControlId();
294 m_radioWidth[i] = ((wxBitmap *)choices[i])->GetWidth();
295 m_radioHeight[i] = ((wxBitmap *)choices[i])->GetHeight();
296 char tmp[32] ;
297 sprintf(tmp,"Toggle%d",i) ;
298 long msStyle = groupStyle | RADIO_FLAGS;
299 m_radioButtons[i] = (WXHWND) CreateWindowEx(exStyle, RADIO_CLASS, tmp,
300 msStyle,0,0,0,0,
301 the_handle, (HMENU)newId, wxhInstance, NULL);
302 #if CTL3D
303 if (want3D)
304 {
305 Ctl3dSubclassCtl((HWND) m_hWnd);
306 m_useCtl3D = TRUE;
307 }
308 #endif
309 m_subControls.Append((wxObject *)newId);
310 }
311 // Create a dummy radio control to end the group.
312 (void)CreateWindowEx(0, RADIO_CLASS, "", WS_GROUP|RADIO_FLAGS, 0,0,0,0, the_handle, (HMENU)NewControlId(), wxGetInstance(), NULL);
313
314 SetSelection(0);
315
316 SetSize(x, y, width, height);
317
318 return TRUE;
319 }
320 #endif
321
322 wxRadioBox::~wxRadioBox(void)
323 {
324 m_isBeingDeleted = TRUE;
325
326 if (m_radioButtons)
327 {
328 int i;
329 for (i = 0; i < m_noItems; i++)
330 DestroyWindow((HWND) m_radioButtons[i]);
331 delete[] m_radioButtons;
332 }
333 if (m_radioWidth)
334 delete[] m_radioWidth ;
335 if (m_radioHeight)
336 delete[] m_radioHeight ;
337 if (m_hWnd)
338 ::DestroyWindow((HWND) m_hWnd) ;
339 m_hWnd = 0 ;
340
341 }
342
343 wxString wxRadioBox::GetLabel(int item) const
344 {
345 GetWindowText((HWND)m_radioButtons[item], wxBuffer, 300);
346 return wxString(wxBuffer);
347 }
348
349 void wxRadioBox::SetLabel(int item, const wxString& label)
350 {
351 m_radioWidth[item] = m_radioHeight[item] = -1 ;
352 SetWindowText((HWND)m_radioButtons[item], (const char *)label);
353 }
354
355 void wxRadioBox::SetLabel(int item, wxBitmap *bitmap)
356 {
357 /*
358 m_radioWidth[item] = bitmap->GetWidth() + FB_MARGIN ;
359 m_radioHeight[item] = bitmap->GetHeight() + FB_MARGIN ;
360 */
361 }
362
363 int wxRadioBox::FindString(const wxString& s) const
364 {
365 int i;
366 for (i = 0; i < m_noItems; i++)
367 {
368 GetWindowText((HWND) m_radioButtons[i], wxBuffer, 1000);
369 if (s == wxBuffer)
370 return i;
371 }
372 return -1;
373 }
374
375 void wxRadioBox::SetSelection(int N)
376 {
377 if ((N < 0) || (N >= m_noItems))
378 return;
379
380 // Following necessary for Win32s, because Win32s translate BM_SETCHECK
381 if (m_selectedButton >= 0 && m_selectedButton < m_noItems)
382 SendMessage((HWND) m_radioButtons[m_selectedButton], BM_SETCHECK, 0, 0L);
383
384 SendMessage((HWND) m_radioButtons[N], BM_SETCHECK, 1, 0L);
385 m_selectedButton = N;
386 }
387
388 // Get single selection, for single choice list items
389 int wxRadioBox::GetSelection(void) const
390 {
391 return m_selectedButton;
392 }
393
394 // Find string for position
395 wxString wxRadioBox::GetString(int N) const
396 {
397 GetWindowText((HWND) m_radioButtons[N], wxBuffer, 1000);
398 return wxString(wxBuffer);
399 }
400
401 void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
402 {
403 int currentX, currentY;
404 GetPosition(&currentX, &currentY);
405 int xx = x;
406 int yy = y;
407
408 if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
409 xx = currentX;
410 if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
411 yy = currentY;
412
413 char buf[400];
414
415 int y_offset = yy;
416 int x_offset = xx;
417 int current_width, cyf;
418
419 int cx1,cy1 ;
420 wxGetCharSize(m_hWnd, &cx1, &cy1, GetFont());
421 // Attempt to have a look coherent with other platforms:
422 // We compute the biggest toggle dim, then we align all
423 // items according this value.
424 int maxWidth = -1;
425 int maxHeight = -1 ;
426
427 int i;
428 for (i = 0 ; i < m_noItems; i++)
429 {
430 int eachWidth;
431 int eachHeight ;
432 if (m_radioWidth[i]<0)
433 {
434 // It's a labelled toggle
435 GetWindowText((HWND) m_radioButtons[i], buf, 300);
436 GetTextExtent(buf, &current_width, &cyf,NULL,NULL, GetFont());
437 eachWidth = (int)(current_width + RADIO_SIZE);
438 eachHeight = (int)((3*cyf)/2);
439 }
440 else
441 {
442 eachWidth = m_radioWidth[i] ;
443 eachHeight = m_radioHeight[i] ;
444 }
445 if (maxWidth<eachWidth) maxWidth = eachWidth ;
446 if (maxHeight<eachHeight) maxHeight = eachHeight ;
447 }
448
449 if (m_hWnd)
450 {
451 int totWidth ;
452 int totHeight;
453
454 int nbHor,nbVer;
455
456 if (m_windowStyle & wxRA_VERTICAL)
457 {
458 nbVer = m_majorDim ;
459 nbHor = (m_noItems+m_majorDim-1)/m_majorDim ;
460 }
461 else
462 {
463 nbHor = m_majorDim ;
464 nbVer = (m_noItems+m_majorDim-1)/m_majorDim ;
465 }
466
467 // this formula works, but I don't know why.
468 // Please, be sure what you do if you modify it!!
469 if (m_radioWidth[0]<0)
470 totHeight = (nbVer * maxHeight) + cy1/2 ;
471 else
472 totHeight = nbVer * (maxHeight+cy1/2) ;
473 totWidth = nbHor * (maxWidth+cx1) ;
474
475 #if (!CTL3D)
476 // Requires a bigger group box in plain Windows
477 MoveWindow((HWND) m_hWnd,x_offset,y_offset,totWidth+cx1,totHeight+(3*cy1)/2,TRUE) ;
478 #else
479 MoveWindow((HWND) m_hWnd,x_offset,y_offset,totWidth+cx1,totHeight+cy1,TRUE) ;
480 #endif
481 x_offset += cx1;
482 y_offset += cy1;
483 }
484
485 #if (!CTL3D)
486 y_offset += (int)(cy1/2); // Fudge factor since buttons overlapped label
487 // JACS 2/12/93. CTL3D draws group label quite high.
488 #endif
489 int startX = x_offset ;
490 int startY = y_offset ;
491
492 for ( i = 0 ; i < m_noItems; i++)
493 {
494 // Bidimensional radio adjustment
495 if (i&&((i%m_majorDim)==0)) // Why is this omitted for i = 0?
496 {
497 if (m_windowStyle & wxRA_VERTICAL)
498 {
499 y_offset = startY;
500 x_offset += maxWidth + cx1 ;
501 }
502 else
503 {
504 x_offset = startX ;
505 y_offset += maxHeight ;
506 if (m_radioWidth[0]>0)
507 y_offset += cy1/2 ;
508 }
509 }
510 int eachWidth ;
511 int eachHeight ;
512 if (m_radioWidth[i]<0)
513 {
514 // It's a labeled item
515 GetWindowText((HWND) m_radioButtons[i], buf, 300);
516 GetTextExtent(buf, &current_width, &cyf,NULL,NULL,GetFont());
517
518 // How do we find out radio button bitmap size!!
519 // By adjusting them carefully, manually :-)
520 eachWidth = (int)(current_width + RADIO_SIZE);
521 eachHeight = (int)((3*cyf)/2);
522 }
523 else
524 {
525 eachWidth = m_radioWidth[i] ;
526 eachHeight = m_radioHeight[i] ;
527 }
528
529 MoveWindow((HWND) m_radioButtons[i],x_offset,y_offset,eachWidth,eachHeight,TRUE);
530 if (m_windowStyle & wxRA_VERTICAL)
531 {
532 y_offset += maxHeight;
533 if (m_radioWidth[0]>0)
534 y_offset += cy1/2 ;
535 }
536 else
537 x_offset += maxWidth + cx1;
538 }
539 }
540
541 void wxRadioBox::GetSize(int *width, int *height) const
542 {
543 RECT rect;
544 rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
545
546 if (m_hWnd)
547 wxFindMaxSize(m_hWnd, &rect);
548
549 int i;
550 for (i = 0; i < m_noItems; i++)
551 wxFindMaxSize(m_radioButtons[i], &rect);
552
553 *width = rect.right - rect.left;
554 *height = rect.bottom - rect.top;
555 }
556
557 void wxRadioBox::GetPosition(int *x, int *y) const
558 {
559 wxWindow *parent = GetParent();
560 RECT rect;
561 rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
562
563 int i;
564 for (i = 0; i < m_noItems; i++)
565 wxFindMaxSize(m_radioButtons[i], &rect);
566
567 if (m_hWnd)
568 wxFindMaxSize(m_hWnd, &rect);
569
570 // Since we now have the absolute screen coords,
571 // if there's a parent we must subtract its top left corner
572 POINT point;
573 point.x = rect.left;
574 point.y = rect.top;
575 if (parent)
576 {
577 ::ScreenToClient((HWND) parent->GetHWND(), &point);
578 }
579
580 *x = point.x;
581 *y = point.y;
582 }
583
584 wxString wxRadioBox::GetLabel(void) const
585 {
586 if (m_hWnd)
587 {
588 GetWindowText((HWND) m_hWnd, wxBuffer, 300);
589 return wxString(wxBuffer);
590 }
591 else return wxString("");
592 }
593
594 void wxRadioBox::SetLabel(const wxString& label)
595 {
596 if (m_hWnd && label)
597 SetWindowText((HWND) m_hWnd, label);
598 }
599
600 void wxRadioBox::SetFocus(void)
601 {
602 /*
603 if (m_noItems > 0)
604 ::SetFocus((HWND) m_radioButtons[0]);
605 */
606 /* Begin Alberts Patch 26. 5. 1997*/
607 if (m_noItems > 0)
608 {
609 if (m_selectedButton == -1)
610 ::SetFocus((HWND) m_radioButtons[0]);
611 else
612 ::SetFocus((HWND) m_radioButtons[m_selectedButton]);
613 }
614 /* Ende Alberts Patch*/
615
616 }
617
618 bool wxRadioBox::Show(bool show)
619 {
620 int cshow;
621 if (show)
622 cshow = SW_SHOW;
623 else
624 cshow = SW_HIDE;
625 if (m_hWnd)
626 ShowWindow((HWND) m_hWnd, cshow);
627 int i;
628 for (i = 0; i < m_noItems; i++)
629 ShowWindow((HWND) m_radioButtons[i], cshow);
630 return TRUE;
631 }
632
633 // Enable a specific button
634 void wxRadioBox::Enable(int item, bool enable)
635 {
636 if (item<0)
637 wxWindow::Enable(enable) ;
638 else if (item < m_noItems)
639 ::EnableWindow((HWND) m_radioButtons[item], enable);
640 }
641
642 // Enable all controls
643 void wxRadioBox::Enable(bool enable)
644 {
645 wxControl::Enable(enable);
646
647 int i;
648 for (i = 0; i < m_noItems; i++)
649 ::EnableWindow((HWND) m_radioButtons[i], enable);
650 }
651
652 // Show a specific button
653 void wxRadioBox::Show(int item, bool show)
654 {
655 if (item<0)
656 wxRadioBox::Show(show) ;
657 else if (item < m_noItems)
658 {
659 int cshow;
660 if (show)
661 cshow = SW_SHOW;
662 else
663 cshow = SW_HIDE;
664 ShowWindow((HWND) m_radioButtons[item], cshow);
665 }
666 }
667
668 WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
669 WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
670 {
671 #if CTL3D
672 if ( m_useCtl3D )
673 {
674 HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
675 return (WXHBRUSH) hbrush;
676 }
677 #endif
678
679 if (GetParent()->GetTransparentBackground())
680 SetBkMode((HDC) pDC, TRANSPARENT);
681 else
682 SetBkMode((HDC) pDC, OPAQUE);
683
684 ::SetBkColor((HDC) pDC, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
685 ::SetTextColor((HDC) pDC, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
686
687 wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID);
688
689 // Note that this will be cleaned up in wxApp::OnIdle, if backgroundBrush
690 // has a zero usage count.
691 // backgroundBrush->RealizeResource();
692 return (WXHBRUSH) backgroundBrush->GetResourceHandle();
693 }
694
695 // For single selection items only
696 wxString wxRadioBox::GetStringSelection (void) const
697 {
698 int sel = GetSelection ();
699 if (sel > -1)
700 return this->GetString (sel);
701 else
702 return wxString("");
703 }
704
705 bool wxRadioBox::SetStringSelection (const wxString& s)
706 {
707 int sel = FindString (s);
708 if (sel > -1)
709 {
710 SetSelection (sel);
711 return TRUE;
712 }
713 else
714 return FALSE;
715 }
716
717 /*
718 void wxRadioBox::SetLabelFont(wxFont *font)
719 {
720 // Decrement the usage count of the old label font
721 // (we may be able to free it up)
722 if (labelFont)
723 labelFont->ReleaseResource();
724
725 labelFont = font;
726
727 // Increment usage count
728 if (font)
729 font->UseResource();
730
731 HWND hWnd = GetHWND();
732 if (hWnd != 0)
733 {
734 if (font)
735 {
736 font->RealizeResource();
737
738 if (font->GetResourceHandle())
739 SendMessage(hWnd, WM_SETFONT,
740 (WPARAM)font->GetResourceHandle(),TRUE);
741 }
742 }
743 }
744
745 */
746
747 bool wxRadioBox::ContainsHWND(WXHWND hWnd) const
748 {
749 int i;
750 for (i = 0; i < Number(); i++)
751 if (GetRadioButtons()[i] == hWnd)
752 return TRUE;
753 return FALSE;
754 }
755
756 void wxRadioBox::Command (wxCommandEvent & event)
757 {
758 SetSelection (event.m_commandInt);
759 ProcessCommand (event);
760 }
761
762