GtkPaned patch



Hi, 

I'm a GTK+ newbie, I'm trying to add a new property to GtkPaned, a
"continuous" property that decides if there should be constant redrawing
when dragging a GtkPaned. 

My patch works, but I'm not sure if this is the best way to do it and it
is missing a visual way of telling the user where it will get dragged
to. I have no idea how to do this, I was hoping someone would give me a
clue :) 

TIA 

-- 
Luis Oliveira
luismbo AT netcabo DOT pt
--- gtk+-2.2.1/gtk/gtkpaned.h	Fri Oct 25 17:28:14 2002
+++ gtk+-2.2.1.new/gtk/gtkpaned.h	Sat Mar  1 23:28:52 2003
@@ -75,6 +75,7 @@
   guint orientation : 1;
   guint in_recursion : 1;
   guint handle_prelit : 1;
+  guint continuous : 1;
 
   GtkWidget *last_child1_focus;
   GtkWidget *last_child2_focus;
--- gtk+-2.2.1/gtk/gtkpaned.c	Fri Oct 25 17:28:13 2002
+++ gtk+-2.2.1.new/gtk/gtkpaned.c	Sun Mar  2 20:51:08 2003
@@ -36,7 +36,8 @@
 enum {
   PROP_0,
   PROP_POSITION,
-  PROP_POSITION_SET
+  PROP_POSITION_SET,
+  PROP_CONTINUOUS
 };
 
 enum {
@@ -397,6 +398,7 @@
   paned->position_set = FALSE;
   paned->last_allocation = -1;
   paned->in_drag = FALSE;
+  paned->continuous = TRUE;
 
   paned->priv = g_new0 (GtkPanedPrivate, 1);
   paned->last_child1_focus = NULL;
@@ -428,6 +430,9 @@
       paned->position_set = g_value_get_boolean (value);
       gtk_widget_queue_resize (GTK_WIDGET (paned));
       break;
+    case PROP_CONTINUOUS:
+      paned->continuous = g_value_get_boolean (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -450,6 +455,9 @@
     case PROP_POSITION_SET:
       g_value_set_boolean (value, paned->position_set);
       break;
+    case PROP_CONTINUOUS:
+      g_value_set_boolean (value, paned->continuous);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -656,6 +664,9 @@
     update_drag (paned);
   else
     {
+      if (!paned->continuous)
+        gtk_widget_queue_resize (GTK_WIDGET (paned));
+
       paned->handle_prelit = FALSE;
       gtk_widget_queue_draw_area (widget,
 				  paned->handle_pos.x,
@@ -925,7 +936,8 @@
   g_object_notify (object, "position_set");
   g_object_thaw_notify (object);
 
-  gtk_widget_queue_resize (GTK_WIDGET (paned));
+  if (paned->continuous || !paned->in_drag)
+    gtk_widget_queue_resize (GTK_WIDGET (paned));
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]