コード例 #1
0
ファイル: class_knj_popup.php プロジェクト: kaspernj/knjphpfw
		/** 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);
		}
コード例 #2
0
		private function GenerateMenus($menu, $menus){
			foreach($menus AS $key => $value){
				$newmenu = new GtkMenuItem($key);
				
				if (is_array($value)){
					$submenu = new GtkMenu();
					$submenu->set_size_request(135, -1);
					$this->GenerateMenus($submenu, $value);
					
					$newmenu->set_submenu($submenu);
				}else{
					$newmenu->connect("activate", array($this, "MenuClicked"), $value);
				}
				
				$menu->append($newmenu);
			}
		}
コード例 #3
0
ファイル: TMenu.class.php プロジェクト: enieber/adianti
 /**
  * Add a MenuItem
  * @param $menuitem A TMenuItem Object
  */
 public function addMenuItem(TMenuItem $menuItem)
 {
     parent::append($menuItem);
 }
コード例 #4
0
 /**
  * @name __construct()
  * @return $GtkMenu
  */
 public function __construct()
 {
     parent::__construct();
 }
コード例 #5
0
ファイル: Gtk.php プロジェクト: Zunair/xataface
 /**
  * Create the menu.
  *
  * The menu is very simple. It an exit menu item, which exits
  * the application, and an about menu item, which shows some
  * basic information about the application itself.
  *
  * @access private
  * @param  none
  * @return &object The GtkMenuBar
  */
 function &_createMenu()
 {
     // Create the menu bar.
     $menuBar = new GtkMenuBar();
     // Create the main (only) menu item.
     $phpHeader = new GtkMenuItem('PHPUnit');
     // Add the menu item to the menu bar.
     $menuBar->append($phpHeader);
     // Create the PHPUnit menu.
     $phpMenu = new GtkMenu();
     // Add the menu items
     $about = new GtkMenuItem('About...');
     $about->connect('activate', array(&$this, 'about'));
     $phpMenu->append($about);
     $exit = new GtkMenuItem('Exit');
     $exit->connect_object('activate', array('gtk', 'main_quit'));
     $phpMenu->append($exit);
     // Complete the menu.
     $phpHeader->set_submenu($phpMenu);
     return $menuBar;
 }