Re: gtk_window_set_user_resizable()



Here's a second go, diong the object argument. The position I took with
the READ was this (here's my logic): Calling
gtk_window_set_user_resizable() does three specific things depending on a
boolean you give it. If the window does not specifically match the state
the window should be in when you give true to this function, then it is
not the possessing the characteristic "user resizable". In other words,
for user_resizable to be true, allow_shrink=false, allow_grow=true, and
auto_shrink=false. This way, you can read this variable and know
specifically that it was caused by gtk_window_set_user_resizable(true),
without anything else being messed around with. 

The other option, I think, would be to really think philosophically about
what it means for the window to be user resizable, and figure out which
combinations fall under that. I'm up to that too, if that's wiser in your
guys's opinions. 

Anyhow, lemme know your thoughts' on this one, 
    David :) 

On 25 Apr 2000, Havoc Pennington wrote:

> 
> David Santiago <mrcooger@cyberverse.com> writes:
> > 
> > What're the thoughts on this? 
> 
> It might be cute to support this as an object argument (ideally a
> READWRITE argument, though READ may require some implementation
> cleverness).
> 
> Havoc
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
> 

Index: gtkwindow.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwindow.c,v
retrieving revision 1.79
diff -u -r1.79 gtkwindow.c
--- gtkwindow.c	1999/12/11 23:04:55	1.79
+++ gtkwindow.c	2000/04/26 07:44:16
@@ -60,6 +60,7 @@
   ARG_ALLOW_GROW,
   ARG_MODAL,
   ARG_WIN_POS,
+  ARG_USER_RESIZABLE,
   ARG_DEFAULT_WIDTH,
   ARG_DEFAULT_HEIGHT
 };
@@ -214,6 +215,7 @@
   gtk_object_add_arg_type ("GtkWindow::allow_grow", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_GROW);
   gtk_object_add_arg_type ("GtkWindow::modal", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_MODAL);
   gtk_object_add_arg_type ("GtkWindow::window_position", GTK_TYPE_WINDOW_POSITION, GTK_ARG_READWRITE, ARG_WIN_POS);
+  gtk_object_add_arg_type ("GtkWindow::user_resizable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_USER_RESIZABLE); 
   gtk_object_add_arg_type ("GtkWindow::default_width", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_DEFAULT_WIDTH);
   gtk_object_add_arg_type ("GtkWindow::default_height", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_DEFAULT_HEIGHT);
   
@@ -319,6 +321,9 @@
     case ARG_WIN_POS:
       gtk_window_set_position (window, GTK_VALUE_ENUM (*arg));
       break;
+    case ARG_USER_RESIZABLE:
+      gtk_window_set_user_resizable (window, GTK_VALUE_BOOL (*arg) != FALSE); 
+      break;
     case ARG_DEFAULT_WIDTH:
       gtk_window_set_default_size (window, GTK_VALUE_INT (*arg), -2);
       break;
@@ -363,6 +368,18 @@
     case ARG_WIN_POS:
       GTK_VALUE_ENUM (*arg) = window->position;
       break;
+    case ARG_USER_RESIZABLE:
+      /* We take this policy: allow_shrink == false,
+                              allow_grow == true,
+                              auto_shrink == false ==> user_resizable. 
+                              Otherwise ==> not user_resizable. */ 
+      if (window->allow_shrink == FALSE || 
+          window->allow_grow == TRUE ||
+          window->auto_shrink == FALSE) 
+	GTK_VALUE_BOOL (*arg) = TRUE; 
+      else
+	GTK_VALUE_BOOL (*arg) = FALSE; 
+      break;
     case ARG_DEFAULT_WIDTH:
       info = gtk_window_get_geometry_info (window, FALSE);
       if (!info)
@@ -489,6 +506,16 @@
   window->auto_shrink = (auto_shrink != FALSE);
 
   gtk_widget_queue_resize (GTK_WIDGET (window));
+}
+
+void
+gtk_window_set_user_resizable (GtkWindow     *window,
+			       gboolean       setting)
+{
+  if (setting) 
+    gtk_window_set_policy (window, FALSE, TRUE, FALSE);
+  else 
+    gtk_window_set_policy (window, FALSE, FALSE, TRUE); 
 }
 
 void
Index: gtkwindow.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwindow.h,v
retrieving revision 1.20
diff -u -r1.20 gtkwindow.h
--- gtkwindow.h	2000/02/13 08:16:48	1.20
+++ gtkwindow.h	2000/04/26 07:44:16
@@ -100,6 +100,8 @@
 						gint                 allow_shrink,
 						gint                 allow_grow,
 						gint                 auto_shrink);
+void       gtk_window_set_user_resizable       (GtkWindow           *window,
+						gboolean             setting); 
 void       gtk_window_add_accel_group          (GtkWindow           *window,
 						GtkAccelGroup	    *accel_group);
 void       gtk_window_remove_accel_group       (GtkWindow           *window,


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