/** * Show the notebook at the screen */ public function show() { foreach ($this->contents as $content) { $content->show(); } parent::show(); }
function create_notebook() { global $windows, $sample_notebook, $book_open, $book_open_mask, $book_closed, $book_closed_mask, $book_open_xpm, $book_closed_xpm; $items = array('Standard' => array('standard_notebook', &$sample_notebook), 'No tabs' => array('notabs_notebook', &$sample_notebook), 'Scrollable' => array('scrollable_notebook', &$sample_notebook)); if (!isset($windows['notebook'])) { $window = new GtkWindow(); $windows['notebook'] = $window; $window->connect('delete_event', 'delete_event'); $window->set_title('Notebook'); $window->set_border_width(0); $box1 =& new GtkVBox(false, 0); $box1->show(); $window->add($box1); $sample_notebook = new GtkNotebook(); $sample_notebook->show(); $sample_notebook->connect('switch_page', 'page_switch'); $sample_notebook->set_tab_pos(GTK_POS_TOP); $box1->pack_start($sample_notebook, true, true, 0); $sample_notebook->set_border_width(10); $sample_notebook->realize(); list($book_open, $book_open_mask) = Gdk::pixmap_create_from_xpm_d($sample_notebook->window, null, $book_open_xpm); list($book_closed, $book_closed_mask) = Gdk::pixmap_create_from_xpm_d($sample_notebook->window, null, $book_closed_xpm); create_pages(&$sample_notebook, 1, 5); $separator =& new GtkHSeparator(); $separator->show(); $box1->pack_start($separator, false, true, 10); $box2 =& new GtkHBox(false, 5); $box2->show(); $box2->set_border_width(10); $box1->pack_start($box2, false, true, 0); $button =& new GtkCheckButton('popup menu'); $button->show(); $box2->pack_start($button, true, false, 0); $button->connect('clicked', 'notebook_popup', &$sample_notebook); $button =& new GtkCheckButton('homogeneous tabs'); $button->show(); $box2->pack_start($button, true, false, 0); $button->connect('clicked', 'notebook_homogeneous', &$sample_notebook); $box2 =& new GtkHBox(false, 5); $box2->show(); $box2->set_border_width(10); $box1->pack_start($box2, false, true, 0); $label =& new GtkLabel('Notebook Style:'); $label->show(); $box2->pack_start($label, false, true, 0); $omenu = build_option_menu($items, 3, 0, &$sample_notebook); $omenu->show(); $box2->pack_start($omenu, false, true, 0); $button =& new GtkButton('Show all Pages'); $button->show(); $box2->pack_start($button, false, true, 0); $button->connect_object('clicked', 'show_all_pages', &$sample_notebook); $box2 =& new GtkHBox(true, 10); $box2->show(); $box2->set_border_width(10); $box1->pack_start($box2, false, true, 0); $button =& new GtkButton('prev'); $button->show(); $button->connect_object('clicked', array(&$sample_notebook, 'prev_page')); $box2->pack_start($button, true, true, 0); $button =& new GtkButton('next'); $button->show(); $button->connect_object('clicked', array(&$sample_notebook, 'next_page')); $box2->pack_start($button, true, true, 0); $button =& new GtkButton('rotate'); $button->show(); $button->connect_object('clicked', 'notebook_rotate', &$sample_notebook); $box2->pack_start($button, true, true, 0); $separator =& new GtkHSeparator(); $separator->show(); $box1->pack_start($separator, false, true, 5); $button =& new GtkButton('close'); $button->show(); $button->set_border_width(5); $button->connect('clicked', 'close_window'); $box1->pack_start($button, false, false, 0); $button->set_flags(GTK_CAN_DEFAULT); $button->grab_default(); } if ($windows['notebook']->flags() & GTK_VISIBLE) { $windows['notebook']->hide(); } else { $windows['notebook']->show(); } }