]> git.saurik.com Git - wxWidgets.git/blob - src/gtk/radiobox.cpp
Warning fix.
[wxWidgets.git] / src / gtk / radiobox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk/radiobox.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #if wxUSE_RADIOBOX
14
15 #include "wx/radiobox.h"
16
17 #ifndef WX_PRECOMP
18 #include "wx/log.h"
19 #include "wx/frame.h"
20 #include "wx/dialog.h"
21 #endif
22
23 #if wxUSE_TOOLTIPS
24 #include "wx/tooltip.h"
25 #endif
26
27 #include "wx/gtk/private.h"
28 #include <gdk/gdkkeysyms.h>
29
30 #include "wx/gtk/win_gtk.h"
31
32 //-----------------------------------------------------------------------------
33 // wxGTKRadioButtonInfo
34 //-----------------------------------------------------------------------------
35 // structure internally used by wxRadioBox to store its child buttons
36
37 class wxGTKRadioButtonInfo : public wxObject
38 {
39 public:
40 wxGTKRadioButtonInfo( GtkRadioButton * abutton, const wxRect & arect )
41 : button( abutton ), rect( arect ) {}
42
43 GtkRadioButton * button;
44 wxRect rect;
45 };
46
47 //-----------------------------------------------------------------------------
48 // data
49 //-----------------------------------------------------------------------------
50
51 #include "wx/listimpl.cpp"
52 WX_DEFINE_LIST( wxRadioBoxButtonsInfoList );
53
54 extern bool g_blockEventsOnDrag;
55 extern wxWindowGTK *g_delayedFocus;
56
57 //-----------------------------------------------------------------------------
58 // "clicked"
59 //-----------------------------------------------------------------------------
60
61 extern "C" {
62 static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBox *rb )
63 {
64 if (g_isIdle) wxapp_install_idle_handler();
65
66 if (!rb->m_hasVMT) return;
67 if (g_blockEventsOnDrag) return;
68
69 if (!button->active) return;
70
71 wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
72 event.SetInt( rb->GetSelection() );
73 event.SetString( rb->GetStringSelection() );
74 event.SetEventObject( rb );
75 rb->GetEventHandler()->ProcessEvent(event);
76 }
77 }
78
79 //-----------------------------------------------------------------------------
80 // "key_press_event"
81 //-----------------------------------------------------------------------------
82
83 extern "C" {
84 static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxRadioBox *rb )
85 {
86 if (g_isIdle)
87 wxapp_install_idle_handler();
88
89 if (!rb->m_hasVMT) return FALSE;
90 if (g_blockEventsOnDrag) return FALSE;
91
92 if ( ((gdk_event->keyval == GDK_Tab) ||
93 (gdk_event->keyval == GDK_ISO_Left_Tab)) &&
94 rb->GetParent() && (rb->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
95 {
96 wxNavigationKeyEvent new_event;
97 new_event.SetEventObject( rb->GetParent() );
98 // GDK reports GDK_ISO_Left_Tab for SHIFT-TAB
99 new_event.SetDirection( (gdk_event->keyval == GDK_Tab) );
100 // CTRL-TAB changes the (parent) window, i.e. switch notebook page
101 new_event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) );
102 new_event.SetCurrentFocus( rb );
103 return rb->GetParent()->GetEventHandler()->ProcessEvent( new_event );
104 }
105
106 if ((gdk_event->keyval != GDK_Up) &&
107 (gdk_event->keyval != GDK_Down) &&
108 (gdk_event->keyval != GDK_Left) &&
109 (gdk_event->keyval != GDK_Right))
110 {
111 return FALSE;
112 }
113
114 wxRadioBoxButtonsInfoList::compatibility_iterator node = rb->m_buttonsInfo.GetFirst();
115 while( node && GTK_WIDGET( node->GetData()->button ) != widget )
116 {
117 node = node->GetNext();
118 }
119 if (!node)
120 {
121 return FALSE;
122 }
123
124 g_signal_stop_emission_by_name (widget, "key_press_event");
125
126 if ((gdk_event->keyval == GDK_Up) ||
127 (gdk_event->keyval == GDK_Left))
128 {
129 if (node == rb->m_buttonsInfo.GetFirst())
130 node = rb->m_buttonsInfo.GetLast();
131 else
132 node = node->GetPrevious();
133 }
134 else
135 {
136 if (node == rb->m_buttonsInfo.GetLast())
137 node = rb->m_buttonsInfo.GetFirst();
138 else
139 node = node->GetNext();
140 }
141
142 GtkWidget *button = (GtkWidget*) node->GetData()->button;
143
144 gtk_widget_grab_focus( button );
145
146 return TRUE;
147 }
148 }
149
150 extern "C" {
151 static gint gtk_radiobutton_focus_in( GtkWidget *widget,
152 GdkEvent *WXUNUSED(event),
153 wxRadioBox *win )
154 {
155 if ( win->m_lostFocus )
156 {
157 // no, we didn't really lose it
158 win->m_lostFocus = FALSE;
159 }
160 else if ( !win->m_hasFocus )
161 {
162 win->m_hasFocus = true;
163
164 wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
165 event.SetEventObject( win );
166
167 // never stop the signal emission, it seems to break the kbd handling
168 // inside the radiobox
169 (void)win->GetEventHandler()->ProcessEvent( event );
170 }
171
172 return FALSE;
173 }
174 }
175
176 extern "C" {
177 static gint gtk_radiobutton_focus_out( GtkWidget *widget,
178 GdkEvent *WXUNUSED(event),
179 wxRadioBox *win )
180 {
181 // wxASSERT_MSG( win->m_hasFocus, _T("got focus out without any focus in?") );
182 // Replace with a warning, else we dump core a lot!
183 // if (!win->m_hasFocus)
184 // wxLogWarning(_T("Radiobox got focus out without any focus in.") );
185
186 // we might have lost the focus, but may be not - it may have just gone to
187 // another button in the same radiobox, so we'll check for it in the next
188 // idle iteration (leave m_hasFocus == true for now)
189 win->m_lostFocus = true;
190
191 return FALSE;
192 }
193 }
194
195 extern "C" {
196 static void gtk_radiobutton_size_allocate( GtkWidget *widget,
197 GtkAllocation * alloc,
198 wxRadioBox *win )
199 {
200 unsigned int n = 0;
201 for ( wxRadioBoxButtonsInfoList::compatibility_iterator node = win->m_buttonsInfo.GetFirst();
202 node;
203 node = node->GetNext(), n++ )
204 {
205 if( widget == GTK_WIDGET(node->GetData()->button) )
206 {
207 const wxPoint origin = win->GetPosition();
208 wxRect rect = wxRect( alloc->x - origin.x, alloc->y - origin.y,
209 alloc->width, alloc->height );
210 node->GetData()->rect = rect;
211 break;
212 }
213 }
214 }
215 }
216
217
218 //-----------------------------------------------------------------------------
219 // wxRadioBox
220 //-----------------------------------------------------------------------------
221
222 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
223
224 void wxRadioBox::Init()
225 {
226 m_needParent = true;
227 m_acceptsFocus = true;
228
229 m_hasFocus =
230 m_lostFocus = false;
231 }
232
233 bool wxRadioBox::Create( wxWindow *parent, wxWindowID id,
234 const wxString& title,
235 const wxPoint &pos, const wxSize &size,
236 const wxArrayString& choices, int majorDim,
237 long style, const wxValidator& validator,
238 const wxString &name )
239 {
240 wxCArrayString chs(choices);
241
242 return Create( parent, id, title, pos, size, chs.GetCount(),
243 chs.GetStrings(), majorDim, style, validator, name );
244 }
245
246 bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
247 const wxPoint &pos, const wxSize &size,
248 int n, const wxString choices[], int majorDim,
249 long style, const wxValidator& validator,
250 const wxString &name )
251 {
252 if (!PreCreation( parent, pos, size ) ||
253 !CreateBase( parent, id, pos, size, style, validator, name ))
254 {
255 wxFAIL_MSG( wxT("wxRadioBox creation failed") );
256 return false;
257 }
258
259 m_widget = GTKCreateFrame(title);
260 wxControl::SetLabel(title);
261
262 // majorDim may be 0 if all trailing parameters were omitted, so don't
263 // assert here but just use the correct value for it
264 SetMajorDim(majorDim == 0 ? n : majorDim, style);
265
266
267 unsigned int num_of_cols = GetColumnCount();
268 unsigned int num_of_rows = GetRowCount();
269
270 GtkRadioButton *rbtn = (GtkRadioButton*) NULL;
271
272 GtkWidget *table = gtk_table_new( num_of_rows, num_of_cols, FALSE );
273 gtk_table_set_col_spacings( GTK_TABLE(table), 1 );
274 gtk_table_set_row_spacings( GTK_TABLE(table), 1 );
275 gtk_widget_show( table );
276 gtk_container_add( GTK_CONTAINER(m_widget), table );
277
278 wxString label;
279 GSList *radio_button_group = (GSList *) NULL;
280 for (unsigned int i = 0; i < (unsigned int)n; i++)
281 {
282 if ( i != 0 )
283 radio_button_group = gtk_radio_button_get_group( GTK_RADIO_BUTTON(rbtn) );
284
285 label.Empty();
286 for ( const wxChar *pc = choices[i]; *pc; pc++ )
287 {
288 if ( *pc != wxT('&') )
289 label += *pc;
290 }
291
292 rbtn = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, wxGTK_CONV( label ) ) );
293 gtk_widget_show( GTK_WIDGET(rbtn) );
294
295 g_signal_connect (rbtn, "key_press_event",
296 G_CALLBACK (gtk_radiobox_keypress_callback), this);
297
298 m_buttonsInfo.Append( new wxGTKRadioButtonInfo( rbtn, wxRect() ) );
299
300 if (HasFlag(wxRA_SPECIFY_COLS))
301 {
302 int left = i%num_of_cols;
303 int right = (i%num_of_cols) + 1;
304 int top = i/num_of_cols;
305 int bottom = (i/num_of_cols)+1;
306 gtk_table_attach( GTK_TABLE(table), GTK_WIDGET(rbtn), left, right, top, bottom,
307 GTK_FILL, GTK_FILL, 1, 1 );
308 }
309 else
310 {
311 int left = i/num_of_rows;
312 int right = (i/num_of_rows) + 1;
313 int top = i%num_of_rows;
314 int bottom = (i%num_of_rows)+1;
315 gtk_table_attach( GTK_TABLE(table), GTK_WIDGET(rbtn), left, right, top, bottom,
316 GTK_FILL, GTK_FILL, 1, 1 );
317 }
318
319 ConnectWidget( GTK_WIDGET(rbtn) );
320
321 if (!i)
322 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(rbtn), TRUE );
323
324 g_signal_connect (rbtn, "clicked",
325 G_CALLBACK (gtk_radiobutton_clicked_callback), this);
326 g_signal_connect (rbtn, "focus_in_event",
327 G_CALLBACK (gtk_radiobutton_focus_in), this);
328 g_signal_connect (rbtn, "focus_out_event",
329 G_CALLBACK (gtk_radiobutton_focus_out), this);
330 g_signal_connect (rbtn, "size_allocate",
331 G_CALLBACK (gtk_radiobutton_size_allocate), this);
332 }
333
334 m_parent->DoAddChild( this );
335
336 PostCreation(size);
337
338 return true;
339 }
340
341 wxRadioBox::~wxRadioBox()
342 {
343 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
344 while (node)
345 {
346 GtkWidget *button = GTK_WIDGET( node->GetData()->button );
347 gtk_widget_destroy( button );
348 node = node->GetNext();
349 }
350 WX_CLEAR_LIST( wxRadioBoxButtonsInfoList, m_buttonsInfo );
351 }
352
353 bool wxRadioBox::Show( bool show )
354 {
355 wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
356
357 if (!wxControl::Show(show))
358 {
359 // nothing to do
360 return false;
361 }
362
363 if ( HasFlag(wxNO_BORDER) )
364 gtk_widget_hide( m_widget );
365
366 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
367 while (node)
368 {
369 GtkWidget *button = GTK_WIDGET( node->GetData()->button );
370
371 if (show)
372 gtk_widget_show( button );
373 else
374 gtk_widget_hide( button );
375
376 node = node->GetNext();
377 }
378
379 return true;
380 }
381
382 void wxRadioBox::SetFocus()
383 {
384 wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
385
386 if (m_buttonsInfo.GetCount() == 0) return;
387
388 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
389 while (node)
390 {
391 GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData()->button );
392 if (button->active)
393 {
394 gtk_widget_grab_focus( GTK_WIDGET(button) );
395 return;
396 }
397 node = node->GetNext();
398 }
399 }
400
401 void wxRadioBox::SetSelection( int n )
402 {
403 wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
404
405 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( n );
406
407 wxCHECK_RET( node, wxT("radiobox wrong index") );
408
409 GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData()->button );
410
411 GtkDisableEvents();
412
413 gtk_toggle_button_set_active( button, 1 );
414
415 GtkEnableEvents();
416 }
417
418 int wxRadioBox::GetSelection(void) const
419 {
420 wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid radiobox") );
421
422 int count = 0;
423
424 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
425 while (node)
426 {
427 GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData()->button );
428 if (button->active) return count;
429 count++;
430 node = node->GetNext();
431 }
432
433 wxFAIL_MSG( wxT("wxRadioBox none selected") );
434
435 return wxNOT_FOUND;
436 }
437
438 wxString wxRadioBox::GetString(unsigned int n) const
439 {
440 wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid radiobox") );
441
442 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( n );
443
444 wxCHECK_MSG( node, wxEmptyString, wxT("radiobox wrong index") );
445
446 GtkLabel *label = GTK_LABEL(GTK_BIN(node->GetData()->button)->child);
447
448 wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );
449
450 return str;
451 }
452
453 void wxRadioBox::SetLabel( const wxString& label )
454 {
455 wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
456
457 GTKSetLabelForFrame(GTK_FRAME(m_widget), label);
458 }
459
460 void wxRadioBox::SetString(unsigned int item, const wxString& label)
461 {
462 wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
463
464 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item );
465
466 wxCHECK_RET( node, wxT("radiobox wrong index") );
467
468 GtkLabel *g_label = GTK_LABEL(GTK_BIN(node->GetData()->button)->child);
469
470 gtk_label_set_text( g_label, wxGTK_CONV( label ) );
471 }
472
473 bool wxRadioBox::Enable( bool enable )
474 {
475 if ( !wxControl::Enable( enable ) )
476 return false;
477
478 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
479 while (node)
480 {
481 GtkButton *button = GTK_BUTTON( node->GetData()->button );
482 GtkLabel *label = GTK_LABEL(GTK_BIN(button)->child);
483
484 gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
485 gtk_widget_set_sensitive( GTK_WIDGET(label), enable );
486 node = node->GetNext();
487 }
488
489 return true;
490 }
491
492 bool wxRadioBox::Enable(unsigned int item, bool enable)
493 {
494 wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
495
496 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item );
497
498 wxCHECK_MSG( node, false, wxT("radiobox wrong index") );
499
500 GtkButton *button = GTK_BUTTON( node->GetData()->button );
501 GtkLabel *label = GTK_LABEL(GTK_BIN(button)->child);
502
503 gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
504 gtk_widget_set_sensitive( GTK_WIDGET(label), enable );
505
506 return true;
507 }
508
509 bool wxRadioBox::IsItemEnabled(unsigned int item) const
510 {
511 wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
512
513 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item );
514
515 wxCHECK_MSG( node, false, wxT("radiobox wrong index") );
516
517 GtkButton *button = GTK_BUTTON( node->GetData()->button );
518
519 // don't use GTK_WIDGET_IS_SENSITIVE() here, we want to return true even if
520 // the parent radiobox is disabled
521 return GTK_WIDGET_SENSITIVE(GTK_WIDGET(button));
522 }
523
524 bool wxRadioBox::Show(unsigned int item, bool show)
525 {
526 wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
527
528 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item );
529
530 wxCHECK_MSG( node, false, wxT("radiobox wrong index") );
531
532 GtkWidget *button = GTK_WIDGET( node->GetData()->button );
533
534 if (show)
535 gtk_widget_show( button );
536 else
537 gtk_widget_hide( button );
538
539 return true;
540 }
541
542 bool wxRadioBox::IsItemShown(unsigned int item) const
543 {
544 wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
545
546 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item );
547
548 wxCHECK_MSG( node, false, wxT("radiobox wrong index") );
549
550 GtkButton *button = GTK_BUTTON( node->GetData()->button );
551
552 return GTK_WIDGET_VISIBLE(GTK_WIDGET(button));
553 }
554
555 unsigned int wxRadioBox::GetCount() const
556 {
557 return m_buttonsInfo.GetCount();
558 }
559
560 void wxRadioBox::GtkDisableEvents()
561 {
562 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
563 while (node)
564 {
565 g_signal_handlers_disconnect_by_func (node->GetData()->button,
566 (gpointer) gtk_radiobutton_clicked_callback,
567 this);
568
569 node = node->GetNext();
570 }
571 }
572
573 void wxRadioBox::GtkEnableEvents()
574 {
575 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
576 while (node)
577 {
578 g_signal_connect (node->GetData()->button, "clicked",
579 G_CALLBACK (gtk_radiobutton_clicked_callback), this);
580
581 node = node->GetNext();
582 }
583 }
584
585 void wxRadioBox::DoApplyWidgetStyle(GtkRcStyle *style)
586 {
587 GTKFrameApplyWidgetStyle(GTK_FRAME(m_widget), style);
588
589 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
590 while (node)
591 {
592 GtkWidget *widget = GTK_WIDGET( node->GetData()->button );
593
594 gtk_widget_modify_style( widget, style );
595 gtk_widget_modify_style(GTK_BIN(widget)->child, style);
596
597 node = node->GetNext();
598 }
599 }
600
601 bool wxRadioBox::GTKWidgetNeedsMnemonic() const
602 {
603 return true;
604 }
605
606 void wxRadioBox::GTKWidgetDoSetMnemonic(GtkWidget* w)
607 {
608 GTKFrameSetMnemonicWidget(GTK_FRAME(m_widget), w);
609 }
610
611 #if wxUSE_TOOLTIPS
612 void wxRadioBox::ApplyToolTip(GtkTooltips * WXUNUSED(tips), const wxChar *tip)
613 {
614 // set this tooltip for all radiobuttons which don't have their own tips
615 unsigned n = 0;
616 for ( wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
617 node;
618 node = node->GetNext(), n++ )
619 {
620 if ( !GetItemToolTip(n) )
621 {
622 wxToolTip::Apply(GTK_WIDGET(node->GetData()->button),
623 wxConvCurrent->cWX2MB(tip));
624 }
625 }
626 }
627
628 void wxRadioBox::DoSetItemToolTip(unsigned int n, wxToolTip *tooltip)
629 {
630 wxCharBuffer buf;
631 if ( !tooltip )
632 tooltip = GetToolTip();
633 if ( tooltip )
634 buf = wxGTK_CONV(tooltip->GetTip());
635
636 wxToolTip::Apply(GTK_WIDGET(m_buttonsInfo[n]->button), buf);
637 }
638
639 #endif // wxUSE_TOOLTIPS
640
641 bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
642 {
643 if (window == m_widget->window)
644 return true;
645
646 wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
647 while (node)
648 {
649 GtkWidget *button = GTK_WIDGET( node->GetData()->button );
650
651 if (window == button->window)
652 return true;
653
654 node = node->GetNext();
655 }
656
657 return false;
658 }
659
660 void wxRadioBox::OnInternalIdle()
661 {
662 if ( m_lostFocus )
663 {
664 m_hasFocus = false;
665 m_lostFocus = false;
666
667 wxFocusEvent event( wxEVT_KILL_FOCUS, GetId() );
668 event.SetEventObject( this );
669
670 (void)GetEventHandler()->ProcessEvent( event );
671 }
672
673 if (g_delayedFocus == this)
674 {
675 if (GTK_WIDGET_REALIZED(m_widget))
676 {
677 g_delayedFocus = NULL;
678 SetFocus();
679 }
680 }
681 }
682
683 // static
684 wxVisualAttributes
685 wxRadioBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
686 {
687 wxVisualAttributes attr;
688 // NB: we need toplevel window so that GTK+ can find the right style
689 GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
690 GtkWidget* widget = gtk_radio_button_new_with_label(NULL, "");
691 gtk_container_add(GTK_CONTAINER(wnd), widget);
692 attr = GetDefaultAttributesFromGTKWidget(widget);
693 gtk_widget_destroy(wnd);
694 return attr;
695 }
696
697 int wxRadioBox::GetItemFromPoint(const wxPoint& point) const
698 {
699 const wxPoint pt = ScreenToClient(point);
700 unsigned n = 0;
701 for ( wxRadioBoxButtonsInfoList::compatibility_iterator
702 node = m_buttonsInfo.GetFirst(); node; node = node->GetNext(), n++ )
703 {
704 if ( m_buttonsInfo[n]->rect.Inside(pt) )
705 return n;
706 }
707
708 return wxNOT_FOUND;
709 }
710
711 #endif // wxUSE_RADIOBOX