Exemplo n.º 1
0
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();
    }
}
Exemplo n.º 2
0
   | Copyright (c) 2004 Ben Ramsey                                        |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.0 of the PHP license,       |
   | that is bundled with this package in the file LICENSE, and is        |
   | available through the world-wide-web at the following url:           |
   | http://www.php.net/license/3_0.txt.                                  |
   | If you did not receive a copy of the PHP license and are unable to   |
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
   | Authors: Ben Ramsey <benramsey@users.sourceforge.net>                |
   +----------------------------------------------------------------------+
   $Id$
*/
$text_area =& new GtkHBox();
$box->pack_start($text_area);
$default_font = Gdk::font_load('-*-courier-medium-r-normal--*-140-*-*-m-*-iso8859-1');
$textpad_style =& new GtkStyle();
$textpad_style->font = $default_font;
/* Editable text field */
$textpad =& new GtkText();
$textpad->set_editable(true);
$textpad->set_style($textpad_style);
$textpad->set_line_wrap(false);
$textpad->set_word_wrap(false);
$textpad->connect('changed', 'text_changed');
$text_area->pack_start($textpad);
/* Vertical scrollbar */
$textpad_vadj = $textpad->vadj;
$textpad_vscrollbar =& new GtkVScrollbar($textpad_vadj);
$text_area->pack_end($textpad_vscrollbar, false);