Title setting for handlebox window




Hi,

I mean, that it is correct to be able to set title of handlebox windows.
So I add new public function gtk_handle_box_set_window_title to do this
job. I don't know if you will agree with API additions in current 1.2
release, so I made patch against current CVS 1.3 version.

With best regards,
Stevo.

---
Stefan Ondrejicka <ondrej@idata.sk>
Beethovenova 11, 917 08 Trnava, Slovakia
http://www.idata.sk/~ondrej/
--- gtk+-orig/gtk/gtkhandlebox.h	Thu Aug  5 17:32:31 1999
+++ gtk+/gtk/gtkhandlebox.h	Thu Sep  9 08:28:44 1999
@@ -66,6 +66,7 @@
 
   gint            snap_edge : 3; /* -1 == unset */
   
+  gchar		 *title;
   /* Variables used during a drag
    */
   gint deskoff_x, deskoff_y; /* Offset between root relative coordinates
@@ -93,6 +94,8 @@
 					         GtkPositionType  position);
 void        gtk_handle_box_set_snap_edge        (GtkHandleBox    *handle_box,
 						 GtkPositionType  edge);
+void        gtk_handle_box_set_window_title	(GtkHandleBox	 *handle_box,
+						 const gchar *title);
 
 
 
--- gtk+-orig/gtk/gtkhandlebox.c.orig	Thu Aug  5 17:32:37 1999
+++ gtk+/gtk/gtkhandlebox.c	Thu Sep  9 08:30:25 1999
@@ -34,7 +34,8 @@
 
 enum {
   ARG_0,
-  ARG_SHADOW
+  ARG_SHADOW,
+  ARG_TITLE
 };
 
 #define DRAG_HANDLE_SIZE 10
@@ -172,6 +173,7 @@
   parent_class = gtk_type_class (gtk_bin_get_type ());
 
   gtk_object_add_arg_type ("GtkHandleBox::shadow", GTK_TYPE_SHADOW_TYPE, GTK_ARG_READWRITE, ARG_SHADOW);
+  gtk_object_add_arg_type ("GtkHandleBox::title", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TITLE);
 
   object_class->set_arg = gtk_handle_box_set_arg;
   object_class->get_arg = gtk_handle_box_get_arg;
@@ -247,6 +249,9 @@
     case ARG_SHADOW:
       gtk_handle_box_set_shadow_type (handle_box, GTK_VALUE_ENUM (*arg));
       break;
+    case ARG_TITLE:
+      gtk_handle_box_set_window_title (handle_box, GTK_VALUE_STRING (*arg));
+      break;
     default:
       break;
     }
@@ -266,6 +271,9 @@
     case ARG_SHADOW:
       GTK_VALUE_ENUM (*arg) = handle_box->shadow_type;
       break;
+    case ARG_TITLE:
+      GTK_VALUE_STRING (*arg) = g_strdup(handle_box->title);
+      break;
     default:
       arg->type = GTK_TYPE_INVALID;
       break;
@@ -288,6 +296,8 @@
 
   hb = GTK_HANDLE_BOX (object);
 
+  g_free(hb->title);
+
   if (GTK_OBJECT_CLASS (parent_class)->destroy)
     (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
 }
@@ -386,6 +396,7 @@
   if (GTK_BIN (hb)->child)
     gtk_widget_set_parent_window (GTK_BIN (hb)->child, hb->bin_window);
   
+  attributes.title = hb->title;
   attributes.x = 0;
   attributes.y = 0;
   attributes.width = widget->requisition.width;
@@ -401,6 +412,7 @@
 			   GDK_FOCUS_CHANGE_MASK |
 			   GDK_STRUCTURE_MASK);
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+  attributes_mask |= hb->title ? GDK_WA_TITLE : 0;
   hb->float_window = gdk_window_new (NULL, &attributes, attributes_mask);
   gdk_window_set_user_data (hb->float_window, widget);
   gdk_window_set_decorations (hb->float_window, 0);
@@ -728,6 +740,21 @@
   g_return_if_fail (GTK_IS_HANDLE_BOX (handle_box));
 
   handle_box->snap_edge = edge;
+}
+
+void
+gtk_handle_box_set_window_title	    (GtkHandleBox   *handle_box,
+				     const gchar *title)
+{
+  g_return_if_fail (handle_box != NULL);
+  g_return_if_fail (GTK_IS_HANDLE_BOX (handle_box));
+
+  if (handle_box->title)
+    g_free (handle_box->title);
+  handle_box->title = g_strdup (title);
+
+  if (GTK_WIDGET_REALIZED (handle_box))
+    gdk_window_set_title (handle_box->float_window, handle_box->title);
 }
 
 static void


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