]> git.saurik.com Git - wxWidgets.git/blob - src/gtk/notebook.cpp
fix wxStringOutputStream::Write() in Unicode build when the output overlaps a boundar...
[wxWidgets.git] / src / gtk / notebook.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk/notebook.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling, Vadim Zeitlin
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #if wxUSE_NOTEBOOK
14
15 #include "wx/notebook.h"
16
17 #ifndef WX_PRECOMP
18 #include "wx/intl.h"
19 #include "wx/log.h"
20 #include "wx/utils.h"
21 #include "wx/msgdlg.h"
22 #include "wx/bitmap.h"
23 #endif
24
25 #include "wx/imaglist.h"
26 #include "wx/fontutil.h"
27
28 #include "wx/gtk/private.h"
29
30 #include <gdk/gdkkeysyms.h>
31
32 // ----------------------------------------------------------------------------
33 // events
34 // ----------------------------------------------------------------------------
35
36 DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
37 DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
38
39 //-----------------------------------------------------------------------------
40 // data
41 //-----------------------------------------------------------------------------
42
43 extern bool g_blockEventsOnDrag;
44
45 //-----------------------------------------------------------------------------
46 // wxGtkNotebookPage
47 //-----------------------------------------------------------------------------
48
49 // VZ: this is rather ugly as we keep the pages themselves in an array (it
50 // allows us to have quite a few functions implemented in the base class)
51 // but the page data is kept in a separate list, so we must maintain them
52 // in sync manually... of course, the list had been there before the base
53 // class which explains it but it still would be nice to do something
54 // about this one day
55
56 class wxGtkNotebookPage: public wxObject
57 {
58 public:
59 wxGtkNotebookPage()
60 {
61 m_image = -1;
62 m_page = (GtkNotebookPage *) NULL;
63 m_box = (GtkWidget *) NULL;
64 }
65
66 wxString m_text;
67 int m_image;
68 GtkNotebookPage *m_page;
69 GtkLabel *m_label;
70 GtkWidget *m_box; // in which the label and image are packed
71 };
72
73
74 #include "wx/listimpl.cpp"
75 WX_DEFINE_LIST(wxGtkNotebookPagesList)
76
77
78 //-----------------------------------------------------------------------------
79 // "switch_page"
80 //-----------------------------------------------------------------------------
81
82 extern "C" {
83 static void gtk_notebook_page_changing_callback( GtkNotebook *widget,
84 GtkNotebookPage *WXUNUSED(gpage),
85 guint page,
86 wxNotebook *notebook )
87 {
88 int old = gtk_notebook_get_current_page( widget );
89
90 if ( !notebook->SendPageChangingEvent(page) )
91 {
92 // program doesn't allow the page change
93 g_signal_stop_emission_by_name(notebook->m_widget, "switch_page");
94 }
95 else
96 {
97 // the page change event also reports the old page
98 notebook->m_oldSelection = old;
99 }
100 }
101 }
102
103 extern "C" {
104 static void gtk_notebook_page_changed_callback( GtkNotebook *widget,
105 GtkNotebookPage *WXUNUSED(gpage),
106 guint page,
107 wxNotebook *notebook )
108 {
109 int old = notebook->m_oldSelection;
110 notebook->SendPageChangedEvent( old );
111 }
112 }
113
114 //-----------------------------------------------------------------------------
115 // "size_allocate"
116 //-----------------------------------------------------------------------------
117
118 extern "C" {
119 static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
120 {
121 if ((win->m_x == alloc->x) &&
122 (win->m_y == alloc->y) &&
123 (win->m_width == alloc->width) &&
124 (win->m_height == alloc->height))
125 {
126 return;
127 }
128
129 win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
130
131 /* GTK 1.2 up to version 1.2.5 is broken so that we have to call allocate
132 here in order to make repositioning after resizing to take effect. */
133 if ((gtk_major_version == 1) &&
134 (gtk_minor_version == 2) &&
135 (gtk_micro_version < 6) &&
136 (win->m_wxwindow) &&
137 (GTK_WIDGET_REALIZED(win->m_wxwindow)))
138 {
139 gtk_widget_size_allocate( win->m_wxwindow, alloc );
140 }
141 }
142 }
143
144 //-----------------------------------------------------------------------------
145 // "realize" from m_widget
146 //-----------------------------------------------------------------------------
147
148 extern "C" {
149 static void
150 gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
151 {
152 /* GTK 1.2 up to version 1.2.5 is broken so that we have to call a queue_resize
153 here in order to make repositioning before showing to take effect. */
154 gtk_widget_queue_resize( win->m_widget );
155 }
156 }
157
158 //-----------------------------------------------------------------------------
159 // InsertChild callback for wxNotebook
160 //-----------------------------------------------------------------------------
161
162 static void wxInsertChildInNotebook( wxNotebook* parent, wxWindow* child )
163 {
164 // Hack Alert! (Part I): This sets the notebook as the parent of the child
165 // widget, and takes care of some details such as updating the state and
166 // style of the child to reflect its new location. We do this early
167 // because without it GetBestSize (which is used to set the initial size
168 // of controls if an explicit size is not given) will often report
169 // incorrect sizes since the widget's style context is not fully known.
170 // See bug #901694 for details
171 // (http://sourceforge.net/tracker/?func=detail&aid=901694&group_id=9863&atid=109863)
172 gtk_widget_set_parent(child->m_widget, parent->m_widget);
173
174 // NOTE: This should be considered a temporary workaround until we can
175 // work out the details and implement delaying the setting of the initial
176 // size of widgets until the size is really needed.
177 }
178
179 //-----------------------------------------------------------------------------
180 // wxNotebook
181 //-----------------------------------------------------------------------------
182
183 IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl)
184
185 BEGIN_EVENT_TABLE(wxNotebook, wxControl)
186 EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
187 END_EVENT_TABLE()
188
189 void wxNotebook::Init()
190 {
191 m_padding = 0;
192
193 m_imageList = (wxImageList *) NULL;
194 m_oldSelection = -1;
195 m_themeEnabled = true;
196 }
197
198 wxNotebook::wxNotebook()
199 {
200 Init();
201 }
202
203 wxNotebook::wxNotebook( wxWindow *parent, wxWindowID id,
204 const wxPoint& pos, const wxSize& size,
205 long style, const wxString& name )
206 {
207 Init();
208 Create( parent, id, pos, size, style, name );
209 }
210
211 wxNotebook::~wxNotebook()
212 {
213 DeleteAllPages();
214 }
215
216 bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
217 const wxPoint& pos, const wxSize& size,
218 long style, const wxString& name )
219 {
220 m_insertCallback = (wxInsertChildFunction)wxInsertChildInNotebook;
221
222 if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT )
223 style |= wxBK_TOP;
224
225 if (!PreCreation( parent, pos, size ) ||
226 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
227 {
228 wxFAIL_MSG( wxT("wxNoteBook creation failed") );
229 return false;
230 }
231
232
233 m_widget = gtk_notebook_new();
234
235 gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
236
237 g_signal_connect (m_widget, "switch_page",
238 G_CALLBACK (gtk_notebook_page_changing_callback), this);
239
240 g_signal_connect_after (m_widget, "switch_page",
241 G_CALLBACK (gtk_notebook_page_changed_callback), this);
242
243 m_parent->DoAddChild( this );
244
245 if (m_windowStyle & wxBK_RIGHT)
246 gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
247 if (m_windowStyle & wxBK_LEFT)
248 gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
249 if (m_windowStyle & wxBK_BOTTOM)
250 gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
251
252 PostCreation(size);
253
254 g_signal_connect (m_widget, "realize",
255 G_CALLBACK (gtk_notebook_realized_callback), this);
256
257 return true;
258 }
259
260 int wxNotebook::GetSelection() const
261 {
262 wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
263
264 return gtk_notebook_get_current_page( GTK_NOTEBOOK(m_widget) );
265 }
266
267 wxString wxNotebook::GetPageText( size_t page ) const
268 {
269 wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid notebook") );
270
271 wxGtkNotebookPage* nb_page = GetNotebookPage(page);
272 if (nb_page)
273 return nb_page->m_text;
274 else
275 return wxEmptyString;
276 }
277
278 int wxNotebook::GetPageImage( size_t page ) const
279 {
280 wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
281
282 wxGtkNotebookPage* nb_page = GetNotebookPage(page);
283 if (nb_page)
284 return nb_page->m_image;
285 else
286 return -1;
287 }
288
289 wxGtkNotebookPage* wxNotebook::GetNotebookPage( int page ) const
290 {
291 wxCHECK_MSG( m_widget != NULL, (wxGtkNotebookPage*) NULL, wxT("invalid notebook") );
292
293 wxCHECK_MSG( page < (int)m_pagesData.GetCount(), (wxGtkNotebookPage*) NULL, wxT("invalid notebook index") );
294
295 return m_pagesData.Item(page)->GetData();
296 }
297
298 int wxNotebook::DoSetSelection( size_t page, int flags )
299 {
300 wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
301
302 wxCHECK_MSG( page < m_pagesData.GetCount(), -1, wxT("invalid notebook index") );
303
304 int selOld = GetSelection();
305
306 if ( !(flags & SetSelection_SendEvent) )
307 {
308 g_signal_handlers_disconnect_by_func (m_widget,
309 (gpointer) gtk_notebook_page_changing_callback,
310 this);
311
312 g_signal_handlers_disconnect_by_func (m_widget,
313 (gpointer) gtk_notebook_page_changed_callback,
314 this);
315 }
316
317 gtk_notebook_set_current_page( GTK_NOTEBOOK(m_widget), page );
318
319 if ( !(flags & SetSelection_SendEvent) )
320 {
321 // reconnect to signals
322
323 g_signal_connect (m_widget, "switch_page",
324 G_CALLBACK (gtk_notebook_page_changing_callback), this);
325
326 g_signal_connect_after (m_widget, "switch_page",
327 G_CALLBACK (gtk_notebook_page_changed_callback), this);
328 }
329
330 wxNotebookPage *client = GetPage(page);
331 if ( client )
332 client->SetFocus();
333
334 return selOld;
335 }
336
337 bool wxNotebook::SetPageText( size_t page, const wxString &text )
338 {
339 wxCHECK_MSG( m_widget != NULL, false, wxT("invalid notebook") );
340
341 wxGtkNotebookPage* nb_page = GetNotebookPage(page);
342
343 wxCHECK_MSG( nb_page, false, wxT("SetPageText: invalid page index") );
344
345 nb_page->m_text = text;
346
347 gtk_label_set_text( nb_page->m_label, wxGTK_CONV( nb_page->m_text ) );
348
349 return true;
350 }
351
352 bool wxNotebook::SetPageImage( size_t page, int image )
353 {
354 /* HvdH 28-12-98: now it works, but it's a bit of a kludge */
355
356 wxGtkNotebookPage* nb_page = GetNotebookPage(page);
357
358 if (!nb_page) return false;
359
360 /* Optimization posibility: return immediately if image unchanged.
361 * Not enabled because it may break existing (stupid) code that
362 * manipulates the imagelist to cycle images */
363
364 /* if (image == nb_page->m_image) return true; */
365
366 /* For different cases:
367 1) no image -> no image
368 2) image -> no image
369 3) no image -> image
370 4) image -> image */
371
372 if (image == -1 && nb_page->m_image == -1)
373 return true; /* Case 1): Nothing to do. */
374
375 GtkWidget *pixmapwid = (GtkWidget*) NULL;
376
377 if (nb_page->m_image != -1)
378 {
379 /* Case 2) or 4). There is already an image in the gtkhbox. Let's find it */
380
381 GList *child = gtk_container_get_children(GTK_CONTAINER(nb_page->m_box));
382 while (child)
383 {
384 if (GTK_IS_IMAGE(child->data))
385 {
386 pixmapwid = GTK_WIDGET(child->data);
387 break;
388 }
389 child = child->next;
390 }
391
392 /* We should have the pixmap widget now */
393 wxASSERT(pixmapwid != NULL);
394
395 if (image == -1)
396 {
397 /* If there's no new widget, just remove the old from the box */
398 gtk_container_remove(GTK_CONTAINER(nb_page->m_box), pixmapwid);
399 nb_page->m_image = -1;
400
401 return true; /* Case 2) */
402 }
403 }
404
405 /* Only cases 3) and 4) left */
406 wxASSERT( m_imageList != NULL ); /* Just in case */
407
408 /* Construct the new pixmap */
409 const wxBitmap *bmp = m_imageList->GetBitmapPtr(image);
410
411 if (pixmapwid == NULL)
412 {
413 /* Case 3) No old pixmap. Create a new one and prepend it to the hbox */
414 pixmapwid = gtk_image_new_from_pixbuf(bmp->GetPixbuf());
415
416 /* CHECKME: Are these pack flags okay? */
417 gtk_box_pack_start(GTK_BOX(nb_page->m_box), pixmapwid, FALSE, FALSE, m_padding);
418 gtk_widget_show(pixmapwid);
419 }
420 else
421 {
422 /* Case 4) Simply replace the pixmap */
423 gtk_image_set_from_pixbuf((GtkImage*)pixmapwid, bmp->GetPixbuf());
424 }
425
426 nb_page->m_image = image;
427
428 return true;
429 }
430
431 void wxNotebook::SetPageSize( const wxSize &WXUNUSED(size) )
432 {
433 wxFAIL_MSG( wxT("wxNotebook::SetPageSize not implemented") );
434 }
435
436 void wxNotebook::SetPadding( const wxSize &padding )
437 {
438 wxCHECK_RET( m_widget != NULL, wxT("invalid notebook") );
439
440 m_padding = padding.GetWidth();
441
442 int i;
443 for (i=0; i<int(GetPageCount()); i++)
444 {
445 wxGtkNotebookPage* nb_page = GetNotebookPage(i);
446 wxASSERT(nb_page != NULL);
447
448 if (nb_page->m_image != -1)
449 {
450 // gtk_box_set_child_packing sets padding on BOTH sides
451 // icon provides left padding, label provides center and right
452 int image = nb_page->m_image;
453 SetPageImage(i,-1);
454 SetPageImage(i,image);
455 }
456 wxASSERT(nb_page->m_label);
457 gtk_box_set_child_packing(GTK_BOX(nb_page->m_box),
458 GTK_WIDGET(nb_page->m_label),
459 FALSE, FALSE, m_padding, GTK_PACK_END);
460 }
461 }
462
463 void wxNotebook::SetTabSize(const wxSize& WXUNUSED(sz))
464 {
465 wxFAIL_MSG( wxT("wxNotebook::SetTabSize not implemented") );
466 }
467
468 bool wxNotebook::DeleteAllPages()
469 {
470 wxCHECK_MSG( m_widget != NULL, false, wxT("invalid notebook") );
471
472 while (m_pagesData.GetCount() > 0)
473 DeletePage( m_pagesData.GetCount()-1 );
474
475 wxASSERT_MSG( GetPageCount() == 0, _T("all pages must have been deleted") );
476
477 InvalidateBestSize();
478 return wxNotebookBase::DeleteAllPages();
479 }
480
481 wxNotebookPage *wxNotebook::DoRemovePage( size_t page )
482 {
483 wxNotebookPage *client = wxNotebookBase::DoRemovePage(page);
484 if ( !client )
485 return NULL;
486
487 gtk_widget_ref( client->m_widget );
488 gtk_widget_unrealize( client->m_widget );
489
490 // we don't need to unparent the client->m_widget; GTK+ will do
491 // that for us (and will throw a warning if we do it!)
492
493 gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
494
495 wxGtkNotebookPage* p = GetNotebookPage(page);
496 m_pagesData.DeleteObject(p);
497 delete p;
498
499 return client;
500 }
501
502 bool wxNotebook::InsertPage( size_t position,
503 wxNotebookPage* win,
504 const wxString& text,
505 bool select,
506 int imageId )
507 {
508 wxCHECK_MSG( m_widget != NULL, false, wxT("invalid notebook") );
509
510 wxCHECK_MSG( win->GetParent() == this, false,
511 wxT("Can't add a page whose parent is not the notebook!") );
512
513 wxCHECK_MSG( position <= GetPageCount(), false,
514 _T("invalid page index in wxNotebookPage::InsertPage()") );
515
516 // Hack Alert! (Part II): See above in wxInsertChildInNotebook callback
517 // why this has to be done. NOTE: using gtk_widget_unparent here does not
518 // work as it seems to undo too much and will cause errors in the
519 // gtk_notebook_insert_page below, so instead just clear the parent by
520 // hand here.
521 win->m_widget->parent = NULL;
522
523 if (m_themeEnabled)
524 win->SetThemeEnabled(true);
525
526 GtkNotebook *notebook = GTK_NOTEBOOK(m_widget);
527
528 wxGtkNotebookPage *nb_page = new wxGtkNotebookPage();
529
530 if ( position == GetPageCount() )
531 m_pagesData.Append( nb_page );
532 else
533 m_pagesData.Insert( position, nb_page );
534
535 m_pages.Insert(win, position);
536
537 nb_page->m_box = gtk_hbox_new( FALSE, 1 );
538 gtk_container_set_border_width((GtkContainer*)nb_page->m_box, 2);
539
540 g_signal_connect (win->m_widget, "size_allocate",
541 G_CALLBACK (gtk_page_size_callback), win);
542
543 gtk_notebook_insert_page( notebook, win->m_widget, nb_page->m_box, position );
544
545 nb_page->m_page = (GtkNotebookPage*) g_list_last(notebook->children)->data;
546
547 /* set the label image */
548 nb_page->m_image = imageId;
549
550 if (imageId != -1)
551 {
552 wxASSERT( m_imageList != NULL );
553
554 const wxBitmap *bmp = m_imageList->GetBitmapPtr(imageId);
555 GtkWidget* pixmapwid = gtk_image_new_from_pixbuf(bmp->GetPixbuf());
556 gtk_box_pack_start(GTK_BOX(nb_page->m_box), pixmapwid, FALSE, FALSE, m_padding);
557 gtk_widget_show(pixmapwid);
558 }
559
560 /* set the label text */
561
562 nb_page->m_text = wxStripMenuCodes(text);
563 if (nb_page->m_text.empty()) nb_page->m_text = wxEmptyString;
564
565 nb_page->m_label = GTK_LABEL( gtk_label_new(wxGTK_CONV(nb_page->m_text)) );
566 gtk_box_pack_end( GTK_BOX(nb_page->m_box), GTK_WIDGET(nb_page->m_label), FALSE, FALSE, m_padding );
567
568 /* apply current style */
569 GtkRcStyle *style = CreateWidgetStyle();
570 if ( style )
571 {
572 gtk_widget_modify_style(GTK_WIDGET(nb_page->m_label), style);
573 gtk_rc_style_unref(style);
574 }
575
576 /* show the label */
577 gtk_widget_show( GTK_WIDGET(nb_page->m_label) );
578
579 if (select && (m_pagesData.GetCount() > 1))
580 {
581 SetSelection( position );
582 }
583
584 InvalidateBestSize();
585 return true;
586 }
587
588 // helper for HitTest(): check if the point lies inside the given widget which
589 // is the child of the notebook whose position and border size are passed as
590 // parameters
591 static bool
592 IsPointInsideWidget(const wxPoint& pt, GtkWidget *w,
593 gint x, gint y, gint border = 0)
594 {
595 return
596 (pt.x >= w->allocation.x - x - border) &&
597 (pt.x <= w->allocation.x - x + border + w->allocation.width) &&
598 (pt.y >= w->allocation.y - y - border) &&
599 (pt.y <= w->allocation.y - y + border + w->allocation.height);
600 }
601
602 int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
603 {
604 const gint x = m_widget->allocation.x;
605 const gint y = m_widget->allocation.y;
606
607 const size_t count = GetPageCount();
608 size_t i = 0;
609
610 GtkNotebook * notebook = GTK_NOTEBOOK(m_widget);
611 if (gtk_notebook_get_scrollable(notebook))
612 i = g_list_position( notebook->children, notebook->first_tab );
613
614 for ( ; i < count; i++ )
615 {
616 wxGtkNotebookPage* nb_page = GetNotebookPage(i);
617 GtkWidget *box = nb_page->m_box;
618
619 const gint border = gtk_container_get_border_width(GTK_CONTAINER(box));
620
621 if ( IsPointInsideWidget(pt, box, x, y, border) )
622 {
623 // ok, we're inside this tab -- now find out where, if needed
624 if ( flags )
625 {
626 GtkWidget *pixmap = NULL;
627
628 GList *children = gtk_container_get_children(GTK_CONTAINER(box));
629 for ( GList *child = children; child; child = child->next )
630 {
631 if (GTK_IS_IMAGE(child->data))
632 {
633 pixmap = GTK_WIDGET(child->data);
634 break;
635 }
636 }
637
638 if ( children )
639 g_list_free(children);
640
641 if ( pixmap && IsPointInsideWidget(pt, pixmap, x, y) )
642 {
643 *flags = wxBK_HITTEST_ONICON;
644 }
645 else if ( IsPointInsideWidget(pt, GTK_WIDGET(nb_page->m_label), x, y) )
646 {
647 *flags = wxBK_HITTEST_ONLABEL;
648 }
649 else
650 {
651 *flags = wxBK_HITTEST_ONITEM;
652 }
653 }
654
655 return i;
656 }
657 }
658
659 if ( flags )
660 {
661 *flags = wxBK_HITTEST_NOWHERE;
662 wxWindowBase * page = GetCurrentPage();
663 if ( page )
664 {
665 // rect origin is in notebook's parent coordinates
666 wxRect rect = page->GetRect();
667
668 // adjust it to the notebook's coordinates
669 wxPoint pos = GetPosition();
670 rect.x -= pos.x;
671 rect.y -= pos.y;
672 if ( rect.Contains( pt ) )
673 *flags |= wxBK_HITTEST_ONPAGE;
674 }
675 }
676
677 return wxNOT_FOUND;
678 }
679
680 void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
681 {
682 if (event.IsWindowChange())
683 AdvanceSelection( event.GetDirection() );
684 else
685 event.Skip();
686 }
687
688 #if wxUSE_CONSTRAINTS
689
690 // override these 2 functions to do nothing: everything is done in OnSize
691 void wxNotebook::SetConstraintSizes( bool WXUNUSED(recurse) )
692 {
693 // don't set the sizes of the pages - their correct size is not yet known
694 wxControl::SetConstraintSizes(false);
695 }
696
697 bool wxNotebook::DoPhase( int WXUNUSED(nPhase) )
698 {
699 return true;
700 }
701
702 #endif
703
704 void wxNotebook::DoApplyWidgetStyle(GtkRcStyle *style)
705 {
706 gtk_widget_modify_style(m_widget, style);
707 size_t cnt = m_pagesData.GetCount();
708 for (size_t i = 0; i < cnt; i++)
709 gtk_widget_modify_style(GTK_WIDGET(GetNotebookPage(i)->m_label), style);
710 }
711
712 GdkWindow *wxNotebook::GTKGetWindow(wxArrayGdkWindows& windows) const
713 {
714 windows.push_back(m_widget->window);
715 windows.push_back(GTK_NOTEBOOK(m_widget)->event_window);
716
717 return NULL;
718 }
719
720 // static
721 wxVisualAttributes
722 wxNotebook::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
723 {
724 return GetDefaultAttributesFromGTKWidget(gtk_notebook_new);
725 }
726
727 //-----------------------------------------------------------------------------
728 // wxNotebookEvent
729 //-----------------------------------------------------------------------------
730
731 IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
732
733 #endif