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);
 }
Ejemplo n.º 2
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.º 3
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();