StockIcons
1 Creating stock icons To create stock icons, first create an array of mappings like this: {code} array iconfiles=({ ([ "file": "icons/actions_wm.png", "stock-id": "hdadmin-actions" ]), ([ "file": "icons/connect_wm.png", "stock-id": "hdadmin-connect" ]), ([ "file": "icons/directory_server_wm.png", "stock-id": "hdadmin-directory" ]), ([ "file": "icons/search_wm.png", "stock-id": "hdadmin-search" ]) }); {code} This isn't really necessary, it just makes it easier. The stock-id is what you will reference later when creating toolbars and things with ActionGroups. Then, create an IconFactory: {code} object iconf=GTK2.IconFactory(); {code} Add each icon to the icon factory. Do this for each icon by creating an IconSet for that icon, then add the IconSet to the IconFactory, associating it with a specific stock-id: {code} foreach (iconfiles, mapping m) { object p1=GTK2.IconSet(GDK2.Pixbuf(m["file"])); iconf->add(m["stock-id"],p1); } iconf->add_default(); {code} There, they are all added. Now you can reference them when you create [PikeModules/Module/GTK2/ActionGroups]. Powered by PikeWiki2 |
|||
gotpike.org | Copyright © 2004 - 2009 | Pike is a trademark of Department of Computer and Information Science, Linköping University |