Пример #1
0
<?php

$obj = new GtkButton();
$obj->set_data("foo", "this is a string");
echo "the data:  " . $obj->get_data("foo") . "\n";
Пример #2
0
 /**
  * Add an item to the Sort list
  * @param $key Item key
  * @param $value Item value
  */
 private function addItem($key, $value)
 {
     $button = new GtkButton($value);
     $button->set_data('key', $key);
     $button->set_data('value', $value);
     //$hbox = new GtkHBox;
     //$hbox->pack_start($button, TRUE, TRUE);
     $this->container->pack_start($button, FALSE, FALSE);
     $button->show();
     $targets = array(array('text/plain', 0, -1));
     $button->connect('drag_data_get', array($this, 'onDragDataGet'));
     $button->connect_simple('drag_data_get', array($this->container, 'remove'), $button);
     $button->drag_source_set(Gdk::BUTTON1_MASK | Gdk::BUTTON3_MASK | Gdk::SHIFT_MASK, $targets, Gdk::ACTION_COPY);
     $button->drag_source_set_icon_stock(Gtk::STOCK_INDEX);
     return $button;
 }