2009-07-13 16:45:48 +00:00
|
|
|
/* Tool Palette
|
|
|
|
*
|
|
|
|
* A tool palette widget shows groups of toolbar items as a grid of icons
|
|
|
|
* or a list of names.
|
|
|
|
*/
|
|
|
|
|
2009-11-27 00:41:38 +00:00
|
|
|
#include <string.h>
|
2009-07-13 16:45:48 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
static GtkWidget *window = NULL;
|
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
static void load_icon_items (GtkToolPalette *palette);
|
2009-07-13 16:45:48 +00:00
|
|
|
static void load_toggle_items (GtkToolPalette *palette);
|
|
|
|
static void load_special_items (GtkToolPalette *palette);
|
|
|
|
|
2009-11-18 09:32:37 +00:00
|
|
|
typedef struct _CanvasItem CanvasItem;
|
|
|
|
|
|
|
|
struct _CanvasItem
|
|
|
|
{
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
gdouble x, y;
|
|
|
|
};
|
|
|
|
|
2013-09-16 12:04:24 +00:00
|
|
|
static gboolean drag_data_requested_for_drop = FALSE;
|
2009-11-18 09:32:37 +00:00
|
|
|
static CanvasItem *drop_item = NULL;
|
|
|
|
static GList *canvas_items = NULL;
|
|
|
|
|
|
|
|
/********************************/
|
|
|
|
/* ====== Canvas drawing ====== */
|
|
|
|
/********************************/
|
|
|
|
|
|
|
|
static CanvasItem*
|
|
|
|
canvas_item_new (GtkWidget *widget,
|
|
|
|
GtkToolButton *button,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y)
|
|
|
|
{
|
|
|
|
CanvasItem *item = NULL;
|
2013-06-21 17:46:54 +00:00
|
|
|
const gchar *icon_name;
|
2009-11-18 09:32:37 +00:00
|
|
|
GdkPixbuf *pixbuf;
|
2013-06-21 17:46:54 +00:00
|
|
|
GtkIconTheme *icon_theme;
|
|
|
|
int width;
|
|
|
|
|
|
|
|
icon_name = gtk_tool_button_get_icon_name (button);
|
|
|
|
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget));
|
|
|
|
gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &width, NULL);
|
|
|
|
pixbuf = gtk_icon_theme_load_icon (icon_theme,
|
|
|
|
icon_name,
|
|
|
|
width,
|
|
|
|
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
|
|
|
|
NULL);
|
2009-11-18 09:32:37 +00:00
|
|
|
|
|
|
|
if (pixbuf)
|
|
|
|
{
|
|
|
|
item = g_slice_new0 (CanvasItem);
|
|
|
|
item->pixbuf = pixbuf;
|
|
|
|
item->x = x;
|
|
|
|
item->y = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
canvas_item_free (CanvasItem *item)
|
|
|
|
{
|
|
|
|
g_object_unref (item->pixbuf);
|
|
|
|
g_slice_free (CanvasItem, item);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
canvas_item_draw (const CanvasItem *item,
|
|
|
|
cairo_t *cr,
|
|
|
|
gboolean preview)
|
|
|
|
{
|
|
|
|
gdouble cx = gdk_pixbuf_get_width (item->pixbuf);
|
|
|
|
gdouble cy = gdk_pixbuf_get_height (item->pixbuf);
|
|
|
|
|
|
|
|
gdk_cairo_set_source_pixbuf (cr,
|
|
|
|
item->pixbuf,
|
|
|
|
item->x - cx * 0.5,
|
|
|
|
item->y - cy * 0.5);
|
|
|
|
|
|
|
|
if (preview)
|
|
|
|
cairo_paint_with_alpha (cr, 0.6);
|
|
|
|
else
|
|
|
|
cairo_paint (cr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2010-09-26 22:06:00 +00:00
|
|
|
canvas_draw (GtkWidget *widget,
|
|
|
|
cairo_t *cr)
|
2009-11-18 09:32:37 +00:00
|
|
|
{
|
|
|
|
GList *iter;
|
2010-08-15 22:36:22 +00:00
|
|
|
|
2009-11-18 09:32:37 +00:00
|
|
|
cairo_set_source_rgb (cr, 1, 1, 1);
|
2010-09-27 18:49:06 +00:00
|
|
|
cairo_paint (cr);
|
2009-11-18 09:32:37 +00:00
|
|
|
|
|
|
|
for (iter = canvas_items; iter; iter = iter->next)
|
|
|
|
canvas_item_draw (iter->data, cr, FALSE);
|
|
|
|
|
|
|
|
if (drop_item)
|
|
|
|
canvas_item_draw (drop_item, cr, TRUE);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************/
|
|
|
|
/* ====== Palette DnD ====== */
|
|
|
|
/*****************************/
|
|
|
|
|
|
|
|
static void
|
|
|
|
palette_drop_item (GtkToolItem *drag_item,
|
|
|
|
GtkToolItemGroup *drop_group,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
|
|
|
{
|
|
|
|
GtkWidget *drag_group = gtk_widget_get_parent (GTK_WIDGET (drag_item));
|
|
|
|
GtkToolItem *drop_item = gtk_tool_item_group_get_drop_item (drop_group, x, y);
|
|
|
|
gint drop_position = -1;
|
|
|
|
|
|
|
|
if (drop_item)
|
|
|
|
drop_position = gtk_tool_item_group_get_item_position (GTK_TOOL_ITEM_GROUP (drop_group), drop_item);
|
|
|
|
|
|
|
|
if (GTK_TOOL_ITEM_GROUP (drag_group) != drop_group)
|
|
|
|
{
|
|
|
|
gboolean homogeneous, expand, fill, new_row;
|
|
|
|
|
|
|
|
g_object_ref (drag_item);
|
|
|
|
gtk_container_child_get (GTK_CONTAINER (drag_group), GTK_WIDGET (drag_item),
|
|
|
|
"homogeneous", &homogeneous,
|
|
|
|
"expand", &expand,
|
|
|
|
"fill", &fill,
|
|
|
|
"new-row", &new_row,
|
|
|
|
NULL);
|
|
|
|
gtk_container_remove (GTK_CONTAINER (drag_group), GTK_WIDGET (drag_item));
|
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (drop_group),
|
|
|
|
drag_item, drop_position);
|
|
|
|
gtk_container_child_set (GTK_CONTAINER (drop_group), GTK_WIDGET (drag_item),
|
|
|
|
"homogeneous", homogeneous,
|
|
|
|
"expand", expand,
|
|
|
|
"fill", fill,
|
|
|
|
"new-row", new_row,
|
|
|
|
NULL);
|
|
|
|
g_object_unref (drag_item);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
gtk_tool_item_group_set_item_position (GTK_TOOL_ITEM_GROUP (drop_group),
|
|
|
|
drag_item, drop_position);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-01-19 15:57:13 +00:00
|
|
|
palette_drop_group (GtkToolPalette *palette,
|
|
|
|
GtkToolItemGroup *drag_group,
|
|
|
|
GtkToolItemGroup *drop_group)
|
2009-11-18 09:32:37 +00:00
|
|
|
{
|
|
|
|
gint drop_position = -1;
|
|
|
|
|
|
|
|
if (drop_group)
|
|
|
|
drop_position = gtk_tool_palette_get_group_position (palette, drop_group);
|
|
|
|
|
|
|
|
gtk_tool_palette_set_group_position (palette, drag_group, drop_position);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
palette_drag_data_received (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
GtkSelectionData *selection,
|
2009-11-27 00:41:38 +00:00
|
|
|
guint info,
|
|
|
|
guint time,
|
|
|
|
gpointer data)
|
2009-11-18 09:32:37 +00:00
|
|
|
{
|
2010-08-15 22:36:22 +00:00
|
|
|
GtkAllocation allocation;
|
2010-01-19 15:57:13 +00:00
|
|
|
GtkToolItemGroup *drop_group = NULL;
|
|
|
|
GtkWidget *drag_palette = gtk_drag_get_source_widget (context);
|
|
|
|
GtkWidget *drag_item = NULL;
|
2009-11-18 09:32:37 +00:00
|
|
|
|
|
|
|
while (drag_palette && !GTK_IS_TOOL_PALETTE (drag_palette))
|
|
|
|
drag_palette = gtk_widget_get_parent (drag_palette);
|
|
|
|
|
|
|
|
if (drag_palette)
|
|
|
|
{
|
2009-11-27 00:41:38 +00:00
|
|
|
drag_item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (drag_palette),
|
|
|
|
selection);
|
|
|
|
drop_group = gtk_tool_palette_get_drop_group (GTK_TOOL_PALETTE (widget),
|
|
|
|
x, y);
|
2009-11-18 09:32:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (GTK_IS_TOOL_ITEM_GROUP (drag_item))
|
2010-01-19 15:57:13 +00:00
|
|
|
palette_drop_group (GTK_TOOL_PALETTE (drag_palette),
|
|
|
|
GTK_TOOL_ITEM_GROUP (drag_item),
|
|
|
|
drop_group);
|
2009-11-18 09:32:37 +00:00
|
|
|
else if (GTK_IS_TOOL_ITEM (drag_item) && drop_group)
|
2010-08-15 22:36:22 +00:00
|
|
|
{
|
|
|
|
gtk_widget_get_allocation (GTK_WIDGET (drop_group), &allocation);
|
|
|
|
palette_drop_item (GTK_TOOL_ITEM (drag_item),
|
|
|
|
drop_group,
|
|
|
|
x - allocation.x,
|
|
|
|
y - allocation.y);
|
|
|
|
}
|
2009-11-18 09:32:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************************/
|
|
|
|
/* ====== Passive Canvas ====== */
|
|
|
|
/********************************/
|
|
|
|
|
|
|
|
static void
|
|
|
|
passive_canvas_drag_data_received (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
GtkSelectionData *selection,
|
2009-11-27 00:41:38 +00:00
|
|
|
guint info,
|
|
|
|
guint time,
|
|
|
|
gpointer data)
|
2009-11-18 09:32:37 +00:00
|
|
|
{
|
|
|
|
/* find the tool button, which is the source of this DnD operation */
|
|
|
|
|
|
|
|
GtkWidget *palette = gtk_drag_get_source_widget (context);
|
|
|
|
CanvasItem *canvas_item = NULL;
|
|
|
|
GtkWidget *tool_item = NULL;
|
|
|
|
|
|
|
|
while (palette && !GTK_IS_TOOL_PALETTE (palette))
|
|
|
|
palette = gtk_widget_get_parent (palette);
|
|
|
|
|
|
|
|
if (palette)
|
2009-11-27 00:41:38 +00:00
|
|
|
tool_item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (palette),
|
|
|
|
selection);
|
2009-11-18 09:32:37 +00:00
|
|
|
|
|
|
|
g_assert (NULL == drop_item);
|
|
|
|
|
|
|
|
/* append a new canvas item when a tool button was found */
|
|
|
|
|
|
|
|
if (GTK_IS_TOOL_ITEM (tool_item))
|
|
|
|
canvas_item = canvas_item_new (widget, GTK_TOOL_BUTTON (tool_item), x, y);
|
|
|
|
|
|
|
|
if (canvas_item)
|
|
|
|
{
|
|
|
|
canvas_items = g_list_append (canvas_items, canvas_item);
|
|
|
|
gtk_widget_queue_draw (widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************/
|
|
|
|
/* ====== Interactive Canvas ====== */
|
|
|
|
/************************************/
|
|
|
|
|
|
|
|
static gboolean
|
2009-11-27 00:41:38 +00:00
|
|
|
interactive_canvas_drag_motion (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time,
|
|
|
|
gpointer data)
|
2009-11-18 09:32:37 +00:00
|
|
|
{
|
|
|
|
if (drop_item)
|
|
|
|
{
|
|
|
|
/* already have a drop indicator - just update position */
|
|
|
|
|
|
|
|
drop_item->x = x;
|
|
|
|
drop_item->y = y;
|
|
|
|
|
|
|
|
gtk_widget_queue_draw (widget);
|
|
|
|
gdk_drag_status (context, GDK_ACTION_COPY, time);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* request DnD data for creating a drop indicator */
|
|
|
|
|
|
|
|
GdkAtom target = gtk_drag_dest_find_target (widget, context, NULL);
|
|
|
|
|
|
|
|
if (!target)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-09-16 12:04:24 +00:00
|
|
|
drag_data_requested_for_drop = FALSE;
|
2009-11-18 09:32:37 +00:00
|
|
|
gtk_drag_get_data (widget, context, target, time);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
interactive_canvas_drag_data_received (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
GtkSelectionData *selection,
|
2009-11-27 00:41:38 +00:00
|
|
|
guint info,
|
|
|
|
guint time,
|
|
|
|
gpointer data)
|
2009-11-18 09:32:37 +00:00
|
|
|
|
|
|
|
{
|
2009-11-27 00:41:38 +00:00
|
|
|
/* find the tool button which is the source of this DnD operation */
|
2009-11-18 09:32:37 +00:00
|
|
|
|
|
|
|
GtkWidget *palette = gtk_drag_get_source_widget (context);
|
|
|
|
GtkWidget *tool_item = NULL;
|
2013-09-23 05:25:49 +00:00
|
|
|
CanvasItem *item;
|
2009-11-18 09:32:37 +00:00
|
|
|
|
|
|
|
while (palette && !GTK_IS_TOOL_PALETTE (palette))
|
|
|
|
palette = gtk_widget_get_parent (palette);
|
|
|
|
|
|
|
|
if (palette)
|
2009-11-27 00:41:38 +00:00
|
|
|
tool_item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (palette),
|
|
|
|
selection);
|
2009-11-18 09:32:37 +00:00
|
|
|
|
2013-09-16 12:04:24 +00:00
|
|
|
/* create a canvas item when a tool button was found */
|
2009-11-18 09:32:37 +00:00
|
|
|
|
|
|
|
g_assert (NULL == drop_item);
|
|
|
|
|
2013-09-16 12:04:24 +00:00
|
|
|
if (!GTK_IS_TOOL_ITEM (tool_item))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (drop_item)
|
|
|
|
{
|
|
|
|
canvas_item_free (drop_item);
|
|
|
|
drop_item = NULL;
|
|
|
|
}
|
|
|
|
|
2013-09-23 05:25:49 +00:00
|
|
|
item = canvas_item_new (widget, GTK_TOOL_BUTTON (tool_item), x, y);
|
2013-09-16 12:04:24 +00:00
|
|
|
|
|
|
|
/* 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
|
2009-11-18 09:32:37 +00:00
|
|
|
{
|
2013-09-16 12:04:24 +00:00
|
|
|
drop_item = item;
|
2009-11-18 09:32:37 +00:00
|
|
|
gdk_drag_status (context, GDK_ACTION_COPY, time);
|
|
|
|
}
|
2013-09-16 12:04:24 +00:00
|
|
|
|
|
|
|
gtk_widget_queue_draw (widget);
|
2009-11-18 09:32:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2009-11-27 00:41:38 +00:00
|
|
|
interactive_canvas_drag_drop (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time,
|
|
|
|
gpointer data)
|
2009-11-18 09:32:37 +00:00
|
|
|
{
|
2013-09-16 12:04:24 +00:00
|
|
|
GdkAtom target = gtk_drag_dest_find_target (widget, context, NULL);
|
2009-11-18 09:32:37 +00:00
|
|
|
|
2013-09-16 12:04:24 +00:00
|
|
|
if (!target)
|
|
|
|
return FALSE;
|
2009-11-18 09:32:37 +00:00
|
|
|
|
2013-09-16 12:04:24 +00:00
|
|
|
drag_data_requested_for_drop = TRUE;
|
|
|
|
gtk_drag_get_data (widget, context, target, time);
|
2009-11-18 09:32:37 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2013-09-16 12:04:24 +00:00
|
|
|
static void
|
|
|
|
interactive_canvas_drag_leave (gpointer data)
|
2009-11-18 09:32:37 +00:00
|
|
|
{
|
|
|
|
if (drop_item)
|
|
|
|
{
|
|
|
|
GtkWidget *widget = GTK_WIDGET (data);
|
|
|
|
|
|
|
|
canvas_item_free (drop_item);
|
|
|
|
drop_item = NULL;
|
|
|
|
|
2013-09-16 12:04:24 +00:00
|
|
|
if (widget)
|
|
|
|
gtk_widget_queue_draw (widget);
|
2009-11-18 09:32:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-27 00:41:38 +00:00
|
|
|
static void
|
|
|
|
on_combo_orientation_changed (GtkComboBox *combo_box,
|
|
|
|
gpointer user_data)
|
2009-07-13 16:45:48 +00:00
|
|
|
{
|
|
|
|
GtkToolPalette *palette = GTK_TOOL_PALETTE (user_data);
|
2010-08-15 22:36:22 +00:00
|
|
|
GtkScrolledWindow *sw;
|
2009-07-13 16:45:48 +00:00
|
|
|
GtkTreeModel *model = gtk_combo_box_get_model (combo_box);
|
|
|
|
GtkTreeIter iter;
|
2009-11-27 00:41:38 +00:00
|
|
|
gint val = 0;
|
|
|
|
|
2010-08-15 22:36:22 +00:00
|
|
|
sw = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (GTK_WIDGET (palette)));
|
|
|
|
|
2009-11-27 00:41:38 +00:00
|
|
|
if (!gtk_combo_box_get_active_iter (combo_box, &iter))
|
2009-07-13 16:45:48 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
gtk_tree_model_get (model, &iter, 1, &val, -1);
|
2009-11-27 00:41:38 +00:00
|
|
|
|
2009-07-14 17:11:20 +00:00
|
|
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (palette), val);
|
2009-07-14 19:55:12 +00:00
|
|
|
|
|
|
|
if (val == GTK_ORIENTATION_HORIZONTAL)
|
|
|
|
gtk_scrolled_window_set_policy (sw, GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
|
|
|
|
else
|
|
|
|
gtk_scrolled_window_set_policy (sw, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
2009-07-13 16:45:48 +00:00
|
|
|
}
|
|
|
|
|
2009-11-27 00:41:38 +00:00
|
|
|
static void
|
|
|
|
on_combo_style_changed (GtkComboBox *combo_box,
|
|
|
|
gpointer user_data)
|
2009-07-13 16:45:48 +00:00
|
|
|
{
|
|
|
|
GtkToolPalette *palette = GTK_TOOL_PALETTE (user_data);
|
|
|
|
GtkTreeModel *model = gtk_combo_box_get_model (combo_box);
|
|
|
|
GtkTreeIter iter;
|
2009-11-27 00:41:38 +00:00
|
|
|
gint val = 0;
|
|
|
|
|
|
|
|
if (!gtk_combo_box_get_active_iter (combo_box, &iter))
|
2009-07-13 16:45:48 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
gtk_tree_model_get (model, &iter, 1, &val, -1);
|
2009-11-27 00:41:38 +00:00
|
|
|
|
2009-07-16 15:51:55 +00:00
|
|
|
if (val == -1)
|
|
|
|
gtk_tool_palette_unset_style (palette);
|
|
|
|
else
|
|
|
|
gtk_tool_palette_set_style (palette, val);
|
2009-07-13 16:45:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *
|
|
|
|
do_toolpalette (GtkWidget *do_widget)
|
|
|
|
{
|
|
|
|
GtkWidget *box = NULL;
|
2009-11-18 09:32:37 +00:00
|
|
|
GtkWidget *hbox = NULL;
|
2009-07-13 16:45:48 +00:00
|
|
|
GtkWidget *combo_orientation = NULL;
|
2009-11-27 00:41:38 +00:00
|
|
|
GtkListStore *orientation_model = NULL;
|
2009-07-13 16:45:48 +00:00
|
|
|
GtkWidget *combo_style = NULL;
|
2009-11-27 00:41:38 +00:00
|
|
|
GtkListStore *style_model = NULL;
|
2009-07-13 16:45:48 +00:00
|
|
|
GtkCellRenderer *cell_renderer = NULL;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkWidget *palette = NULL;
|
|
|
|
GtkWidget *palette_scroller = NULL;
|
2009-11-18 09:32:37 +00:00
|
|
|
GtkWidget *notebook = NULL;
|
|
|
|
GtkWidget *contents = NULL;
|
|
|
|
GtkWidget *contents_scroller = NULL;
|
2009-07-13 16:45:48 +00:00
|
|
|
|
|
|
|
if (!window)
|
|
|
|
{
|
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
gtk_window_set_screen (GTK_WINDOW (window),
|
|
|
|
gtk_widget_get_screen (do_widget));
|
|
|
|
gtk_window_set_title (GTK_WINDOW (window), "Tool Palette");
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (window), 200, 600);
|
|
|
|
|
2009-11-27 00:41:38 +00:00
|
|
|
g_signal_connect (window, "destroy",
|
|
|
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
2009-07-13 16:45:48 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
|
|
|
|
|
|
|
/* Add widgets to control the ToolPalette appearance: */
|
2010-10-31 17:07:20 +00:00
|
|
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
2009-07-13 16:45:48 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (window), box);
|
2009-11-27 00:41:38 +00:00
|
|
|
|
2009-07-13 16:45:48 +00:00
|
|
|
/* Orientation combo box: */
|
2009-11-27 00:41:38 +00:00
|
|
|
orientation_model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
|
|
|
|
gtk_list_store_append (orientation_model, &iter);
|
|
|
|
gtk_list_store_set (orientation_model, &iter,
|
|
|
|
0, "Horizontal",
|
|
|
|
1, GTK_ORIENTATION_HORIZONTAL,
|
|
|
|
-1);
|
|
|
|
gtk_list_store_append (orientation_model, &iter);
|
|
|
|
gtk_list_store_set (orientation_model, &iter,
|
|
|
|
0, "Vertical",
|
|
|
|
1, GTK_ORIENTATION_VERTICAL,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
combo_orientation =
|
|
|
|
gtk_combo_box_new_with_model (GTK_TREE_MODEL (orientation_model));
|
2009-07-13 16:45:48 +00:00
|
|
|
cell_renderer = gtk_cell_renderer_text_new ();
|
2009-11-27 00:41:38 +00:00
|
|
|
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_orientation),
|
|
|
|
cell_renderer,
|
|
|
|
TRUE);
|
|
|
|
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_orientation),
|
|
|
|
cell_renderer,
|
|
|
|
"text", 0,
|
|
|
|
NULL);
|
|
|
|
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_orientation), &iter);
|
2009-07-13 16:45:48 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (box), combo_orientation, FALSE, FALSE, 0);
|
2009-11-27 00:41:38 +00:00
|
|
|
|
2009-07-13 16:45:48 +00:00
|
|
|
/* Style combo box: */
|
2009-11-27 00:41:38 +00:00
|
|
|
style_model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
|
|
|
|
gtk_list_store_append (style_model, &iter);
|
|
|
|
gtk_list_store_set (style_model, &iter,
|
|
|
|
0, "Text",
|
|
|
|
1, GTK_TOOLBAR_TEXT,
|
|
|
|
-1);
|
|
|
|
gtk_list_store_append (style_model, &iter);
|
|
|
|
gtk_list_store_set (style_model, &iter,
|
|
|
|
0, "Both",
|
|
|
|
1, GTK_TOOLBAR_BOTH,
|
|
|
|
-1);
|
|
|
|
gtk_list_store_append (style_model, &iter);
|
|
|
|
gtk_list_store_set (style_model, &iter,
|
|
|
|
0, "Both: Horizontal",
|
|
|
|
1, GTK_TOOLBAR_BOTH_HORIZ,
|
|
|
|
-1);
|
|
|
|
gtk_list_store_append (style_model, &iter);
|
|
|
|
gtk_list_store_set (style_model, &iter,
|
|
|
|
0, "Icons",
|
|
|
|
1, GTK_TOOLBAR_ICONS,
|
|
|
|
-1);
|
|
|
|
gtk_list_store_append (style_model, &iter);
|
|
|
|
gtk_list_store_set (style_model, &iter,
|
|
|
|
0, "Default",
|
|
|
|
1, -1, /* A custom meaning for this demo. */
|
|
|
|
-1);
|
|
|
|
combo_style = gtk_combo_box_new_with_model (GTK_TREE_MODEL (style_model));
|
2009-07-13 16:45:48 +00:00
|
|
|
cell_renderer = gtk_cell_renderer_text_new ();
|
2009-11-27 00:41:38 +00:00
|
|
|
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_style),
|
|
|
|
cell_renderer,
|
|
|
|
TRUE);
|
|
|
|
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_style),
|
|
|
|
cell_renderer,
|
|
|
|
"text", 0,
|
|
|
|
NULL);
|
|
|
|
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_style), &iter);
|
2009-07-13 16:45:48 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (box), combo_style, FALSE, FALSE, 0);
|
|
|
|
|
2009-11-18 09:32:37 +00:00
|
|
|
/* Add hbox */
|
2010-10-31 17:07:20 +00:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
|
2009-11-18 09:32:37 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, TRUE, 0);
|
2009-11-27 00:41:38 +00:00
|
|
|
|
2009-07-13 16:45:48 +00:00
|
|
|
/* Add and fill the ToolPalette: */
|
|
|
|
palette = gtk_tool_palette_new ();
|
2009-11-27 00:41:38 +00:00
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
load_icon_items (GTK_TOOL_PALETTE (palette));
|
2009-07-13 16:45:48 +00:00
|
|
|
load_toggle_items (GTK_TOOL_PALETTE (palette));
|
|
|
|
load_special_items (GTK_TOOL_PALETTE (palette));
|
2009-11-27 00:41:38 +00:00
|
|
|
|
2009-07-13 16:45:48 +00:00
|
|
|
palette_scroller = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (palette_scroller),
|
2009-11-27 00:41:38 +00:00
|
|
|
GTK_POLICY_NEVER,
|
|
|
|
GTK_POLICY_AUTOMATIC);
|
2009-07-13 16:45:48 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (palette_scroller), 6);
|
2012-04-27 12:30:05 +00:00
|
|
|
gtk_widget_set_hexpand (palette_scroller, TRUE);
|
2009-11-27 00:41:38 +00:00
|
|
|
|
2009-07-13 16:45:48 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (palette_scroller), palette);
|
2009-11-18 09:32:37 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), palette_scroller);
|
2009-11-27 00:41:38 +00:00
|
|
|
|
2009-07-13 16:45:48 +00:00
|
|
|
gtk_widget_show_all (box);
|
2009-11-27 00:41:38 +00:00
|
|
|
|
2009-07-13 16:45:48 +00:00
|
|
|
/* Connect signals: */
|
2009-11-27 00:41:38 +00:00
|
|
|
g_signal_connect (combo_orientation, "changed",
|
|
|
|
G_CALLBACK (on_combo_orientation_changed), palette);
|
|
|
|
g_signal_connect (combo_style, "changed",
|
|
|
|
G_CALLBACK (on_combo_style_changed), palette);
|
|
|
|
|
2009-07-13 16:45:48 +00:00
|
|
|
/* Keep the widgets in sync: */
|
|
|
|
on_combo_orientation_changed (GTK_COMBO_BOX (combo_orientation), palette);
|
2009-11-18 09:32:37 +00:00
|
|
|
|
|
|
|
/* ===== notebook ===== */
|
|
|
|
|
|
|
|
notebook = gtk_notebook_new ();
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (notebook), 6);
|
|
|
|
gtk_box_pack_end (GTK_BOX(hbox), notebook, FALSE, FALSE, 0);
|
2009-11-27 00:41:38 +00:00
|
|
|
|
2009-11-18 09:32:37 +00:00
|
|
|
/* ===== DnD for tool items ===== */
|
|
|
|
|
|
|
|
g_signal_connect (palette, "drag-data-received",
|
2009-11-27 00:41:38 +00:00
|
|
|
G_CALLBACK (palette_drag_data_received), NULL);
|
2009-11-18 09:32:37 +00:00
|
|
|
|
|
|
|
gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette),
|
2009-11-27 00:41:38 +00:00
|
|
|
palette,
|
|
|
|
GTK_DEST_DEFAULT_ALL,
|
2009-11-18 09:32:37 +00:00
|
|
|
GTK_TOOL_PALETTE_DRAG_ITEMS |
|
|
|
|
GTK_TOOL_PALETTE_DRAG_GROUPS,
|
|
|
|
GDK_ACTION_MOVE);
|
|
|
|
|
|
|
|
/* ===== passive DnD dest ===== */
|
|
|
|
|
|
|
|
contents = gtk_drawing_area_new ();
|
|
|
|
gtk_widget_set_app_paintable (contents, TRUE);
|
|
|
|
|
|
|
|
g_object_connect (contents,
|
2010-09-26 22:06:00 +00:00
|
|
|
"signal::draw", canvas_draw, NULL,
|
2009-11-18 09:32:37 +00:00
|
|
|
"signal::drag-data-received", passive_canvas_drag_data_received, NULL,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette),
|
2009-11-27 00:41:38 +00:00
|
|
|
contents,
|
|
|
|
GTK_DEST_DEFAULT_ALL,
|
2009-11-18 09:32:37 +00:00
|
|
|
GTK_TOOL_PALETTE_DRAG_ITEMS,
|
|
|
|
GDK_ACTION_COPY);
|
|
|
|
|
|
|
|
contents_scroller = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (contents_scroller),
|
2009-11-27 00:41:38 +00:00
|
|
|
GTK_POLICY_AUTOMATIC,
|
|
|
|
GTK_POLICY_ALWAYS);
|
2013-02-01 16:22:13 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (contents_scroller), contents);
|
2009-11-18 09:32:37 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (contents_scroller), 6);
|
|
|
|
|
2009-11-27 00:41:38 +00:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
|
|
|
contents_scroller,
|
2009-11-18 09:32:37 +00:00
|
|
|
gtk_label_new ("Passive DnD Mode"));
|
|
|
|
|
|
|
|
/* ===== interactive DnD dest ===== */
|
|
|
|
|
|
|
|
contents = gtk_drawing_area_new ();
|
|
|
|
gtk_widget_set_app_paintable (contents, TRUE);
|
|
|
|
|
|
|
|
g_object_connect (contents,
|
2010-09-26 22:06:00 +00:00
|
|
|
"signal::draw", canvas_draw, NULL,
|
2009-11-27 00:41:38 +00:00
|
|
|
"signal::drag-motion", interactive_canvas_drag_motion, NULL,
|
2009-11-18 09:32:37 +00:00
|
|
|
"signal::drag-data-received", interactive_canvas_drag_data_received, NULL,
|
2013-09-16 12:04:24 +00:00
|
|
|
"signal::drag-leave", interactive_canvas_drag_leave, contents,
|
2009-11-27 00:41:38 +00:00
|
|
|
"signal::drag-drop", interactive_canvas_drag_drop, NULL,
|
2009-11-18 09:32:37 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette),
|
2009-11-27 00:41:38 +00:00
|
|
|
contents,
|
|
|
|
GTK_DEST_DEFAULT_HIGHLIGHT,
|
2009-11-18 09:32:37 +00:00
|
|
|
GTK_TOOL_PALETTE_DRAG_ITEMS,
|
|
|
|
GDK_ACTION_COPY);
|
|
|
|
|
|
|
|
contents_scroller = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (contents_scroller),
|
2009-11-27 00:41:38 +00:00
|
|
|
GTK_POLICY_AUTOMATIC,
|
|
|
|
GTK_POLICY_ALWAYS);
|
2013-02-01 16:22:13 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (contents_scroller), contents);
|
2009-11-18 09:32:37 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (contents_scroller), 6);
|
|
|
|
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), contents_scroller,
|
|
|
|
gtk_label_new ("Interactive DnD Mode"));
|
2009-07-13 16:45:48 +00:00
|
|
|
}
|
|
|
|
|
2010-03-01 06:47:38 +00:00
|
|
|
if (!gtk_widget_get_visible (window))
|
2009-07-13 16:45:48 +00:00
|
|
|
{
|
|
|
|
gtk_widget_show_all (window);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (window);
|
|
|
|
window = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2013-06-21 17:46:54 +00:00
|
|
|
load_icon_items (GtkToolPalette *palette)
|
2009-07-13 16:45:48 +00:00
|
|
|
{
|
2013-06-21 17:46:54 +00:00
|
|
|
GList *contexts;
|
|
|
|
GList *l;
|
|
|
|
GtkIconTheme *icon_theme;
|
2009-07-13 16:45:48 +00:00
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (palette)));
|
2009-07-13 16:45:48 +00:00
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
contexts = gtk_icon_theme_list_contexts (icon_theme);
|
|
|
|
for (l = contexts; l; l = g_list_next (l))
|
|
|
|
{
|
|
|
|
gchar *context = l->data;
|
|
|
|
GList *icon_names;
|
|
|
|
GList *ll;
|
2013-09-16 12:10:52 +00:00
|
|
|
const guint max_icons = 10;
|
|
|
|
guint icons_count = 0;
|
2009-07-13 16:45:48 +00:00
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
GtkWidget *group = gtk_tool_item_group_new (context);
|
|
|
|
gtk_container_add (GTK_CONTAINER (palette), group);
|
2009-07-13 16:45:48 +00:00
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
g_message ("Got context '%s'", context);
|
|
|
|
icon_names = gtk_icon_theme_list_icons (icon_theme, context);
|
|
|
|
icon_names = g_list_sort (icon_names, (GCompareFunc) strcmp);
|
2009-07-13 16:45:48 +00:00
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
for (ll = icon_names; ll; ll = g_list_next (ll))
|
2009-07-13 16:45:48 +00:00
|
|
|
{
|
2013-06-21 17:46:54 +00:00
|
|
|
GtkToolItem *item;
|
|
|
|
gchar *id = ll->data;
|
2009-07-13 16:45:48 +00:00
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
g_message ("Got id '%s'", id);
|
2009-07-13 16:45:48 +00:00
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), id);
|
|
|
|
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (item), id);
|
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
2013-09-16 12:10:52 +00:00
|
|
|
|
|
|
|
/* Prevent us having an insane number of icons: */
|
|
|
|
++icons_count;
|
|
|
|
if(icons_count >= max_icons)
|
|
|
|
break;
|
2009-07-13 16:45:48 +00:00
|
|
|
}
|
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
g_list_free_full (icon_names, g_free);
|
2009-07-13 16:45:48 +00:00
|
|
|
}
|
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
g_list_free_full (contexts, g_free);
|
2009-07-13 16:45:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
load_toggle_items (GtkToolPalette *palette)
|
|
|
|
{
|
|
|
|
GSList *toggle_group = NULL;
|
|
|
|
GtkToolItem *item;
|
|
|
|
GtkWidget *group;
|
|
|
|
char *label;
|
|
|
|
int i;
|
|
|
|
|
2009-11-27 00:41:38 +00:00
|
|
|
group = gtk_tool_item_group_new ("Radio Item");
|
2009-07-13 16:45:48 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (palette), group);
|
|
|
|
|
|
|
|
for (i = 1; i <= 10; ++i)
|
|
|
|
{
|
|
|
|
label = g_strdup_printf ("#%d", i);
|
|
|
|
item = gtk_radio_tool_button_new (toggle_group);
|
|
|
|
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), label);
|
|
|
|
g_free (label);
|
|
|
|
|
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
|
|
|
toggle_group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkToolItem *
|
|
|
|
create_entry_item (const char *text)
|
|
|
|
{
|
|
|
|
GtkToolItem *item;
|
|
|
|
GtkWidget *entry;
|
|
|
|
|
|
|
|
entry = gtk_entry_new ();
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (entry), text);
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (entry), 5);
|
|
|
|
|
|
|
|
item = gtk_tool_item_new ();
|
|
|
|
gtk_container_add (GTK_CONTAINER (item), entry);
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
load_special_items (GtkToolPalette *palette)
|
|
|
|
{
|
|
|
|
GtkToolItem *item;
|
|
|
|
GtkWidget *group;
|
2009-07-14 21:46:21 +00:00
|
|
|
GtkWidget *label_button;
|
2009-07-13 16:45:48 +00:00
|
|
|
|
2009-07-14 21:46:21 +00:00
|
|
|
group = gtk_tool_item_group_new (NULL);
|
2009-11-27 00:41:38 +00:00
|
|
|
label_button = gtk_button_new_with_label ("Advanced Features");
|
2009-07-14 21:46:21 +00:00
|
|
|
gtk_widget_show (label_button);
|
|
|
|
gtk_tool_item_group_set_label_widget (GTK_TOOL_ITEM_GROUP (group),
|
2009-11-27 00:41:38 +00:00
|
|
|
label_button);
|
2009-07-13 16:45:48 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (palette), group);
|
|
|
|
|
|
|
|
item = create_entry_item ("homogeneous=FALSE");
|
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
|
|
|
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
|
|
|
|
"homogeneous", FALSE, NULL);
|
|
|
|
|
|
|
|
item = create_entry_item ("homogeneous=FALSE, expand=TRUE");
|
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
|
|
|
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
|
|
|
|
"homogeneous", FALSE, "expand", TRUE,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
item = create_entry_item ("homogeneous=FALSE, expand=TRUE, fill=FALSE");
|
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
|
|
|
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
|
|
|
|
"homogeneous", FALSE, "expand", TRUE,
|
|
|
|
"fill", FALSE, NULL);
|
|
|
|
|
|
|
|
item = create_entry_item ("homogeneous=FALSE, expand=TRUE, new-row=TRUE");
|
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
|
|
|
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
|
|
|
|
"homogeneous", FALSE, "expand", TRUE,
|
|
|
|
"new-row", TRUE, NULL);
|
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-up");
|
2009-07-13 16:45:48 +00:00
|
|
|
gtk_tool_item_set_tooltip_text (item, "Show on vertical palettes only");
|
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
|
|
|
gtk_tool_item_set_visible_horizontal (item, FALSE);
|
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-next");
|
2009-07-13 16:45:48 +00:00
|
|
|
gtk_tool_item_set_tooltip_text (item, "Show on horizontal palettes only");
|
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
|
|
|
gtk_tool_item_set_visible_vertical (item, FALSE);
|
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "edit-delete");
|
2009-07-13 16:45:48 +00:00
|
|
|
gtk_tool_item_set_tooltip_text (item, "Do not show at all");
|
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
|
|
|
gtk_widget_set_no_show_all (GTK_WIDGET (item), TRUE);
|
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "view-fullscreen");
|
2009-07-13 16:45:48 +00:00
|
|
|
gtk_tool_item_set_tooltip_text (item, "Expanded this item");
|
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
|
|
|
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
|
|
|
|
"homogeneous", FALSE,
|
|
|
|
"expand", TRUE,
|
|
|
|
NULL);
|
|
|
|
|
2013-06-21 17:46:54 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "help-browser");
|
2009-07-13 16:45:48 +00:00
|
|
|
gtk_tool_item_set_tooltip_text (item, "A regular item");
|
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
|
|
|
}
|