1999-06-01 Miguel de Icaza <miguel@nuclecu.unam.mx>

* gdesktop-icon.c (desktop_icon_select): Show the
	dicon->background.
	(desktop_icon_init): Initialize backgorund as a rectangle that
	fills all of the space used by the icon.
This commit is contained in:
Miguel de Icaza 1999-06-01 19:15:47 +00:00
parent 11728374c2
commit ef3fe0dafe
3 changed files with 35 additions and 4 deletions

View File

@ -1,3 +1,10 @@
1999-06-01 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdesktop-icon.c (desktop_icon_select): Show the
dicon->background.
(desktop_icon_init): Initialize backgorund as a rectangle that
fills all of the space used by the icon.
1999-05-31 Kjartan Maraas <kmaraas@online.no>
* glayout.c (gnome_panel_about_menu): Hooked up the new help

View File

@ -91,7 +91,15 @@ size_changed (GnomeIconTextItem *text, gpointer data)
static void
canvas_size_allocated (GtkWidget *widget, GtkAllocation *allocation, gpointer data)
{
DesktopIcon *dicon = data;
gnome_canvas_set_scroll_region (GNOME_CANVAS (widget), 0, 0, allocation->width, allocation->height);
gnome_canvas_item_set (dicon->background,
"x2", (double) allocation->width,
"y2", (double) allocation->height,
NULL);
}
static void
@ -108,13 +116,22 @@ desktop_icon_init (DesktopIcon *dicon)
dicon->canvas = gnome_canvas_new ();
gtk_signal_connect (GTK_OBJECT (dicon->canvas), "size_allocate",
(GtkSignalFunc) canvas_size_allocated,
NULL);
dicon);
gtk_container_add (GTK_CONTAINER (dicon), dicon->canvas);
gtk_widget_show (dicon->canvas);
/* Create the icon and the text items */
dicon->background = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (dicon->canvas)),
gnome_canvas_rect_get_type (),
"x1", 0.0,
"y1", 0.0,
"x2", 0.0,
"y2", 0.0,
NULL);
gnome_canvas_item_hide (dicon->background);
dicon->icon = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (dicon->canvas)),
gnome_canvas_image_get_type (),
"anchor", GTK_ANCHOR_NW,
@ -185,6 +202,9 @@ desktop_icon_realize (GtkWidget *widget)
gnome_canvas_item_set (dicon->stipple,
"fill_color_gdk", &widget->style->bg[GTK_STATE_SELECTED],
NULL);
gnome_canvas_item_set (dicon->background,
"fill_color_gdk", &widget->style->bg[GTK_STATE_SELECTED],
NULL);
}
/* Sets the icon from the specified image. Does not re-create the window shape for the desktop
@ -435,10 +455,13 @@ desktop_icon_select (DesktopIcon *dicon, int sel)
g_return_if_fail (dicon != NULL);
g_return_if_fail (IS_DESKTOP_ICON (dicon));
if (sel)
if (sel){
gnome_canvas_item_show (dicon->stipple);
else
gnome_canvas_item_show (dicon->background);
} else {
gnome_canvas_item_hide (dicon->stipple);
gnome_canvas_item_hide (dicon->background);
}
gnome_icon_text_item_select (GNOME_ICON_TEXT_ITEM (dicon->text), sel);
}

View File

@ -37,7 +37,8 @@ struct _DesktopIcon {
GnomeCanvasItem *icon; /* The item that contains the icon */
GnomeCanvasItem *text; /* The item that contains the editable text */
GnomeCanvasItem *stipple; /* The rectangle used as a stipple when the icon is selected */
GnomeCanvasItem *background; /* A background we can control */
int width, height; /* Total size of the window */
int icon_x, icon_y; /* Icon offsets */