ActionGroups
Create an Action GroupThere are several types of action groups: radio, menu, toolbar, toggle, popup.Defining the action groupsMenu actionsTo create a regular menu action group, create an array like the following:array menu_actions=({ ([ "name": "FileMenu", "label": "_File" ]), ([ "name": "FileOpen", "label": "_Open", "callback": open_file, "data": 0 ]), ([ "name": "FileQuit", "label": "_Quit", "callback": appQuit, "data": 0 ]), ([ "name": "EditMenu", "label": "_Edit" ]), ([ "name": "EditCopy", "label": "_Copy", "callback": edit_copy, "data": 0 ]), ([ "name": "EditPast", "label": "_Paste", "callback": edit_past, "data": 0 ]) }); Radio actionsSimilar to regular menu actions, but with an additional "value" parameter, and without the "data" parameterarray radio_actions=({ ([ "name": "ViewIcons", "label": "Icons", "value": 0 ]) }) Toggle actionsToggle actions look like:array toggle_actions=({ ([ "name": "Connect", "label": "_Connect", "stock_id": "hdadmin-connect", "active": 0 ]) }); Creating the action group(s)Now that you have the action group definitions, you have to create one or more action groups to go with them.object gt1=GTK2.ActionGroup("Group1"); gt1->add_actions(menu_actions); gt1->add_toggle_actions(toggle_actions); gt1->add_radio_actions(radio_actions,my_radio_callback,"some data"); Powered by PikeWiki2 |
|||
gotpike.org | Copyright © 2004 - 2009 | Pike is a trademark of Department of Computer and Information Science, Linköping University |