/** * Class Constructor * @param $name Name of the widget */ public function __construct($name) { parent::__construct(); $this->wname = $name; $this->mask = 'yyyy-mm-dd'; $this->validations = array(); // creates the entry field $this->entry = new TEntry($name); $this->entry->setSize(200); //set_size_request(200, 24); $this->setMask($this->mask); parent::add($this->entry); // creates a button with a calendar image $button = new GtkButton(); $button->set_relief(GTK::RELIEF_NONE); $imagem = GtkImage::new_from_file('lib/adianti/images/tdate-gtk.png'); $button->set_image($imagem); // define the button's callback $button->connect_simple('clicked', array($this, 'onCalendar')); parent::add($button); // creates the calendar window $this->popWindow = new GtkWindow(Gtk::WINDOW_POPUP); // creates the calendar $this->calendar = new GtkCalendar(); // define the action when the user selects a date $this->calendar->connect_simple('day-selected-double-click', array($this, 'onSelectDate')); $this->month = new TCombo('tdate-month'); $this->month->addItems(array(TAdiantiCoreTranslator::translate('January'), TAdiantiCoreTranslator::translate('February'), TAdiantiCoreTranslator::translate('March'), TAdiantiCoreTranslator::translate('April'), TAdiantiCoreTranslator::translate('May'), TAdiantiCoreTranslator::translate('June'), TAdiantiCoreTranslator::translate('July'), TAdiantiCoreTranslator::translate('August'), TAdiantiCoreTranslator::translate('September'), TAdiantiCoreTranslator::translate('October'), TAdiantiCoreTranslator::translate('November'), TAdiantiCoreTranslator::translate('December'))); $this->month->setCallback(array($this, 'onChangeMonth')); $this->month->setSize(70); for ($n = date('Y') - 10; $n <= date('Y') + 10; $n++) { $years[$n] = $n; } $this->year = new TCombo('tdate-year'); $this->year->addItems($years); $this->year->setCallback(array($this, 'onChangeMonth')); $this->year->setSize(70); $hbox = new GtkHBox(); $hbox->pack_start($this->month); $hbox->pack_start($this->year); $bt_today = new GtkButton(TAdiantiCoreTranslator::translate('Today')); $bt_close = new GtkButton(TAdiantiCoreTranslator::translate('Close')); $bt_today->connect_simple('clicked', array($this, 'selectToday')); $inst = $this->popWindow; $bt_close->connect_simple('clicked', array($inst, 'hide')); $hbox2 = new GtkHBox(); $hbox2->pack_start($bt_today); $hbox2->pack_start($bt_close); $vbox = new GtkVBox(); $vbox->pack_start($hbox, FALSE, FALSE); $vbox->pack_start($this->calendar); $vbox->pack_start($hbox2, FALSE, FALSE); // shows the window $this->popWindow->add($vbox); }
/** * Class Constructor * @param $name widget's name */ public function __construct($name) { parent::__construct(); $this->widget = GtkComboBox::new_text(); // create the combo model $this->model = new GtkListStore(GObject::TYPE_STRING, GObject::TYPE_STRING); $this->widget->set_model($this->model); $this->widget->set_size_request(200, -1); $this->wname = $name; parent::add($this->widget); $this->validations = array(); }
<?php /* Create base window */ $window = new GtkWindow(); $window->set_title('Notebooks and Pages'); $window->connect_simple('destroy', array('gtk', 'main_quit')); $window->add($vbox = new GtkHBox()); $group = 'MyGroup'; $vbox->add($notebook1 = new GtkNoteBook()); $notebook1->append_page($label = new GtkLabel('This is the first page')); $notebook1->set_tab_detachable($label, true); $notebook1->append_page($label = new GtkLabel('This is the second page')); $notebook1->set_tab_detachable($label, true); $notebook1->append_page($label = new GtkLabel('This is the third page')); $notebook1->set_tab_detachable($label, true); $notebook1->set_group($group); var_dump($notebook1->get_group()); $vbox->add($notebook2 = new GtkNoteBook()); $notebook2->append_page($label = new GtkLabel('This is the first page')); $notebook2->set_tab_detachable($label, true); $notebook2->append_page($label = new GtkLabel('This is the second page')); $notebook2->set_tab_detachable($label, true); $notebook2->append_page($label = new GtkLabel('This is the third page')); $notebook2->set_tab_detachable($label, true); $notebook2->set_group($group); var_dump($notebook2->get_group()); unset($group); $vbox->add($notebook3 = new GtkNoteBook()); $notebook3->append_page($label = new GtkLabel('This is the first page')); $notebook3->set_tab_detachable($label, true); $notebook3->append_page($label = new GtkLabel('This is the second page'));