function redboxtip($widget, $x, $y, $keyboard_mode, $tooltip) { $tipwindow = $widget->get_tooltip_window(); $tipwindow->modify_bg(Gtk::STATE_NORMAL, GdkColor::parse("#CC0000")); return true; // return false or nothing to NOT show a tooltip }
function on_delete_confirm() { $dialog = new GtkDialog('CAUTION!', $this, 0, array(Gtk::STOCK_OK, Gtk::RESPONSE_OK, Gtk::STOCK_CANCEL, Gtk::RESPONSE_CANCEL)); $hbox = new GtkHBox(false, 8); $hbox->set_border_width(8); $stock = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_QUESTION, Gtk::ICON_SIZE_DIALOG); $confirm_text1 = new GtkLabel('Are you sure you want to proceed ?'); $confirm_text2 = new GtkLabel('Note: This process is irreversible.'); $confirm_text3 = new GtkLabel($this->selected_file); $confirm_text3->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#ff0000")); $vbox2 = new GtkVBox(); $vbox2->pack_start($confirm_text1); $vbox2->pack_start($confirm_text2); $vbox2->pack_start($confirm_text3); $hbox->pack_start($stock, false, false, 0); $hbox->pack_start($vbox2, false, false, 0); $dialog->vbox->pack_start($hbox, false, false, 0); $dialog->show_all(); $response = $dialog->run(); if ($response == Gtk::RESPONSE_OK) { $resp = $this->delete_file(); if ($resp) { $this->on_delete_successful(); $this->selected_file = ""; $this->file_label->set_text($this->file_label_default); } else { $this->selected_file = ""; $this->file_label->set_text('Unable to delete the specified file.'); } } $dialog->destroy(); }
/** * Shows the exception stack */ function show() { $error_array = $this->e->getTrace(); $table = new TTable(); $row = $table->addRow(); $message = $this->e->getMessage(); $message = str_replace('<br>', "\n", $message); $title = new GtkLabel(); $title->set_markup('<b>General Error: ' . $message . '</b>' . "\n"); $row->addCell($title); var_dump($this->e->getTraceAsString()); foreach ($error_array as $error) { $file = isset($error['file']) ? $error['file'] : ''; $line = isset($error['line']) ? $error['line'] : ''; $file = str_replace(PATH, '', $file); $row = $table->addRow(); $row->addCell('File: ' . $file . ' : ' . $line); $row = $table->addRow(); $args = array(); if ($error['args']) { foreach ($error['args'] as $arg) { if (is_object($arg)) { $args[] = get_class($arg) . ' object'; } else { if (is_array($arg)) { $array_param = array(); foreach ($arg as $value) { if (is_object($value)) { $array_param[] = get_class($value); } else { if (is_array($value)) { $array_param[] = 'array'; } else { $array_param[] = $value; } } } $args[] = implode(',', $array_param); } else { $args[] = (string) $arg; } } } } $label = new GtkLabel(); $row->addCell($label); $class = isset($error['class']) ? $error['class'] : ''; $type = isset($error['type']) ? $error['type'] : ''; $label->set_markup(' <i>' . '<span foreground="#78BD4C">' . $class . '</span>' . '<span foreground="#600097">' . $type . '</span>' . '<span foreground="#5258A3">' . $error['function'] . '</span>' . '(' . '<span foreground="#894444">' . implode(',', $args) . '</span>' . ')</i>'); } $scroll = new TScroll(); $scroll->setSize(690, 390); $scroll->add($table); $scroll->child->modify_bg(GTK::STATE_NORMAL, GdkColor::parse('#ffffff')); parent::add($scroll); parent::show(); }
return true; } $G["rezimdisplej"] = new GtkLabel('A->A'); $G["sensorstatus1"] = new GtkLabel('[ ]'); $G["sensorstatus2"] = new GtkLabel('[ ]'); setup_menu($vbox, $menu_definition); $vbox->pack_start($hbox = new GtkHBox(), 0, 0); $hbox->pack_start($G["rezimdisplej"], 0); $hbox->pack_start($G["sensorstatus1"], 0); $hbox->pack_start($G["sensorstatus2"], 0); $hbox->pack_start($button2 = new GtkButton('START'), 1, 0); $hbox->pack_start($posledny = new GtkLabel('000.00'), 0); $button2->connect('clicked', 'stop'); $G["progress"] = new GtkLabel('000.00'); $G["progress"]->modify_font(new PangoFontDescription($font . " 145")); $G["progress"]->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#800000")); $vbox->pack_start($G["progress"]); $vbox->pack_start($hbox4 = new GtkHBox(), 0, 0); $hbox4->pack_start(new GtkLabel('BEH:'), 0, 1); $hbox4->pack_start($buttonbp = new GtkButton(' <<< '), 0, 1); reset($G["behy"]); $cb = current($G["behy"]); $hbox4->pack_start($G["beh"] = new GtkLabel($cb[0]), 1, 1); $hbox4->pack_start($buttonbd = new GtkButton(' >>> '), 0, 1); $buttonbp->connect('clicked', 'buttonbp'); $buttonbd->connect('clicked', 'buttonbd'); $hbox4->pack_start($buttonbexport = new GtkButton('Uložiť výsledky'), 0, 1); $buttonbexport->connect("clicked", "exportcsv"); $vbox->pack_start($hbox3 = new GtkHBox(), 0, 0); $hbox3->pack_start(new GtkLabel('TÍM:'), 0, 1); $hbox3->pack_start($buttonmp = new GtkButton(' <<< '), 0, 1);
<?php $window = new GtkWindow(); $window->set_size_request(148, 240); $window->connect_simple('destroy', array('Gtk', 'main_quit')); $window->add($vbox = new GtkVBox()); // display title $title = new GtkLabel("Set up Volume Control\n" . "Part 1 - using GtkVScale"); $title->modify_font(new PangoFontDescription("Arial Narrow 8")); $title->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#0000ff")); $title->set_size_request(-1, 40); $title->set_justify(Gtk::JUSTIFY_CENTER); $alignment = new GtkAlignment(0.5, 0.5, 0, 0); $alignment->add($title); $vbox->pack_start($alignment, 0); $vol_adj = GtkVScale::new_with_range(-100, 80, 1); // note 1 $vbox->pack_start(new GtkLabel('Volume'), 0); $vbox->pack_start($vol_adj, 0); $vol_adj->set_size_request(10, 160); $vol_adj->set_inverted(1); // note 2 $vol_adj->connect('format-value', 'on_format_value'); // note 3 $window->show_all(); Gtk::main(); function on_format_value($scale, $value) { return $value . "dB"; // note 4 }
function set_fg($color) { $this->entry->modify_text(Gtk::STATE_NORMAL, GdkColor::parse($color)); }
<?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();
/** * 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(); }
<?php $window = new GtkWindow(); $window->set_size_request(400, 200); $window->set_position(Gtk::WIN_POS_CENTER_ALWAYS); $window->connect_simple('destroy', array('Gtk', 'main_quit')); $window->add($vbox = new GtkVBox()); // display title $title = new GtkLabel("Change the background color and\nset the font and color of GtkEntry"); $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); $entry = new GtkEntry(); $entry->modify_base(Gtk::STATE_NORMAL, GdkColor::parse('#ffff00')); // note 1 $entry->modify_text(Gtk::STATE_NORMAL, GdkColor::parse('#0000ff')); // note 2 $entry->modify_font(new PangoFontDescription("Arial Black 12")); // note 3 $hbox = new GtkHBox(); $hbox->pack_start(new GtkLabel('Item Number: '), 0, 0); $hbox->pack_start($entry, 0, 0); $vbox->pack_start($hbox); $window->show_all(); Gtk::main();
} } } $glade =& new GladeXML('gtk_senha.glade'); $window = $glade->get_widget("window1"); $titulo = $glade->get_widget("label1"); $lblsenha = $glade->get_widget("label2"); $ultima = $glade->get_widget("label3"); $lblultima = $glade->get_widget("label4"); $window->connect_simple('destroy', array('Gtk', 'main_quit')); $window->set_decorated(false); $window->move(840, 0); $window->modify_bg(Gtk::STATE_NORMAL, GdkColor::parse("#000000")); $lblsenha->modify_font(new PangoFontDescription("Courier New Bold 72")); $lblsenha->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#380")); // em producao deixar comentado $lblsenha->set_label('P002 14'); $titulo->modify_font(new PangoFontDescription("Arial 50")); $titulo->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#380")); $titulo->set_label(' Senha Mesa'); $ultima->modify_font(new PangoFontDescription("Arial 50")); $ultima->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#FF4500")); $ultima->set_label(utf8_decode(' Últimas ')); $lblultima->modify_font(new PangoFontDescription("Courier New Bold 72")); $lblultima->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#FF4500")); // em producao deixar comentado $lblultima->set_label("P001 14\nS110 01\nI201 05\nP112 31\nN213 40"); $window->show_all(); // em producao deixar descomentado //Gtk::timeout_add(2000, 'lista_senha'); Gtk::main();
<?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();