changeset 151:344d4ab0e20a

improved drawing of frame around selected image
author nadvornik
date Sun, 09 Dec 2007 00:11:40 +0000
parents 976fba0add7c
children 2c534c7c8c1f
files src/image.c
diffstat 1 files changed, 26 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Sun Nov 25 10:25:25 2007 +0000
+++ b/src/image.c	Sun Dec 09 00:11:40 2007 +0000
@@ -1673,16 +1673,13 @@
 {
 	if (imd->has_frame)
 		{
-		if (select)
+		if (select) 
 			{
-			gtk_frame_set_shadow_type(GTK_FRAME(imd->inner_frame), GTK_SHADOW_IN);
-			gtk_frame_set_shadow_type(GTK_FRAME(imd->widget), GTK_SHADOW_OUT);
+			gtk_widget_set_state(imd->inner_frame, GTK_STATE_SELECTED);
+			gtk_widget_set_state(imd->pr, GTK_STATE_NORMAL); /* do not propagate */
 			}
 		else
-			{
-			gtk_frame_set_shadow_type(GTK_FRAME(imd->inner_frame), GTK_SHADOW_NONE);
-			gtk_frame_set_shadow_type(GTK_FRAME(imd->widget), GTK_SHADOW_IN);
-			}
+			gtk_widget_set_state(imd->inner_frame, GTK_STATE_NORMAL);
 		}
 }
 
@@ -1754,6 +1751,23 @@
 	image_free(imd);
 }
 
+gboolean selectable_frame_expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
+{
+	gtk_paint_flat_box(widget->style,
+                           widget->window,
+                    	   widget->state,
+			   GTK_FRAME (widget)->shadow_type,
+                           NULL,
+                           widget,
+                           NULL,
+		    	   widget->allocation.x, widget->allocation.y, 
+		    	   widget->allocation.width, widget->allocation.height); 
+ 
+ 
+	return FALSE;
+}
+
+
 ImageWindow *image_new(gint frame)
 {
 	ImageWindow *imd;
@@ -1816,6 +1830,11 @@
 
 		gtk_widget_show(imd->inner_frame);
 		gtk_widget_show(imd->pr);
+		g_signal_connect (G_OBJECT (imd->inner_frame), "expose_event",  
+                    G_CALLBACK (selectable_frame_expose_cb), NULL);
+
+//		g_signal_connect (G_OBJECT (imd->widget), "expose_event",  
+//                    G_CALLBACK (selectable_frame_expose_cb), NULL);
 
 		GTK_WIDGET_SET_FLAGS(imd->widget, GTK_CAN_FOCUS);
 		g_signal_connect(G_OBJECT(imd->widget), "focus_in_event",