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