Ejemplo n.º 1
0
 /**
  * Class Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->hbox = new GtkHBox();
     $this->buttons = array();
     $box = new GtkEventBox();
     $a = new GdkColor(50000, 50000, 50000);
     $box->modify_bg(Gtk::STATE_NORMAL, $a);
     $box->add($this->hbox);
     $this->back = new GtkButton('<<');
     $this->back->set_relief(GTK::RELIEF_NONE);
     $this->back->connect('clicked', array($this, 'executeAction'));
     $this->back->set_sensitive(FALSE);
     $this->front = new GtkButton('>>');
     $this->front->set_relief(GTK::RELIEF_NONE);
     $this->front->connect('clicked', array($this, 'executeAction'));
     $this->front->set_sensitive(FALSE);
     $this->hbox->pack_start(new GtkHBox(), true, true);
     $this->hbox->pack_start($this->back, false, false);
     for ($n = 1; $n <= 10; $n++) {
         $this->buttons[$n] = new GtkButton($n);
         $this->buttons[$n]->get_child()->set_use_markup(TRUE);
         $this->buttons[$n]->set_relief(GTK::RELIEF_NONE);
         $this->buttons[$n]->connect('clicked', array($this, 'executeAction'));
         $this->buttons[$n]->set_sensitive(FALSE);
         $this->hbox->pack_start($this->buttons[$n], false, false);
     }
     $this->hbox->pack_start($this->front, false, false);
     $this->hbox->pack_start(new GtkHBox(), true, true);
     parent::add($box);
 }
 public function insert($widget, $label)
 {
     $event = new GtkEventBox();
     $event->set_visible_window(FALSE);
     $event->add($label);
     $this->notebook->insert_page($container = new GtkEventBox(), $event);
     $container->add($widget);
     $label->show();
     $this->containers[] = $container;
     $this->labels[] = $label;
     $this->abas[] = $widget;
 }
Ejemplo n.º 3
0
function link($title, $url)
{
    $label = new GtkLabel($title);
    $label->set_markup('<span color="blue"><u>' . $title . "</u></span>");
    $eventbox = new GtkEventBox();
    $eventbox->add($label);
    $eventbox->connect('button-press-event', 'on_click', $title, $url);
    $eventbox->connect('enter-notify-event', 'on_enter', $title, $url);
    $eventbox->connect('leave-notify-event', 'on_leave', $title, $url);
    return $eventbox;
}
Ejemplo n.º 4
0
<?php

$window = new GtkWindow();
$window->set_size_request(400, 200);
$window->connect_simple('destroy', array('Gtk', 'main_quit'));
$window->add($vbox = new GtkVBox());
// display title
$title = new GtkLabel("Window with status area");
$title->modify_font(new PangoFontDescription("Times New Roman Italic 10"));
$title->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#0000ff"));
$title->set_size_request(-1, 40);
$vbox->pack_start($title, 0, 0);
$vbox->pack_start(new GtkLabel('your body contents'));
// setup status area
$status = new GtkStatusbar();
// note 1
$eventbox = new GtkEventBox();
$eventbox->add($status);
$vbox->pack_start($eventbox, 0, 0);
// note 2
$eventbox->modify_bg(Gtk::STATE_NORMAL, GdkColor::parse('#ffff00'));
// note 3
// display a message
$context_id = $status->get_context_id('msg1');
// note 4
$status->push($context_id, 'this is msg 1');
// note 4
$window->show_all();
Gtk::main();
Ejemplo n.º 5
0
 /**
  * Define the menu based on user profile
  */
 public function configureMenu()
 {
     if ($this->scroll->get_child()) {
         $this->scroll->remove($this->scroll->get_child());
     }
     TTransaction::open('library');
     $member = User::newFromLogin(TSession::getValue('login'));
     if ($member->role->mnemonic == 'LIBRARIAN') {
         $buttons = array();
         $buttons[] = array('<b>' . _t('Cataloging') . '</b>');
         $buttons[] = array(_t('Books'), 'BookList');
         $buttons[] = array(_t('Collections'), 'CollectionFormList');
         $buttons[] = array(_t('Classifications'), 'ClassificationFormList');
         $buttons[] = array(_t('Subjects'), 'SubjectList');
         $buttons[] = array(_t('Authors'), 'AuthorList');
         $buttons[] = array(_t('Publishers'), 'PublisherList');
         $buttons[] = array(_t('Status'), 'StatusFormList');
         $buttons[] = array('<b>' . _t('Members') . '</b>');
         $buttons[] = array(_t('Members'), 'MemberList');
         $buttons[] = array(_t('Categories'), 'CategoryFormList');
         $buttons[] = array(_t('Cities'), 'CityList');
         $buttons[] = array('<b>' . _t('Circulation') . '</b>');
         $buttons[] = array(_t('Check in'), 'CheckInForm');
         $buttons[] = array(_t('Check out'), 'CheckOutForm');
         $buttons[] = array('<b>' . _t('Reports') . '</b>');
         $buttons[] = array(_t('Loans'), 'LoanReport');
         $buttons[] = array(_t('Member'), 'MemberReport');
         $buttons[] = array(_t('Books'), 'BookReport');
         $buttons[] = array('Logout', array('LoginForm', 'onLogout'));
     } else {
         if ($member->role->mnemonic == 'OPERATOR') {
             $buttons = array();
             $buttons[] = array('<b>' . _t('Members') . '</b>');
             $buttons[] = array(_t('Members'), 'MemberList');
             $buttons[] = array(_t('Categories'), 'CategoryFormList');
             $buttons[] = array(_t('Cities'), 'CityList');
             $buttons[] = array('<b>' . _t('Circulation') . '</b>');
             $buttons[] = array(_t('Check in'), 'CheckInForm');
             $buttons[] = array(_t('Check out'), 'CheckOutForm');
             $buttons[] = array('<b>' . _t('Reports') . '</b>');
             $buttons[] = array(_t('Loans'), 'LoanReport');
             $buttons[] = array(_t('Member'), 'MemberReport');
             $buttons[] = array(_t('Books'), 'BookReport');
             $buttons[] = array('Logout', array('LoginForm', 'onLogout'));
         } else {
             if ($member->role->mnemonic == 'ADMINISTRATOR') {
                 $buttons = array();
                 $buttons[] = array('<b>' . 'Admin' . '</b>');
                 $buttons[] = array(_t('Users'), 'UserList');
                 $buttons[] = array(_t('Roles'), 'RoleList');
                 $buttons[] = array('Logout', array('LoginForm', 'onLogout'));
             }
         }
     }
     TTransaction::close();
     $vbox_buttons = new GtkVBox(FALSE, 0);
     $this->scroll->add_with_viewport($vbox_buttons);
     $this->scroll->get_child()->modify_bg(Gtk::STATE_NORMAL, GdkColor::parse('#EFEFEF'));
     foreach ($buttons as $button_info) {
         if (!isset($button_info[1])) {
             $button = new GtkEventBox();
             $button->add($label = new GtkLabel($button_info[0]));
             $button->set_size_request(-1, 20);
             $label->set_use_markup(TRUE);
             $button->modify_bg(Gtk::STATE_NORMAL, GdkColor::parse('#C0C0C0'));
         } else {
             $button = new GtkButton($button_info[0]);
             $button->get_child()->set_alignment(0, 0);
             $button->set_property('can-focus', FALSE);
             $button->set_relief(Gtk::RELIEF_NONE);
             $button->modify_bg(Gtk::STATE_PRELIGHT, GdkColor::parse('#CFCFCF'));
             $button->modify_bg(Gtk::STATE_ACTIVE, GdkColor::parse('#CFCFCF'));
             $button->set_size_request(-1, 24);
             $button->connect_simple('clicked', array($this, 'run'), $button_info[1]);
         }
         $vbox_buttons->pack_start($button, FALSE, FALSE, 0);
     }
     $this->scroll->show_all();
 }
Ejemplo n.º 6
0
<?php

$window = new GtkWindow();
$window->set_size_request(400, 300);
$window->connect_simple('destroy', array('Gtk', 'main_quit'));
$vbox2 = new GtkVBox();
// note 1
$vbox2->pack_start(new GtkLabel("This frame of size 200x200"));
$vbox2->pack_start(new GtkLabel("will always stay stay centered"));
$vbox2->pack_start(new GtkLabel("no matter how you resize the app"));
$eventbox = new GtkEventBox();
// note 2
$eventbox->add($vbox2);
$eventbox->modify_bg(Gtk::STATE_NORMAL, GdkColor::parse("#CCFF99"));
$frame_200_200 = new GtkFrame();
// note 3
$frame_200_200->set_size_request(200, 200);
$frame_200_200->add($eventbox);
$hbox = new GtkHBox();
// note 4
$hbox->pack_start(new GtkHBox());
$hbox->pack_start($frame_200_200, 0);
$hbox->pack_start(new GtkHBox());
$vbox = new GtkVBox();
// note 5
$vbox->pack_start(new GtkHBox());
$vbox->pack_start($hbox, 0);
$vbox->pack_start(new GtkHBox());
$window->add($vbox);
// note 6
$window->show_all();