eb05362005-11-05Henrik Grubbström (Grubba) /* -*- C -*- */
1a05542005-07-28Martin Nilsson require gtk24; class GTK2.Action; inherit G.Object; //! Properties: //! GTK2.ActionGroup action-group //! int hide-if-empty //! int is-important //! string label //! string name //! int sensitive //! string short-label //! string stock-id //! string tooltip //! int visible //! int visible-horizontal require gtk26; //! int visible-overflown endrequire; //! int visible-vertical signal activate;
3d76632005-11-03Lance Dillon void create(string|mapping(string:mixed) name_or_props, ?string label, ?string tooltip, ?string stock_id)
1a05542005-07-28Martin Nilsson //! Creates a new object.
3d76632005-11-03Lance Dillon {
ba9e802006-02-27Martin Stjernholm  pgtk2_verify_not_inited(); pgtk2_verify_setup();
017b572011-10-28Henrik Grubbström (Grubba)  if (args>0 && TYPEOF(Pike_sp[-args]) == PIKE_T_STRING) {
535ddd2005-12-18Marcus Comstedt  char *name, *stock_id=NULL; struct pike_string *label=NULL,*tooltip=NULL;
eac9aa2005-12-18Martin Nilsson  gchar *label2=NULL, *tooltip2=NULL;
3d76632005-11-03Lance Dillon  GtkAction *ga;
96f5f42018-08-05Martin Nilsson  get_all_args(NULL,args,"%s.%t%t%s",&name,&label,&tooltip,&stock_id);
535ddd2005-12-18Marcus Comstedt  if(label) { ref_push_string(label); f_string_to_utf8(1);
eac9aa2005-12-18Martin Nilsson  label2 = GSTR0(Pike_sp[-1].u.string);
535ddd2005-12-18Marcus Comstedt  } if(tooltip) { ref_push_string(tooltip); f_string_to_utf8(1);
eac9aa2005-12-18Martin Nilsson  tooltip2 = GSTR0(Pike_sp[-1].u.string);
535ddd2005-12-18Marcus Comstedt  } ga=gtk_action_new(name,label2,tooltip2,stock_id); if(tooltip) pop_stack(); if(label) pop_stack();
3d76632005-11-03Lance Dillon  THIS->obj=G_OBJECT(ga); } else { INIT_WITH_PROPS(GTK_TYPE_ACTION); }
ba9e802006-02-27Martin Stjernholm  pgtk2_pop_n_elems(args); pgtk2__init_this_object();
3d76632005-11-03Lance Dillon }
1a05542005-07-28Martin Nilsson  string get_name(); //! Returns the name of the action. int is_sensitive(); //! Returns whether the action is effectively sensitive. int get_sensitive(); //! Returns whether the action itself is sensitive. Note that this doesn't //! necessarily mean effective sensitivity. require gtk26; void set_sensitive(int setting); //! Sets the sensitive property. endrequire; int is_visible(); //! Returns whether the action is effectively visible. int get_visible(); //! Returns whether the action itself is visible. require gtk26; void set_visible(int setting); //! Sets the visible property. endrequire; void activate(); //! Emits the "activate" signal, if it isn't insensitive.
f284492006-08-03Lance Dillon +GTK2.Widget create_icon(int icon_size);
1a05542005-07-28Martin Nilsson //! This function is intended for use by action implementations to create //! icons displayed in the proxy widgets. One of CONST(GTK_ICON_SIZE_).
f284492006-08-03Lance Dillon +GTK2.Widget create_menu_item();
1a05542005-07-28Martin Nilsson //! Creates a menu item widget that proxies for the action.
f284492006-08-03Lance Dillon +GTK2.Widget create_tool_item();
1a05542005-07-28Martin Nilsson //! Creates a toolbar item widget that proxies for the action.
c37a152007-10-14Lance Dillon require gtk212; +GTK2.Widget create_menu(); //! If this action provides a W(Menu) widget as a submenu for the menu item //! or the toolbar item it creates, this function returns an instance of //! that menu. endrequire;
1a05542005-07-28Martin Nilsson void connect_proxy(GTK2.Widget proxy); //! Connects a widget to an action object as a proxy. Synchronises various //! properties of the action with the widget (such as label text, icon, //! tooltip, etc), and attaches a callback so that the action gets activated //! when the proxy widget does. void disconnect_proxy(GTK2.Widget proxy); //! Disconnects a proxy widget. Does not destroy the widget. array(GTK2.Widget) get_proxies() //! Returns the proxy widgets. {
ba9e802006-02-27Martin Stjernholm  pgtk2_verify_inited(); pgtk2_pop_n_elems(args);
1a05542005-07-28Martin Nilsson  { GSList *gl; int i=0; gl=gtk_action_get_proxies(GTK_ACTION(THIS->obj)); while (gl) { push_gobject(gl->data); g_object_ref(gl->data); i++; gl=g_slist_next(gl); } f_aggregate(i); } } void connect_accelerator(); //! Installs the accelerator if this action widget has an accel path and group. void disconnect_accelerator(); //! Undoes the effect of one call to connect_accelerator(). void block_activate_from(GTK2.Widget proxy); //! Disables calls to the activate() function by signals on the proxy. This is //! used to break notification loops for things like check or radio actions. void unblock_activate_from(GTK2.Widget proxy); //! Re-enables calls to the activate() function. require gtk26; string get_accel_path(); //! Returns the accel path for this action. endrequire; void set_accel_path(string accel_path); //! Sets the accel path for this action. All proxy widgets associated with //! this action will have this accel path, so that their accelerators are //! consistent. void set_accel_group(GTK2.AccelGroup group); //! Sets the GTK2.AccelGroup in which the accelerator for this action will be //! installed. endrequire;