summaryrefslogtreecommitdiff
path: root/libs/gtkmm2/gtk/gtkmm/notebook.cc
blob: 7ff83da6d161d2052e2f14a59c9553ba00602b7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
// Generated by gtkmmproc -- DO NOT MODIFY!

#include <gtkmm/notebook.h>
#include <gtkmm/private/notebook_p.h>

#include <gtk/gtktypebuiltins.h>
// -*- c++ -*-
/* $Id$ */

/* Copyright 1998-2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gtk/gtknotebook.h>
#include <gtkmm/label.h>


namespace Gtk
{

namespace Notebook_Helpers
{

/**** Gtk::Notebook_Helpers::PageIterator **********************************/

bool PageIterator::equal(const PageIterator& other) const
{
  return (node_ == other.node_);
}

PageIterator::operator bool() const
{
  return (node_ != 0);
}

PageIterator& PageIterator::operator++()
{
  g_return_val_if_fail(node_ != 0, *this);

  node_ = node_->next;
  return *this;
}

const PageIterator PageIterator::operator++(int)
{
  const PageIterator tmp (*this);
  this->operator++();
  return tmp;
}

PageIterator& PageIterator::operator--()
{
  if(node_)
    node_ = node_->prev;
  else
    node_ = g_list_last(parent_->gobj()->children);

  return *this;
}

const PageIterator PageIterator::operator--(int)
{
  const PageIterator tmp (*this);
  this->operator--();
  return tmp;
}


/*********************************************************************
***** Page Properties
*********************************************************************/

int Page::get_page_num() const
{
  return g_list_position(parent_->gobj()->children, node_);
}

Widget* Page::get_child() const
{
  return parent_->get_nth_page(get_page_num());
}

Widget* Page::get_tab_label() const
{
  return parent_->get_tab_label(*get_child());
}

void Page::set_tab_label(Widget& tab_label)
{
  parent_->set_tab_label(*get_child(), tab_label);
}

void Page::set_tab_label_text(const Glib::ustring& tab_text)
{
  parent_->set_tab_label_text(*get_child(), tab_text);
}

Glib::ustring Page::get_tab_label_text() const
{
  return parent_->get_tab_label_text(*get_child());
}

Widget* Page::get_menu_label() const
{
  return parent_->get_menu_label(*get_child());
}

void Page::set_menu_label(Widget& menu_label)
{
  parent_->set_menu_label(*get_child(), menu_label);
}

void Page::set_menu_label_text(const Glib::ustring& menu_text)
{
  parent_->set_menu_label_text(*get_child(), menu_text);
}

Glib::ustring Page::get_menu_label_text() const
{
  return parent_->get_menu_label_text(*get_child());
}

void Page::query_tab_label_packing(bool& expand, bool& fill, PackType& pack_type)
{
  parent_->query_tab_label_packing(*get_child(), expand, fill, pack_type);
}

void Page::set_tab_label_packing(bool expand, bool fill, PackType pack_type)
{
  parent_->set_tab_label_packing(*get_child(), expand, fill, pack_type);
}

/*********************************************************************
***** List properties
*********************************************************************/
PageList::PageList()
:
  gparent_ (0)
{}

PageList::PageList(GtkNotebook* gparent)
:
  gparent_ (gparent)
{}

PageList::PageList(const PageList& src)
{
  operator=(src);
}

PageList& PageList::operator=(const PageList& src)
{
  gparent_ = src.gparent_;
  return *this;
}

PageList::size_type PageList::max_size() const
{
  return G_MAXINT;
}

bool PageList::empty() const
{
  return (gparent_->children == 0);
}

PageList::size_type PageList::size() const
{
  return g_list_length(gparent_->children);
}

PageList::value_type PageList::front() const
{
  return *begin();
}

PageList::value_type PageList::back() const
{
  iterator pend (end());
  return *--pend;
}

PageList::value_type PageList::operator[](size_type index) const
{
  GList *const node = g_list_nth(gparent_->children, index);
  g_assert(node != 0);

  return *iterator(Glib::wrap(gparent_), node);
}

PageList::iterator PageList::insert(PageList::iterator position, const Element& elem)
{
  // Get the iterator index, or -1 for end().
  const int index = (position) ? position->get_page_num() : -1;

  // Give item to GTK+.
  gtk_notebook_insert_page_menu(gparent_,
                                Glib::unwrap(elem.child_),
                                Glib::unwrap(elem.tab_),
                                Glib::unwrap(elem.menu_),
                                index);

  // Return an iterator pointing to the inserted element.
  return --position;
}

void PageList::erase(PageList::iterator start, PageList::iterator stop)
{
  while(start != stop)
    start = erase(start);
}

PageList::iterator PageList::erase(PageList::iterator position)
{
  iterator next (position);

  if(position)
  {
    ++next;
    gtk_container_remove(GTK_CONTAINER(gparent_), position->get_child()->gobj());
  }

  return next;
}

void PageList::remove(const_reference child)
{
//  g_return_if_fail(child.parent_ != 0);
  gtk_container_remove(GTK_CONTAINER(gparent_), child.get_child()->gobj());
}

void PageList::remove(Widget& widget)
{
  gtk_container_remove(GTK_CONTAINER(gparent_), widget.gobj());
}

void PageList::reorder(PageList::iterator position, PageList::iterator page)
{
  gtk_notebook_reorder_child(gparent(), page->get_child()->gobj(), position->get_page_num());
}

PageList::iterator PageList::find(int num)
{
  if(num < 0) return end();
  int j = 0;
  iterator i;
  for(i = begin(), j = 0; i != end(), j < num; ++i, ++j);
  return i;
}

PageList::iterator PageList::find(const_reference c)
{
  iterator i = begin();
  for(i = begin(); i != end() && ((*i).get_child() != c.get_child()); i++);
  return i;
}

PageList::iterator PageList::find(Widget& widget)
{
  iterator i;
  for(i = begin(); i != end() && ((*i).get_child() != &widget); i++);
  return i;
}

PageList::iterator PageList::find(GtkNotebookPage* page)
{
  GList* node = gparent_->children;

  while(node && node->data != page)
    node = node->next;

  return (node) ? iterator(Glib::wrap(gparent_), node) : end();
}

void PageList::clear()
{
  erase(begin(), end());
}

PageList::iterator PageList::begin_() const
{
  return iterator(Glib::wrap(gparent_), gparent_->children);
}

PageList::iterator PageList::end_() const
{
  return iterator(Glib::wrap(gparent_), 0);
}

Element::Element(Widget* child, Widget* tab, Widget* menu)
:
  child_  (child),
  tab_    (tab),
  menu_   (menu)
{}

Element::Element(Widget& child, Widget& tab, Widget& menu)
:
  child_  (&child),
  tab_    (&tab),
  menu_   (&menu)
{}

Element::Element(Widget& child)
:
  child_  (&child),
  tab_    (0),
  menu_   (0)
{}

TabElem::TabElem(Widget& child, Widget& tab)
:
  Element(&child, &tab, 0)
{}

TabElem::TabElem(Widget& child, const Glib::ustring& label, bool mnemonic)
:
  Element(&child, manage(new Label(label, mnemonic)), 0)
{}

MenuElem::MenuElem(Widget& child, Widget& menu)
:
  Element(&child, 0, &menu)
{}

} /* namespace Notebook_Helpers */


Notebook::PageList::iterator Notebook::get_current()
{
  return pages().find(get_current_page());
}

Notebook::PageList& Notebook::pages()
{
  pages_proxy_ = PageList(gobj());
  return pages_proxy_;
}

const Notebook::PageList& Notebook::pages() const
{
  pages_proxy_ = PageList(const_cast<GtkNotebook*>(gobj()));
  return pages_proxy_;
}

/*Widget* Notebook::get_current_page()
{
  return get_nth_page(get_current_page_num());
}*/

int Notebook::prepend_page(Widget& child, const Glib::ustring& tab_label, bool use_mnemonic)
{
  Label* pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) );
  return prepend_page(child, *pLabel);
}

int Notebook::prepend_page(Widget& child, const Glib::ustring& tab_label, const Glib::ustring& menu_label, bool use_mnemonic)
{
  Label* pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) );
  Label* pLabelMenu = Gtk::manage( new Label(menu_label, use_mnemonic) );
  return prepend_page(child, *pLabel, *pLabelMenu);
}

int Notebook::append_page(Widget& child, const Glib::ustring& tab_label, bool use_mnemonic)
{
  Label* pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) );
  return append_page(child, *pLabel);
}

int Notebook::append_page(Widget& child, const Glib::ustring& tab_label, const Glib::ustring& menu_label, bool use_mnemonic)
{
  Label* pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) );
  Label* pLabelMenu = Gtk::manage( new Label(menu_label, use_mnemonic) );
  return append_page(child, *pLabel, *pLabelMenu);
}

int Notebook::insert_page(Widget& child, const Glib::ustring& tab_label, int position, bool use_mnemonic)
{
  Label* pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) );
  return insert_page(child, *pLabel, position);
}

int Notebook::insert_page(Widget& child, const Glib::ustring& tab_label, const Glib::ustring& menu_label, int position, bool use_mnemonic)
{
  Label* pLabel = Gtk::manage( new Label(tab_label, use_mnemonic) );
  Label* pLabelMenu = Gtk::manage( new Label(menu_label, use_mnemonic) );
  return insert_page(child, *pLabel, *pLabelMenu, position);
}

void Notebook::remove_page(Widget& child)
{
  int pos = page_num(child);
  if(pos != -1)
    remove_page(pos);
}

void Notebook::query_tab_label_packing(Widget& child, bool& expand, bool& fill, PackType& pack_type)
{
  gboolean gexpand = false;
  gboolean gfill = false;
  GtkPackType gpack_type = GTK_PACK_START;
  gtk_notebook_query_tab_label_packing(gobj(), child.gobj(), &gexpand, &gfill, &gpack_type);
  expand = gexpand;
  fill = gfill;
  pack_type = (PackType)gpack_type;
}

int Notebook::prepend_page(Widget& child)
{
  return gtk_notebook_prepend_page(gobj(), child.gobj(), 0 /* see GTK+ docs */);
}

int Notebook::append_page(Widget& child)
{
  return gtk_notebook_append_page(gobj(), child.gobj(), 0 /* see GTK+ docs */);
}

int Notebook::insert_page(Widget& child, int position)
{
  return gtk_notebook_insert_page(gobj(), child.gobj(), 0 /* see GTK+ docs */, position);
}

} //namespace Gtk


namespace
{

void Notebook_signal_switch_page_callback(GtkNotebook* self, GtkNotebookPage* p0,guint p1,void* data)
{
  using namespace Gtk;
  typedef sigc::slot< void,GtkNotebookPage*,guint > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    try
    {
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(p0, p1);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }
}

const Glib::SignalProxyInfo Notebook_signal_switch_page_info =
{
  "switch_page",
  (GCallback) &Notebook_signal_switch_page_callback,
  (GCallback) &Notebook_signal_switch_page_callback
};

} // anonymous namespace

// static
GType Glib::Value<Gtk::NotebookTab>::value_type()
{
  return gtk_notebook_tab_get_type();
}


namespace Glib
{

Gtk::Notebook* wrap(GtkNotebook* object, bool take_copy)
{
  return dynamic_cast<Gtk::Notebook *> (Glib::wrap_auto ((GObject*)(object), take_copy));
}

} /* namespace Glib */

namespace Gtk
{


/* The *_Class implementation: */

const Glib::Class& Notebook_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Class has to know the class init function to clone custom types.
    class_init_func_ = &Notebook_Class::class_init_function;

    // This is actually just optimized away, apparently with no harm.
    // Make sure that the parent type has been created.
    //CppClassParent::CppObjectType::get_type();

    // Create the wrapper type, with the same class/instance size as the base type.
    register_derived_type(gtk_notebook_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:
  }

  return *this;
}

void Notebook_Class::class_init_function(void* g_class, void* class_data)
{
  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);

  klass->switch_page = &switch_page_callback;
}


void Notebook_Class::switch_page_callback(GtkNotebook* self, GtkNotebookPage* p0, guint p1)
{
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj && obj->is_derived_())
  {
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
    {
      // Call the virtual member method, which derived classes might override.
      obj->on_switch_page(p0, p1);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }
  else
  {
    BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

    // Call the original underlying C function:
    if(base && base->switch_page)
      (*base->switch_page)(self, p0, p1);
  }
}


Glib::ObjectBase* Notebook_Class::wrap_new(GObject* o)
{
  return manage(new Notebook((GtkNotebook*)(o)));

}


/* The implementation: */

Notebook::Notebook(const Glib::ConstructParams& construct_params)
:
  Gtk::Container(construct_params)
{
  }

Notebook::Notebook(GtkNotebook* castitem)
:
  Gtk::Container((GtkContainer*)(castitem))
{
  }

Notebook::~Notebook()
{
  destroy_();
}

Notebook::CppClassType Notebook::notebook_class_; // initialize static member

GType Notebook::get_type()
{
  return notebook_class_.init().get_type();
}

GType Notebook::get_base_type()
{
  return gtk_notebook_get_type();
}


Notebook::Notebook()
:
  Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
  Gtk::Container(Glib::ConstructParams(notebook_class_.init()))
{
  }

int Notebook::prepend_page(Widget& child, Widget& tab_label)
{
  return gtk_notebook_prepend_page(gobj(), (child).gobj(), (tab_label).gobj());
}

int Notebook::prepend_page(Widget& child, Widget& tab_label, Widget& menu_label)
{
  return gtk_notebook_prepend_page_menu(gobj(), (child).gobj(), (tab_label).gobj(), (menu_label).gobj());
}

int Notebook::append_page(Widget& child, Widget& tab_label)
{
  return gtk_notebook_append_page(gobj(), (child).gobj(), (tab_label).gobj());
}

int Notebook::append_page(Widget& child, Widget& tab_label, Widget& menu_label)
{
  return gtk_notebook_append_page_menu(gobj(), (child).gobj(), (tab_label).gobj(), (menu_label).gobj());
}

int Notebook::insert_page(Widget& child, Widget& tab_label, int position)
{
  return gtk_notebook_insert_page(gobj(), (child).gobj(), (tab_label).gobj(), position);
}

int Notebook::insert_page(Widget& child, Widget& tab_label, Widget& menu_label, int position)
{
  return gtk_notebook_insert_page_menu(gobj(), (child).gobj(), (tab_label).gobj(), (menu_label).gobj(), position);
}

void Notebook::remove_page(int page_num)
{
  gtk_notebook_remove_page(gobj(), page_num);
}

int Notebook::get_current_page() const
{
  return gtk_notebook_get_current_page(const_cast<GtkNotebook*>(gobj()));
}

Widget* Notebook::get_nth_page(int page_num)
{
  return Glib::wrap(gtk_notebook_get_nth_page(gobj(), page_num));
}

const Widget* Notebook::get_nth_page(int page_num) const
{
  return Glib::wrap(gtk_notebook_get_nth_page(const_cast<GtkNotebook*>(gobj()), page_num));
}

int Notebook::get_n_pages()
{
  return gtk_notebook_get_n_pages(gobj());
}

int Notebook::page_num(const Widget& child)
{
  return gtk_notebook_page_num(gobj(), const_cast<GtkWidget*>((child).gobj()));
}

void Notebook::set_current_page(int page_num)
{
  gtk_notebook_set_current_page(gobj(), page_num);
}

void Notebook::next_page()
{
  gtk_notebook_next_page(gobj());
}

void Notebook::prev_page()
{
  gtk_notebook_prev_page(gobj());
}

void Notebook::set_show_border(bool show_border)
{
  gtk_notebook_set_show_border(gobj(), static_cast<int>(show_border));
}

bool Notebook::get_show_border() const
{
  return gtk_notebook_get_show_border(const_cast<GtkNotebook*>(gobj()));
}

void Notebook::set_show_tabs(bool show_tabs)
{
  gtk_notebook_set_show_tabs(gobj(), static_cast<int>(show_tabs));
}

bool Notebook::get_show_tabs() const
{
  return gtk_notebook_get_show_tabs(const_cast<GtkNotebook*>(gobj()));
}

void Notebook::set_tab_pos(PositionType pos)
{
  gtk_notebook_set_tab_pos(gobj(), ((GtkPositionType)(pos)));
}

PositionType Notebook::get_tab_pos() const
{
  return ((PositionType)(gtk_notebook_get_tab_pos(const_cast<GtkNotebook*>(gobj()))));
}

void Notebook::set_scrollable(bool scrollable)
{
  gtk_notebook_set_scrollable(gobj(), static_cast<int>(scrollable));
}

bool Notebook::get_scrollable() const
{
  return gtk_notebook_get_scrollable(const_cast<GtkNotebook*>(gobj()));
}

void Notebook::popup_enable()
{
  gtk_notebook_popup_enable(gobj());
}

void Notebook::popup_disable()
{
  gtk_notebook_popup_disable(gobj());
}

Widget* Notebook::get_tab_label(Widget& child)
{
  return Glib::wrap(gtk_notebook_get_tab_label(gobj(), (child).gobj()));
}

const Widget* Notebook::get_tab_label(Widget& child) const
{
  return Glib::wrap(gtk_notebook_get_tab_label(const_cast<GtkNotebook*>(gobj()), (child).gobj()));
}

void Notebook::set_tab_label(Widget& child, Widget& tab_label)
{
  gtk_notebook_set_tab_label(gobj(), (child).gobj(), (tab_label).gobj());
}

void Notebook::set_tab_label_text(Widget& child, const Glib::ustring& tab_text)
{
  gtk_notebook_set_tab_label_text(gobj(), (child).gobj(), tab_text.c_str());
}

Glib::ustring Notebook::get_tab_label_text(Widget& child) const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gtk_notebook_get_tab_label_text(const_cast<GtkNotebook*>(gobj()), (child).gobj()));
}

Widget* Notebook::get_menu_label(Widget& child)
{
  return Glib::wrap(gtk_notebook_get_menu_label(gobj(), (child).gobj()));
}

const Widget* Notebook::get_menu_label(Widget& child) const
{
  return Glib::wrap(gtk_notebook_get_menu_label(const_cast<GtkNotebook*>(gobj()), (child).gobj()));
}

void Notebook::set_menu_label(Widget& child, Widget& menu_label)
{
  gtk_notebook_set_menu_label(gobj(), (child).gobj(), (menu_label).gobj());
}

void Notebook::set_menu_label_text(Widget& child, const Glib::ustring& menu_text)
{
  gtk_notebook_set_menu_label_text(gobj(), (child).gobj(), menu_text.c_str());
}

Glib::ustring Notebook::get_menu_label_text(Widget& child) const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gtk_notebook_get_menu_label_text(const_cast<GtkNotebook*>(gobj()), (child).gobj()));
}

void Notebook::set_tab_label_packing(Widget& child, bool expand, bool fill, PackType pack_type)
{
  gtk_notebook_set_tab_label_packing(gobj(), (child).gobj(), static_cast<int>(expand), static_cast<int>(fill), ((GtkPackType)(pack_type)));
}

void Notebook::reorder_child(Widget& child, int position)
{
  gtk_notebook_reorder_child(gobj(), (child).gobj(), position);
}


Glib::SignalProxy2< void,GtkNotebookPage*,guint > Notebook::signal_switch_page()
{
  return Glib::SignalProxy2< void,GtkNotebookPage*,guint >(this, &Notebook_signal_switch_page_info);
}


Glib::PropertyProxy<PositionType> Notebook::property_tab_pos() 
{
  return Glib::PropertyProxy<PositionType>(this, "tab-pos");
}

Glib::PropertyProxy_ReadOnly<PositionType> Notebook::property_tab_pos() const
{
  return Glib::PropertyProxy_ReadOnly<PositionType>(this, "tab-pos");
}

Glib::PropertyProxy<bool> Notebook::property_show_tabs() 
{
  return Glib::PropertyProxy<bool>(this, "show-tabs");
}

Glib::PropertyProxy_ReadOnly<bool> Notebook::property_show_tabs() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "show-tabs");
}

Glib::PropertyProxy<bool> Notebook::property_show_border() 
{
  return Glib::PropertyProxy<bool>(this, "show-border");
}

Glib::PropertyProxy_ReadOnly<bool> Notebook::property_show_border() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "show-border");
}

Glib::PropertyProxy<bool> Notebook::property_scrollable() 
{
  return Glib::PropertyProxy<bool>(this, "scrollable");
}

Glib::PropertyProxy_ReadOnly<bool> Notebook::property_scrollable() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "scrollable");
}

Glib::PropertyProxy_WriteOnly<guint> Notebook::property_tab_border() 
{
  return Glib::PropertyProxy_WriteOnly<guint>(this, "tab-border");
}

Glib::PropertyProxy_ReadOnly<guint> Notebook::property_tab_border() const
{
  return Glib::PropertyProxy_ReadOnly<guint>(this, "tab-border");
}

Glib::PropertyProxy<guint> Notebook::property_tab_hborder() 
{
  return Glib::PropertyProxy<guint>(this, "tab-hborder");
}

Glib::PropertyProxy_ReadOnly<guint> Notebook::property_tab_hborder() const
{
  return Glib::PropertyProxy_ReadOnly<guint>(this, "tab-hborder");
}

Glib::PropertyProxy<guint> Notebook::property_tab_vborder() 
{
  return Glib::PropertyProxy<guint>(this, "tab-vborder");
}

Glib::PropertyProxy_ReadOnly<guint> Notebook::property_tab_vborder() const
{
  return Glib::PropertyProxy_ReadOnly<guint>(this, "tab-vborder");
}

Glib::PropertyProxy<int> Notebook::property_page() 
{
  return Glib::PropertyProxy<int>(this, "page");
}

Glib::PropertyProxy_ReadOnly<int> Notebook::property_page() const
{
  return Glib::PropertyProxy_ReadOnly<int>(this, "page");
}

Glib::PropertyProxy<bool> Notebook::property_enable_popup() 
{
  return Glib::PropertyProxy<bool>(this, "enable-popup");
}

Glib::PropertyProxy_ReadOnly<bool> Notebook::property_enable_popup() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "enable-popup");
}

Glib::PropertyProxy<bool> Notebook::property_homogeneous() 
{
  return Glib::PropertyProxy<bool>(this, "homogeneous");
}

Glib::PropertyProxy_ReadOnly<bool> Notebook::property_homogeneous() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "homogeneous");
}


void Gtk::Notebook::on_switch_page(GtkNotebookPage* page, guint page_num)
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->switch_page)
    (*base->switch_page)(gobj(),page,page_num);
}


} // namespace Gtk