42 lines
75 KiB
Text
42 lines
75 KiB
Text
version=pmwiki-1.0.5
|
|
newline=²
|
|
text=!! menu class with icons support²²* [-[[#intro Introduction]]-]²* [-[[#shots screenshots]]-]²* [-[[#sample How to use it?]]-]²* [-[[#classcode the class code]]-]²* [-[[#changelog changelog]]-]²* [-%target=_blank%[[http://opensource.org/licenses/lgpl-license.php licence: LGPL]]-]²-----²²!!![[#intro]] Introduction²When creating a soft, you'll often want to have a menu like in the majority of graphical softs. It's often clear in your mind but require²more code than you want to do simple things.²So here's a class to help you to quickly design such menus and will also allow you to display nice icon in your menus. \\²[+Now you can easily add a common right click menu to all of your gtkeditable see [-[[#sample How to use it?]]-] sample code +][[<<]]²[[#top top]]²----²²!!! [[#shots]] screenshots ²menu sample²²http://jonathan.gotti.free.fr/phpgtkwikki/menuicon.png²²menueditable sample ²²http://jonathan.gotti.free.fr/phpgtkwikki/menueditable.png[[<<]]²[[#top top]]²-----²²!!! [[#sample]]How to use it ?²²first of all copy the class [[#classcode code]] to a file (ie: class-menu.php) and then include it in your code. Then here is a sample of code to show you how simple it is to create menu in your application so lets see:²²[[include:Main/CodeTable]]²<?²if(strtoupper(substr(PHP_OS, 0,3)) == 'WIN')² dl('php_gtk.dll');²else² dl('php_gtk.so');²include_once('class-menu.php');²²$w = &new gtkwindow();²$w->connect('destroy-event','shutdown');²$w->connect('delete-event','shutdown');²$w->set_position('center');²²// We realize the window to get the gdkwindow needed to ²// create Xpm if we want to display icons in our menu²$w->realize();²$gdkwindow = $w->window;²²// We also create a gtkaccelgroup to manage accelkeys²// the class menu will attempt to create its own if none is given at creation time²$accelgroup = &new gtkaccelgroup();²$w->add_accel_group($accelgroup);²²// So we declare the menu and add it to the window²$menu = &new menu($gdkwindow,$accelgroup);²²// We now can add entrys to the menu²// first the file menu ²$menu->add_menu_item('file',null,'file');²// Second we want a open file option in the file menu²$menu->add_menu_item($keyid='open',$parent='file',$label='_open',² $callback='openfilefunctionname',$imgfile='img/fileopen.xpm');²//we also want a separator in the menu file²$menu->add_sep('file');² # you can now pass $xpmdatas or array(gdkpixmap,gdkkbitmask) instead of a file as image²$menu->add_menu_item('quit','file','_quit','shutdown','img/exit.xpm');²$menu->add_menu_item('help',null,'help');²$menu->add_menu_item('about','help','about','about_function_name');²//You can add check menu item too by setting is_checkmenuitem patameter to TRUE.²$menu->add_menu_item('check','help','checkitem','callbackfuntion',null,² $is_sensitive=TRUE,$is_checkmenuitem=TRUE,$is_checked=FALSE);²²# now add an entry with a beautifull right click menu²$box = &new gtkvbox();²$entry = &new gtkentry();²$menueditable = &new menu_editable($gdkwindow,$accelgroup);²$menueditable->connect_editable($entry);²$box->pack_start($menu->bar);²$box->pack_start($entry);²$w->add($box);²$w->show_all();²gtk::main();²function shutdown(){² gtk::main_quit();²}²?>[[include:Main/CodeTableEnd]]²²this would display a window with only a nice menu with icons and accelkey already defined.[[<<]]²[[#top top]]²----²²!!! [[#classcode]]So now here's the menu class code²check the code to find more details on how to use methods²[[include:Main/CodeTable]]<?php²/**²* easy way to create menu with optionnal icons²* @author Jonathan Gotti <nathan at the-ring dot homelinux dot net>²* @copyleft (l) 2003-2004 Jonathan Gotti²* @package GUI²* @subpackage extended widgets²* @license http://opensource.org/licenses/gpl-license.php GNU Public License²* @date 2004-06-08²* @changelog 2005-04-05 add_menu_item() now accept underscored string as additional accelkey (see $label param)²* 2005-01-28 new class menu_editable to add a common right click menu on any gtkeditable widgets²* 2005-01-02 (by Brian) now accel key is still available in the label even when adding an icon²* 2004-10-09 add support for array(gdkpixmap,gdkmask) AND xpmdatas ²* 2004-08-12 now menuitem with shortcuts and no parents are attached to the ALT modifier key ²* instead of CTRL (because that's the default behaviour in most modern apps) ²* 2004-07-01 now support checkmenuitem new ensure unique keyid for items²*/²class menu{²² var $bar;² /** the gdkwindow used to create pixmaps */² var $gdkwindow;² /** the accel group to manage accelkeys */² var $accel_group;² /** used for easy access to menus */² var $menus;² /** used for easy access to menuitems */² var $items;² /**² *constructor function² *@param gdkwindow $gdkwindow² *@param gtkaccelgroup $accel_group² *@return menu object² **/² function menu($gdkwindow=null,$accel_group=null){² if(is_a($gdkwindow,'gdkwindow'))² $this->gdkwindow = &$gdkwindow;² $this->bar = &new GtkMenuBar();² $this->bar->set_shadow_type(GTK_SHADOW_ETCHED_IN);² if(is_a($accel_group,'GtkAccelGroup')){² $this->accel_group = &$accel_group;² }else{² $this->accel_group = &new GtkAccelGroup();² }² # showvar($GLOBALS['MAIN']);² }² /**² *add an handlebox as box propertie ² *and pack the bar into it so you will need to pack $this->box instead of $this->bar² */² function add_handlebox(){² $this->box = &new Gtkhandlebox();² $this->box->add($this->bar);² }² /**² *will add a separator to $parent menu ² *@param string $parent the parent menu keyindex² */² function add_sep($parent){² $this->add_menu_item('SEP',$parent);² }² /**² *add an item to the menu² *@param string $key is the keyindex to acces the item inside the objects² *@param string $parent the parent's keyindex ² *@param mixed $label the text to display for this item ² * (can be null to get a separator or an array ² * array(string label, key_symbol accelkey | string underscored key ('_k') [,GdkModifierType]) )² *@param mixed $callback the function name or array(object,methodname) to call on select² *@param string $imgfile optionnal file path to an icon ² * (ADD support to array(gdkpixmap,gdkmask) and xpmdatas at 2004-10-09)² *@param bool $sensitive² *@param bool $is_checkmenuitem² *@param bool $is_checked² */² function add_menu_item($key,$parent,$label=null,$callback=null,$imgfile=null,² $sensitive=TRUE,$is_checkmenuitem=FALSE,$is_checked=FALSE){² while($this->items[$key]){ # ensure a unike keyid² preg_match("!(\d+)$!",$key,$m);² $int=$m[1];² if(is_numeric($int))² $key = substr($key,0,- strlen($int)).($int+1);² else² $key.='1';² }² if( (!$label)&& $this->menus[$parent]){² $this->items[$key] = &new gtkmenuitem();² $this->items[$key]->set_sensitive(FALSE);² $this->menus[$parent]->append($this->items[$key]);² return;² }elseif(is_array($label)){² $acckey = $label[1];² if(count($label)==3)² $modifier = $label[2];² $label = $label[0];² }² if(!$is_checkmenuitem){² $this->items[$key]= &new gtkmenuitem($label);² }else{² $this->items[$key]= &new gtkcheckmenuitem($label);² $this->items[$key]->set_active($is_checked);² }² $lb = $this->items[$key]->child;² # add icon if needed² if(is_string($imgfile) && file_exists($imgfile)){² $this->check_gdkwindow();² if($img = Gdk::pixmap_create_from_xpm($this->gdkwindow,null,$imgfile)){² $img = &new GtkPixmap($img[0], $img[1]);² $this->items[$key]->remove($lb);² $box = &new gtkhbox();² $box->pack_start($img,0,0,2);² $box->pack_start($lb,1,1,2); # bryan changed to keep accelkey displayed² $this->items[$key]->add($box);² }² }elseif(is_array($imgfile)){ # add support for array(gdkpixmap,gdkmask) AND xpmdatas 2004-10-09² if(count($imgfile)>2){ # assume we have xpmdatas² $this->check_gdkwindow();² $imgfile = Gdk::pixmap_create_from_xpm_d($this->gdkwindow,null,$imgfile);² }² if($img = &new gtkpixmap($imgfile[0], $imgfile[1])){² $this->items[$key]->remove($lb);² $box = &new gtkhbox();² $box->pack_start($img,0,0,2);² $box->pack_start($lb,1,1,2);² $this->items[$key]->add($box);² }² }² if(!$sensitive)# forgotten sensitivity check (2004-12-18)² $this->items[$key]->set_sensitive(FALSE);² # adding to parent menu² if(!$parent){² $this->bar->append($this->items[$key]);² }else{² if(! $this->items[$parent]){² echo "[ERROR] menu::add_menu_item to non-existent parent '$parent'\n";² return FALSE;² }² if(! $this->menus[$parent]){² $this->menus[$parent] = &new GtkMenu();² $this->items[$parent]->set_submenu($this->menus[$parent]);² }² $this->menus[$parent]->append($this->items[$key]);² }² # add accellkey if needed² if(substr_count($label,'_')||$acckey){² if(! isset($acckey) ){² $acckey = $lb->parse_uline($label);² }elseif(is_string($acckey)){ # 2005-04-05 now accept underscored string as accelkey² $acckey = $lb->parse_uline($acckey);² $lb->set_text($label);² }² if(! isset($modifier)){² if($parent===null && $callback===null){² $this->items[$key]->add_accelerator('activate_item',$this->accel_group,² $acckey,GDK_MOD1_MASK,GTK_ACCEL_VISIBLE);² }else{² $this->items[$key]->add_accelerator('activate',$this->accel_group,² $acckey,GDK_CONTROL_MASK,GTK_ACCEL_VISIBLE);² }² }else{² $this->items[$key]->add_accelerator('activate',$this->accel_group,² $acckey,$modifier,GTK_ACCEL_VISIBLE);² }² }² #connect to callback² if($callback)² $this->items[$key]->connect('activate',$callback,$key);² }² /**² * more complex menuitem connection to improve usability² * still offer only the activate signal support² * @since 2005-01-28² * @param string $itemkey the menuitem key of the menuitem you want to connect² * @param mixed $vars pass as many parameter to the callback function as you need ² * (exactly as a normal connect)² * @todo never tested so test this method ² */² function on_activate_item($itemkey){² # get all additional vars² for($i=1;$i<func_num_args();$i++){² $args[$i]= &func_get_arg($i);² $str .= '$args['.$i.'],';² }² $str = substr($str,0,-1);² eval('$cb = $this->entry->connect("activate",'.$str.');');² return $cb;² }² /**² *@access private² */² function check_gdkwindow(){² if(! $this->gdkwindow){² $this->bar->realize();² $this->gdkwindow = $this->bar->window;² }² }² function destroy(){² if($this->box)² $this->box->destroy();² else² $this->bar->destroy();² }²}²/**²* icons have been convert using Mk0-imgview and come from the crystal icon theme by everaldo ²* under the lgpl licence (found at kdelook.org) (this concern thoose with name prefixed with edit)²* @author Jonathan Gotti <nathan at the-ring dot homelinux dot net>²* @copyleft (l) 2003-2005 Jonathan Gotti²* @license http://opensource.org/licenses/gpl-license.php GNU Public License²* @date 2005-01-28 ²*/²class menu_editable extends menu{²² ² function menu_editable($gdkwindow=null,$accel_group=null){² menu::menu($gdkwindow,$accel_group);² $this->_load_icons();² $this->add_menu_item('edit',null);² $this->add_menu_item('cut','edit','cut',array(&$this,'_cut'),$this->pixdatas['editcut']);² $this->add_menu_item('copy','edit','copy',array(&$this,'_copy'),$this->pixdatas['editcopy']);² $this->add_menu_item('paste','edit','paste',array(&$this,'_paste'),$this->pixdatas['editpaste']);² $this->add_menu_item('delete','edit','delete',array(&$this,'_delete'),$this->pixdatas['editdelete']);² $this->add_sep('edit');² $this->add_menu_item('select_all','edit','select all',array(&$this,'_select_all'),$this->pixdatas['all']);² $this->add_menu_item('cancel','edit','cancel',array(&$this,'_cancel'),$this->pixdatas['cancel']);² $this->menus['edit']->connect('hide',array(&$this,'_cancel'));² }² /**² * connect a gtkeditable widget to support the menu_editable on right click² * @param gtkeditable $editable² * return callback handler;² */² function connect_editable(&$editable){² if(! is_a($editable,'gtkeditable'))² return FALSE;² return $editable->connect('button-press-event',array(&$this,'_popup'));² }² /**² * popup the menu_editable on a right click from &$editable² * @param gtkeditable $editable² * @param gdkevent $event² * @access private² */² function _popup(&$editable,&$event){² if( $event->button !=3) return FALSE; # check for right click² $this->editable = $editable; # keep trace of the gtkeditable we're working on² $this->has_selection = $editable->has_selection;² $this->selection_start= $editable->selection_start_pos;² $this->selection_end = $editable->selection_end_pos;² $this->menus['edit']->popup(null,null,null,1,$event->time); # popup the menu² $this->menus['edit']->show_all(); # and show all to be sure that's it's realized² }² function _select_all(){² if(! is_a($this->editable,'gtkeditable')) return FALSE;² $this->editable->select_region(0,-1);² }² function _delete(){² if(! (is_a($this->editable,'gtkeditable') && $this->has_selection) ) return FALSE;² $this->_restore_selection();² $this->editable->delete_selection();² }² function _cut(){² if(! (is_a($this->editable,'gtkeditable') && $this->has_selection) ) return FALSE;² $this->_restore_selection();² $this->editable->cut_clipboard();² }² function _copy(){² if(! (is_a($this->editable,'gtkeditable') && $this->has_selection) ) return FALSE;² $this->_restore_selection();² $this->editable->copy_clipboard();² }² function _paste(){² if(! is_a($this->editable,'gtkeditable')) return FALSE;² $this->_restore_selection();² $this->editable->paste_clipboard();² }² function _restore_selection(){² if(! is_a($this->editable,'gtkeditable')) return FALSE;² $this->editable->select_region($this->selection_start,$this->selection_end);² }² function _cancel(){² $this->_restore_selection();² }² function _load_icons(){² $all = array( "16 16 2 1",² " c none",² "0 c #9C9A74",² " ",² " ",² " ",² " ",² " ",² " 00 00 ",² " 00 00 ",² "00 0000000000 00",² "00 0000000000 00",² " 00 00 ",² " 00 00 ",² " ",² " ",² " ",² " ",² " ");² $cancel = array( "16 16 2 1",² " c none",² "0 c #9C9A74",² " ",² " ",² " ",² " ",² " 000 000 ",² " 000 000 ",² " 000000 ",² " 000 ",² " 000 ",² " 000000 ",² " 000 000 ",² " 000 000 ",² " ",² " ",² " ",² " ");² /**² *Xpm_datas Generated file² */#PHP imgview generated array from editpaste.png on 2005-01-28² $editpaste = array( "16 16 131 2",² "01 c #643214",² "03 c #9C9A74",² "05 c #F4D244",² "07 c #9C661C",² "09 c #BC6E14",² "0; c #9C9AB4",² "0= c #DCDAB4",² "0? c #D47A14",² "0A c #646684",² "0C c #CCA23C",² "0E c #E4EAFC",² "0G c #8C8274",² "0I c #AC7E2C",² "0K c #ECBA34",² "0M c #C4C2AC",² "0O c #84829C",² "0Q c #DCDEEC",² "0S c #FCEA5C",² "0U c #BC761C",² "0W c #E49A1C",² "0Y c #8C8EA4",² "0[ c #844E24",² "0] c #ACAEC4",² "0_ c #D4922C",² "0a c #F4F6FC",² "0c c #F4DE4C",² "0e c #84664C",² "0g c #ECA62C",² "0i c #7C3E14",² "0k c #9CA2AC",² "0m c #CC7A1C",² "0o c #94969C",² "0q c #E48A0C",² "0s c #BCB26C",² "0u c #CCCEDC",² "0w c #F4F2FC",² "0y c #E4E6EC",² "0{ c #C4761C",² "0} c #743A0C",² "10 c #ECEAEC",² "12 c #CC7E1C",² "14 c #ECC63C",² "16 c #BCBACC",² "18 c #94929C",² "1: c #DCDAE4",² "1< c #ECD264",² "1> c #9C6E2C",² "1@ c #CC6E04",² "1B c #847274",² "1D c #8C8AA4",² "1F c #E4E2EC",² "1H c #E4A23C",² "1J c #ECE26C",² "1L c #946A3C",² "1N c #F4AA2C",² "1P c #A4A2BC",² "1R c #E4961C",² "1T c #ECEEFC",² "1V c #E4C65C",² "1X c #6C3A14",² "1Z c #C49A3C",² "1/ c #F4DA54",² "1^ c #9C9EAC",² "1` c #D4821C",² "1b c #DCAE3C",² "1d c #B48654",² "1f c #FCFE74",² "1h c #BC762C",² "1j c #ECA22C",² "1l c #945614",² "1n c #B4B2C4",² "1p c #DC8E24",² "1r c #FCFEFC",² "1t c #E4AE44",² "1v c #C4BA64",² "1x c #D4D2E4",² "1z c #C47A1C",² "1| c #ECEEF4",² "1~ c #CCCADC",² "20 c #9492AC",² "22 c #ECCA5C",² "24 c #643614",² "26 c #ACAA74",² "28 c #F4D24C",² "2: c #9C6A24",² "2< c #C47614",² "2> c #64668C",² "2@ c #DC9A34",² "2B c #948A6C",² "2D c #B48A34",² "2F c #CCBE9C",² "2H c #8486A4",² "2J c #DCE2EC",² "2L c #FCF25C",² "2N c #BC7624",² "2P c #EC9E24",² "2R c #8C8EAC",² "2T c #FCFAFC",² "2V c #F4DE54",² "2X c #8C6A54",² "2Z c #7C4214",² "2/ c #9CA2BC",² "2^ c #9496B4",² "2` c #E48E14",² "2b c #BCB664",² "2d c #CCCEE4",² "2f c #E4E6F4",² "2h c #743A14",² "2j c #ECEAF4",² "2l c #CC8624",² "2n c #C4C2D4",² "2p c #9492A4",² "2r c #DCDAEC",² "2t c #9C722C",² "2v c #CC720C",² "2x c #7C7A94",² "2z c #8C8AAC",² "2| c #E4E2F4",² "2~ c #F4E674",² "30 c #9C6E44",² "32 c #A4A6BC",² "34 c #EC961C",² "36 c #E4CA5C",² "38 c #9C9EB4",² "3: c #E4860C",² "3< c #945A1C",² "3> c #B4B2CC",² "3@ c #DC922C",² "3B c #ECAE34",² "3D c #C47A24",² "3F c None",² "3F3F3F0A0O1^0;1D0A3F3F3F3F3F3F3F01",² "120?1L2x1F1r1r102H0e0m2<3F3F3F3F01",² "2l222B1n2j2J1F0y2n0G1V0_093F3F3F01",² "0C1r261D2p2p2p0o0o031f1b1d3F3F3F01",² "1Z1r1J1v2b1v0s0k1^0M0=2F162R3F3F01",² "2D1r0S0S2L2L2~0Q1r2T2j2f2|162R3F01",² "0I1r1/2V1/0c1<1:1r1r1r1r1r0]2^1D01",² "2t1r28282805361:1r1r1r0w2f2n1n2001",² "1>1r140K3B1N1t2r1r1r1r0a2j0u2n0;01",²² "2:1r0g1j1j2P1H0Q1r1r2T1T2r1x0u0;01",² "071r340W341R2@0Q1r2T0w1F0Q1:1x3801",² "3<1r2`2`2`2`3@0Q1r0a2j2f1F0Q0Q3801",² "1l1r0q0q0q3:1p1:1r0w1|2j1F1F0Q3801",² "2Z2v2v2v2v1@0m0Q1r1T1|2j2|1F0Q3801",² "011X0i0i0i0}0[0Q1r2T0w1|2j0y2f3801",² "3F3F3F3F3F3F1B1P321P1P1P2/1P1P2R01",² );² #PHP imgview generated array from edit.png on 2005-01-28² $edit = array( "16 16 133 2",² "01 c #040204",² "03 c #7C829C",² "05 c #FCCA0C",² "07 c #D4C6BC",² "09 c #E48E1C",² "0; c #D4E6FC",² "0= c #8C1E0C",² "0? c #C48A74",² "0A c #F4D28C",² "0C c #444654",² "0E c #9CA6B4",² "0G c #FCA60C",² "0I c #FCE6C4",² "0K c #CCD6E4",² "0M c #945E4C",² "0O c #646674",² "0Q c #F4F6FC",² "0S c #FCC244",² "0U c #FCBA04",² "0W c #E44E04",² "0Y c #AC826C",² "0[ c #E4B66C",² "0] c #ACB2BC",² "0_ c #1C222C",² "0a c #C4CAD4",² "0c c #F48624",² "0e c #545664",² "0g c #ECEAF4",² "0i c #D4DEEC",² "0k c #848E9C",² "0m c #F4DAC4",² "0o c #FCB624",² "0q c #CC6A3C",² "0s c #D4D2DC",² "0u c #ECEEF4",² "0w c #ACAEBC",² "0y c #747684",² "0{ c #FC9A04",² "0} c #EC6A14",² "10 c #0C0E1C",² "12 c #848A94",² "14 c #FCD21C",² "16 c #A43A24",² "18 c #DCDAE4",² "1: c #F4FEFC",² "1< c #FCD244",² "1> c #C4B2B4",² "1@ c #CCD2DC",² "1B c #5C5E6C",² "1D c #E4E6F4",² "1F c #A41E04",² "1H c #C4928C",² "1J c #A4A2AC",² "1L c #D4D6DC",² "1N c #6C6E7C",² "1P c #F4BE1C",² "1R c #CCCAD4",² "1T c #FCE2B4",² "1V c #FCEEEC",² "1X c #FCCE64",² "1Z c #CCBAB4",² "1/ c #848694",² "1^ c #F4C22C",² "1` c #94220C",² "1b c #FCD6A4",² "1d c #4C5264",² "1f c #FCB204",² "1h c #C4764C",² "1j c #FCFAFC",² "1l c #B4BAC4",² "1n c #24222C",² "1p c #F4924C",² "1r c #F4E6E4",² "1t c #DCDEE4",² "1v c #FCBE3C",² "1x c #DC763C",² "1z c #F49E34",² "1| c #FC7A04",² "1~ c #14121C",² "20 c #5C626C",² "22 c #E4EEFC",² "24 c #CC927C",² "26 c #A4A6B4",² "28 c #D4DAE4",² "2: c #F4E2C4",² "2< c #04020C",² "2> c #FCCA1C",² "2@ c #D48E54",² "2B c #941A04",² "2D c #FCD294",² "2F c #444A5C",² "2H c #FCAA04",² "2J c #B45634",² "2L c #646A7C",² "2N c #F4FAFC",² "2P c #FCBE04",² "2R c #AC868C",² "2T c #B4B6C4",² "2V c #C4CADC",² "2X c #FC9204",² "2Z c #545A6C",² "2/ c #8C96AC",² "2^ c #FCB634",² "2` c #D4D2E4",² "2b c #F4F2FC",² "2d c #B4AAAC",² "2f c #747E94",² "2h c #FC9614",² "2j c #FC6A04",² "2l c #0C121C",² "2n c #848AA4",² "2p c #FCCE34",² "2r c #FCFEFC",² "2t c #FCD654",² "2v c #C4B6BC",² "2x c #E4EAF4",² "2z c #A4A2B4",² "2| c #D4D6E4",² "2~ c #6C7284",² "30 c #FCBE14",² "32 c #CCCEDC",² "34 c #FCF2F4",² "36 c #FCD264",² "38 c #CCBEC4",² "3: c #84869C",² "3< c #242634",² "3> c #F4EAEC",² "3@ c #DCE2EC",² "3B c #DC7E3C",² "3D c #5C6274",² "3F c #CC9284",² "3H c #F4E2CC",² "3J c None",² "322|282|281@2V2d092@162B3J3J3J3J01",² "282r2r2r2r1j0Q0[2P1v1p2B3J3J3J3J01",² "282r2r2r2r2r0g1P2H1|0W1`3J3J3J3J01",² "2|2r2r2r2r2r0A0U0{2j2J3:2f3J3J3J01",² "282r2r2r2r1V1^0U2X0W2R2/0O3J3J3J01",² "2|2r2r2r2r1T0U1f1|0q2V0E1B3J3J3J01",² "282r2r2r2r0S050G0}1H0;26203J3J3J01",² "2|2r2r2r0I2>302h1x0s3@2T1n3J013J01",² "282r2r1j1X140o0c3F2x2x0]2l01010101",² "2|2r2r3H1<2p2^3B181t28261001010101",² "182r2N2:362t1z241@1R322z2l01010101",² "2|2r1j0m1b2D1h1>0K2V1@1J1001013J01",² "282r2r070Y0?1>0K320a1L0w1~3J3J3J01",² "182r2r1Z0M380i0s0s280g0]1d3J3J3J01",² "282r2r1V3>2N2b0u0Q0u2N2T2Z3J3J3J01",² "1l1/1/120k121/1/1/1/1/0y203J3J3J01",² );² #PHP imgview generated array from editcopy.png on 2005-01-28² $editcopy = array( "16 16 43 1",² "1 c #747294",² "2 c #BCBACC",² "3 c #DCDEEC",² "4 c #9496B4",² "5 c #CCCEDC",² "6 c #F4F2FC",² "7 c #8486AC",² "8 c #ACAAC4",² "9 c #C4C6DC",² ": c #ECEAF4",² "; c #7C7E9C",² "< c #D4D6E4",² "= c #C4C2D4",² "> c #A4A2BC",² "? c #E4E6F4",² "@ c #FCFAFC",² "A c #8C8EAC",² "B c #7C7A9C",² "C c #BCBED4",² "D c #E4E2EC",² "E c #9C9EBC",² "F c #D4D2E4",² "G c #B4B2CC",² "H c #ECEEF4",² "I c #8482A4",² "J c #DCDAEC",² "K c #74769C",² "L c #BCBAD4",² "M c #9C9AB4",² "N c #CCCEE4",² "O c #F4F6FC",² "P c #8C8AAC",² "Q c #CCCADC",² "R c #7C7EA4",² "S c #D4D6EC",² "T c #C4C2DC",² "U c #A4A6C4",² "V c #FCFEFC",² "W c #9492B4",² "X c #E4E2F4",² "Y c #B4B6CC",² "Z c #ECEEFC",² "[ c None",² "9<<FNFUK[[[[[[[[1",² "5VVV@HJUB[[[[[[[1",² "FVVV@6GWIK[[[[[[1",² "5VVVV6398B[[[[[[1",² "5VVVV6FCLG9=YB[[1",² "FVVV6X96VVO?X8R[1",² "5VV@:XQOVVV6JE7B1",² "5V@6:ZQOVVVOXY8I1",² "FV@ZZ:QOVVV@:N971",² "5V@66ZN@VVV:3QF71",² "T6XX339@VV6XJSJP1",² ";BB;;1>VV@:??D3A1",² "[[[[[[Y@V66:?XXP1",² "[[[[[[T@@6ZZ?X3A1",² "[[[[[[C@@OO6Z?:P1",² "[[[[[[AMEEM4M44I1",² );² #PHP imgview generated array from editcut.png on 2005-01-28² $editcut = array( "16 16 149 2",² "01 c #3C365C",² "03 c #BCB244",² "05 c #9C520C",² "07 c #AC7A3C",² "09 c #FCCE14",² "0; c #646284",² "0= c #E4960C",² "0? c #C46204",² "0A c #B4660C",² "0C c #D47604",² "0E c #6C320C",² "0G c #949ABC",² "0I c #ACB2CC",² "0K c #847E7C",² "0M c #D4860C",² "0O c #B45204",² "0Q c #CCCAD4",² "0S c #84420C",² "0U c #C46E04",² "0W c #F4AE0C",² "0Y c #CCCEDC",² "0[ c #B4A29C",² "0] c #B4BEDC",² "0_ c #9C6E4C",² "0a c #EC7604",² "0c c #7C86AC",² "0e c #44466C",² "0g c #A45A0C",² "0i c #BC6E0C",² "0k c #F4BE14",² "0m c #A4928C",² "0o c #D46604",² "0q c #F4F2FC",² "0s c #D4820C",² "0u c #7C360C",² "0w c #8C4A0C",² "0y c #CC760C",² "0{ c #846654",² "0} c #C46A04",² "10 c #BC660C",² "12 c #A4A6BC",² "14 c #DC8E14",² "16 c #E4E2EC",² "18 c #C4C2CC",² "1: c #AC5204",² "1< c #747294",² "1> c #BCB2AC",² "1@ c #7C7E9C",² "1B c #B45E04",² "1D c #DC6E04",² "1F c #FCB20C",² "1H c #ACAABC",² "1J c #8C92BC",² "1L c #545A84",² "1N c #642A0C",² "1P c #DC7604",² "1R c #9C9AAC",² "1T c #8C4204",² "1V c #C46E14",² "1X c #D4D6DC",² "1Z c #AC5A0C",² "1/ c #FCBE0C",² "1^ c #843E0C",² "1` c #CC7E0C",² "1b c #BC6A14",² "1d c #E48E04",² "1f c #84869C",² "1h c #ACAECC",² "1j c #A4560C",² "1l c #FCEE14",² "1n c #6C667C",² "1p c #E4A60C",² "1r c #CC6204",² "1t c #743A0C",² "1v c #B4B2C4",² "1x c #C4720C",² "1z c #ECB60C",² "1| c #BCC6DC",² "1~ c #F47604",² "20 c #8C8AA4",² "22 c #B47224",² "24 c #DC7E04",² "26 c #843A0C",² "28 c #944A0C",² "2: c #CC6A04",² "2< c #BC6A04",² "2> c #C4C6D4",² "2@ c #848294",² "2B c #BC5E04",² "2D c #ACAEC4",² "2F c #5C5A7C",² "2H c #543E3C",² "2J c #9C9EB4",² "2L c #DCDAE4",² "2N c #E4920C",² "2P c #9C560C",² "2R c #AC7A44",² "2T c #FCD214",² "2V c #646684",² "2X c #B46614",² "2Z c #D47A0C",² "2/ c #74360C",² "2^ c #DC8604",² "2` c #B45604",² "2b c #CCCADC",² "2d c #84460C",² "2f c #C46E0C",² "2h c #BCBECC",² "2j c #EC7A04",² "2l c #8482A4",² "2n c #4C4A64",² "2p c #A45E14",² "2r c #BC6E14",² "2t c #F4C214",² "2v c #AC9284",² "2x c #D46A04",² "2z c #FCFEFC",² "2| c #7C3A0C",² "2~ c #CC7A0C",² "30 c #C46A0C",² "32 c #A4AAC4",² "34 c #E4E6EC",² "36 c #C4C2D4",² "38 c #AC5604",² "3: c #747694",² "3< c #BCBACC",² "3> c #B4620C",² "3@ c #FCB614",² "3B c #9492AC",² "3D c #ECA20C",² "3F c #F4B614",² "3H c #8C460C",² "3J c #B4B6CC",² "3L c #DC820C",² "3N c #5C5E84",² "3P c #642E0C",² "3R c #DC7A04",² "3T c #AC5E0C",² "3V c #FCC20C",² "3X c #CC820C",² "3Z c #CC6604",² "3/ c #944E0C",² "3^ c #ACAAC4",² "3` c #9C9AB4",² "3b c #D4D6E4",² "3d c #E48E0C",² "3f c #BC6A0C",² "3h c #84829C",² "3j c None",² "3j3j3j3j3j3j3j3j2D0Q3<3j3j3j3j3j01",² "3j3j3j3j3j3j3j3j0Q343^3j3j3`2D3j01",² "3j3j3j3j3j3j3j3j3b2L1R3j3:2D1X3j01",² "3j3j3j3j3j3j3j3j180Y1<1L1R2z2>3j01",² "3j3j3j3j3j3j3j3j2D2h0e3B0q0Y3h3j01",² "3j3j3j3j3j3j3j3j3`2J3h16120;3j3j01",² "3j3j3j3T10100C3j0;202>1@0e3j3j3j01",² "3j3j1j0M1z2t140C0K1J2F013j3j3j3j01",² "3j0w2^0=2N3@2T09030{2H3j3j3j3j3j01",² "3j1B24053j0y091l0k1/0W3D0y3j3j3j01",² "3j2x2B3P282~1/0s1p1l092T1z0A3j3j01",² "3j2`1~382<1d0i1j3D0W1P3L1F1`1j3j01",² "3j2/1:1D0}1j3/3j140s1Z051`0M283j01",² "3j3j0u1:1T3j3j3j0}240E2/243f0S3j01",² "3j3j3j3j3j3j3j3j3H0a0?0?0a2d3j3j01",² "3j3j3j3j3j3j3j3j1t1^0o1r1^2/3j3j01",² );² #PHP imgview generated array from editdelete.png on 2005-01-28² $editdelete = array( "16 16 97 2",² "01 c #FC0204",² "03 c #7C8294",² "05 c #BCC2CC",² "07 c #DCE2EC",² "09 c #F4866C",² "0; c #646674",² "0= c #E4F2FC",² "0? c #DCA29C",² "0A c #E4CED4",² "0C c #F44234",² "0E c #9CA2B4",² "0G c #FC2214",² "0I c #F4F2F4",² "0K c #F4B2AC",² "0M c #CCD2DC",² "0O c #FCE2D4",² "0Q c #FC624C",² "0S c #ACB2C4",² "0U c #E4EAF4",² "0W c #FC361C",² "0Y c #F4FAFC",² "0[ c #FC9274",² "0] c #FCB2A4",² "0_ c #EC7A6C",² "0a c #FC1604",² "0c c #9C9EB4",² "0e c #DCCED4",² "0g c #E4E2EC",² "0i c #6C7284",² "0k c #ECFAFC",² "0m c #FCA294",² "0o c #FCD6CC",² "0q c #A4AABC",² "0s c #D4DAE4",² "0u c #848A94",² "0w c #C4CAD4",² "0y c #E4D6DC",² "0{ c #FC5644",² "0} c #F42E34",² "10 c #B4BECC",² "12 c #FC3E24",² "14 c #FCFAFC",² "16 c #EC969C",² "18 c #848694",² "1: c #DCE6F4",² "1< c #ECF2FC",² "1> c #E4AEB4",² "1@ c #A4A6BC",² "1B c #FC2A14",² "1D c #F4F6FC",² "1F c #ECBAC4",² "1H c #D4D6E4",² "1J c #F46A54",² "1L c #ECEEF4",² "1N c #FCBAA4",² "1P c #FC7654",² "1R c #FC1E1C",² "1T c #747684",² "1V c #CCCEDC",² "1X c #FC0E0C",² "1Z c #7C8694",² "1/ c #DCE2F4",² "1^ c #FC8274",² "1` c #6C6E7C",² "1b c #ECCAD4",² "1d c #FC4E3C",² "1f c #9CA6BC",² "1h c #FC260C",² "1j c #F4F2FC",² "1l c #F4B6AC",² "1n c #CCD6E4",² "1p c #F4EEF4",² "1r c #B4B6C4",² "1t c #E4EEFC",² "1v c #FC322C",² "1x c #F4FEFC",² "1z c #FC9E84",² "1| c #FC1614",² "1~ c #E4E6F4",² "20 c #6C7684",² "22 c #ECFEFC",² "24 c #F4AEB4",² "26 c #ACAEC4",² "28 c #DCDEE4",² "2: c #C4CADC",² "2< c #ECD6D4",² "2> c #FC5A3C",²² "2@ c #BCBECC",² "2B c #FC3E2C",² "2D c #FCFEFC",² "2F c #F4928C",² "2H c #ECF6FC",² "2J c #ECAAB4",² "2L c #FC6A4C",²² "2N c #FCBAAC",² "2P c #FC7664",² "2R c None",² "0w0s1H1H1H1H1V0w0S0S1f2R2R2R2R2R01",² "0M2D2D2D2D2D1D1j0M282@0E2R2R2R2R01",² "1V2D2D2D2D2D0Y1D1H1D1D2:0q2R2R2R01",² "0M2D2D2D2D2D14140S2@0w050E032R2R01",² "1V2D2D2D2D2D2D2D0w100S0c1@202R2R01",² "0M2D2D2D2D2D141D0Y1<070w0M1`2R2R01",² "1V2D2D0o0o2D2D0Y0y0_0?1n1H0i2R2R01",² "0M2D0O1z0[2N2H2<1J1h2B0e070i2R2R01",² "1V2D141N1P2L090Q0G121>0707202R2R01",² "0M2D140Y0]2>121h1d0A1t071~202R2R01",² "0M2D1D1x0K0W1h0a1v0A0=071~1T2R2R01",² "0M2D1j1z121B0{0G010a2J0U0U1T2R2R01",² "0M2D2N0W0G1^0k241X011R0y1t0i2R2R01",² "0M2D1p2P2F1D2H221F1v160g1~1T2R2R01",² "0M2D2D2D2D2D14140Y0Y2H1L1<1T2R2R01",² "05180u0u0u0u180u180u1Z18180;2R2R01",² );² $this->pixdatas = array('editdelete'=>$editdelete,'editpaste'=>$editpaste,'edit'=>$edit,² 'editcopy'=>$editcopy,'editcut'=>$editcut,'all'=>$all,'cancel'=>$cancel);² }²}²?>[[include:Main/CodeTableEnd]]²If you have any idea to enhance this piece of code don't hesitate to mail me, i'll surely enjoy.²²Hope this will help {{~Nathan}} at the-ring dot homelinux dot net[[<<]]²[[#top top]]²----²!!! [[#changelog]]Change log ²* 2004-07-01 ²**now support checkmenuitem²**ensure unique keyid for items[[<<]]²*2004-08-12²**will activate menuitem with shortcuts and no parents on the ALT modifier key instead of CTRL (usefull for parents menu like file or help)²*2004-10-09 ²**add support for array(gdkpixmap,gdkmask) AND xpmdatas ²*2005-01-02 (Change by Brian) ²** Changed $box->pack_start($lb,0,0,2); to $box->pack_start($lb, true, true, 2); - Otherwise, adding an Icon caused the accelerator key to disappear.²*2005-01-28²** new class menu_editable to add a common right click menu on any gtkeditable widgets %bgcolor=#a0F0a0 color=green%[-new-]²*2005-04-05 ²** add_menu_item() now accept underscored string as additional accelkey (see $label param)
|
|
time=1117377282
|
|
diff:1092073151:1092073151:=1,216c1²< !! menu class with icons support²< ²< http://jonathan.gotti.free.fr/phpgtkwikki/menuicon.png²< ²< * [-[[#sample How to use it?]]-]²< * [-[[#classcode the class code]]-]²< * [-[[#changelog changelog]]-]²< * [-%target=_blank%[[http://opensource.org/licenses/lgpl-license.php licence: LGPL]]-]²< -----²< ²< When creating a soft, you'll often want to have a menu like in the majority of graphical softs. It's often clear in your mind but require²< more code than you want to do simple things.²< So here's a class to help you to quickly design such menus and will also allow you to display nice icon in your menus.²< ----²< ²< !!! [[#sample]]How to use it ?²< ²< first of all copy the class [[#classcode code]] to a file (ie: class-menu.php) and then include it in your code. Then here is a sample of code to show you how simple it is to create menu in your application so lets see:²< ²< [[include:Main/CodeTable]]²< <?²< if(strtoupper(substr(PHP_OS, 0,3)) == 'WIN')²< dl('php_gtk.dll');²< else²< dl('php_gtk.so');²< include_once('path_to_class-menu.php');²< ²< $w = &new gtkwindow();²< $w->connect('destroy-event','shutdown');²< $w->connect('delete-event','shutdown');²< $w->set_position('center');²< ²< // We realize the window to get the gdkwindow needed to ²< // create Xpm if we want to display icons in our menu²< $w->realize();²< $gdkwindow = $w->window;²< ²< // We also create a gtkaccelgroup to manage accelkeys²< // the class menu will attempt to create its own if none is given at creation time²< $accelgroup = &new gtkaccelgroup();²< $w->add_accel_group($accelgroup);²< ²< // So we declare the menu and add it to the window²< $menu = &new menu($gdkwindow,$accelgroup);²< $w->add($menu->bar);²< ²< // We now can add entrys to the menu²< // first the file menu ²< $menu->add_menu_item('file',null,'file');²< // Second we want a open file option in the file menu²< $menu->add_menu_item($keyid='open',$parent='file',$label='_open',²< $callback='openfilefunctionname',$imgfile='img/fileopen.xpm');²< //we also want a separator in the menu file²< $menu->add_sep('file');²< $menu->add_menu_item('quit','file','_quit','shutdown','img/exit.xpm');²< $menu->add_menu_item('help',null,'help');²< $menu->add_menu_item('about','help','about','about_function_name');²< ²< $w->show_all();²< gtk::main();²< ²< function shutdown(){²< gtk::main_quit();²< }²< ?>[[include:Main/CodeTableEnd]]²< ²< this would display a window with only a nice menu with icons and accelkey already defined.[[<<]]²< [[#top top]]²< ----²< ²< !!! [[#classcode]]So now here's the menu class code²< check the code to find more details on how to use methods²< [[include:Main/CodeTable]]²< <?php²< /**²< Easy menu manipulation²< @author Jonathan Gotti <nathan at the-ring dot homelinux dot net>²< @copyright © 2004 Jonathan Gotti²< @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public Licence²< */²< ²< class menu{²< ²< var $bar;²< /** the gdkwindow used to create pixmaps */²< var $gdkwindow;²< /** the accel group to manage accelkeys */²< var $accel_group;²< /** used for easy access to menus */²< var $menus;²< /** used for easy access to menuitems */²< var $items;²< /**²< * constructor function²< * @param gdkwindow $gdkwindow²< * @param gtkaccelgroup $accel_group²< * @return menu object²< **/²< function menu($gdkwindow=null,$accel_group=null){²< if(is_a($gdkwindow,'gdkwindow'))²< $this->gdkwindow = &$gdkwindow;²< $this->bar = &new GtkMenuBar();²< $this->bar->set_shadow_type(GTK_SHADOW_ETCHED_IN);²< if(is_a($accel_group,'GtkAccelGroup')){²< $this->accel_group = &$accel_group;²< }else{²< $this->accel_group = &new GtkAccelGroup();²< }²< # showvar($GLOBALS['MAIN']);²< }²< /**²< add an handlebox as box propertie ²< and pack the bar into it so you will need to pack $this->box instead of $this->bar²< */²< function add_handlebox(){²< $this->box = &new Gtkhandlebox();²< $this->box->add($this->bar);²< }²< /**²< will add a separator to $parent menu ²< @param string $parent the parent menu keyindex²< */²< function add_sep($parent){²< $this->add_menu_item('SEP',$parent);²< }²< /**²< add an item to the menu²< @param string $key is the keyindex to acces the item inside the objects²< @param string $parent the parent's keyindex ²< @param string $label the text to display for this item (can be null to get a separator)²< @param mixed $callback the function name or array(object,methodname) to call on select²< @param string $imgfile optionnal file path to an icon²< @param bool $sensitive²< @param bool $is_checkmenuitem²< @param bool $is_checked²< */²< function add_menu_item($key,$parent,$label=null,$callback=null,$imgfile=null,²< $sensitive=TRUE,$is_checkmenuitem=FALSE,$is_checked=FALSE){²< while($this->items[$key]){ # ensure a unike keyid²< preg_match("!(\d+)$!",$key,$m);²< $int=$m[1];²< if(is_numeric($int))²< $key = substr($key,0,- strlen($int)).($int+1);²< else²< $key.='1';²< }²< if( (!$label)&& $this->menus[$parent]){²< $this->items[$key] = &new gtkmenuitem();²< $this->items[$key]->set_sensitive(FALSE);²< $this->menus[$parent]->append($this->items[$key]);²< return;²< }²< if(!$is_checkmenuitem){²< $this->items[$key]= &new gtkmenuitem($label);²< }else{²< $this->items[$key]= &new gtkcheckmenuitem($label);²< $this->items[$key]->set_active($is_checked);²< }²< $lb = $this->items[$key]->child;²< # add icon if needed²< if(file_exists($imgfile)){²< if(! $this->gdkwindow){²< $this->bar->realize();²< $this->gdkwindow = $this->bar->window;²< }²< if($img = Gdk::pixmap_create_from_xpm($this->gdkwindow,null,$imgfile)){²< $img = &new GtkPixmap($img[0], $img[1]);²< $this->items[$key]->remove($lb);²< $box = &new gtkhbox();²< $box->pack_start($img,0,0,2);²< $box->pack_start($lb,0,0,2);²< $this->items[$key]->add($box);²< }²< }²< # adding to parent menu²< if(!$parent){²< $this->bar->append($this->items[$key]);²< }else{²< if(! $this->items[$parent]){²< echo "[ERROR] menu::add_menu_item to non-existent parent '$parent'\n";²< return FALSE;²< }²< if(! $this->menus[$parent]){²< $this->menus[$parent] = &new GtkMenu();²< $this->items[$parent]->set_submenu($this->menus[$parent]);²< }²< $this->menus[$parent]->append($this->items[$key]);²< }²< # add accellkey if needed²< if(substr_count($label,'_')){ # ajoute un raccourcis clavier²< $acckey = $lb->parse_uline($label);²< $this->items[$key]->add_accelerator('activate',$this->accel_group,$acckey,²< GDK_CONTROL_MASK,GTK_ACCEL_VISIBLE);²< }²< #connect to callback²< if($callback)²< $this->items[$key]->connect('activate',$callback,$key);²< }²< function destroy(){²< if($this->box)²< $this->box->destroy();²< else²< $this->bar->destroy();²< }²< }²< ?>[[include:Main/CodeTableEnd]]²< If you have any idea to enhance this piece of code don't hesitate to mail me, i'll surely enjoy.²< ²< Hope this will help {{~Nathan}} at the-ring dot homelinux dot net[[<<]]²< [[#top top]]²< ----²< ²< !!! [[#changelog]]Change log ²< * 2004-07-01 ²< **now support checkmenuitem %bgcolor=#a0F0a0 color=green%[-new-]²< **ensure unique keyid for items[[<<]]²---²> Describe MenuIcon here.²\ No newline at end of file²
|
|
author=Scott
|
|
author:1092073151=nathan
|
|
host:1092073151=82.120.145.180
|
|
name=CodeSnippets.MenuIcon
|
|
host=68.199.17.225
|
|
agent=Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2
|
|
rev=11
|
|
diff:1092274167:1092073151:=49c49²< $menu->add_menu_item('file',null,'_file'); # the 3rd parameter will define a shortcuts²---²> $menu->add_menu_item('file',null,'file');²192,198c192,193²< if($parent===null && $callback===null){²< $this->items[$key]->add_accelerator('activate_item',$this->accel_group,$acckey,²< GDK_MOD1_MASK,GTK_ACCEL_VISIBLE);²< }else{²< $this->items[$key]->add_accelerator('activate',$this->accel_group,$acckey,²< GDK_CONTROL_MASK,GTK_ACCEL_VISIBLE);²< }²---²> $this->items[$key]->add_accelerator('activate',$this->accel_group,$acckey,²> GDK_CONTROL_MASK,GTK_ACCEL_VISIBLE);²222,223d216²< *2004-08-12²< **will activate menuitem with shortcuts and no parents on the ALT modifier key instead of CTRL (usefull for parents menu like file or help)²\ No newline at end of file²
|
|
author:1092274167=nathan
|
|
host:1092274167=82.120.157.202
|
|
diff:1104661709:1092274167:minor=170,171c170,171²< $box->pack_start($img, false, false, 2);²< $box->pack_start($lb, true, true, 2);²---²> $box->pack_start($img,0,0,2);²> $box->pack_start($lb,0,0,2);²
|
|
author:1104661709=Brian Haase
|
|
host:1104661709=4.8.165.251
|
|
diff:1104661832:1104661709:minor=223,225c223²< **will activate menuitem with shortcuts and no parents on the ALT modifier key instead of CTRL (usefull for parents menu like file or help)²< *2005-01-02 (Change by Brian)²< ** Changed $box->pack_start($lb,0,0,2); to $box->pack_start($lb, true, true, 2); - Otherwise, adding an Icon caused the accelerator key to disappear.²\ No newline at end of file²---²> **will activate menuitem with shortcuts and no parents on the ALT modifier key instead of CTRL (usefull for parents menu like file or help)²\ No newline at end of file²
|
|
author:1104661832=Brian Haase
|
|
host:1104661832=4.8.165.251
|
|
diff:1112707722:1104661832:=13,14c13²< So here's a class to help you to quickly design such menus and will also allow you to display nice icon in your menus. \\²< [+Now you can easily add a common right click menu to all of your gtkeditable see [-[[#sample How to use it?]]-] sample code +]²---²> So here's a class to help you to quickly design such menus and will also allow you to display nice icon in your menus.²27c26²< include_once('class-menu.php');²---²> include_once('path_to_class-menu.php');²45a45²> $w->add($menu->bar);²49c49²< $menu->add_menu_item('file',null,'file');²---²> $menu->add_menu_item('file',null,'_file'); # the 3rd parameter will define a shortcuts²55d54²< # you can now pass $xpmdatas or array(gdkpixmap,gdkkbitmask) instead of a file as image²59,61d57²< //You can add check menu item too by setting is_checkmenuitem patameter to TRUE.²< $menu->add_menu_item('check','help','checkitem','callbackfuntion',null,²< $is_sensitive=TRUE,$is_checkmenuitem=TRUE,$is_checked=FALSE);²63,70d58²< # now add an entry with a beautifull right click menu²< $box = &new gtkvbox();²< $entry = &new gtkentry();²< $menueditable = &new menu_editable($gdkwindow,$accelgroup);²< $menueditable->connect_editable($entry);²< $box->pack_start($menu->bar);²< $box->pack_start($entry);²< $w->add($box);²72a61²> ²84c73,74²< [[include:Main/CodeTable]]<?php²---²> [[include:Main/CodeTable]]²> <?php²86,99c76,79²< * easy way to create menu with optionnal icons²< * @author Jonathan Gotti <nathan at the-ring dot homelinux dot net>²< * @copyleft (l) 2003-2004 Jonathan Gotti²< * @package GUI²< * @subpackage extended widgets²< * @license http://opensource.org/licenses/gpl-license.php GNU Public License²< * @date 2004-06-08²< * @changelog 2005-04-05 add_menu_item() now accept underscored string as additional accelkey (see $label param)²< * 2005-01-28 new class menu_editable to add a common right click menu on any gtkeditable widgets²< * 2005-01-02 (by Brian) now accel key is still available in the label even when adding an icon²< * 2004-10-09 add support for array(gdkpixmap,gdkmask) AND xpmdatas ²< * 2004-08-12 now menuitem with shortcuts and no parents are attached to the ALT modifier key ²< * instead of CTRL (because that's the default behaviour in most modern apps) ²< * 2004-07-01 now support checkmenuitem new ensure unique keyid for items²---²> Easy menu manipulation²> @author Jonathan Gotti <nathan at the-ring dot homelinux dot net>²> @copyright © 2004 Jonathan Gotti²> @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public Licence²100a81²> ²113,116c94,97²< *constructor function²< *@param gdkwindow $gdkwindow²< *@param gtkaccelgroup $accel_group²< *@return menu object²---²> * constructor function²> * @param gdkwindow $gdkwindow²> * @param gtkaccelgroup $accel_group²> * @return menu object²131,132c112,113²< *add an handlebox as box propertie ²< *and pack the bar into it so you will need to pack $this->box instead of $this->bar²---²> add an handlebox as box propertie ²> and pack the bar into it so you will need to pack $this->box instead of $this->bar²139,140c120,121²< *will add a separator to $parent menu ²< *@param string $parent the parent menu keyindex²---²> will add a separator to $parent menu ²> @param string $parent the parent menu keyindex²146,157c127,135²< *add an item to the menu²< *@param string $key is the keyindex to acces the item inside the objects²< *@param string $parent the parent's keyindex ²< *@param mixed $label the text to display for this item ²< * (can be null to get a separator or an array ²< * array(string label, key_symbol accelkey | string underscored key ('_k') [,GdkModifierType]) )²< *@param mixed $callback the function name or array(object,methodname) to call on select²< *@param string $imgfile optionnal file path to an icon ²< * (ADD support to array(gdkpixmap,gdkmask) and xpmdatas at 2004-10-09)²< *@param bool $sensitive²< *@param bool $is_checkmenuitem²< *@param bool $is_checked²---²> add an item to the menu²> @param string $key is the keyindex to acces the item inside the objects²> @param string $parent the parent's keyindex ²> @param string $label the text to display for this item (can be null to get a separator)²> @param mixed $callback the function name or array(object,methodname) to call on select²> @param string $imgfile optionnal file path to an icon²> @param bool $sensitive²> @param bool $is_checkmenuitem²> @param bool $is_checked²160c138²< $sensitive=TRUE,$is_checkmenuitem=FALSE,$is_checked=FALSE){²---²> $sensitive=TRUE,$is_checkmenuitem=FALSE,$is_checked=FALSE){²174,178d151²< }elseif(is_array($label)){²< $acckey = $label[1];²< if(count($label)==3)²< $modifier = $label[2];²< $label = $label[0];²188,189c161,165²< if(is_string($imgfile) && file_exists($imgfile)){²< $this->check_gdkwindow();²---²> if(file_exists($imgfile)){²> if(! $this->gdkwindow){²> $this->bar->realize();²> $this->gdkwindow = $this->bar->window;²> }²194,207c170,171²< $box->pack_start($img,0,0,2);²< $box->pack_start($lb,1,1,2); # bryan changed to keep accelkey displayed²< $this->items[$key]->add($box);²< }²< }elseif(is_array($imgfile)){ # add support for array(gdkpixmap,gdkmask) AND xpmdatas 2004-10-09²< if(count($imgfile)>2){ # assume we have xpmdatas²< $this->check_gdkwindow();²< $imgfile = Gdk::pixmap_create_from_xpm_d($this->gdkwindow,null,$imgfile);²< }²< if($img = &new gtkpixmap($imgfile[0], $imgfile[1])){²< $this->items[$key]->remove($lb);²< $box = &new gtkhbox();²< $box->pack_start($img,0,0,2);²< $box->pack_start($lb,1,1,2);²---²> $box->pack_start($img, false, false, 2);²> $box->pack_start($lb, true, true, 2);²211,212d174²< if(!$sensitive)# forgotten sensitivity check (2004-12-18)²< $this->items[$key]->set_sensitive(FALSE);²228,242c190,194²< if(substr_count($label,'_')||$acckey){²< if(! isset($acckey) ){²< $acckey = $lb->parse_uline($label);²< }elseif(is_string($acckey)){ # 2005-04-05 now accept underscored string as accelkey²< $acckey = $lb->parse_uline($acckey);²< $lb->set_text($label);²< }²< if(! isset($modifier)){²< if($parent===null && $callback===null){²< $this->items[$key]->add_accelerator('activate_item',$this->accel_group,²< $acckey,GDK_MOD1_MASK,GTK_ACCEL_VISIBLE);²< }else{²< $this->items[$key]->add_accelerator('activate',$this->accel_group,²< $acckey,GDK_CONTROL_MASK,GTK_ACCEL_VISIBLE);²< }²---²> if(substr_count($label,'_')){ # ajoute un raccourcis clavier²> $acckey = $lb->parse_uline($label);²> if($parent===null && $callback===null){²> $this->items[$key]->add_accelerator('activate_item',$this->accel_group,$acckey,²> GDK_MOD1_MASK,GTK_ACCEL_VISIBLE);²244,245c196,197²< $this->items[$key]->add_accelerator('activate',$this->accel_group,²< $acckey,$modifier,GTK_ACCEL_VISIBLE);²---²> $this->items[$key]->add_accelerator('activate',$this->accel_group,$acckey,²> GDK_CONTROL_MASK,GTK_ACCEL_VISIBLE);²252,279d203²< /**²< * more complex menuitem connection to improve usability²< * still offer only the activate signal support²< * @since 2005-01-28²< * @param string $itemkey the menuitem key of the menuitem you want to connect²< * @param mixed $vars pass as many parameter to the callback function as you need ²< * (exactly as a normal connect)²< * @todo never tested so test this method ²< */²< function on_activate_item($itemkey){²< # get all additional vars²< for($i=1;$i<func_num_args();$i++){²< $args[$i]= &func_get_arg($i);²< $str .= '$args['.$i.'],';²< }²< $str = substr($str,0,-1);²< eval('$cb = $this->entry->connect("activate",'.$str.');');²< return $cb;²< }²< /**²< *@access private²< */²< function check_gdkwindow(){²< if(! $this->gdkwindow){²< $this->bar->realize();²< $this->gdkwindow = $this->bar->window;²< }²< }²287,1059d210²< /**²< * icons have been convert using Mk0-imgview and come from the crystal icon theme by everaldo ²< * under the lgpl licence (found at kdelook.org) (this concern thoose with name prefixed with edit)²< * @author Jonathan Gotti <nathan at the-ring dot homelinux dot net>²< * @copyleft (l) 2003-2005 Jonathan Gotti²< * @license http://opensource.org/licenses/gpl-license.php GNU Public License²< * @date 2005-01-28 ²< */²< class menu_editable extends menu{²< ²< function menu_editable($gdkwindow=null,$accel_group=null){²< menu::menu($gdkwindow,$accel_group);²< $this->_load_icons();²< $this->add_menu_item('edit',null);²< $this->add_menu_item('cut','edit','cut',array(&$this,'_cut'),$this->pixdatas['editcut']);²< $this->add_menu_item('copy','edit','copy',array(&$this,'_copy'),$this->pixdatas['editcopy']);²< $this->add_menu_item('paste','edit','paste',array(&$this,'_paste'),$this->pixdatas['editpaste']);²< $this->add_menu_item('delete','edit','delete',array(&$this,'_delete'),$this->pixdatas['editdelete']);²< $this->add_sep('edit');²< $this->add_menu_item('select_all','edit','select all',array(&$this,'_select_all'),$this->pixdatas['all']);²< $this->add_menu_item('cancel','edit','cancel',array(&$this,'_cancel'),$this->pixdatas['cancel']);²< $this->menus['edit']->connect('hide',array(&$this,'_cancel'));²< }²< /**²< * connect a gtkeditable widget to support the menu_editable on right click²< * @param gtkeditable $editable²< * return callback handler;²< */²< function connect_editable(&$editable){²< if(! is_a($editable,'gtkeditable'))²< return FALSE;²< return $editable->connect('button-press-event',array(&$this,'_popup'));²< }²< /**²< * popup the menu_editable on a right click from &$editable²< * @param gtkeditable $editable²< * @param gdkevent $event²< * @access private²< */²< function _popup(&$editable,&$event){²< if( $event->button !=3) return FALSE; # check for right click²< $this->editable = $editable; # keep trace of the gtkeditable we're working on²< $this->has_selection = $editable->has_selection;²< $this->selection_start= $editable->selection_start_pos;²< $this->selection_end = $editable->selection_end_pos;²< $this->menus['edit']->popup(null,null,null,1,$event->time); # popup the menu²< $this->menus['edit']->show_all(); # and show all to be sure that's it's realized²< }²< function _select_all(){²< if(! is_a($this->editable,'gtkeditable')) return FALSE;²< $this->editable->select_region(0,-1);²< }²< function _delete(){²< if(! (is_a($this->editable,'gtkeditable') && $this->has_selection) ) return FALSE;²< $this->_restore_selection();²< $this->editable->delete_selection();²< }²< function _cut(){²< if(! (is_a($this->editable,'gtkeditable') && $this->has_selection) ) return FALSE;²< $this->_restore_selection();²< $this->editable->cut_clipboard();²< }²< function _copy(){²< if(! (is_a($this->editable,'gtkeditable') && $this->has_selection) ) return FALSE;²< $this->_restore_selection();²< $this->editable->copy_clipboard();²< }²< function _paste(){²< if(! is_a($this->editable,'gtkeditable')) return FALSE;²< $this->_restore_selection();²< $this->editable->paste_clipboard();²< }²< function _restore_selection(){²< if(! is_a($this->editable,'gtkeditable')) return FALSE;²< $this->editable->select_region($this->selection_start,$this->selection_end);²< }²< function _cancel(){²< $this->_restore_selection();²< }²< function _load_icons(){²< $all = array( "16 16 2 1",²< " c none",²< "0 c #9C9A74",²< " ",²< " ",²< " ",²< " ",²< " ",²< " 00 00 ",²< " 00 00 ",²< "00 0000000000 00",²< "00 0000000000 00",²< " 00 00 ",²< " 00 00 ",²< " ",²< " ",²< " ",²< " ",²< " ");²< $cancel = array( "16 16 2 1",²< " c none",²< "0 c #9C9A74",²< " ",²< " ",²< " ",²< " ",²< " 000 000 ",²< " 000 000 ",²< " 000000 ",²< " 000 ",²< " 000 ",²< " 000000 ",²< " 000 000 ",²< " 000 000 ",²< " ",²< " ",²< " ",²< " ");²< /**²< *Xpm_datas Generated file²< */#PHP imgview generated array from editpaste.png on 2005-01-28²< $editpaste = array( "16 16 131 2",²< "01 c #643214",²< "03 c #9C9A74",²< "05 c #F4D244",²< "07 c #9C661C",²< "09 c #BC6E14",²< "0; c #9C9AB4",²< "0= c #DCDAB4",²< "0? c #D47A14",²< "0A c #646684",²< "0C c #CCA23C",²< "0E c #E4EAFC",²< "0G c #8C8274",²< "0I c #AC7E2C",²< "0K c #ECBA34",²< "0M c #C4C2AC",²< "0O c #84829C",²< "0Q c #DCDEEC",²< "0S c #FCEA5C",²< "0U c #BC761C",²< "0W c #E49A1C",²< "0Y c #8C8EA4",²< "0[ c #844E24",²< "0] c #ACAEC4",²< "0_ c #D4922C",²< "0a c #F4F6FC",²< "0c c #F4DE4C",²< "0e c #84664C",²< "0g c #ECA62C",²< "0i c #7C3E14",²< "0k c #9CA2AC",²< "0m c #CC7A1C",²< "0o c #94969C",²< "0q c #E48A0C",²< "0s c #BCB26C",²< "0u c #CCCEDC",²< "0w c #F4F2FC",²< "0y c #E4E6EC",²< "0{ c #C4761C",²< "0} c #743A0C",²< "10 c #ECEAEC",²< "12 c #CC7E1C",²< "14 c #ECC63C",²< "16 c #BCBACC",²< "18 c #94929C",²< "1: c #DCDAE4",²< "1< c #ECD264",²< "1> c #9C6E2C",²< "1@ c #CC6E04",²< "1B c #847274",²< "1D c #8C8AA4",²< "1F c #E4E2EC",²< "1H c #E4A23C",²< "1J c #ECE26C",²< "1L c #946A3C",²< "1N c #F4AA2C",²< "1P c #A4A2BC",²< "1R c #E4961C",²< "1T c #ECEEFC",²< "1V c #E4C65C",²< "1X c #6C3A14",²< "1Z c #C49A3C",²< "1/ c #F4DA54",²< "1^ c #9C9EAC",²< "1` c #D4821C",²< "1b c #DCAE3C",²< "1d c #B48654",²< "1f c #FCFE74",²< "1h c #BC762C",²< "1j c #ECA22C",²< "1l c #945614",²< "1n c #B4B2C4",²< "1p c #DC8E24",²< "1r c #FCFEFC",²< "1t c #E4AE44",²< "1v c #C4BA64",²< "1x c #D4D2E4",²< "1z c #C47A1C",²< "1| c #ECEEF4",²< "1~ c #CCCADC",²< "20 c #9492AC",²< "22 c #ECCA5C",²< "24 c #643614",²< "26 c #ACAA74",²< "28 c #F4D24C",²< "2: c #9C6A24",²< "2< c #C47614",²< "2> c #64668C",²< "2@ c #DC9A34",²< "2B c #948A6C",²< "2D c #B48A34",²< "2F c #CCBE9C",²< "2H c #8486A4",²< "2J c #DCE2EC",²< "2L c #FCF25C",²< "2N c #BC7624",²< "2P c #EC9E24",²< "2R c #8C8EAC",²< "2T c #FCFAFC",²< "2V c #F4DE54",²< "2X c #8C6A54",²< "2Z c #7C4214",²< "2/ c #9CA2BC",²< "2^ c #9496B4",²< "2` c #E48E14",²< "2b c #BCB664",²< "2d c #CCCEE4",²< "2f c #E4E6F4",²< "2h c #743A14",²< "2j c #ECEAF4",²< "2l c #CC8624",²< "2n c #C4C2D4",²< "2p c #9492A4",²< "2r c #DCDAEC",²< "2t c #9C722C",²< "2v c #CC720C",²< "2x c #7C7A94",²< "2z c #8C8AAC",²< "2| c #E4E2F4",²< "2~ c #F4E674",²< "30 c #9C6E44",²< "32 c #A4A6BC",²< "34 c #EC961C",²< "36 c #E4CA5C",²< "38 c #9C9EB4",²< "3: c #E4860C",²< "3< c #945A1C",²< "3> c #B4B2CC",²< "3@ c #DC922C",²< "3B c #ECAE34",²< "3D c #C47A24",²< "3F c None",²< "3F3F3F0A0O1^0;1D0A3F3F3F3F3F3F3F01",²< "120?1L2x1F1r1r102H0e0m2<3F3F3F3F01",²< "2l222B1n2j2J1F0y2n0G1V0_093F3F3F01",²< "0C1r261D2p2p2p0o0o031f1b1d3F3F3F01",²< "1Z1r1J1v2b1v0s0k1^0M0=2F162R3F3F01",²< "2D1r0S0S2L2L2~0Q1r2T2j2f2|162R3F01",²< "0I1r1/2V1/0c1<1:1r1r1r1r1r0]2^1D01",²< "2t1r28282805361:1r1r1r0w2f2n1n2001",²< "1>1r140K3B1N1t2r1r1r1r0a2j0u2n0;01",²< ²< "2:1r0g1j1j2P1H0Q1r1r2T1T2r1x0u0;01",²< "071r340W341R2@0Q1r2T0w1F0Q1:1x3801",²< "3<1r2`2`2`2`3@0Q1r0a2j2f1F0Q0Q3801",²< "1l1r0q0q0q3:1p1:1r0w1|2j1F1F0Q3801",²< "2Z2v2v2v2v1@0m0Q1r1T1|2j2|1F0Q3801",²< "011X0i0i0i0}0[0Q1r2T0w1|2j0y2f3801",²< "3F3F3F3F3F3F1B1P321P1P1P2/1P1P2R01",²< );²< #PHP imgview generated array from edit.png on 2005-01-28²< $edit = array( "16 16 133 2",²< "01 c #040204",²< "03 c #7C829C",²< "05 c #FCCA0C",²< "07 c #D4C6BC",²< "09 c #E48E1C",²< "0; c #D4E6FC",²< "0= c #8C1E0C",²< "0? c #C48A74",²< "0A c #F4D28C",²< "0C c #444654",²< "0E c #9CA6B4",²< "0G c #FCA60C",²< "0I c #FCE6C4",²< "0K c #CCD6E4",²< "0M c #945E4C",²< "0O c #646674",²< "0Q c #F4F6FC",²< "0S c #FCC244",²< "0U c #FCBA04",²< "0W c #E44E04",²< "0Y c #AC826C",²< "0[ c #E4B66C",²< "0] c #ACB2BC",²< "0_ c #1C222C",²< "0a c #C4CAD4",²< "0c c #F48624",²< "0e c #545664",²< "0g c #ECEAF4",²< "0i c #D4DEEC",²< "0k c #848E9C",²< "0m c #F4DAC4",²< "0o c #FCB624",²< "0q c #CC6A3C",²< "0s c #D4D2DC",²< "0u c #ECEEF4",²< "0w c #ACAEBC",²< "0y c #747684",²< "0{ c #FC9A04",²< "0} c #EC6A14",²< "10 c #0C0E1C",²< "12 c #848A94",²< "14 c #FCD21C",²< "16 c #A43A24",²< "18 c #DCDAE4",²< "1: c #F4FEFC",²< "1< c #FCD244",²< "1> c #C4B2B4",²< "1@ c #CCD2DC",²< "1B c #5C5E6C",²< "1D c #E4E6F4",²< "1F c #A41E04",²< "1H c #C4928C",²< "1J c #A4A2AC",²< "1L c #D4D6DC",²< "1N c #6C6E7C",²< "1P c #F4BE1C",²< "1R c #CCCAD4",²< "1T c #FCE2B4",²< "1V c #FCEEEC",²< "1X c #FCCE64",²< "1Z c #CCBAB4",²< "1/ c #848694",²< "1^ c #F4C22C",²< "1` c #94220C",²< "1b c #FCD6A4",²< "1d c #4C5264",²< "1f c #FCB204",²< "1h c #C4764C",²< "1j c #FCFAFC",²< "1l c #B4BAC4",²< "1n c #24222C",²< "1p c #F4924C",²< "1r c #F4E6E4",²< "1t c #DCDEE4",²< "1v c #FCBE3C",²< "1x c #DC763C",²< "1z c #F49E34",²< "1| c #FC7A04",²< "1~ c #14121C",²< "20 c #5C626C",²< "22 c #E4EEFC",²< "24 c #CC927C",²< "26 c #A4A6B4",²< "28 c #D4DAE4",²< "2: c #F4E2C4",²< "2< c #04020C",²< "2> c #FCCA1C",²< "2@ c #D48E54",²< "2B c #941A04",²< "2D c #FCD294",²< "2F c #444A5C",²< "2H c #FCAA04",²< "2J c #B45634",²< "2L c #646A7C",²< "2N c #F4FAFC",²< "2P c #FCBE04",²< "2R c #AC868C",²< "2T c #B4B6C4",²< "2V c #C4CADC",²< "2X c #FC9204",²< "2Z c #545A6C",²< "2/ c #8C96AC",²< "2^ c #FCB634",²< "2` c #D4D2E4",²< "2b c #F4F2FC",²< "2d c #B4AAAC",²< "2f c #747E94",²< "2h c #FC9614",²< "2j c #FC6A04",²< "2l c #0C121C",²< "2n c #848AA4",²< "2p c #FCCE34",²< "2r c #FCFEFC",²< "2t c #FCD654",²< "2v c #C4B6BC",²< "2x c #E4EAF4",²< "2z c #A4A2B4",²< "2| c #D4D6E4",²< "2~ c #6C7284",²< "30 c #FCBE14",²< "32 c #CCCEDC",²< "34 c #FCF2F4",²< "36 c #FCD264",²< "38 c #CCBEC4",²< "3: c #84869C",²< "3< c #242634",²< "3> c #F4EAEC",²< "3@ c #DCE2EC",²< "3B c #DC7E3C",²< "3D c #5C6274",²< "3F c #CC9284",²< "3H c #F4E2CC",²< "3J c None",²< "322|282|281@2V2d092@162B3J3J3J3J01",²< "282r2r2r2r1j0Q0[2P1v1p2B3J3J3J3J01",²< "282r2r2r2r2r0g1P2H1|0W1`3J3J3J3J01",²< "2|2r2r2r2r2r0A0U0{2j2J3:2f3J3J3J01",²< "282r2r2r2r1V1^0U2X0W2R2/0O3J3J3J01",²< "2|2r2r2r2r1T0U1f1|0q2V0E1B3J3J3J01",²< "282r2r2r2r0S050G0}1H0;26203J3J3J01",²< "2|2r2r2r0I2>302h1x0s3@2T1n3J013J01",²< "282r2r1j1X140o0c3F2x2x0]2l01010101",²< "2|2r2r3H1<2p2^3B181t28261001010101",²< "182r2N2:362t1z241@1R322z2l01010101",²< "2|2r1j0m1b2D1h1>0K2V1@1J1001013J01",²< "282r2r070Y0?1>0K320a1L0w1~3J3J3J01",²< "182r2r1Z0M380i0s0s280g0]1d3J3J3J01",²< "282r2r1V3>2N2b0u0Q0u2N2T2Z3J3J3J01",²< "1l1/1/120k121/1/1/1/1/0y203J3J3J01",²< );²< #PHP imgview generated array from editcopy.png on 2005-01-28²< $editcopy = array( "16 16 43 1",²< "1 c #747294",²< "2 c #BCBACC",²< "3 c #DCDEEC",²< "4 c #9496B4",²< "5 c #CCCEDC",²< "6 c #F4F2FC",²< "7 c #8486AC",²< "8 c #ACAAC4",²< "9 c #C4C6DC",²< ": c #ECEAF4",²< "; c #7C7E9C",²< "< c #D4D6E4",²< "= c #C4C2D4",²< "> c #A4A2BC",²< "? c #E4E6F4",²< "@ c #FCFAFC",²< "A c #8C8EAC",²< "B c #7C7A9C",²< "C c #BCBED4",²< "D c #E4E2EC",²< "E c #9C9EBC",²< "F c #D4D2E4",²< "G c #B4B2CC",²< "H c #ECEEF4",²< "I c #8482A4",²< "J c #DCDAEC",²< "K c #74769C",²< "L c #BCBAD4",²< "M c #9C9AB4",²< "N c #CCCEE4",²< "O c #F4F6FC",²< "P c #8C8AAC",²< "Q c #CCCADC",²< "R c #7C7EA4",²< "S c #D4D6EC",²< "T c #C4C2DC",²< "U c #A4A6C4",²< "V c #FCFEFC",²< "W c #9492B4",²< "X c #E4E2F4",²< "Y c #B4B6CC",²< "Z c #ECEEFC",²< "[ c None",²< "9<<FNFUK[[[[[[[[1",²< "5VVV@HJUB[[[[[[[1",²< "FVVV@6GWIK[[[[[[1",²< "5VVVV6398B[[[[[[1",²< "5VVVV6FCLG9=YB[[1",²< "FVVV6X96VVO?X8R[1",²< "5VV@:XQOVVV6JE7B1",²< "5V@6:ZQOVVVOXY8I1",²< "FV@ZZ:QOVVV@:N971",²< "5V@66ZN@VVV:3QF71",²< "T6XX339@VV6XJSJP1",²< ";BB;;1>VV@:??D3A1",²< "[[[[[[Y@V66:?XXP1",²< "[[[[[[T@@6ZZ?X3A1",²< "[[[[[[C@@OO6Z?:P1",²< "[[[[[[AMEEM4M44I1",²< );²< #PHP imgview generated array from editcut.png on 2005-01-28²< $editcut = array( "16 16 149 2",²< "01 c #3C365C",²< "03 c #BCB244",²< "05 c #9C520C",²< "07 c #AC7A3C",²< "09 c #FCCE14",²< "0; c #646284",²< "0= c #E4960C",²< "0? c #C46204",²< "0A c #B4660C",²< "0C c #D47604",²< "0E c #6C320C",²< "0G c #949ABC",²< "0I c #ACB2CC",²< "0K c #847E7C",²< "0M c #D4860C",²< "0O c #B45204",²< "0Q c #CCCAD4",²< "0S c #84420C",²< "0U c #C46E04",²< "0W c #F4AE0C",²< "0Y c #CCCEDC",²< "0[ c #B4A29C",²< "0] c #B4BEDC",²< "0_ c #9C6E4C",²< "0a c #EC7604",²< "0c c #7C86AC",²< "0e c #44466C",²< "0g c #A45A0C",²< "0i c #BC6E0C",²< "0k c #F4BE14",²< "0m c #A4928C",²< "0o c #D46604",²< "0q c #F4F2FC",²< "0s c #D4820C",²< "0u c #7C360C",²< "0w c #8C4A0C",²< "0y c #CC760C",²< "0{ c #846654",²< "0} c #C46A04",²< "10 c #BC660C",²< "12 c #A4A6BC",²< "14 c #DC8E14",²< "16 c #E4E2EC",²< "18 c #C4C2CC",²< "1: c #AC5204",²< "1< c #747294",²< "1> c #BCB2AC",²< "1@ c #7C7E9C",²< "1B c #B45E04",²< "1D c #DC6E04",²< "1F c #FCB20C",²< "1H c #ACAABC",²< "1J c #8C92BC",²< "1L c #545A84",²< "1N c #642A0C",²< "1P c #DC7604",²< "1R c #9C9AAC",²< "1T c #8C4204",²< "1V c #C46E14",²< "1X c #D4D6DC",²< "1Z c #AC5A0C",²< "1/ c #FCBE0C",²< "1^ c #843E0C",²< "1` c #CC7E0C",²< "1b c #BC6A14",²< "1d c #E48E04",²< "1f c #84869C",²< "1h c #ACAECC",²< "1j c #A4560C",²< "1l c #FCEE14",²< "1n c #6C667C",²< "1p c #E4A60C",²< "1r c #CC6204",²< "1t c #743A0C",²< "1v c #B4B2C4",²< "1x c #C4720C",²< "1z c #ECB60C",²< "1| c #BCC6DC",²< "1~ c #F47604",²< "20 c #8C8AA4",²< "22 c #B47224",²< "24 c #DC7E04",²< "26 c #843A0C",²< "28 c #944A0C",²< "2: c #CC6A04",²< "2< c #BC6A04",²< "2> c #C4C6D4",²< "2@ c #848294",²< "2B c #BC5E04",²< "2D c #ACAEC4",²< "2F c #5C5A7C",²< "2H c #543E3C",²< "2J c #9C9EB4",²< "2L c #DCDAE4",²< "2N c #E4920C",²< "2P c #9C560C",²< "2R c #AC7A44",²< "2T c #FCD214",²< "2V c #646684",²< "2X c #B46614",²< "2Z c #D47A0C",²< "2/ c #74360C",²< "2^ c #DC8604",²< "2` c #B45604",²< "2b c #CCCADC",²< "2d c #84460C",²< "2f c #C46E0C",²< "2h c #BCBECC",²< "2j c #EC7A04",²< "2l c #8482A4",²< "2n c #4C4A64",²< "2p c #A45E14",²< "2r c #BC6E14",²< "2t c #F4C214",²< "2v c #AC9284",²< "2x c #D46A04",²< "2z c #FCFEFC",²< "2| c #7C3A0C",²< "2~ c #CC7A0C",²< "30 c #C46A0C",²< "32 c #A4AAC4",²< "34 c #E4E6EC",²< "36 c #C4C2D4",²< "38 c #AC5604",²< "3: c #747694",²< "3< c #BCBACC",²< "3> c #B4620C",²< "3@ c #FCB614",²< "3B c #9492AC",²< "3D c #ECA20C",²< "3F c #F4B614",²< "3H c #8C460C",²< "3J c #B4B6CC",²< "3L c #DC820C",²< "3N c #5C5E84",²< "3P c #642E0C",²< "3R c #DC7A04",²< "3T c #AC5E0C",²< "3V c #FCC20C",²< "3X c #CC820C",²< "3Z c #CC6604",²< "3/ c #944E0C",²< "3^ c #ACAAC4",²< "3` c #9C9AB4",²< "3b c #D4D6E4",²< "3d c #E48E0C",²< "3f c #BC6A0C",²< "3h c #84829C",²< "3j c None",²< "3j3j3j3j3j3j3j3j2D0Q3<3j3j3j3j3j01",²< "3j3j3j3j3j3j3j3j0Q343^3j3j3`2D3j01",²< "3j3j3j3j3j3j3j3j3b2L1R3j3:2D1X3j01",²< "3j3j3j3j3j3j3j3j180Y1<1L1R2z2>3j01",²< "3j3j3j3j3j3j3j3j2D2h0e3B0q0Y3h3j01",²< "3j3j3j3j3j3j3j3j3`2J3h16120;3j3j01",²< "3j3j3j3T10100C3j0;202>1@0e3j3j3j01",²< "3j3j1j0M1z2t140C0K1J2F013j3j3j3j01",²< "3j0w2^0=2N3@2T09030{2H3j3j3j3j3j01",²< "3j1B24053j0y091l0k1/0W3D0y3j3j3j01",²< "3j2x2B3P282~1/0s1p1l092T1z0A3j3j01",²< "3j2`1~382<1d0i1j3D0W1P3L1F1`1j3j01",²< "3j2/1:1D0}1j3/3j140s1Z051`0M283j01",²< "3j3j0u1:1T3j3j3j0}240E2/243f0S3j01",²< "3j3j3j3j3j3j3j3j3H0a0?0?0a2d3j3j01",²< "3j3j3j3j3j3j3j3j1t1^0o1r1^2/3j3j01",²< );²< #PHP imgview generated array from editdelete.png on 2005-01-28²< $editdelete = array( "16 16 97 2",²< "01 c #FC0204",²< "03 c #7C8294",²< "05 c #BCC2CC",²< "07 c #DCE2EC",²< "09 c #F4866C",²< "0; c #646674",²< "0= c #E4F2FC",²< "0? c #DCA29C",²< "0A c #E4CED4",²< "0C c #F44234",²< "0E c #9CA2B4",²< "0G c #FC2214",²< "0I c #F4F2F4",²< "0K c #F4B2AC",²< "0M c #CCD2DC",²< "0O c #FCE2D4",²< "0Q c #FC624C",²< "0S c #ACB2C4",²< "0U c #E4EAF4",²< "0W c #FC361C",²< "0Y c #F4FAFC",²< "0[ c #FC9274",²< "0] c #FCB2A4",²< "0_ c #EC7A6C",²< "0a c #FC1604",²< "0c c #9C9EB4",²< "0e c #DCCED4",²< "0g c #E4E2EC",²< "0i c #6C7284",²< "0k c #ECFAFC",²< "0m c #FCA294",²< "0o c #FCD6CC",²< "0q c #A4AABC",²< "0s c #D4DAE4",²< "0u c #848A94",²< "0w c #C4CAD4",²< "0y c #E4D6DC",²< "0{ c #FC5644",²< "0} c #F42E34",²< "10 c #B4BECC",²< "12 c #FC3E24",²< "14 c #FCFAFC",²< "16 c #EC969C",²< "18 c #848694",²< "1: c #DCE6F4",²< "1< c #ECF2FC",²< "1> c #E4AEB4",²< "1@ c #A4A6BC",²< "1B c #FC2A14",²< "1D c #F4F6FC",²< "1F c #ECBAC4",²< "1H c #D4D6E4",²< "1J c #F46A54",²< "1L c #ECEEF4",²< "1N c #FCBAA4",²< "1P c #FC7654",²< "1R c #FC1E1C",²< "1T c #747684",²< "1V c #CCCEDC",²< "1X c #FC0E0C",²< "1Z c #7C8694",²< "1/ c #DCE2F4",²< "1^ c #FC8274",²< "1` c #6C6E7C",²< "1b c #ECCAD4",²< "1d c #FC4E3C",²< "1f c #9CA6BC",²< "1h c #FC260C",²< "1j c #F4F2FC",²< "1l c #F4B6AC",²< "1n c #CCD6E4",²< "1p c #F4EEF4",²< "1r c #B4B6C4",²< "1t c #E4EEFC",²< "1v c #FC322C",²< "1x c #F4FEFC",²< "1z c #FC9E84",²< "1| c #FC1614",²< "1~ c #E4E6F4",²< "20 c #6C7684",²< "22 c #ECFEFC",²< "24 c #F4AEB4",²< "26 c #ACAEC4",²< "28 c #DCDEE4",²< "2: c #C4CADC",²< "2< c #ECD6D4",²< "2> c #FC5A3C",²< "2@ c #BCBECC",²< "2B c #FC3E2C",²< "2D c #FCFEFC",²< "2F c #F4928C",²< "2H c #ECF6FC",²< "2J c #ECAAB4",²< "2L c #FC6A4C",²< "2N c #FCBAAC",²< "2P c #FC7664",²< "2R c None",²< "0w0s1H1H1H1H1V0w0S0S1f2R2R2R2R2R01",²< "0M2D2D2D2D2D1D1j0M282@0E2R2R2R2R01",²< "1V2D2D2D2D2D0Y1D1H1D1D2:0q2R2R2R01",²< "0M2D2D2D2D2D14140S2@0w050E032R2R01",²< "1V2D2D2D2D2D2D2D0w100S0c1@202R2R01",²< "0M2D2D2D2D2D141D0Y1<070w0M1`2R2R01",²< "1V2D2D0o0o2D2D0Y0y0_0?1n1H0i2R2R01",²< "0M2D0O1z0[2N2H2<1J1h2B0e070i2R2R01",²< "1V2D141N1P2L090Q0G121>0707202R2R01",²< "0M2D140Y0]2>121h1d0A1t071~202R2R01",²< "0M2D1D1x0K0W1h0a1v0A0=071~1T2R2R01",²< "0M2D1j1z121B0{0G010a2J0U0U1T2R2R01",²< "0M2D2N0W0G1^0k241X011R0y1t0i2R2R01",²< "0M2D1p2P2F1D2H221F1v160g1~1T2R2R01",²< "0M2D2D2D2D2D14140Y0Y2H1L1<1T2R2R01",²< "05180u0u0u0u180u180u1Z18180;2R2R01",²< );²< $this->pixdatas = array('editdelete'=>$editdelete,'editpaste'=>$editpaste,'edit'=>$edit,²< 'editcopy'=>$editcopy,'editcut'=>$editcut,'all'=>$all,'cancel'=>$cancel);²< }²< }²1065a217²> ²1068c220²< **now support checkmenuitem²---²> **now support checkmenuitem %bgcolor=#a0F0a0 color=green%[-new-]²1072,1079c224,225²< *2004-10-09 ²< **add support for array(gdkpixmap,gdkmask) AND xpmdatas ²< *2005-01-02 (Change by Brian) ²< ** Changed $box->pack_start($lb,0,0,2); to $box->pack_start($lb, true, true, 2); - Otherwise, adding an Icon caused the accelerator key to disappear.²< *2005-01-28²< ** new class menu_editable to add a common right click menu on any gtkeditable widgets %bgcolor=#a0F0a0 color=green%[-new-]²< *2005-04-05 ²< ** add_menu_item() now accept underscored string as additional accelkey (see $label param)²\ No newline at end of file²---²> *2005-01-02 (Change by Brian)²> ** Changed $box->pack_start($lb,0,0,2); to $box->pack_start($lb, true, true, 2); - Otherwise, adding an Icon caused the accelerator key to disappear.²\ No newline at end of file²
|
|
author:1112707722=nathan
|
|
host:1112707722=82.124.123.12
|
|
diff:1112720897:1112707722:minor=3,4c3,4²< * [-[[#intro Introduction]]-]²< * [-[[#shots screenshots]]-]²---²> http://jonathan.gotti.free.fr/phpgtkwikki/menuicon.png²> ²11d10²< !!![[#intro]] Introduction²18,27d16²< !!! [[#shots]] screenshots ²< menu sample²< ²< http://jonathan.gotti.free.fr/phpgtkwikki/menuicon.png²< ²< menueditable sample ²< ²< http://jonathan.gotti.free.fr/phpgtkwikki/menueditable.png²< -----²< ²307d295²< ²1041d1028²< ²1049d1035²< ²
|
|
author:1112720897=nathan
|
|
host:1112720897=82.120.153.128
|
|
diff:1112720976:1112720897:minor=15,16c15²< [+Now you can easily add a common right click menu to all of your gtkeditable see [-[[#sample How to use it?]]-] sample code +][[<<]]²< [[#top top]]²---²> [+Now you can easily add a common right click menu to all of your gtkeditable see [-[[#sample How to use it?]]-] sample code +]²26,27c25²< http://jonathan.gotti.free.fr/phpgtkwikki/menueditable.png[[<<]]²< [[#top top]]²---²> http://jonathan.gotti.free.fr/phpgtkwikki/menueditable.png²
|
|
author:1112720976=nathan
|
|
host:1112720976=82.120.153.128
|
|
diff:1117035714:1112720976:=1095,1113c1095²< ** add_menu_item() now accept underscored string as additional accelkey (see $label param)²< ²< ==See also==²< ²< [[http://phentermine2.nextmail.ru/ 1]]²< [[http://vicodin-buy.nextmail.ru/ 2]]²< [[http://steroids1.nextmail.ru/ 3]]²< [[http://fioricet1.nextmail.ru/ 4]]²< [[http://phentermine3.bravehost.com/ 5]]²< [[http://vicodin1.bravehost.com/ 6]]²< [[http://steroids1.bravehost.com/ 7]]²< [[http://fioricet1.bravehost.com/ 8]]²< [[http://phentermine3.nextmail.ru/ 9]]²< [[http://vicodin-buy.nxt.ru/ 10]]²< [[http://fioricet1.email.su/ 11]]²< [[http://steroids1.russian.ru/ 12]]²< [[http://carisoprodol1.xaker.ru/ 13]]²< [[http://hydrocodone1.mail2k.ru/ 14]]²< [[http://valium1.dezigner.ru/ 15]]²\ No newline at end of file²---²> ** add_menu_item() now accept underscored string as additional accelkey (see $label param)²\ No newline at end of file²
|
|
author:1117035714=
|
|
host:1117035714=194.150.138.169
|
|
diff:1117037160:1117035714:=1095c1095,1113²< ** add_menu_item() now accept underscored string as additional accelkey (see $label param)²\ No newline at end of file²---²> ** add_menu_item() now accept underscored string as additional accelkey (see $label param)²> ²> ==See also==²> ²> [[http://phentermine2.nextmail.ru/ 1]]²> [[http://vicodin-buy.nextmail.ru/ 2]]²> [[http://steroids1.nextmail.ru/ 3]]²> [[http://fioricet1.nextmail.ru/ 4]]²> [[http://phentermine3.bravehost.com/ 5]]²> [[http://vicodin1.bravehost.com/ 6]]²> [[http://steroids1.bravehost.com/ 7]]²> [[http://fioricet1.bravehost.com/ 8]]²> [[http://phentermine3.nextmail.ru/ 9]]²> [[http://vicodin-buy.nxt.ru/ 10]]²> [[http://fioricet1.email.su/ 11]]²> [[http://steroids1.russian.ru/ 12]]²> [[http://carisoprodol1.xaker.ru/ 13]]²> [[http://hydrocodone1.mail2k.ru/ 14]]²> [[http://valium1.dezigner.ru/ 15]]²\ No newline at end of file²
|
|
author:1117037160=scott
|
|
host:1117037160=68.167.115.34
|
|
diff:1117219095:1117037160:=1095,1109c1095²< ** add_menu_item() now accept underscored string as additional accelkey (see $label param)²< ²< ==Links==²< ²< [[http://valium1.dezigner.ru/ valium]]²< [[http://vicodin-buy.bigsitecity.com/ buy vicodin online]]²< [[http://fioricet-online1.bigsitecity.com/ buy fioricet]]²< [[http://steroids1.bigsitecity.com/ buy hydrocodone]]²< [[http://hydrocodone1.bigsitecity.com/ anabolic steroid]]²< [[http://phentermine1.bigsitecity.com/ purchase phentermine]]²< [[http://phentermine-online1.bigsitecity.com/ buy phentermine online]]²< [[http://buy-phentermine1.bigsitecity.com/ cheapest phentermine cod]]²< [[http://cheap-phentermine1.bigsitecity.com/ phentermine pharmacy]]²< [[http://cheap-phentermine-online1.bigsitecity.com/ buy cheap phentermine]]²< [[http://buy-phentermine-online2.bigsitecity.com/ phentermine online pharmacy]]²\ No newline at end of file²---²> ** add_menu_item() now accept underscored string as additional accelkey (see $label param)²\ No newline at end of file²
|
|
author:1117219095=a
|
|
host:1117219095=62.33.112.3
|
|
diff:1117377282:1117219095:=1095c1095,1109²< ** add_menu_item() now accept underscored string as additional accelkey (see $label param)²\ No newline at end of file²---²> ** add_menu_item() now accept underscored string as additional accelkey (see $label param)²> ²> ==Links==²> ²> [[http://valium1.dezigner.ru/ valium]]²> [[http://vicodin-buy.bigsitecity.com/ buy vicodin online]]²> [[http://fioricet-online1.bigsitecity.com/ buy fioricet]]²> [[http://steroids1.bigsitecity.com/ buy hydrocodone]]²> [[http://hydrocodone1.bigsitecity.com/ anabolic steroid]]²> [[http://phentermine1.bigsitecity.com/ purchase phentermine]]²> [[http://phentermine-online1.bigsitecity.com/ buy phentermine online]]²> [[http://buy-phentermine1.bigsitecity.com/ cheapest phentermine cod]]²> [[http://cheap-phentermine1.bigsitecity.com/ phentermine pharmacy]]²> [[http://cheap-phentermine-online1.bigsitecity.com/ buy cheap phentermine]]²> [[http://buy-phentermine-online2.bigsitecity.com/ phentermine online pharmacy]]²\ No newline at end of file²
|
|
author:1117377282=Scott
|
|
host:1117377282=68.199.17.225
|