]> git.saurik.com Git - wxWidgets.git/blob - src/gtk1/notebook.cpp
Watcom compilation fix
[wxWidgets.git] / src / gtk1 / notebook.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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 #ifdef __GNUG__
11 #pragma implementation "notebook.h"
12 #endif
13
14 #include "wx/notebook.h"
15
16 #if wxUSE_NOTEBOOK
17
18 #include "wx/panel.h"
19 #include "wx/utils.h"
20 #include "wx/imaglist.h"
21 #include "wx/intl.h"
22 #include "wx/log.h"
23 #include "wx/bitmap.h"
24
25 #include "wx/gtk/private.h"
26 #include "wx/gtk/win_gtk.h"
27
28 #include <gdk/gdkkeysyms.h>
29
30 // ----------------------------------------------------------------------------
31 // events
32 // ----------------------------------------------------------------------------
33
34 DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
35 DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
36
37 //-----------------------------------------------------------------------------
38 // idle system
39 //-----------------------------------------------------------------------------
40
41 extern void wxapp_install_idle_handler();
42 extern bool g_isIdle;
43
44 //-----------------------------------------------------------------------------
45 // data
46 //-----------------------------------------------------------------------------
47
48 extern bool g_blockEventsOnDrag;
49
50 //-----------------------------------------------------------------------------
51 // wxGtkNotebookPage
52 //-----------------------------------------------------------------------------
53
54 // VZ: this is rather ugly as we keep the pages themselves in an array (it
55 // allows us to have quite a few functions implemented in the base class)
56 // but the page data is kept in a separate list, so we must maintain them
57 // in sync manually... of course, the list had been there before the base
58 // class which explains it but it still would be nice to do something
59 // about this one day
60
61 class wxGtkNotebookPage: public wxObject
62 {
63 public:
64 wxGtkNotebookPage()
65 {
66 m_image = -1;
67 m_page = (GtkNotebookPage *) NULL;
68 m_box = (GtkWidget *) NULL;
69 }
70
71 wxString m_text;
72 int m_image;
73 GtkNotebookPage *m_page;
74 GtkLabel *m_label;
75 GtkWidget *m_box; // in which the label and image are packed
76 };
77
78 #include "wx/listimpl.cpp"
79 WX_DEFINE_LIST(wxGtkNotebookPagesList);
80
81 //-----------------------------------------------------------------------------
82 // "switch_page"
83 //-----------------------------------------------------------------------------
84
85 static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
86 GtkNotebookPage *WXUNUSED(page),
87 gint page,
88 wxNotebook *notebook )
89 {
90 // are you trying to call SetSelection() from a notebook event handler?
91 // you shouldn't!
92 wxCHECK_RET( !notebook->m_inSwitchPage,
93 _T("gtk_notebook_page_change_callback reentered") );
94
95 notebook->m_inSwitchPage = TRUE;
96 if (g_isIdle)
97 wxapp_install_idle_handler();
98
99 int old = notebook->GetSelection();
100
101 wxNotebookEvent eventChanging( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING,
102 notebook->GetId(), page, old );
103 eventChanging.SetEventObject( notebook );
104
105 if ( (notebook->GetEventHandler()->ProcessEvent(eventChanging)) &&
106 !eventChanging.IsAllowed() )
107 {
108 /* program doesn't allow the page change */
109 gtk_signal_emit_stop_by_name( GTK_OBJECT(notebook->m_widget),
110 "switch_page" );
111 }
112 else // change allowed
113 {
114 // make wxNotebook::GetSelection() return the correct (i.e. consistent
115 // with wxNotebookEvent::GetSelection()) value even though the page is
116 // not really changed in GTK+
117 notebook->m_selection = page;
118
119 wxNotebookEvent eventChanged( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
120 notebook->GetId(), page, old );
121 eventChanged.SetEventObject( notebook );
122 notebook->GetEventHandler()->ProcessEvent( eventChanged );
123 }
124
125 notebook->m_inSwitchPage = FALSE;
126 }
127
128 //-----------------------------------------------------------------------------
129 // "size_allocate"
130 //-----------------------------------------------------------------------------
131
132 static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
133 {
134 if (g_isIdle)
135 wxapp_install_idle_handler();
136
137 if ((win->m_x == alloc->x) &&
138 (win->m_y == alloc->y) &&
139 (win->m_width == alloc->width) &&
140 (win->m_height == alloc->height))
141 {
142 return;
143 }
144
145 win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
146
147 /* GTK 1.2 up to version 1.2.5 is broken so that we have to call allocate
148 here in order to make repositioning after resizing to take effect. */
149 if ((gtk_major_version == 1) &&
150 (gtk_minor_version == 2) &&
151 (gtk_micro_version < 6) &&
152 (win->m_wxwindow) &&
153 (GTK_WIDGET_REALIZED(win->m_wxwindow)))
154 {
155 gtk_widget_size_allocate( win->m_wxwindow, alloc );
156 }
157 }
158
159 //-----------------------------------------------------------------------------
160 // "realize" from m_widget
161 //-----------------------------------------------------------------------------
162
163 static gint
164 gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
165 {
166 if (g_isIdle)
167 wxapp_install_idle_handler();
168
169 /* GTK 1.2 up to version 1.2.5 is broken so that we have to call a queue_resize
170 here in order to make repositioning before showing to take effect. */
171 gtk_widget_queue_resize( win->m_widget );
172
173 return FALSE;
174 }
175
176 //-----------------------------------------------------------------------------
177 // "key_press_event"
178 //-----------------------------------------------------------------------------
179
180 static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxNotebook *win )
181 {
182 if (g_isIdle)
183 wxapp_install_idle_handler();
184
185 if (!win->m_hasVMT) return FALSE;
186 if (g_blockEventsOnDrag) return FALSE;
187
188 /* win is a control: tab can be propagated up */
189 if ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab))
190 {
191 int sel = win->GetSelection();
192 if (sel == -1)
193 return TRUE;
194 wxGtkNotebookPage *nb_page = win->GetNotebookPage(sel);
195 wxCHECK_MSG( nb_page, FALSE, _T("invalid selection in wxNotebook") );
196
197 wxNavigationKeyEvent event;
198 event.SetEventObject( win );
199 /* GDK reports GDK_ISO_Left_Tab for SHIFT-TAB */
200 event.SetDirection( (gdk_event->keyval == GDK_Tab) );
201 /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
202 event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) );
203 event.SetCurrentFocus( win );
204
205 wxNotebookPage *client = win->GetPage(sel);
206 if ( !client->GetEventHandler()->ProcessEvent( event ) )
207 {
208 client->SetFocus();
209 }
210
211 gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
212 return TRUE;
213 }
214
215 return FALSE;
216 }
217
218 //-----------------------------------------------------------------------------
219 // InsertChild callback for wxNotebook
220 //-----------------------------------------------------------------------------
221
222 static void wxInsertChildInNotebook( wxNotebook* WXUNUSED(parent), wxWindow* WXUNUSED(child) )
223 {
224 /* we don't do anything here but pray */
225 }
226
227 //-----------------------------------------------------------------------------
228 // wxNotebook
229 //-----------------------------------------------------------------------------
230
231 IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl)
232
233 BEGIN_EVENT_TABLE(wxNotebook, wxControl)
234 EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
235 END_EVENT_TABLE()
236
237 void wxNotebook::Init()
238 {
239 m_padding = 0;
240 m_inSwitchPage = FALSE;
241
242 m_imageList = (wxImageList *) NULL;
243 m_selection = -1;
244 m_themeEnabled = TRUE;
245 }
246
247 wxNotebook::wxNotebook()
248 {
249 Init();
250 }
251
252 wxNotebook::wxNotebook( wxWindow *parent, wxWindowID id,
253 const wxPoint& pos, const wxSize& size,
254 long style, const wxString& name )
255 {
256 Init();
257 Create( parent, id, pos, size, style, name );
258 }
259
260 wxNotebook::~wxNotebook()
261 {
262 /* don't generate change page events any more */
263 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
264 GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer) this );
265
266 DeleteAllPages();
267 }
268
269 bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
270 const wxPoint& pos, const wxSize& size,
271 long style, const wxString& name )
272 {
273 m_needParent = TRUE;
274 m_acceptsFocus = TRUE;
275 m_insertCallback = (wxInsertChildFunction)wxInsertChildInNotebook;
276
277 if (!PreCreation( parent, pos, size ) ||
278 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
279 {
280 wxFAIL_MSG( wxT("wxNoteBook creation failed") );
281 return FALSE;
282 }
283
284
285 m_widget = gtk_notebook_new();
286
287 gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
288
289 gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page",
290 GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer)this );
291
292 m_parent->DoAddChild( this );
293
294 if (m_windowStyle & wxNB_RIGHT)
295 gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
296 if (m_windowStyle & wxNB_LEFT)
297 gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
298 if (m_windowStyle & wxNB_BOTTOM)
299 gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
300
301 gtk_signal_connect( GTK_OBJECT(m_widget), "key_press_event",
302 GTK_SIGNAL_FUNC(gtk_notebook_key_press_callback), (gpointer)this );
303
304 PostCreation();
305
306 SetFont( parent->GetFont() );
307
308 gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
309 GTK_SIGNAL_FUNC(gtk_notebook_realized_callback), (gpointer) this );
310
311 Show( TRUE );
312
313 return TRUE;
314 }
315
316 int wxNotebook::GetSelection() const
317 {
318 wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
319
320 if ( m_selection == -1 )
321 {
322 GList *nb_pages = GTK_NOTEBOOK(m_widget)->children;
323
324 if (g_list_length(nb_pages) != 0)
325 {
326 GtkNotebook *notebook = GTK_NOTEBOOK(m_widget);
327
328 gpointer cur = notebook->cur_page;
329 if ( cur != NULL )
330 {
331 wxConstCast(this, wxNotebook)->m_selection =
332 g_list_index( nb_pages, cur );
333 }
334 }
335 }
336
337 return m_selection;
338 }
339
340 wxString wxNotebook::GetPageText( int page ) const
341 {
342 wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid notebook") );
343
344 wxGtkNotebookPage* nb_page = GetNotebookPage(page);
345 if (nb_page)
346 return nb_page->m_text;
347 else
348 return wxT("");
349 }
350
351 int wxNotebook::GetPageImage( int page ) const
352 {
353 wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
354
355 wxGtkNotebookPage* nb_page = GetNotebookPage(page);
356 if (nb_page)
357 return nb_page->m_image;
358 else
359 return -1;
360 }
361
362 wxGtkNotebookPage* wxNotebook::GetNotebookPage( int page ) const
363 {
364 wxCHECK_MSG( m_widget != NULL, (wxGtkNotebookPage*) NULL, wxT("invalid notebook") );
365
366 wxCHECK_MSG( page < (int)m_pagesData.GetCount(), (wxGtkNotebookPage*) NULL, wxT("invalid notebook index") );
367
368 return m_pagesData.Item(page)->GetData();
369 }
370
371 int wxNotebook::SetSelection( int page )
372 {
373 wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
374
375 wxCHECK_MSG( page >= 0 && page < (int)m_pagesData.GetCount(), -1, wxT("invalid notebook index") );
376
377 int selOld = GetSelection();
378
379 // cache the selection
380 m_selection = page;
381 gtk_notebook_set_page( GTK_NOTEBOOK(m_widget), page );
382
383 wxNotebookPage *client = GetPage(page);
384 if ( client )
385 client->SetFocus();
386
387 return selOld;
388 }
389
390 bool wxNotebook::SetPageText( int page, const wxString &text )
391 {
392 wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid notebook") );
393
394 wxGtkNotebookPage* nb_page = GetNotebookPage(page);
395
396 wxCHECK_MSG( nb_page, FALSE, wxT("SetPageText: invalid page index") );
397
398 nb_page->m_text = text;
399
400 gtk_label_set( nb_page->m_label, wxGTK_CONV( nb_page->m_text ) );
401
402 return TRUE;
403 }
404
405 bool wxNotebook::SetPageImage( int page, int image )
406 {
407 /* HvdH 28-12-98: now it works, but it's a bit of a kludge */
408
409 wxGtkNotebookPage* nb_page = GetNotebookPage(page);
410
411 if (!nb_page) return FALSE;
412
413 /* Optimization posibility: return immediately if image unchanged.
414 * Not enabled because it may break existing (stupid) code that
415 * manipulates the imagelist to cycle images */
416
417 /* if (image == nb_page->m_image) return TRUE; */
418
419 /* For different cases:
420 1) no image -> no image
421 2) image -> no image
422 3) no image -> image
423 4) image -> image */
424
425 if (image == -1 && nb_page->m_image == -1)
426 return TRUE; /* Case 1): Nothing to do. */
427
428 GtkWidget *pixmapwid = (GtkWidget*) NULL;
429
430 if (nb_page->m_image != -1)
431 {
432 /* Case 2) or 4). There is already an image in the gtkhbox. Let's find it */
433
434 GList *child = gtk_container_children(GTK_CONTAINER(nb_page->m_box));
435 while (child)
436 {
437 if (GTK_IS_PIXMAP(child->data))
438 {
439 pixmapwid = GTK_WIDGET(child->data);
440 break;
441 }
442 child = child->next;
443 }
444
445 /* We should have the pixmap widget now */
446 wxASSERT(pixmapwid != NULL);
447
448 if (image == -1)
449 {
450 /* If there's no new widget, just remove the old from the box */
451 gtk_container_remove(GTK_CONTAINER(nb_page->m_box), pixmapwid);
452 nb_page->m_image = -1;
453
454 return TRUE; /* Case 2) */
455 }
456 }
457
458 /* Only cases 3) and 4) left */
459 wxASSERT( m_imageList != NULL ); /* Just in case */
460
461 /* Construct the new pixmap */
462 const wxBitmap *bmp = m_imageList->GetBitmap(image);
463 GdkPixmap *pixmap = bmp->GetPixmap();
464 GdkBitmap *mask = (GdkBitmap*) NULL;
465 if ( bmp->GetMask() )
466 {
467 mask = bmp->GetMask()->GetBitmap();
468 }
469
470 if (pixmapwid == NULL)
471 {
472 /* Case 3) No old pixmap. Create a new one and prepend it to the hbox */
473 pixmapwid = gtk_pixmap_new (pixmap, mask );
474
475 /* CHECKME: Are these pack flags okay? */
476 gtk_box_pack_start(GTK_BOX(nb_page->m_box), pixmapwid, FALSE, FALSE, m_padding);
477 gtk_widget_show(pixmapwid);
478 }
479 else
480 {
481 /* Case 4) Simply replace the pixmap */
482 gtk_pixmap_set(GTK_PIXMAP(pixmapwid), pixmap, mask);
483 }
484
485 nb_page->m_image = image;
486
487 return TRUE;
488 }
489
490 void wxNotebook::SetPageSize( const wxSize &WXUNUSED(size) )
491 {
492 wxFAIL_MSG( wxT("wxNotebook::SetPageSize not implemented") );
493 }
494
495 void wxNotebook::SetPadding( const wxSize &padding )
496 {
497 wxCHECK_RET( m_widget != NULL, wxT("invalid notebook") );
498
499 m_padding = padding.GetWidth();
500
501 int i;
502 for (i=0; i<int(GetPageCount()); i++)
503 {
504 wxGtkNotebookPage* nb_page = GetNotebookPage(i);
505 wxASSERT(nb_page != NULL);
506
507 if (nb_page->m_image != -1)
508 {
509 // gtk_box_set_child_packing sets padding on BOTH sides
510 // icon provides left padding, label provides center and right
511 int image = nb_page->m_image;
512 SetPageImage(i,-1);
513 SetPageImage(i,image);
514 }
515 wxASSERT(nb_page->m_label);
516 gtk_box_set_child_packing(GTK_BOX(nb_page->m_box),
517 GTK_WIDGET(nb_page->m_label),
518 FALSE, FALSE, m_padding, GTK_PACK_END);
519 }
520 }
521
522 void wxNotebook::SetTabSize(const wxSize& WXUNUSED(sz))
523 {
524 wxFAIL_MSG( wxT("wxNotebook::SetTabSize not implemented") );
525 }
526
527 bool wxNotebook::DeleteAllPages()
528 {
529 wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid notebook") );
530
531 while (m_pagesData.GetCount() > 0)
532 DeletePage( m_pagesData.GetCount()-1 );
533
534 wxASSERT_MSG( GetPageCount() == 0, _T("all pages must have been deleted") );
535
536 return wxNotebookBase::DeleteAllPages();
537 }
538
539 bool wxNotebook::DeletePage( int page )
540 {
541 // GTK sets GtkNotebook.cur_page to NULL before sending the switch page
542 // event so we have to store the selection internally
543 if ( m_selection == -1 )
544 {
545 m_selection = GetSelection();
546 if ( m_selection == (int)m_pagesData.GetCount() - 1 )
547 {
548 // the index will become invalid after the page is deleted
549 m_selection = -1;
550 }
551 }
552
553 // it will call our DoRemovePage() to do the real work
554 return wxNotebookBase::DeletePage(page);
555 }
556
557 wxNotebookPage *wxNotebook::DoRemovePage( int page )
558 {
559 wxNotebookPage *client = wxNotebookBase::DoRemovePage(page);
560 if ( !client )
561 return NULL;
562
563 gtk_widget_ref( client->m_widget );
564 gtk_widget_unrealize( client->m_widget );
565 gtk_widget_unparent( client->m_widget );
566
567 gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
568
569 wxGtkNotebookPage* p = GetNotebookPage(page);
570 m_pagesData.DeleteObject(p);
571 delete p;
572
573 return client;
574 }
575
576 bool wxNotebook::InsertPage( int position,
577 wxNotebookPage* win,
578 const wxString& text,
579 bool select,
580 int imageId )
581 {
582 wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid notebook") );
583
584 wxCHECK_MSG( win->GetParent() == this, FALSE,
585 wxT("Can't add a page whose parent is not the notebook!") );
586
587 wxCHECK_MSG( position >= 0 && position <= GetPageCount(), FALSE,
588 _T("invalid page index in wxNotebookPage::InsertPage()") );
589
590 /* don't receive switch page during addition */
591 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
592 GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer) this );
593
594 if (m_themeEnabled)
595 win->SetThemeEnabled(TRUE);
596
597 GtkNotebook *notebook = GTK_NOTEBOOK(m_widget);
598
599 wxGtkNotebookPage *nb_page = new wxGtkNotebookPage();
600
601 if ( position == GetPageCount() )
602 m_pagesData.Append( nb_page );
603 else
604 m_pagesData.Insert( m_pagesData.Item( position ), nb_page );
605
606 m_pages.Insert(win, position);
607
608 nb_page->m_box = gtk_hbox_new( FALSE, 1 );
609 gtk_container_border_width( GTK_CONTAINER(nb_page->m_box), 2 );
610
611 gtk_signal_connect( GTK_OBJECT(win->m_widget), "size_allocate",
612 GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)win );
613
614 if (position < 0)
615 gtk_notebook_append_page( notebook, win->m_widget, nb_page->m_box );
616 else
617 gtk_notebook_insert_page( notebook, win->m_widget, nb_page->m_box, position );
618
619 nb_page->m_page = (GtkNotebookPage*) g_list_last(notebook->children)->data;
620
621 /* set the label image */
622 nb_page->m_image = imageId;
623
624 if (imageId != -1)
625 {
626 wxASSERT( m_imageList != NULL );
627
628 const wxBitmap *bmp = m_imageList->GetBitmap(imageId);
629 GdkPixmap *pixmap = bmp->GetPixmap();
630 GdkBitmap *mask = (GdkBitmap*) NULL;
631 if ( bmp->GetMask() )
632 {
633 mask = bmp->GetMask()->GetBitmap();
634 }
635
636 GtkWidget *pixmapwid = gtk_pixmap_new (pixmap, mask );
637
638 gtk_box_pack_start(GTK_BOX(nb_page->m_box), pixmapwid, FALSE, FALSE, m_padding);
639
640 gtk_widget_show(pixmapwid);
641 }
642
643 /* set the label text */
644 nb_page->m_text = text;
645 if (nb_page->m_text.IsEmpty()) nb_page->m_text = wxT("");
646
647 nb_page->m_label = GTK_LABEL( gtk_label_new(nb_page->m_text.mbc_str()) );
648 gtk_box_pack_end( GTK_BOX(nb_page->m_box), GTK_WIDGET(nb_page->m_label), FALSE, FALSE, m_padding );
649
650 /* show the label */
651 gtk_widget_show( GTK_WIDGET(nb_page->m_label) );
652 if (select && (m_pagesData.GetCount() > 1))
653 {
654 if (position < 0)
655 SetSelection( GetPageCount()-1 );
656 else
657 SetSelection( position );
658 }
659
660 gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page",
661 GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer)this );
662
663 return TRUE;
664 }
665
666 void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
667 {
668 if (event.IsWindowChange())
669 AdvanceSelection( event.GetDirection() );
670 else
671 event.Skip();
672 }
673
674 #if wxUSE_CONSTRAINTS
675
676 // override these 2 functions to do nothing: everything is done in OnSize
677 void wxNotebook::SetConstraintSizes( bool WXUNUSED(recurse) )
678 {
679 // don't set the sizes of the pages - their correct size is not yet known
680 wxControl::SetConstraintSizes(FALSE);
681 }
682
683 bool wxNotebook::DoPhase( int WXUNUSED(nPhase) )
684 {
685 return TRUE;
686 }
687
688 #endif
689
690 void wxNotebook::ApplyWidgetStyle()
691 {
692 // TODO, font for labels etc
693
694 SetWidgetStyle();
695 gtk_widget_set_style( m_widget, m_widgetStyle );
696 }
697
698 bool wxNotebook::IsOwnGtkWindow( GdkWindow *window )
699 {
700 return ((m_widget->window == window) ||
701 (NOTEBOOK_PANEL(m_widget) == window));
702 }
703
704 //-----------------------------------------------------------------------------
705 // wxNotebookEvent
706 //-----------------------------------------------------------------------------
707
708 IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
709
710 #endif