Location: PHPKode > scripts > Menu Bar Generator > menu-bar-generator/MBFactory.inc
<?php
/**
 *+-----------------------------------------------------------------------+
 *| MenuBar - 07 Oct 2006                                                 |
 *+-----------------------------------------------------------------------+
 *|  Diego do Nascimento Feitosa                                          |
 *|  hide@address.com                                                  |
 *|  www.dnfeitosa.com                                                    |
 *|  São Paulo/SP - Brasil                                                |
 *+-----------------------------------------------------------------------+
 *| MenuBar is free software; you can redistribute it and/or modify       |
 *| it under the terms of the GNU General Public License as published by  |
 *| the Free Software Foundation; either version 2 of the License, or     |
 *| (at your option) any later version.                                   |
 *|                                                                       |
 *| MenuBar is distributed in the hope that it will be useful, but        |
 *| WITHOUT ANY WARRANTY; without even the implied warranty of            |
 *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     |
 *| General Public License for more details.                              |
 *|                                                                       |
 *| You should have received a copy of the GNU General Public License     |
 *| along with MenuBar; if not, write to the Free Software                |
 *| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA              |
 *| 02111-1307  USA                                                       |
 *+-----------------------------------------------------------------------+
**/
class MBFactory {
	static protected $instance;

	static public function getFactory() {
		if (!isset(self::$instance)) 
			self::$instance = new MBFactory();
		return self::$instance;
	}

	private function __construct() {}

	public function icon($img) {
		if (defined($img)) {
			return GtkImage::new_from_stock(constant($img), 1);
		} else if (is_file($img) && is_readable($img)) {
			return GtkImage::new_from_file($img);
		} 
	}
	public function menuItem($display) {
		return new GtkImageMenuItem($display);
	}
	public function imageMenuItem($display) {
		return new GtkImageMenuItem($display);
	}
	public function itemSeparator() {
		return new GtkSeparatorMenuItem();
	}
	public function menu() {
		return new GtkMenu();
	}
	public function tearoff() {
		return new GtkTearoffMenuItem();
	}
}
?>
Return current item: Menu Bar Generator