/** The constructor of knj_popup. */ function __construct($menu_items, $connect){ parent::__construct(); $this->connect_info = $connect; foreach($menu_items AS $key => $value){ if (!is_array($value)){ $value = array( "type" => "menuitem", "text" => $value ); } if ($value["type"] == "menuitem"){ $this->opt[$key] = new GtkMenuItem($value["text"]); $this->opt[$key]->connect("activate", array($this, "ItemActivate"), $key); }elseif($value["type"] == "checkitem"){ $this->opt[$key] = new GtkCheckMenuItem($value["text"], false); if ($value["active"]){ $this->opt[$key]->set_active(true); } $this->opt[$key]->connect("toggled", array($this, "CheckActivate"), $key); } $this->append($this->opt[$key]); } $this->show_all(); $this->popup(null, null, null, 1); }
/** * Class Constructor * @param $xml SimpleXMLElement parsed from XML Menu */ public function __construct($xml) { parent::__construct(); $this->items = array(); if ($xml instanceof SimpleXMLElement) { $this->parse($xml); } }
/** * @name __construct() * @return $GtkMenu */ public function __construct() { parent::__construct(); }