예제 #1
0
파일: gtktoolitem.c 프로젝트: jjardon/gtk
/**
 * gtk_tool_item_rebuild_menu:
 * @tool_item: a #GtkToolItem
 *
 * Calling this function signals to the toolbar that the
 * overflow menu item for @tool_item has changed. If the
 * overflow menu is visible when this function it called,
 * the menu will be rebuilt.
 *
 * The function must be called when the tool item changes what it
 * will do in response to the #GtkToolItem::create-menu-proxy signal.
 *
 * Since: 2.6
 */
void
gtk_tool_item_rebuild_menu (GtkToolItem *tool_item)
{
    GtkWidget *widget;

    g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));

    widget = GTK_WIDGET (tool_item);

    if (GTK_IS_TOOL_SHELL (widget->parent))
        gtk_tool_shell_rebuild_menu (GTK_TOOL_SHELL (widget->parent));
}
예제 #2
0
파일: gtktoolitem.c 프로젝트: jjardon/gtk
/**
 * gtk_tool_item_get_text_size_group:
 * @tool_item: a #GtkToolItem
 *
 * Returns the size group used for labels in @tool_item. Custom subclasses of
 * #GtkToolItem should call this function and use the size group for labels.
 *
 * Return value: a #GtkSizeGroup
 *
 * Since: 2.20
 */
GtkSizeGroup *
gtk_tool_item_get_text_size_group (GtkToolItem *tool_item)
{
    GtkWidget *parent;

    g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), NULL);

    parent = GTK_WIDGET (tool_item)->parent;
    if (!parent || !GTK_IS_TOOL_SHELL (parent))
        return NULL;

    return gtk_tool_shell_get_text_size_group (GTK_TOOL_SHELL (parent));
}
예제 #3
0
파일: gtktoolitem.c 프로젝트: jjardon/gtk
/**
 * gtk_tool_item_get_text_orientation:
 * @tool_item: a #GtkToolItem
 *
 * Returns the text orientation used for @tool_item. Custom subclasses of
 * #GtkToolItem should call this function to find out how text should
 * be orientated.
 *
 * Return value: a #GtkOrientation indicating the text orientation
 * used for @tool_item
 *
 * Since: 2.20
 */
GtkOrientation
gtk_tool_item_get_text_orientation (GtkToolItem *tool_item)
{
    GtkWidget *parent;

    g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ORIENTATION_HORIZONTAL);

    parent = GTK_WIDGET (tool_item)->parent;
    if (!parent || !GTK_IS_TOOL_SHELL (parent))
        return GTK_ORIENTATION_HORIZONTAL;

    return gtk_tool_shell_get_text_orientation (GTK_TOOL_SHELL (parent));
}
예제 #4
0
파일: gtktoolitem.c 프로젝트: jjardon/gtk
/**
 * gtk_tool_item_get_relief_style:
 * @tool_item: a #GtkToolItem
 *
 * Returns the relief style of @tool_item. See gtk_button_set_relief_style().
 * Custom subclasses of #GtkToolItem should call this function in the handler
 * of the #GtkToolItem::toolbar_reconfigured signal to find out the
 * relief style of buttons.
 *
 * Return value: a #GtkReliefStyle indicating the relief style used
 * for @tool_item.
 *
 * Since: 2.4
 **/
GtkReliefStyle
gtk_tool_item_get_relief_style (GtkToolItem *tool_item)
{
    GtkWidget *parent;

    g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_RELIEF_NONE);

    parent = GTK_WIDGET (tool_item)->parent;
    if (!parent || !GTK_IS_TOOL_SHELL (parent))
        return GTK_RELIEF_NONE;

    return gtk_tool_shell_get_relief_style (GTK_TOOL_SHELL (parent));
}
예제 #5
0
파일: gtktoolitem.c 프로젝트: jjardon/gtk
/**
 * gtk_tool_item_get_toolbar_style:
 * @tool_item: a #GtkToolItem
 *
 * Returns the toolbar style used for @tool_item. Custom subclasses of
 * #GtkToolItem should call this function in the handler of the
 * GtkToolItem::toolbar_reconfigured signal to find out in what style
 * the toolbar is displayed and change themselves accordingly
 *
 * Possibilities are:
 * <itemizedlist>
 * <listitem> GTK_TOOLBAR_BOTH, meaning the tool item should show
 * both an icon and a label, stacked vertically </listitem>
 * <listitem> GTK_TOOLBAR_ICONS, meaning the toolbar shows
 * only icons </listitem>
 * <listitem> GTK_TOOLBAR_TEXT, meaning the tool item should only
 * show text</listitem>
 * <listitem> GTK_TOOLBAR_BOTH_HORIZ, meaning the tool item should show
 * both an icon and a label, arranged horizontally (however, note the
 * #GtkToolButton::has_text_horizontally that makes tool buttons not
 * show labels when the toolbar style is GTK_TOOLBAR_BOTH_HORIZ.
 * </listitem>
 * </itemizedlist>
 *
 * Return value: A #GtkToolbarStyle indicating the toolbar style used
 * for @tool_item.
 *
 * Since: 2.4
 **/
GtkToolbarStyle
gtk_tool_item_get_toolbar_style (GtkToolItem *tool_item)
{
    GtkWidget *parent;

    g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_TOOLBAR_ICONS);

    parent = GTK_WIDGET (tool_item)->parent;
    if (!parent || !GTK_IS_TOOL_SHELL (parent))
        return GTK_TOOLBAR_ICONS;

    return gtk_tool_shell_get_style (GTK_TOOL_SHELL (parent));
}
예제 #6
0
파일: gtktoolitem.c 프로젝트: jjardon/gtk
/**
 * gtk_tool_item_get_icon_size:
 * @tool_item: a #GtkToolItem
 *
 * Returns the icon size used for @tool_item. Custom subclasses of
 * #GtkToolItem should call this function to find out what size icons
 * they should use.
 *
 * Return value: (type int): a #GtkIconSize indicating the icon size
 * used for @tool_item
 *
 * Since: 2.4
 **/
GtkIconSize
gtk_tool_item_get_icon_size (GtkToolItem *tool_item)
{
    GtkWidget *parent;

    g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ICON_SIZE_LARGE_TOOLBAR);

    parent = GTK_WIDGET (tool_item)->parent;
    if (!parent || !GTK_IS_TOOL_SHELL (parent))
        return GTK_ICON_SIZE_LARGE_TOOLBAR;

    return gtk_tool_shell_get_icon_size (GTK_TOOL_SHELL (parent));
}
예제 #7
0
파일: gtktoolitem.c 프로젝트: jjardon/gtk
/**
 * gtk_tool_item_get_ellipsize_mode:
 * @tool_item: a #GtkToolItem
 *
 * Returns the ellipsize mode used for @tool_item. Custom subclasses of
 * #GtkToolItem should call this function to find out how text should
 * be ellipsized.
 *
 * Return value: a #PangoEllipsizeMode indicating how text in @tool_item
 * should be ellipsized.
 *
 * Since: 2.20
 **/
PangoEllipsizeMode
gtk_tool_item_get_ellipsize_mode (GtkToolItem *tool_item)
{
    GtkWidget *parent;

    g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ORIENTATION_HORIZONTAL);

    parent = GTK_WIDGET (tool_item)->parent;
    if (!parent || !GTK_IS_TOOL_SHELL (parent))
        return PANGO_ELLIPSIZE_NONE;

    return gtk_tool_shell_get_ellipsize_mode (GTK_TOOL_SHELL (parent));
}
예제 #8
0
static void on_toolbar_reconfigured(GtkToolItem *tool_item, ToolItem *item)
{
	GtkToolShell *shell = GTK_TOOL_SHELL(gtk_widget_get_parent(item->widget));
	gboolean large = gtk_tool_shell_get_icon_size(shell) > GTK_ICON_SIZE_MENU;
	gchar *tooltip = NULL;

	if (gtk_tool_shell_get_style(shell) == GTK_TOOLBAR_ICONS)
	{
		GtkMenuItem *menu_item = GTK_MENU_ITEM(debug_menu_items[item->index].widget);
		tooltip = g_strdup(gtk_menu_item_get_label(menu_item));
		utils_str_remove_chars(tooltip, "_");
	}

	gtk_tool_item_set_tooltip_text(tool_item, tooltip);
	g_free(tooltip);
	gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(tool_item),
		get_widget(item->icon[large]));
}
예제 #9
0
파일: gtk_glue.c 프로젝트: Blei/rgtk
GtkToolShell* cast_GtkToolShell(GtkWidget* widget) {
    return GTK_TOOL_SHELL(widget);
}