Commit cb98231c authored by Tim Janik's avatar Tim Janik Committed by Tim Janik

implemented new flag shrink_on_detach (TRUE by default) which will cause

Tue Mar 24 14:59:50 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkhandlebox.h:
                * gtk/gtkhandlebox.c: implemented new flag shrink_on_detach (TRUE by
                        default) which will cause the handle boxes requisition to collapse in
                                case the child is already detached.


                                removed duplicate ChangeLog entry from owen.
parent 36e83663
Tue Mar 24 14:59:50 1998 Tim Janik <timj@gtk.org>
* gtk/gtkhandlebox.h:
* gtk/gtkhandlebox.c: implemented new flag shrink_on_detach (TRUE by
default) which will cause the handle boxes requisition to collapse in
case the child is already detached.
Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for
......@@ -11,30 +18,6 @@ Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
to refer to gtk-config.
(From: johannes@nada.kth.se (Johannes Keukelaar))
Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
an X grab when the button is released, grab immediately.
This solves a problem where menus wouldn't pop down
if the caller didn't have the BUTTON_RELEASE mask on
their window, and and another where the X grab would
be released prematurely.
* gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
button presses to make sure they occurred in a child item.
(From: "Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkmenushell.c: Do sanity checking on button
press/releases. Handle button events on window widget
descendents of menu items correctly.
* gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c
gtk/gtkeventbox.c:
Make the window size allocated in _realize() match that
in _size_allocate(). Take into account the border width
in the draw() handler.
1998-03-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness ->
......@@ -75,7 +58,6 @@ Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
in _size_allocate(). Take into account the border width
in the draw() handler.
>>>>>>> 1.285
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
......
Tue Mar 24 14:59:50 1998 Tim Janik <timj@gtk.org>
* gtk/gtkhandlebox.h:
* gtk/gtkhandlebox.c: implemented new flag shrink_on_detach (TRUE by
default) which will cause the handle boxes requisition to collapse in
case the child is already detached.
Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for
......@@ -11,30 +18,6 @@ Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
to refer to gtk-config.
(From: johannes@nada.kth.se (Johannes Keukelaar))
Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
an X grab when the button is released, grab immediately.
This solves a problem where menus wouldn't pop down
if the caller didn't have the BUTTON_RELEASE mask on
their window, and and another where the X grab would
be released prematurely.
* gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
button presses to make sure they occurred in a child item.
(From: "Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkmenushell.c: Do sanity checking on button
press/releases. Handle button events on window widget
descendents of menu items correctly.
* gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c
gtk/gtkeventbox.c:
Make the window size allocated in _realize() match that
in _size_allocate(). Take into account the border width
in the draw() handler.
1998-03-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness ->
......@@ -75,7 +58,6 @@ Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
in _size_allocate(). Take into account the border width
in the draw() handler.
>>>>>>> 1.285
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
......
Tue Mar 24 14:59:50 1998 Tim Janik <timj@gtk.org>
* gtk/gtkhandlebox.h:
* gtk/gtkhandlebox.c: implemented new flag shrink_on_detach (TRUE by
default) which will cause the handle boxes requisition to collapse in
case the child is already detached.
Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for
......@@ -11,30 +18,6 @@ Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
to refer to gtk-config.
(From: johannes@nada.kth.se (Johannes Keukelaar))
Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
an X grab when the button is released, grab immediately.
This solves a problem where menus wouldn't pop down
if the caller didn't have the BUTTON_RELEASE mask on
their window, and and another where the X grab would
be released prematurely.
* gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
button presses to make sure they occurred in a child item.
(From: "Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkmenushell.c: Do sanity checking on button
press/releases. Handle button events on window widget
descendents of menu items correctly.
* gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c
gtk/gtkeventbox.c:
Make the window size allocated in _realize() match that
in _size_allocate(). Take into account the border width
in the draw() handler.
1998-03-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness ->
......@@ -75,7 +58,6 @@ Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
in _size_allocate(). Take into account the border width
in the draw() handler.
>>>>>>> 1.285
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
......
Tue Mar 24 14:59:50 1998 Tim Janik <timj@gtk.org>
* gtk/gtkhandlebox.h:
* gtk/gtkhandlebox.c: implemented new flag shrink_on_detach (TRUE by
default) which will cause the handle boxes requisition to collapse in
case the child is already detached.
Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for
......@@ -11,30 +18,6 @@ Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
to refer to gtk-config.
(From: johannes@nada.kth.se (Johannes Keukelaar))
Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
an X grab when the button is released, grab immediately.
This solves a problem where menus wouldn't pop down
if the caller didn't have the BUTTON_RELEASE mask on
their window, and and another where the X grab would
be released prematurely.
* gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
button presses to make sure they occurred in a child item.
(From: "Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkmenushell.c: Do sanity checking on button
press/releases. Handle button events on window widget
descendents of menu items correctly.
* gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c
gtk/gtkeventbox.c:
Make the window size allocated in _realize() match that
in _size_allocate(). Take into account the border width
in the draw() handler.
1998-03-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness ->
......@@ -75,7 +58,6 @@ Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
in _size_allocate(). Take into account the border width
in the draw() handler.
>>>>>>> 1.285
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
......
Tue Mar 24 14:59:50 1998 Tim Janik <timj@gtk.org>
* gtk/gtkhandlebox.h:
* gtk/gtkhandlebox.c: implemented new flag shrink_on_detach (TRUE by
default) which will cause the handle boxes requisition to collapse in
case the child is already detached.
Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for
......@@ -11,30 +18,6 @@ Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
to refer to gtk-config.
(From: johannes@nada.kth.se (Johannes Keukelaar))
Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
an X grab when the button is released, grab immediately.
This solves a problem where menus wouldn't pop down
if the caller didn't have the BUTTON_RELEASE mask on
their window, and and another where the X grab would
be released prematurely.
* gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
button presses to make sure they occurred in a child item.
(From: "Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkmenushell.c: Do sanity checking on button
press/releases. Handle button events on window widget
descendents of menu items correctly.
* gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c
gtk/gtkeventbox.c:
Make the window size allocated in _realize() match that
in _size_allocate(). Take into account the border width
in the draw() handler.
1998-03-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness ->
......@@ -75,7 +58,6 @@ Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
in _size_allocate(). Take into account the border width
in the draw() handler.
>>>>>>> 1.285
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
......
Tue Mar 24 14:59:50 1998 Tim Janik <timj@gtk.org>
* gtk/gtkhandlebox.h:
* gtk/gtkhandlebox.c: implemented new flag shrink_on_detach (TRUE by
default) which will cause the handle boxes requisition to collapse in
case the child is already detached.
Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for
......@@ -11,30 +18,6 @@ Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
to refer to gtk-config.
(From: johannes@nada.kth.se (Johannes Keukelaar))
Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
an X grab when the button is released, grab immediately.
This solves a problem where menus wouldn't pop down
if the caller didn't have the BUTTON_RELEASE mask on
their window, and and another where the X grab would
be released prematurely.
* gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
button presses to make sure they occurred in a child item.
(From: "Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkmenushell.c: Do sanity checking on button
press/releases. Handle button events on window widget
descendents of menu items correctly.
* gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c
gtk/gtkeventbox.c:
Make the window size allocated in _realize() match that
in _size_allocate(). Take into account the border width
in the draw() handler.
1998-03-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness ->
......@@ -75,7 +58,6 @@ Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
in _size_allocate(). Take into account the border width
in the draw() handler.
>>>>>>> 1.285
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
......
Tue Mar 24 14:59:50 1998 Tim Janik <timj@gtk.org>
* gtk/gtkhandlebox.h:
* gtk/gtkhandlebox.c: implemented new flag shrink_on_detach (TRUE by
default) which will cause the handle boxes requisition to collapse in
case the child is already detached.
Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for
......@@ -11,30 +18,6 @@ Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
to refer to gtk-config.
(From: johannes@nada.kth.se (Johannes Keukelaar))
Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
an X grab when the button is released, grab immediately.
This solves a problem where menus wouldn't pop down
if the caller didn't have the BUTTON_RELEASE mask on
their window, and and another where the X grab would
be released prematurely.
* gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
button presses to make sure they occurred in a child item.
(From: "Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkmenushell.c: Do sanity checking on button
press/releases. Handle button events on window widget
descendents of menu items correctly.
* gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c
gtk/gtkeventbox.c:
Make the window size allocated in _realize() match that
in _size_allocate(). Take into account the border width
in the draw() handler.
1998-03-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness ->
......@@ -75,7 +58,6 @@ Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
in _size_allocate(). Take into account the border width
in the draw() handler.
>>>>>>> 1.285
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
......
......@@ -178,6 +178,7 @@ gtk_handle_box_init (GtkHandleBox *handle_box)
handle_box->float_window_mapped = FALSE;
handle_box->child_detached = FALSE;
handle_box->in_drag = FALSE;
handle_box->shrink_on_detach = TRUE;
handle_box->fleur_cursor = gdk_cursor_new (GDK_FLEUR);
handle_box->dragoff_x = 0;
handle_box->dragoff_y = 0;
......@@ -372,8 +373,6 @@ gtk_handle_box_size_request (GtkWidget *widget,
requisition->width = 0;
requisition->height = DRAG_HANDLE_SIZE;
}
requisition->width += GTK_CONTAINER (widget)->border_width * 2;
requisition->height += GTK_CONTAINER (widget)->border_width * 2;
/* if our child is not visible, we still request its size, since we
* won't have any usefull hint for our size otherwise.
......@@ -383,22 +382,40 @@ gtk_handle_box_size_request (GtkWidget *widget,
if (hb->child_detached)
{
if (hb->handle_position == GTK_POS_LEFT ||
hb->handle_position == GTK_POS_RIGHT)
requisition->height += bin->child->requisition.height;
if (!hb->shrink_on_detach)
{
if (hb->handle_position == GTK_POS_LEFT ||
hb->handle_position == GTK_POS_RIGHT)
requisition->height += bin->child->requisition.height;
else
requisition->width += bin->child->requisition.width;
}
else
requisition->width += bin->child->requisition.width;
}
else if (bin->child)
{
requisition->width += bin->child->requisition.width;
requisition->height += bin->child->requisition.height;
{
if (hb->handle_position == GTK_POS_LEFT ||
hb->handle_position == GTK_POS_RIGHT)
requisition->height += widget->style->klass->ythickness;
else
requisition->width += widget->style->klass->xthickness;
}
}
else
{
requisition->width += CHILDLESS_SIZE;
requisition->height += CHILDLESS_SIZE;
requisition->width += GTK_CONTAINER (widget)->border_width * 2;
requisition->height += GTK_CONTAINER (widget)->border_width * 2;
if (bin->child)
{
requisition->width += bin->child->requisition.width;
requisition->height += bin->child->requisition.height;
}
else
{
requisition->width += CHILDLESS_SIZE;
requisition->height += CHILDLESS_SIZE;
}
}
g_print ("size_request: width=%d height=%d\n", requisition->width, requisition->height);
}
static void
......@@ -419,14 +436,24 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
if (hb->child_detached)
{
if (allocation->height > widget->requisition.height)
guint max_req_height;
guint max_req_width;
max_req_height = MAX (widget->requisition.height,
bin->child->requisition.height +
2 * widget->style->klass->ythickness);
max_req_width = MAX (widget->requisition.width,
bin->child->requisition.width +
2 * widget->style->klass->xthickness);
if (allocation->height > max_req_height)
widget->allocation.y = allocation->y +
(allocation->height - widget->requisition.height) / 2;
(allocation->height - max_req_height) / 2;
else
widget->allocation.y = allocation->y;
widget->allocation.height = MIN (allocation->height, widget->requisition.height);
widget->allocation.width = MIN (allocation->width, widget->requisition.width);
widget->allocation.height = MIN (allocation->height, max_req_height);
widget->allocation.width = MIN (allocation->width, max_req_width);
}
else
{
......
......@@ -53,6 +53,7 @@ struct _GtkHandleBox
guint float_window_mapped : 1;
guint child_detached : 1;
guint in_drag : 1;
guint shrink_on_detach : 1;
GdkCursor *fleur_cursor;
gint dragoff_x, dragoff_y; /* start drag position (wrt widget->window) */
......
......@@ -1465,15 +1465,21 @@ create_handle_box ()
static GtkWidget* window = NULL;
GtkWidget *handle_box;
GtkWidget *handle_box2;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *toolbar;
GtkWidget *label;
GtkWidget *separator;
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window),
"Handle Box Test");
gtk_window_set_policy (GTK_WINDOW (window),
TRUE,
TRUE,
FALSE);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC(gtk_widget_destroyed),
......@@ -1481,10 +1487,30 @@ create_handle_box ()
gtk_container_border_width (GTK_CONTAINER (window), 20);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_widget_show (vbox);
label = gtk_label_new ("Above");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_widget_show (label);
separator = gtk_hseparator_new ();
gtk_container_add (GTK_CONTAINER (vbox), separator);
gtk_widget_show (separator);
hbox = gtk_hbox_new (FALSE, 10);
gtk_container_add (GTK_CONTAINER (window), hbox);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_widget_show (hbox);
separator = gtk_hseparator_new ();
gtk_container_add (GTK_CONTAINER (vbox), separator);
gtk_widget_show (separator);
label = gtk_label_new ("Below");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_widget_show (label);
handle_box = gtk_handle_box_new ();
gtk_container_add (GTK_CONTAINER (hbox), handle_box);
gtk_signal_connect (GTK_OBJECT (handle_box),
......
......@@ -1465,15 +1465,21 @@ create_handle_box ()
static GtkWidget* window = NULL;
GtkWidget *handle_box;
GtkWidget *handle_box2;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *toolbar;
GtkWidget *label;
GtkWidget *separator;
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window),
"Handle Box Test");
gtk_window_set_policy (GTK_WINDOW (window),
TRUE,
TRUE,
FALSE);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC(gtk_widget_destroyed),
......@@ -1481,10 +1487,30 @@ create_handle_box ()
gtk_container_border_width (GTK_CONTAINER (window), 20);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_widget_show (vbox);
label = gtk_label_new ("Above");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_widget_show (label);
separator = gtk_hseparator_new ();
gtk_container_add (GTK_CONTAINER (vbox), separator);
gtk_widget_show (separator);
hbox = gtk_hbox_new (FALSE, 10);
gtk_container_add (GTK_CONTAINER (window), hbox);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_widget_show (hbox);
separator = gtk_hseparator_new ();
gtk_container_add (GTK_CONTAINER (vbox), separator);
gtk_widget_show (separator);
label = gtk_label_new ("Below");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_widget_show (label);
handle_box = gtk_handle_box_new ();
gtk_container_add (GTK_CONTAINER (hbox), handle_box);
gtk_signal_connect (GTK_OBJECT (handle_box),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment