static void
connect_widget_signals (GtkWidget *proxy, EggEditableToolbar *etoolbar)
{
  if (GTK_IS_CONTAINER (proxy))
    {
       gtk_container_forall (GTK_CONTAINER (proxy),
			     (GtkCallback) connect_widget_signals,
			     (gpointer) etoolbar);
    }

  if (GTK_IS_TOOL_ITEM (proxy))
    {
      g_signal_connect_object (proxy, "drag_begin",
			       G_CALLBACK (drag_begin_cb),
			       etoolbar, 0);
      g_signal_connect_object (proxy, "drag_end",
			       G_CALLBACK (drag_end_cb),
			       etoolbar, 0);
      g_signal_connect_object (proxy, "drag_data_get",
			       G_CALLBACK (drag_data_get_cb),
			       etoolbar, 0);
      g_signal_connect_object (proxy, "drag_data_delete",
			       G_CALLBACK (drag_data_delete_cb),
			       etoolbar, 0);
    }

  if (GTK_IS_BUTTON (proxy) || GTK_IS_TOOL_ITEM (proxy))
    {
      g_signal_connect_object (proxy, "button-press-event",
			       G_CALLBACK (button_press_event_cb),
			       etoolbar, 0);
    }
}
Esempio n. 2
0
/**
 * gtk_tool_item_get_use_drag_window:
 * @tool_item: a #GtkToolItem
 *
 * Returns whether @tool_item has a drag window. See
 * gtk_tool_item_set_use_drag_window().
 *
 * Return value: %TRUE if @tool_item uses a drag window.
 *
 * Since: 2.4
 **/
gboolean
gtk_tool_item_get_use_drag_window (GtkToolItem *toolitem)
{
    g_return_val_if_fail (GTK_IS_TOOL_ITEM (toolitem), FALSE);

    return toolitem->priv->use_drag_window;
}
Esempio n. 3
0
/**
 * gtk_tool_item_get_expand:
 * @tool_item: a #GtkToolItem
 *
 * Returns whether @tool_item is allocated extra space.
 * See gtk_tool_item_set_expand().
 *
 * Return value: %TRUE if @tool_item is allocated extra space.
 *
 * Since: 2.4
 **/
gboolean
gtk_tool_item_get_expand (GtkToolItem *tool_item)
{
    g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), FALSE);

    return tool_item->priv->expand;
}
Esempio n. 4
0
void fixup_labels( GObject *gobject, GParamSpec *arg1, gpointer user_data )
{
    /* TODO: handle 'use-markup' getting changed also */

    if ( arg1 && arg1->name && (strcmp("label", arg1->name) == 0) ) {
        GSList* proxies = gtk_action_get_proxies( GTK_ACTION(gobject) );
        gchar* str = 0;
        g_object_get( gobject, "label", &str, NULL );
        (void)user_data;
        while ( proxies ) {
            if ( GTK_IS_TOOL_ITEM(proxies->data) ) {
                /* Search for the things we built up in create_tool_item() */
                GList* children = gtk_container_get_children( GTK_CONTAINER(proxies->data) );
                if ( children && children->data ) {
                    if ( GTK_IS_HBOX(children->data) ) {
                        children = gtk_container_get_children( GTK_CONTAINER(children->data) );
                        if ( children && g_list_next(children) ) {
                            GtkWidget* child = GTK_WIDGET( g_list_next(children)->data );
                            if ( GTK_IS_LABEL(child) ) {
                                GtkLabel* lbl = GTK_LABEL(child);
                                if ( EGE_OUTPUT_ACTION(gobject)->private_data->useMarkup ) {
                                    gtk_label_set_markup( lbl, str );
                                } else {
                                    gtk_label_set_text( lbl, str );
                                }
                            }
                        }
                    }
                }
            }
            proxies = g_slist_next( proxies );
        }
        g_free( str );
    }
}
Esempio n. 5
0
static void
interactive_canvas_drag_data_received (GtkWidget        *widget,
                                       GdkDragContext   *context,
                                       gint              x,
                                       gint              y,
                                       GtkSelectionData *selection,
                                       guint             info,
                                       guint             time,
                                       gpointer          data)

{
  /* find the tool button which is the source of this DnD operation */

  GtkWidget *palette = gtk_drag_get_source_widget (context);
  GtkWidget *tool_item = NULL;

  while (palette && !GTK_IS_TOOL_PALETTE (palette))
    palette = gtk_widget_get_parent (palette);

  if (palette)
    tool_item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (palette),
                                                selection);

  /* create a drop indicator when a tool button was found */

  g_assert (NULL == drop_item);

  if (GTK_IS_TOOL_ITEM (tool_item))
    {
      drop_item = canvas_item_new (widget, GTK_TOOL_BUTTON (tool_item), x, y);
      gdk_drag_status (context, GDK_ACTION_COPY, time);
      gtk_widget_queue_draw (widget);
    }
}
Esempio n. 6
0
static void
connect_proxy (GtkAction *action,
               GtkWidget *proxy)
{
        if (GTK_IS_TOOL_ITEM (proxy)) {
                GtkToolItem *item = GTK_TOOL_ITEM (proxy);
                NautilusZoomAction *zaction = NAUTILUS_ZOOM_ACTION (action);
                NautilusNavigationWindow *window = zaction->priv->window;
                GtkWidget *zoom_control;

                zoom_control = nautilus_zoom_control_new ();
                gtk_container_set_border_width (GTK_CONTAINER (item), 4);
                gtk_container_add (GTK_CONTAINER (item),  zoom_control);
                gtk_widget_show (zoom_control);

                g_signal_connect_object (zoom_control, "zoom_in",
                                         G_CALLBACK (nautilus_window_zoom_in),
                                         window, G_CONNECT_SWAPPED);
                g_signal_connect_object (zoom_control, "zoom_out",
                                         G_CALLBACK (nautilus_window_zoom_out),
                                         window, G_CONNECT_SWAPPED);
                g_signal_connect_object (zoom_control, "zoom_to_level",
                                         G_CALLBACK (nautilus_window_zoom_to_level),
                                         window, G_CONNECT_SWAPPED);
                g_signal_connect_object (zoom_control, "zoom_to_default",
                                         G_CALLBACK (nautilus_window_zoom_to_default),
                                         window, G_CONNECT_SWAPPED);

                g_signal_connect (window, "zoom-changed",
                                  G_CALLBACK (zoom_changed_callback),
                                  zoom_control);
        }

        (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
}
Esempio n. 7
0
/**
 * gtk_tool_item_get_is_important:
 * @tool_item: a #GtkToolItem
 *
 * Returns whether @tool_item is considered important. See
 * gtk_tool_item_set_is_important()
 *
 * Return value: %TRUE if @tool_item is considered important.
 *
 * Since: 2.4
 **/
gboolean
gtk_tool_item_get_is_important (GtkToolItem *tool_item)
{
    g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), FALSE);

    return tool_item->priv->is_important;
}
Esempio n. 8
0
/**
 * gtk_tool_item_get_homogeneous:
 * @tool_item: a #GtkToolItem
 *
 * Returns whether @tool_item is the same size as other homogeneous
 * items. See gtk_tool_item_set_homogeneous().
 *
 * Return value: %TRUE if the item is the same size as other homogeneous
 * items.
 *
 * Since: 2.4
 **/
gboolean
gtk_tool_item_get_homogeneous (GtkToolItem *tool_item)
{
    g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), FALSE);

    return tool_item->priv->homogeneous;
}
Esempio n. 9
0
/**
 * gtk_tool_item_get_visible_vertical:
 * @tool_item: a #GtkToolItem
 *
 * Returns whether @tool_item is visible when the toolbar is docked vertically.
 * See gtk_tool_item_set_visible_vertical().
 *
 * Return value: Whether @tool_item is visible when the toolbar is docked vertically
 *
 * Since: 2.4
 **/
gboolean
gtk_tool_item_get_visible_vertical (GtkToolItem *toolitem)
{
    g_return_val_if_fail (GTK_IS_TOOL_ITEM (toolitem), FALSE);

    return toolitem->priv->visible_vertical;
}
Esempio n. 10
0
/**
 * gtk_tool_item_set_use_drag_window:
 * @tool_item: a #GtkToolItem
 * @use_drag_window: Whether @tool_item has a drag window.
 *
 * Sets whether @tool_item has a drag window. When %TRUE the
 * toolitem can be used as a drag source through gtk_drag_source_set().
 * When @tool_item has a drag window it will intercept all events,
 * even those that would otherwise be sent to a child of @tool_item.
 *
 * Since: 2.4
 **/
void
gtk_tool_item_set_use_drag_window (GtkToolItem *toolitem,
                                   gboolean     use_drag_window)
{
    g_return_if_fail (GTK_IS_TOOL_ITEM (toolitem));

    use_drag_window = use_drag_window != FALSE;

    if (toolitem->priv->use_drag_window != use_drag_window)
    {
        toolitem->priv->use_drag_window = use_drag_window;

        if (use_drag_window)
        {
            if (!toolitem->priv->drag_window &&
                    gtk_widget_get_realized (GTK_WIDGET (toolitem)))
            {
                create_drag_window(toolitem);
                if (gtk_widget_get_mapped (GTK_WIDGET (toolitem)))
                    gdk_window_show (toolitem->priv->drag_window);
            }
        }
        else
        {
            destroy_drag_window (toolitem);
        }
    }
}
Esempio n. 11
0
static void ink_toggle_action_update_icon( InkToggleAction* action )
{
    if ( action ) {
        GSList* proxies = gtk_action_get_proxies( GTK_ACTION(action) );
        while ( proxies ) {
            if ( GTK_IS_TOOL_ITEM(proxies->data) ) {
                if ( GTK_IS_TOOL_BUTTON(proxies->data) ) {
                    GtkToolButton* button = GTK_TOOL_BUTTON(proxies->data);

                    GtkWidget* child = sp_icon_new( action->private_data->iconSize, action->private_data->iconId );

#if GTK_CHECK_VERSION(3,0,0)
		    gtk_widget_set_hexpand(child, FALSE);
		    gtk_widget_set_vexpand(child, FALSE);
		    gtk_widget_show_all(child);
		    gtk_tool_button_set_icon_widget(button, child);
#else
                    GtkWidget* align = gtk_alignment_new( 0.5, 0.5, 0.0, 0.0 );
                    gtk_container_add( GTK_CONTAINER(align), child );
                    gtk_widget_show_all( align );
                    gtk_tool_button_set_icon_widget( button, align );
#endif
                }
            }

            proxies = g_slist_next( proxies );
        }
    }
}
Esempio n. 12
0
/**
 * gtk_tool_item_set_proxy_menu_item:
 * @tool_item: a #GtkToolItem
 * @menu_item_id: a string used to identify @menu_item
 * @menu_item: a #GtkMenuItem to be used in the overflow menu
 *
 * Sets the #GtkMenuItem used in the toolbar overflow menu. The
 * @menu_item_id is used to identify the caller of this function and
 * should also be used with gtk_tool_item_get_proxy_menu_item().
 *
 * Since: 2.4
 **/
void
gtk_tool_item_set_proxy_menu_item (GtkToolItem *tool_item,
                                   const gchar *menu_item_id,
                                   GtkWidget   *menu_item)
{
    g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
    g_return_if_fail (menu_item == NULL || GTK_IS_MENU_ITEM (menu_item));
    g_return_if_fail (menu_item_id != NULL);

    g_free (tool_item->priv->menu_item_id);

    tool_item->priv->menu_item_id = g_strdup (menu_item_id);

    if (tool_item->priv->menu_item != menu_item)
    {
        if (tool_item->priv->menu_item)
            g_object_unref (tool_item->priv->menu_item);

        if (menu_item)
        {
            g_object_ref_sink (menu_item);

            gtk_widget_set_sensitive (menu_item,
                                      gtk_widget_get_sensitive (GTK_WIDGET (tool_item)));
        }

        tool_item->priv->menu_item = menu_item;
    }
}
Esempio n. 13
0
void ToolButton::updateDescription(String description) {
	XOJ_CHECK_TYPE(ToolButton);

	this->description = description;
	if (GTK_IS_TOOL_ITEM(item)) {
		gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(item), description.c_str());
		gtk_tool_button_set_label(GTK_TOOL_BUTTON(item), description.c_str());
	}
}
Esempio n. 14
0
static void
interactive_canvas_drag_data_received (GtkWidget        *widget,
                                       GdkDragContext   *context,
                                       gint              x,
                                       gint              y,
                                       GtkSelectionData *selection,
                                       guint             info,
                                       guint             time,
                                       gpointer          data)

{
  /* find the tool button which is the source of this DnD operation */

  GtkWidget *palette = gtk_drag_get_source_widget (context);
  GtkWidget *tool_item = NULL;
  CanvasItem *item;

  while (palette && !GTK_IS_TOOL_PALETTE (palette))
    palette = gtk_widget_get_parent (palette);

  if (palette)
    tool_item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (palette),
                                                selection);

  /* create a canvas item when a tool button was found */

  g_assert (NULL == drop_item);

  if (!GTK_IS_TOOL_ITEM (tool_item))
    return;

  if (drop_item)
    {
      canvas_item_free (drop_item);
      drop_item = NULL;
    }

  item = canvas_item_new (widget, GTK_TOOL_BUTTON (tool_item), x, y);

  /* Either create a new item or just create a preview item, 
     depending on why the drag data was requested. */
  if(drag_data_requested_for_drop)
    {
      canvas_items = g_list_append (canvas_items, item);
      drop_item = NULL;

      gtk_drag_finish (context, TRUE, FALSE, time);
    } else
    {
      drop_item = item;
      gdk_drag_status (context, GDK_ACTION_COPY, time);
    }

  gtk_widget_queue_draw (widget);
}
Esempio n. 15
0
/**
 * 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));
}
Esempio n. 16
0
/**
 * gtk_tool_item_get_proxy_menu_item:
 * @tool_item: a #GtkToolItem
 * @menu_item_id: a string used to identify the menu item
 *
 * If @menu_item_id matches the string passed to
 * gtk_tool_item_set_proxy_menu_item() return the corresponding #GtkMenuItem.
 *
 * Custom subclasses of #GtkToolItem should use this function to update
 * their menu item when the #GtkToolItem changes. That the
 * @menu_item_id<!-- -->s must match ensures that a #GtkToolItem will not
 * inadvertently change a menu item that they did not create.
 *
 * Return value: The #GtkMenuItem passed to
 * gtk_tool_item_set_proxy_menu_item(), if the @menu_item_id<!-- -->s match.
 *
 * Since: 2.4
 **/
GtkWidget *
gtk_tool_item_get_proxy_menu_item (GtkToolItem *tool_item,
                                   const gchar *menu_item_id)
{
    g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), NULL);
    g_return_val_if_fail (menu_item_id != NULL, NULL);

    if (tool_item->priv->menu_item_id && strcmp (tool_item->priv->menu_item_id, menu_item_id) == 0)
        return tool_item->priv->menu_item;

    return NULL;
}
Esempio n. 17
0
/**
 * gtk_tool_item_retrieve_proxy_menu_item:
 * @tool_item: a #GtkToolItem
 *
 * Returns the #GtkMenuItem that was last set by
 * gtk_tool_item_set_proxy_menu_item(), ie. the #GtkMenuItem
 * that is going to appear in the overflow menu.
 *
 * Return value: (transfer none): The #GtkMenuItem that is going to appear in the
 * overflow menu for @tool_item.
 *
 * Since: 2.4
 **/
GtkWidget *
gtk_tool_item_retrieve_proxy_menu_item (GtkToolItem *tool_item)
{
    gboolean retval;

    g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), NULL);

    g_signal_emit (tool_item, toolitem_signals[CREATE_MENU_PROXY], 0,
                   &retval);

    return tool_item->priv->menu_item;
}
Esempio n. 18
0
GtkToolItem* AbstractToolItem::createTmpItem(bool horizontal)
{
	GtkToolItem* item = newItem();

	if (GTK_IS_TOOL_ITEM(item))
	{
		gtk_tool_item_set_homogeneous(GTK_TOOL_ITEM(item), false);
	}

	gtk_widget_show_all(GTK_WIDGET(item));
	return item;
}
Esempio n. 19
0
/**
 * 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));
}
Esempio n. 20
0
/**
 * gtk_tool_item_set_tooltip_markup:
 * @tool_item: a #GtkToolItem
 * @markup: markup text to be used as tooltip for @tool_item
 *
 * Sets the markup text to be displayed as tooltip on the item.
 * See gtk_widget_set_tooltip_markup().
 *
 * Since: 2.12
 **/
void
gtk_tool_item_set_tooltip_markup (GtkToolItem *tool_item,
                                  const gchar *markup)
{
    GtkWidget *child;

    g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));

    child = GTK_BIN (tool_item)->child;

    if (child)
        gtk_widget_set_tooltip_markup (child, markup);
}
Esempio n. 21
0
/**
 * gtk_tool_item_set_tooltip:
 * @tool_item: a #GtkToolItem
 * @tooltips: The #GtkTooltips object to be used
 * @tip_text: (allow-none): text to be used as tooltip text for @tool_item
 * @tip_private: (allow-none): text to be used as private tooltip text
 *
 * Sets the #GtkTooltips object to be used for @tool_item, the
 * text to be displayed as tooltip on the item and the private text
 * to be used. See gtk_tooltips_set_tip().
 *
 * Since: 2.4
 *
 * Deprecated: 2.12: Use gtk_tool_item_set_tooltip_text() instead.
 **/
void
gtk_tool_item_set_tooltip (GtkToolItem *tool_item,
                           GtkTooltips *tooltips,
                           const gchar *tip_text,
                           const gchar *tip_private)
{
    gboolean retval;

    g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));

    g_signal_emit (tool_item, toolitem_signals[SET_TOOLTIP], 0,
                   tooltips, tip_text, tip_private, &retval);
}
Esempio n. 22
0
/**
 * 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));
}
Esempio n. 23
0
/**
 * 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));
}
Esempio n. 24
0
/**
 * 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));
}
Esempio n. 25
0
/**
 * 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));
}
Esempio n. 26
0
/**
 * 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));
}
Esempio n. 27
0
/**
 * gtk_tool_item_set_homogeneous:
 * @tool_item: a #GtkToolItem
 * @homogeneous: whether @tool_item is the same size as other homogeneous items
 *
 * Sets whether @tool_item is to be allocated the same size as other
 * homogeneous items. The effect is that all homogeneous items will have
 * the same width as the widest of the items.
 *
 * Since: 2.4
 **/
void
gtk_tool_item_set_homogeneous (GtkToolItem *tool_item,
                               gboolean     homogeneous)
{
    g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));

    homogeneous = homogeneous != FALSE;

    if (tool_item->priv->homogeneous != homogeneous)
    {
        tool_item->priv->homogeneous = homogeneous;
        gtk_widget_child_notify (GTK_WIDGET (tool_item), "homogeneous");
        gtk_widget_queue_resize (GTK_WIDGET (tool_item));
    }
}
Esempio n. 28
0
/**
 * gtk_tool_item_set_expand:
 * @tool_item: a #GtkToolItem
 * @expand: Whether @tool_item is allocated extra space
 *
 * Sets whether @tool_item is allocated extra space when there
 * is more room on the toolbar then needed for the items. The
 * effect is that the item gets bigger when the toolbar gets bigger
 * and smaller when the toolbar gets smaller.
 *
 * Since: 2.4
 */
void
gtk_tool_item_set_expand (GtkToolItem *tool_item,
                          gboolean     expand)
{
    g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));

    expand = expand != FALSE;

    if (tool_item->priv->expand != expand)
    {
        tool_item->priv->expand = expand;
        gtk_widget_child_notify (GTK_WIDGET (tool_item), "expand");
        gtk_widget_queue_resize (GTK_WIDGET (tool_item));
    }
}
static void
disconnect_proxy (GtkAction *action,
                  GtkWidget *proxy)
{
    if (GTK_IS_TOOL_ITEM (proxy))
    {
        CajaViewAsAction *vaction = CAJA_VIEW_AS_ACTION (action);
        CajaNavigationWindow *window = vaction->priv->window;

        g_signal_handlers_disconnect_matched (window,
                                              G_SIGNAL_MATCH_FUNC,
                                              0, 0, NULL, G_CALLBACK (view_as_changed_callback), NULL);
    }

    (* GTK_ACTION_CLASS (parent_class)->disconnect_proxy) (action, proxy);
}
Esempio n. 30
0
/**
 * gtk_tool_item_set_is_important:
 * @tool_item: a #GtkToolItem
 * @is_important: whether the tool item should be considered important
 *
 * Sets whether @tool_item should be considered important. The #GtkToolButton
 * class uses this property to determine whether to show or hide its label
 * when the toolbar style is %GTK_TOOLBAR_BOTH_HORIZ. The result is that
 * only tool buttons with the "is_important" property set have labels, an
 * effect known as "priority text"
 *
 * Since: 2.4
 **/
void
gtk_tool_item_set_is_important (GtkToolItem *tool_item, gboolean is_important)
{
    g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));

    is_important = is_important != FALSE;

    if (is_important != tool_item->priv->is_important)
    {
        tool_item->priv->is_important = is_important;

        gtk_widget_queue_resize (GTK_WIDGET (tool_item));

        g_object_notify (G_OBJECT (tool_item), "is-important");
    }
}