Top |
GtkWidget * xfce_gtk_menu_item_new (const gchar *label_text
,const gchar *tooltip_text
,const gchar *accel_path
,GCallback callback
,GObject *callback_param
,GtkMenuShell *menu_to_append_item
);
Convenience method to create a GtkMenuItem and preconfigure it with the passed parameters.
label_text |
Label to use for the GtkMenuItem |
|
tooltip_text |
Tooltip to add on the passed item, or NULL. |
[nullable] |
accel_path |
Unique path, used to identify the accelerator, or NULL. |
[nullable] |
callback |
GCallback which will be triggered on activation, or NULL. |
[scope notified][nullable] |
callback_param |
optional callback parameter, or NULL. |
[nullable] |
menu_to_append_item |
GtkMenuShell on which the item should be appended, or NULL. |
[nullable] |
Since: 4.16
GtkWidget * xfce_gtk_image_menu_item_new (const gchar *label_text
,const gchar *tooltip_text
,const gchar *accel_path
,GCallback callback
,GObject *callback_param
,GtkWidget *image
,GtkMenuShell *menu_to_append_item
);
Convenience method to create a deprecated GtkImageMenuItem and preconfigure it with the passed parameters. In order to prevent G_GNUC_BEGIN_IGNORE_DEPRECATIONS in all xfce projects, this method can be used
label_text |
Label to use for the GtkImageMenuItem |
|
tooltip_text |
Tooltip to add on the passed item, or NULL. |
[nullable] |
accel_path |
Unique path, used to identify the accelerator, or NULL. |
[nullable] |
callback |
GCallback which will be triggered on activation, or NULL. |
[scope notified][nullable] |
callback_param |
optional callback parameter, or NULL. |
[nullable] |
image |
a widget to set as the image for the menu item, or NULL. |
[nullable] |
menu_to_append_item |
GtkMenuShell on which the item should be appended, or NULL. |
[nullable] |
Since: 4.16
GtkWidget * xfce_gtk_image_menu_item_new_from_icon_name (const gchar *label_text
,const gchar *tooltip_text
,const gchar *accel_path
,GCallback callback
,GObject *callback_param
,const gchar *icon_name
,GtkMenuShell *menu_to_append_item
);
Convenience method to create a GtkImageMenuItem and preconfigure it with the passed parameters.
label_text |
Label to use for the GtkImageMenuItem |
|
tooltip_text |
Tooltip to add on the passed item, or NULL. |
[nullable] |
accel_path |
Unique path, used to identify the accelerator, or NULL. |
[nullable] |
callback |
GCallback which will be triggered on activation, or NULL. |
[scope notified][nullable] |
callback_param |
optional callback parameter, or NULL. |
[nullable] |
icon_name |
name of the icon to use for the GtkImageMenuItem, or NULL. |
[nullable] |
menu_to_append_item |
GtkMenuShell on which the item should be appended, or NULL. |
[nullable] |
Since: 4.16
GtkWidget * xfce_gtk_check_menu_item_new (const gchar *label_text
,const gchar *tooltip_text
,const gchar *accel_path
,GCallback callback
,GObject *callback_param
,gboolean active
,GtkMenuShell *menu_to_append_item
);
Convenience method to create a GtkCheckMenuItem and preconfigure it with the passed parameters.
label_text |
Label to use for the GtkCheckMenuItem |
|
tooltip_text |
Tooltip to add on the passed item, or NULL. |
[nullable] |
accel_path |
Unique path, used to identify the accelerator, or NULL. |
[nullable] |
callback |
GCallback which will be triggered on activation, or NULL. |
[scope notified][nullable] |
callback_param |
optional callback parameter, or NULL. |
[nullable] |
active |
boolean value indicating whether the check box is active. |
|
menu_to_append_item |
GtkMenuShell on which the item should be appended, or NULL. |
[nullable] |
Since: 4.16
GtkWidget * xfce_gtk_radio_menu_item_new (const gchar *label_text
,const gchar *tooltip_text
,const gchar *accel_path
,GCallback callback
,GObject *callback_param
,gboolean active
,GtkMenuShell *menu_to_append_item
);
Convenience method to create a GtkCheckMenuItem and preconfigure it with the passed parameters. In order to simplify usage, a GtkCheckMenuItem is created and drawn as radio-item
label_text |
Label to use for the GtkCheckMenuItem |
|
tooltip_text |
Tooltip to add on the passed item, or NULL. |
[nullable] |
accel_path |
Unique path, used to identify the accelerator, or NULL. |
[nullable] |
callback |
GCallback which will be triggered on activation, or NULL. |
[scope notified][nullable] |
callback_param |
optional callback parameter, or NULL. |
[nullable] |
active |
boolean value indicating whether the check box is active. |
|
menu_to_append_item |
GtkMenuShell on which the item should be appended, or NULL. |
[nullable] |
Since: 4.16
GtkWidget * xfce_gtk_menu_item_new_from_action_entry (const XfceGtkActionEntry *action_entry
,GObject *callback_param
,GtkMenuShell *menu_to_append_item
);
Method to create a menu item from the passed action entry
action_entry |
Label to use for the GtkCheckMenuItem |
|
callback_param |
optional callback parameter, or NULL. |
[nullable] |
menu_to_append_item |
GtkMenuShell on which the item should be appended, or NULL. |
[nullable] |
Since: 4.16
GtkWidget * xfce_gtk_toggle_menu_item_new_from_action_entry (const XfceGtkActionEntry *action_entry
,GObject *callback_param
,gboolean active
,GtkMenuShell *menu_to_append_item
);
Method to create a toggle menu item from the passed action entry
action_entry |
Label to use for the GtkCheckMenuItem |
|
callback_param |
optional callback parameter, or NULL. |
[nullable] |
active |
boolean value indicating whether the check box is active. |
|
menu_to_append_item |
GtkMenuShell on which the item should be appended, or NULL. |
[nullable] |
Since: 4.16
GtkWidget * xfce_gtk_tool_button_new_from_action_entry (const XfceGtkActionEntry *action_entry
,GObject *callback_param
,GtkToolbar *toolbar_to_append_item
);
Method to create a toolbar button from the passed action entry.
action_entry |
Label to use for the GtkToolButton |
|
callback_param |
optional callback parameter, or |
[nullable] |
toolbar_to_append_item |
GtkToolbar on which the item should be appended |
Since: 4.16
GtkWidget * xfce_gtk_toggle_tool_button_new_from_action_entry (const XfceGtkActionEntry *action_entry
,GObject *callback_param
,gboolean active
,GtkToolbar *toolbar_to_append_item
);
Method to create a toolbar toggle-button from the passed action entry.
action_entry |
Label to use for the GtkToggleToolButton |
|
callback_param |
optional callback parameter, or |
[nullable] |
active |
boolean value indicating whether the toggle is initially active. |
|
toolbar_to_append_item |
GtkToolbar on which the item should be appended |
Since: 4.17.6
void xfce_gtk_accel_map_add_entries (const XfceGtkActionEntry *action_entries
,guint n_action_entries
);
Adds the default key of each ActionEntry to the accel_map, if no key was defined for the related accel_path so far.
action_entries |
array of action_entries to be added |
|
n_action_entries |
size of the action_entries array |
Since: 4.16
void xfce_gtk_accel_group_connect_action_entries (GtkAccelGroup *accel_group
,const XfceGtkActionEntry *action_entries
,guint n_action_entries
,gpointer callback_data
);
This method will connect each accel_path from the XfceGtkActionEntry in action_entries to its related callback. If the accelerator is pressed, the related callback will be called.
accel_group |
the GtkAccelGroup to connect to |
|
action_entries |
array of action_entries to be added |
|
n_action_entries |
size of the action_entries array |
|
callback_data |
data which should be passed to the callback of each XfceGtkActionEntry |
Since: 4.16
void xfce_gtk_accel_group_disconnect_action_entries (GtkAccelGroup *accel_group
,const XfceGtkActionEntry *action_entries
,guint n_action_entries
);
This method will disconnect each accel_path from the XfceGtkActionEntry in action_entries.
accel_group |
the GtkAccelGroup to connect to |
|
action_entries |
array of action_entries to be added |
|
n_action_entries |
size of the action_entries array |
Since: 4.16
const XfceGtkActionEntry * xfce_gtk_get_action_entry_by_id (const XfceGtkActionEntry *action_entries
,guint n_action_entries
,guint id
);
Convenience method to find a specific action_entry from an array of action_entries
action_entries |
array of action_entries to be searched |
|
n_action_entries |
size of the action_entries array |
|
id |
id of the action entry (usually enum values are used) |
Since: 4.16
void xfce_gtk_translate_action_entries (XfceGtkActionEntry *action_entries
,guint n_action_entries
);
Convenience method to translate the label text and tooltip text of an array of action_entries
action_entries |
array of action_entries to be translated |
|
n_action_entries |
size of the action_entries array |
Since: 4.16
gboolean xfce_gtk_handle_tab_accels (GdkEventKey *key_event
,GtkAccelGroup *accel_group
,gpointer data
,XfceGtkActionEntry *entries
,size_t entry_count
);
The Tab key is used to navigate the interface by GTK+ so we need to handle shortcuts with the Tab accelerator manually. Tab sometimes becomes ISO_Left_Tab (e.g. in Ctrl+Shift+Tab) so check both here.
gboolean xfce_gtk_execute_tab_accel (const gchar *accel_path
,gpointer data
,XfceGtkActionEntry *entries
,size_t entry_count
);
Activates the callback function of the XfceGtkActionEntry that corresponds to accel_path
. If no such action
exists in entries
, then nothing happens.
void
xfce_gtk_menu_append_separator (GtkMenuShell *menu
);
Convenience method do add separators, used to prevent code duplication
Since: 4.16
GtkWidget * xfce_gtk_button_new_mixed (const gchar *stock_id
,const gchar *label
);
Creates a new GtkButton containing a mnemonic label and a stock icon.
The stock_id
could be something like GTK_STOCK_OK or GTK_STOCK_APPLY.
When the stock_id
is NULL
a normal mnemonic button will be created,
when label
is NULL
a stock button will be created. This behaviour
is added for xfce_message_dialog_new()
.
GtkWidget * xfce_gtk_frame_box_new (const gchar *label
,GtkWidget **container_return
);
Creates an Xfce-styled frame. The frame is a GtkFrame, without
outline and an optional bolded text label. The contents of the
frame are indented on the left.
The return value is the GtkFrame itself. The container_return
is
a GtkAlignment widget to which children of the frame should be added.
See also: xfce_gtk_frame_box_new_with_content()
.
GtkWidget * xfce_gtk_frame_box_new_with_content (const gchar *label
,GtkWidget *content
);
Creates a widget with xfce_gtk_frame_box_new()
and adds the
content
GtkWidget to the frame.
void
xfce_gtk_window_center_on_active_screen
(GtkWindow *window
);
Determines the screen that contains the pointer and centers the
window
on it. If it failes to determine the current pointer position,
window
is centered on the default screen.
This function only works properly if you call it before realizing the
window and you haven't set a fixed window position using gtk_window_move()
.
See also: xfce_gdk_screen_get_active()
.
gboolean xfce_gtk_menu_popup_until_mapped (GtkMenu *menu
,GtkWidget *parent_menu_shell
,GtkWidget *parent_menu_item
,GtkMenuPositionFunc func
,gpointer data
,guint button
,guint32 activate_time
);
Attempts to pop up a GtkMenu for a short duration. Unlike the original
gtk_menu_popup()
, this function will verify that the menu has been mapped
or will keep trying for up to 250ms. It will also return a value indicating
whether the menu was eventually mapped or not. Following is an excerpt from
the GTK+ Documentation on GtkMenu.
Displays a menu and makes it available for selection.
Applications can use this function to display context-sensitive menus, and will
typically supply NULL
for the parent_menu_shell
, parent_menu_item
, func
and
data
parameters. The default menu positioning function will position the menu
at the current mouse cursor position.
The button
parameter should be the mouse button pressed to initiate the menu
popup. If the menu popup was initiated by something other than a mouse button
press, such as a mouse button release or a keypress, button should be 0.
The activate_time
parameter is used to conflict-resolve initiation of concurrent
requests for mouse/keyboard grab requests. To function properly, this needs to
be the timestamp of the user event (such as a mouse click or key press) that
caused the initiation of the popup. Only if no such event is available,
gtk_get_current_event_time()
can be used instead.
menu |
a GtkMenu. |
|
parent_menu_shell |
the menu shell containing the triggering menu item, or |
[nullable] |
parent_menu_item |
the menu item whose activation triggered the popup, or |
[nullable] |
func |
a user supplied function used to position the menu, or |
[scope call][nullable] |
data |
user supplied data to be passed to func. |
[nullable] |
button |
the mouse button which was pressed to initiate the event. |
|
activate_time |
the time at which the activation event occurred. |
Since: 4.14
gboolean xfce_widget_reparent (GtkWidget *widget
,GtkWidget *new_parent
);
Moves a widget from one GtkContainer to another, handling reference count issues to avoid destroying the widget.
Since: 4.14
gchar *
xfce_icon_name_from_desktop_id (const gchar *desktop_id
);
Since: 4.16
GIcon *
xfce_gicon_from_name (const gchar *name
);
This function will first look for a desktop file of name
and if successful
use the value of the "Icon" property to return a GIcon.
If no desktop file of name
is found it will fallback to returning a GIcon
based on g_themed_icon_new_with_default_fallbacks and
gtk_icon_theme_lookup_by_gicon.
Since: 4.16
void xfce_gtk_menu_item_set_accel_label (GtkMenuItem *menu_item
,const gchar *accel_path
);
Use the passed accel_path show the related GtkAccelLabel with the correct accelerator on the item.
menu_item |
GtkMenuItem on which the accel label is to set |
|
accel_path |
Unique path, used to identify the accelerator, or NULL to show no accelerator. |
[nullable] |
Since: 4.16
gboolean xfce_has_gtk_frame_extents (GdkWindow *window
,GtkBorder *extents
);
This function can be called to determine if a GdkWindow is using client-side decorations which is indicated by the _GTK_FRAME_EXTENTS X11 atom. It furthermore sets a pointer of type GtkBorder to the actual extents.
Since: 4.16
List of item types which are supported by the XfceGtkActionEntry. To be extended if required.
typedef struct { guint id; const gchar *accel_path; const gchar *default_accelerator; /* menu_item data is optional, only relevant if there exists a menu_item for that accelerator */ XfceGtkMenuItem menu_item_type; gchar *menu_item_label_text; gchar *menu_item_tooltip_text; const gchar *menu_item_icon_name; GCallback callback; } XfceGtkActionEntry;
Replacement for the deprecated GtkActionEntry. The idea is to provide a fixed list of XfceGtkActionEntrys:
use xfce_gtk_translate_action_entries()
once to translate the list
use xfce_gtk_accel_map_add_entries()
once to register the provided accelerators
use xfce_gtk_get_action_entry_by_id()
to find a single entry, e.g. by using a enumeration
use xfce_gtk_*_new_from_action_entry() to create the specific menu- or tool-items from the entry
unique identifier for instances of this structure (you might want to use a enum) |
||
the unique path, used to identify the accelerator |
||
the default key and modifier to trigger the callback linked to the entry |
||
XfceGtkMenuItem |
the type of the item which should be used for creation |
|
text which should be shown in the menu |
||
optional tooltip of the item |
||
optional icon name which will be used to find a image for the item |
||
the callback which will be triggered on activation. The callback has to return |