}
static gboolean
-canvas_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
+canvas_draw (GtkWidget *widget,
+ cairo_t *cr)
{
- cairo_t *cr;
GList *iter;
- cr = gdk_cairo_create (widget->window);
- gdk_cairo_region (cr, event->region);
- cairo_clip (cr);
-
cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_rectangle (cr, 0, 0, widget->allocation.width, widget->allocation.height);
- cairo_fill (cr);
+ cairo_paint (cr);
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);
- cairo_destroy (cr);
-
return TRUE;
}
guint time,
gpointer data)
{
+ GtkAllocation allocation;
GtkToolItemGroup *drop_group = NULL;
GtkWidget *drag_palette = gtk_drag_get_source_widget (context);
GtkWidget *drag_item = NULL;
GTK_TOOL_ITEM_GROUP (drag_item),
drop_group);
else if (GTK_IS_TOOL_ITEM (drag_item) && drop_group)
- palette_drop_item (GTK_TOOL_ITEM (drag_item),
- drop_group,
- x - GTK_WIDGET (drop_group)->allocation.x,
- y - GTK_WIDGET (drop_group)->allocation.y);
+ {
+ 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);
+ }
}
/********************************/
gpointer user_data)
{
GtkToolPalette *palette = GTK_TOOL_PALETTE (user_data);
- GtkScrolledWindow *sw = GTK_SCROLLED_WINDOW (GTK_WIDGET (palette)->parent);
+ GtkScrolledWindow *sw;
GtkTreeModel *model = gtk_combo_box_get_model (combo_box);
GtkTreeIter iter;
gint val = 0;
+ sw = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (GTK_WIDGET (palette)));
+
if (!gtk_combo_box_get_active_iter (combo_box, &iter))
return;
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
/* Add widgets to control the ToolPalette appearance: */
- box = gtk_vbox_new (FALSE, 6);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_add (GTK_CONTAINER (window), box);
/* Orientation combo box: */
gtk_box_pack_start (GTK_BOX (box), combo_style, FALSE, FALSE, 0);
/* Add hbox */
- hbox = gtk_hbox_new (FALSE, 5);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, TRUE, 0);
/* Add and fill the ToolPalette: */
gtk_widget_set_app_paintable (contents, TRUE);
g_object_connect (contents,
- "signal::expose-event", canvas_expose_event, NULL,
+ "signal::draw", canvas_draw, NULL,
"signal::drag-data-received", passive_canvas_drag_data_received, NULL,
NULL);
gtk_widget_set_app_paintable (contents, TRUE);
g_object_connect (contents,
- "signal::expose-event", canvas_expose_event, NULL,
+ "signal::draw", canvas_draw, NULL,
"signal::drag-motion", interactive_canvas_drag_motion, NULL,
"signal::drag-data-received", interactive_canvas_drag_data_received, NULL,
"signal::drag-leave", interactive_canvas_drag_leave, NULL,
gtk_label_new ("Interactive DnD Mode"));
}
- if (!GTK_WIDGET_VISIBLE (window))
+ if (!gtk_widget_get_visible (window))
{
gtk_widget_show_all (window);
}