From ef3fe0dafef470291acc9f0384cda9377d1957fc Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Tue, 1 Jun 1999 19:15:47 +0000 Subject: [PATCH] 1999-06-01 Miguel de Icaza * 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. --- gnome/ChangeLog | 7 +++++++ gnome/gdesktop-icon.c | 29 ++++++++++++++++++++++++++--- gnome/gdesktop-icon.h | 3 ++- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 98415a616..2e7a89902 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,10 @@ +1999-06-01 Miguel de Icaza + + * 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 * glayout.c (gnome_panel_about_menu): Hooked up the new help diff --git a/gnome/gdesktop-icon.c b/gnome/gdesktop-icon.c index eb104012f..af6e1592f 100644 --- a/gnome/gdesktop-icon.c +++ b/gnome/gdesktop-icon.c @@ -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); } diff --git a/gnome/gdesktop-icon.h b/gnome/gdesktop-icon.h index 868a52903..43efc5505 100644 --- a/gnome/gdesktop-icon.h +++ b/gnome/gdesktop-icon.h @@ -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 */