]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/radiobox.cpp
?lk
[wxWidgets.git] / src / gtk / radiobox.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: radiobox.cpp
3// Purpose:
4// Author: Robert Roebling
f96aa4d9
RR
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
29006414 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
c801d85f
KB
10#ifdef __GNUG__
11#pragma implementation "radiobox.h"
12#endif
13
14#include "wx/radiobox.h"
dcf924a3
RR
15
16#if wxUSE_RADIOBOX
17
c801d85f
KB
18#include "wx/dialog.h"
19#include "wx/frame.h"
83624f79
RR
20
21#include "gdk/gdk.h"
22#include "gtk/gtk.h"
354aa1e3 23#include "gdk/gdkkeysyms.h"
c801d85f
KB
24#include "wx/gtk/win_gtk.h"
25
acfd422a
RR
26//-----------------------------------------------------------------------------
27// idle system
28//-----------------------------------------------------------------------------
29
30extern void wxapp_install_idle_handler();
31extern bool g_isIdle;
32
66bd6b93
RR
33//-----------------------------------------------------------------------------
34// data
35//-----------------------------------------------------------------------------
36
69ffe1d2 37extern bool g_blockEventsOnDrag;
66bd6b93 38
c801d85f 39//-----------------------------------------------------------------------------
b4071e91 40// "clicked"
c801d85f
KB
41//-----------------------------------------------------------------------------
42
66bd6b93 43static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
c801d85f 44{
acfd422a
RR
45 if (g_isIdle) wxapp_install_idle_handler();
46
a2053b27 47 if (!rb->m_hasVMT) return;
907789a0 48 if (g_blockEventsOnDrag) return;
29006414 49
907789a0
RR
50 if (rb->m_alreadySent)
51 {
52 rb->m_alreadySent = FALSE;
53 return;
54 }
47908e25 55
907789a0 56 rb->m_alreadySent = TRUE;
29006414 57
907789a0
RR
58 wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
59 event.SetInt( rb->GetSelection() );
29006414 60 event.SetString( rb->GetStringSelection() );
907789a0
RR
61 event.SetEventObject( rb );
62 rb->GetEventHandler()->ProcessEvent(event);
6de97a3b 63}
c801d85f 64
2e0e025e
RR
65//-----------------------------------------------------------------------------
66// "key_press_event"
67//-----------------------------------------------------------------------------
68
69static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxRadioBox *rb )
70{
71 if (g_isIdle)
72 wxapp_install_idle_handler();
73
74 if (!rb->m_hasVMT) return FALSE;
75 if (g_blockEventsOnDrag) return FALSE;
76
77 if ((gdk_event->keyval != GDK_Up) &&
78 (gdk_event->keyval != GDK_Down) &&
79 (gdk_event->keyval != GDK_Left) &&
80 (gdk_event->keyval != GDK_Right))
81 {
82 return FALSE;
83 }
84
85 wxNode *node = rb->m_boxes.Find( (wxObject*) widget );
86 if (!node)
87 {
88 return FALSE;
89 }
90
91 gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
92
93 if ((gdk_event->keyval == GDK_Up) ||
94 (gdk_event->keyval == GDK_Left))
95 {
96 if (node == rb->m_boxes.First())
97 node = rb->m_boxes.Last();
98 else
99 node = node->Previous();
100 }
101 else
102 {
103 if (node == rb->m_boxes.Last())
104 node = rb->m_boxes.First();
105 else
106 node = node->Next();
107 }
108
109 GtkWidget *button = (GtkWidget*) node->Data();
110
111 gtk_widget_grab_focus( button );
112
113 return TRUE;
114}
115
b4071e91
RR
116//-----------------------------------------------------------------------------
117// wxRadioBox
c801d85f
KB
118//-----------------------------------------------------------------------------
119
120IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
121
f03fc89f 122wxRadioBox::wxRadioBox()
c801d85f 123{
6de97a3b 124}
c801d85f 125
debe6624 126bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
907789a0 127 const wxPoint &pos, const wxSize &size,
29006414
VZ
128 int n, const wxString choices[], int majorDim,
129 long style, const wxValidator& validator,
130 const wxString &name )
c801d85f 131{
907789a0
RR
132 m_alreadySent = FALSE;
133 m_needParent = TRUE;
b292e2f5 134 m_acceptsFocus = TRUE;
29006414 135
4dcaf11a
RR
136 if (!PreCreation( parent, pos, size ) ||
137 !CreateBase( parent, id, pos, size, style, validator, name ))
138 {
223d09f6 139 wxFAIL_MSG( wxT("wxRadioBox creation failed") );
4dcaf11a
RR
140 return FALSE;
141 }
6de97a3b 142
b019151f 143 m_widget = gtk_frame_new( title.mbc_str() );
29006414 144
d3b4d113 145 m_majorDim = majorDim;
29006414 146
907789a0 147 GtkRadioButton *m_radio = (GtkRadioButton*) NULL;
29006414 148
26333898 149 wxString label;
d3b4d113
RR
150 GSList *radio_button_group = (GSList *) NULL;
151 for (int i = 0; i < n; i++)
c801d85f 152 {
26333898
VZ
153 if ( i != 0 )
154 radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
29006414 155
26333898
VZ
156 label.Empty();
157 for ( const wxChar *pc = choices[i]; *pc; pc++ )
158 {
223d09f6 159 if ( *pc != wxT('&') )
26333898
VZ
160 label += *pc;
161 }
162
163 m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, label.mbc_str() ) );
29006414 164
2e0e025e
RR
165 gtk_signal_connect( GTK_OBJECT(m_radio), "key_press_event",
166 GTK_SIGNAL_FUNC(gtk_radiobox_keypress_callback), (gpointer)this );
167
d3b4d113 168 m_boxes.Append( (wxObject*) m_radio );
29006414 169
d3b4d113 170 ConnectWidget( GTK_WIDGET(m_radio) );
29006414 171
d3b4d113 172 if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
29006414
VZ
173
174 gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
354aa1e3 175 GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
29006414 176
da048e3d 177 gtk_pizza_put( GTK_PIZZA(m_parent->m_wxwindow),
e3e717ec 178 GTK_WIDGET(m_radio),
f03fc89f 179 m_x+10, m_y+10+(i*24), 10, 10 );
6de97a3b 180 }
29006414 181
d3b4d113 182 wxSize ls = LayoutItems();
29006414 183
907789a0 184 wxSize newSize = size;
d3b4d113
RR
185 if (newSize.x == -1) newSize.x = ls.x;
186 if (newSize.y == -1) newSize.y = ls.y;
907789a0 187 SetSize( newSize.x, newSize.y );
29006414 188
f03fc89f 189 m_parent->DoAddChild( this );
29006414 190
907789a0 191 PostCreation();
29006414 192
907789a0 193 SetLabel( title );
29006414 194
907789a0
RR
195 SetBackgroundColour( parent->GetBackgroundColour() );
196 SetForegroundColour( parent->GetForegroundColour() );
a7ac4461 197 SetFont( parent->GetFont() );
f96aa4d9 198
907789a0 199 Show( TRUE );
29006414 200
907789a0 201 return TRUE;
6de97a3b 202}
c801d85f 203
f03fc89f 204wxRadioBox::~wxRadioBox()
d6d1892b 205{
907789a0
RR
206 wxNode *node = m_boxes.First();
207 while (node)
208 {
209 GtkWidget *button = GTK_WIDGET( node->Data() );
210 gtk_widget_destroy( button );
211 node = node->Next();
212 }
d6d1892b
RR
213}
214
54517652 215void wxRadioBox::DoSetSize( int x, int y, int width, int height, int sizeFlags )
3f659fd6 216{
54517652
RR
217 wxWindow::DoSetSize( x, y, width, height, sizeFlags );
218
d3b4d113
RR
219 LayoutItems();
220}
221
222wxSize wxRadioBox::LayoutItems()
223{
bbe0af5b
RR
224 int x = 7;
225 int y = 15;
29006414 226
e3e717ec
VZ
227 if ( m_majorDim == 0 )
228 {
229 // avoid dividing by 0 below
223d09f6 230 wxFAIL_MSG( wxT("dimension of radiobox should not be 0!") );
e3e717ec
VZ
231
232 m_majorDim = 1;
233 }
234
d3b4d113 235 int num_per_major = (m_boxes.GetCount() - 1) / m_majorDim +1;
29006414 236
d3b4d113 237 wxSize res( 0, 0 );
29006414 238
e9158f7d
RR
239 int num_of_cols = 0;
240 int num_of_rows = 0;
241 if (HasFlag(wxRA_SPECIFY_COLS))
d3b4d113 242 {
e9158f7d
RR
243 num_of_cols = m_majorDim;
244 num_of_rows = num_per_major;
245 }
246 else
247 {
248 num_of_cols = num_per_major;
249 num_of_rows = m_majorDim;
250 }
251
252 if ( HasFlag(wxRA_SPECIFY_COLS) ||
253 (HasFlag(wxRA_SPECIFY_ROWS) && (num_of_cols > 1)) )
254 {
255 for (int j = 0; j < num_of_cols; j++)
29006414 256 {
bbe0af5b 257 y = 15;
29006414 258
d3b4d113 259 int max_len = 0;
e9158f7d
RR
260 wxNode *node = m_boxes.Nth( j*num_of_rows );
261 for (int i1 = 0; i1< num_of_rows; i1++)
29006414 262 {
d3b4d113
RR
263 GtkWidget *button = GTK_WIDGET( node->Data() );
264 GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
265 GdkFont *font = m_widget->style->font;
bbe0af5b 266 int len = 22+gdk_string_measure( font, label->label );
d3b4d113 267 if (len > max_len) max_len = len;
29006414 268
da048e3d 269 gtk_pizza_move( GTK_PIZZA(m_parent->m_wxwindow), button, m_x+x, m_y+y );
dcf924a3 270 y += 22;
29006414
VZ
271
272 node = node->Next();
273 if (!node) break;
274 }
275
276 // we don't know the max_len before
277
e9158f7d
RR
278 node = m_boxes.Nth( j*num_of_rows );
279 for (int i2 = 0; i2< num_of_rows; i2++)
29006414 280 {
d3b4d113 281 GtkWidget *button = GTK_WIDGET( node->Data() );
29006414 282
da048e3d 283 gtk_pizza_resize( GTK_PIZZA(m_parent->m_wxwindow), button, max_len, 20 );
29006414
VZ
284
285 node = node->Next();
286 if (!node) break;
287 }
288
289 if (y > res.y) res.y = y;
290
291 x += max_len + 2;
d3b4d113 292 }
29006414
VZ
293
294 res.x = x+4;
295 res.y += 9;
e5403d7c 296 }
d3b4d113 297 else
e5403d7c 298 {
d3b4d113
RR
299 int max = 0;
300
301 wxNode *node = m_boxes.First();
302 while (node)
303 {
304 GtkButton *button = GTK_BUTTON( node->Data() );
305 GtkLabel *label = GTK_LABEL( button->child );
29006414 306
d3b4d113 307 GdkFont *font = m_widget->style->font;
bbe0af5b 308 int len = 22+gdk_string_measure( font, label->label );
d3b4d113 309 if (len > max) max = len;
29006414 310
d3b4d113
RR
311 node = node->Next();
312 }
29006414 313
d3b4d113
RR
314 node = m_boxes.First();
315 while (node)
316 {
317 GtkWidget *button = GTK_WIDGET( node->Data() );
29006414 318
da048e3d 319 gtk_pizza_set_size( GTK_PIZZA(m_parent->m_wxwindow), button, m_x+x, m_y+y, max, 20 );
d3b4d113 320 x += max;
29006414 321
d3b4d113
RR
322 node = node->Next();
323 }
29006414 324 res.x = x+4;
3417c2cd 325 res.y = 40;
e5403d7c 326 }
29006414 327
d3b4d113 328 return res;
3f659fd6
RR
329}
330
debe6624 331bool wxRadioBox::Show( bool show )
c801d85f 332{
223d09f6 333 wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid radiobox") );
29006414 334
f96ac56a
RR
335 if (!wxControl::Show(show))
336 {
337 // nothing to do
338 return FALSE;
339 }
c801d85f 340
ba2a0103 341 if ((m_windowStyle & wxNO_BORDER) != 0)
b0351fc9 342 gtk_widget_hide( m_widget );
e3e717ec 343
907789a0
RR
344 wxNode *node = m_boxes.First();
345 while (node)
346 {
347 GtkWidget *button = GTK_WIDGET( node->Data() );
29006414 348
907789a0 349 if (show) gtk_widget_show( button ); else gtk_widget_hide( button );
29006414 350
907789a0
RR
351 node = node->Next();
352 }
c801d85f 353
907789a0 354 return TRUE;
6de97a3b 355}
c801d85f 356
47908e25 357int wxRadioBox::FindString( const wxString &s ) const
c801d85f 358{
223d09f6 359 wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid radiobox") );
29006414 360
907789a0 361 int count = 0;
29006414 362
907789a0
RR
363 wxNode *node = m_boxes.First();
364 while (node)
365 {
366 GtkButton *button = GTK_BUTTON( node->Data() );
29006414 367
907789a0
RR
368 GtkLabel *label = GTK_LABEL( button->child );
369 if (s == label->label) return count;
370 count++;
29006414 371
907789a0
RR
372 node = node->Next();
373 }
29006414 374
907789a0 375 return -1;
6de97a3b 376}
c801d85f 377
b292e2f5
RR
378void wxRadioBox::SetFocus()
379{
223d09f6 380 wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
29006414 381
b292e2f5 382 if (m_boxes.GetCount() == 0) return;
29006414 383
b292e2f5
RR
384 wxNode *node = m_boxes.First();
385 while (node)
386 {
387 GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
388 if (button->active)
29006414 389 {
b292e2f5 390 gtk_widget_grab_focus( GTK_WIDGET(button) );
29006414
VZ
391 return;
392 }
b292e2f5
RR
393 node = node->Next();
394 }
29006414 395
b292e2f5
RR
396}
397
47908e25 398void wxRadioBox::SetSelection( int n )
c801d85f 399{
223d09f6 400 wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
29006414 401
907789a0 402 wxNode *node = m_boxes.Nth( n );
29006414 403
223d09f6 404 wxCHECK_RET( node, wxT("radiobox wrong index") );
29006414 405
907789a0 406 GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
29006414 407
72a7edf0 408 GtkDisableEvents();
953704c1 409
907789a0 410 gtk_toggle_button_set_state( button, 1 );
953704c1 411
72a7edf0 412 GtkEnableEvents();
6de97a3b 413}
c801d85f
KB
414
415int wxRadioBox::GetSelection(void) const
416{
223d09f6 417 wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid radiobox") );
29006414 418
907789a0 419 int count = 0;
29006414 420
907789a0
RR
421 wxNode *node = m_boxes.First();
422 while (node)
423 {
424 GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
425 if (button->active) return count;
426 count++;
427 node = node->Next();
428 }
29006414 429
223d09f6 430 wxFAIL_MSG( wxT("wxRadioBox none selected") );
29006414 431
907789a0 432 return -1;
6de97a3b 433}
c801d85f 434
47908e25 435wxString wxRadioBox::GetString( int n ) const
c801d85f 436{
223d09f6 437 wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid radiobox") );
29006414 438
907789a0 439 wxNode *node = m_boxes.Nth( n );
29006414 440
223d09f6 441 wxCHECK_MSG( node, wxT(""), wxT("radiobox wrong index") );
29006414 442
907789a0
RR
443 GtkButton *button = GTK_BUTTON( node->Data() );
444 GtkLabel *label = GTK_LABEL( button->child );
29006414 445
907789a0 446 return wxString( label->label );
6de97a3b 447}
c801d85f 448
d3904ceb 449wxString wxRadioBox::GetLabel( int item ) const
c801d85f 450{
223d09f6 451 wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid radiobox") );
29006414 452
907789a0 453 return GetString( item );
6de97a3b 454}
c801d85f 455
d3904ceb 456void wxRadioBox::SetLabel( const wxString& label )
c801d85f 457{
223d09f6 458 wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
29006414 459
907789a0 460 wxControl::SetLabel( label );
29006414 461
b019151f 462 gtk_frame_set_label( GTK_FRAME(m_widget), wxControl::GetLabel().mbc_str() );
6de97a3b 463}
c801d85f 464
d3904ceb 465void wxRadioBox::SetLabel( int item, const wxString& label )
c801d85f 466{
223d09f6 467 wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
29006414 468
907789a0 469 wxNode *node = m_boxes.Nth( item );
29006414 470
223d09f6 471 wxCHECK_RET( node, wxT("radiobox wrong index") );
29006414 472
907789a0
RR
473 GtkButton *button = GTK_BUTTON( node->Data() );
474 GtkLabel *g_label = GTK_LABEL( button->child );
29006414 475
b019151f 476 gtk_label_set( g_label, label.mbc_str() );
6de97a3b 477}
c801d85f 478
debe6624 479void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) )
c801d85f 480{
223d09f6 481 wxFAIL_MSG(wxT("wxRadioBox::SetLabel not implemented."));
6de97a3b 482}
c801d85f 483
f03fc89f 484bool wxRadioBox::Enable( bool enable )
c801d85f 485{
f03fc89f
VZ
486 if ( !wxControl::Enable( enable ) )
487 return FALSE;
29006414 488
907789a0
RR
489 wxNode *node = m_boxes.First();
490 while (node)
491 {
492 GtkButton *button = GTK_BUTTON( node->Data() );
493 GtkWidget *label = button->child;
494 gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
495 gtk_widget_set_sensitive( label, enable );
496 node = node->Next();
497 }
f03fc89f
VZ
498
499 return TRUE;
6de97a3b 500}
c801d85f 501
d3904ceb 502void wxRadioBox::Enable( int item, bool enable )
c801d85f 503{
223d09f6 504 wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
29006414 505
907789a0 506 wxNode *node = m_boxes.Nth( item );
29006414 507
223d09f6 508 wxCHECK_RET( node, wxT("radiobox wrong index") );
29006414 509
907789a0
RR
510 GtkButton *button = GTK_BUTTON( node->Data() );
511 GtkWidget *label = button->child;
512 gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
513 gtk_widget_set_sensitive( label, enable );
6de97a3b 514}
c801d85f 515
d3904ceb 516void wxRadioBox::Show( int item, bool show )
c801d85f 517{
223d09f6 518 wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
29006414 519
907789a0 520 wxNode *node = m_boxes.Nth( item );
29006414 521
223d09f6 522 wxCHECK_RET( node, wxT("radiobox wrong index") );
29006414 523
907789a0 524 GtkWidget *button = GTK_WIDGET( node->Data() );
c801d85f 525
907789a0
RR
526 if (show)
527 gtk_widget_show( button );
528 else
529 gtk_widget_hide( button );
6de97a3b 530}
c801d85f 531
9c884972 532wxString wxRadioBox::GetStringSelection() const
c801d85f 533{
223d09f6 534 wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid radiobox") );
29006414 535
907789a0
RR
536 wxNode *node = m_boxes.First();
537 while (node)
c801d85f 538 {
907789a0
RR
539 GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
540 if (button->active)
541 {
542 GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
543 return label->label;
544 }
545 node = node->Next();
6de97a3b 546 }
29006414 547
223d09f6
KB
548 wxFAIL_MSG( wxT("wxRadioBox none selected") );
549 return wxT("");
6de97a3b 550}
c801d85f 551
907789a0 552bool wxRadioBox::SetStringSelection( const wxString &s )
c801d85f 553{
223d09f6 554 wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid radiobox") );
29006414 555
907789a0
RR
556 int res = FindString( s );
557 if (res == -1) return FALSE;
558 SetSelection( res );
29006414 559
907789a0 560 return TRUE;
6de97a3b 561}
c801d85f 562
9c884972 563int wxRadioBox::Number() const
c801d85f 564{
907789a0 565 return m_boxes.Number();
6de97a3b 566}
c801d85f 567
9c884972 568int wxRadioBox::GetNumberOfRowsOrCols() const
c801d85f 569{
907789a0 570 return 1;
6de97a3b 571}
c801d85f 572
debe6624 573void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
c801d85f 574{
223d09f6 575 wxFAIL_MSG(wxT("wxRadioBox::SetNumberOfRowsOrCols not implemented."));
6de97a3b 576}
c801d85f 577
72a7edf0 578void wxRadioBox::GtkDisableEvents()
953704c1
RR
579{
580 wxNode *node = m_boxes.First();
581 while (node)
582 {
583 gtk_signal_disconnect_by_func( GTK_OBJECT(node->Data()),
584 GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
585
586 node = node->Next();
587 }
588}
589
72a7edf0 590void wxRadioBox::GtkEnableEvents()
953704c1
RR
591{
592 wxNode *node = m_boxes.First();
593 while (node)
594 {
595 gtk_signal_connect( GTK_OBJECT(node->Data()), "clicked",
596 GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
597
598 node = node->Next();
599 }
600}
601
58614078 602void wxRadioBox::ApplyWidgetStyle()
868a2826 603{
907789a0 604 SetWidgetStyle();
29006414 605
907789a0 606 gtk_widget_set_style( m_widget, m_widgetStyle );
29006414 607
907789a0
RR
608 wxNode *node = m_boxes.First();
609 while (node)
610 {
611 GtkWidget *widget = GTK_WIDGET( node->Data() );
612 gtk_widget_set_style( widget, m_widgetStyle );
29006414 613
907789a0
RR
614 GtkButton *button = GTK_BUTTON( node->Data() );
615 gtk_widget_set_style( button->child, m_widgetStyle );
29006414 616
907789a0
RR
617 node = node->Next();
618 }
868a2826 619}
b4071e91 620
72a7edf0
RR
621#if wxUSE_TOOLTIPS
622void wxRadioBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
623{
624 wxNode *node = m_boxes.First();
625 while (node)
626 {
627 GtkWidget *widget = GTK_WIDGET( node->Data() );
628 gtk_tooltips_set_tip( tips, widget, wxConvCurrent->cWX2MB(tip), (gchar*) NULL );
629 node = node->Next();
630 }
631}
632#endif // wxUSE_TOOLTIPS
633
b4071e91
RR
634bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
635{
907789a0 636 if (window == m_widget->window) return TRUE;
29006414 637
907789a0
RR
638 wxNode *node = m_boxes.First();
639 while (node)
640 {
641 GtkWidget *button = GTK_WIDGET( node->Data() );
29006414 642
907789a0 643 if (window == button->window) return TRUE;
29006414 644
907789a0
RR
645 node = node->Next();
646 }
29006414 647
907789a0 648 return FALSE;
b4071e91 649}
dcf924a3
RR
650
651#endif