gtk2/gtk/gtkfixed.c

389 lines
12 KiB
C
Raw Normal View History

/* GTK - The GIMP Toolkit
1997-11-24 22:37:52 +00:00
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
1997-11-24 22:37:52 +00:00
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
1997-11-24 22:37:52 +00:00
*
* You should have received a copy of the GNU Lesser General Public
2012-02-27 13:01:10 +00:00
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
1997-11-24 22:37:52 +00:00
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
2010-10-27 02:28:24 +00:00
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
/**
* SECTION:gtkfixed
* @Short_description: A container which allows you to position
* widgets at fixed coordinates
* @Title: GtkFixed
*
* The #GtkFixed widget is a container which can place child widgets
* at fixed positions and with fixed sizes, given in pixels. #GtkFixed
* performs no automatic layout management.
*
* For most applications, you should not use this container! It keeps
* you from having to learn about the other GTK+ containers, but it
* results in broken applications. With #GtkFixed, the following
* things will result in truncated text, overlapping widgets, and
* other display bugs:
*
* - Themes, which may change widget sizes.
*
* - Fonts other than the one you used to write the app will of course
* change the size of widgets containing text; keep in mind that
* users may use a larger font because of difficulty reading the
* default, or they may be using a different OS that provides different fonts.
*
* - Translation of text into other languages changes its size. Also,
* display of non-English text will use a different font in many
* cases.
*
* In addition, #GtkFixed does not pay attention to text direction and thus may
* produce unwanted results if your app is run under right-to-left languages
* such as Hebrew or Arabic. That is: normally GTK will order containers
* appropriately for the text direction, e.g. to put labels to the right of the
* thing they label when using an RTL language, but it cant do that with
* #GtkFixed. So if you need to reorder widgets depending on the text direction,
* you would need to manually detect it and adjust child positions accordingly.
*
* Finally, fixed positioning makes it kind of annoying to add/remove
* GUI elements, since you have to reposition all the other
* elements. This is a long-term maintenance problem for your
* application.
*
* If you know none of these things are an issue for your application,
* and prefer the simplicity of #GtkFixed, by all means use the
* widget. But you should be aware of the tradeoffs.
*/
#include "config.h"
1997-11-24 22:37:52 +00:00
#include "gtkfixed.h"
#include "gtkfixedlayout.h"
2016-11-15 03:07:16 +00:00
#include "gtkintl.h"
#include "gtkprivate.h"
#include "gtkwidgetprivate.h"
2020-05-07 19:40:20 +00:00
#include "gtkbuildable.h"
1997-11-24 22:37:52 +00:00
typedef struct {
GtkLayoutManager *layout;
} GtkFixedPrivate;
2020-05-07 19:40:20 +00:00
static void gtk_fixed_buildable_iface_init (GtkBuildableIface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkFixed, gtk_fixed, GTK_TYPE_WIDGET,
G_ADD_PRIVATE (GtkFixed)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_fixed_buildable_iface_init))
static void
gtk_fixed_compute_expand (GtkWidget *widget,
gboolean *hexpand_p,
gboolean *vexpand_p)
{
GtkWidget *w;
gboolean hexpand = FALSE;
gboolean vexpand = FALSE;
for (w = gtk_widget_get_first_child (widget);
w != NULL;
w = gtk_widget_get_next_sibling (w))
{
hexpand = hexpand || gtk_widget_compute_expand (w, GTK_ORIENTATION_HORIZONTAL);
vexpand = vexpand || gtk_widget_compute_expand (w, GTK_ORIENTATION_VERTICAL);
}
*hexpand_p = hexpand;
*vexpand_p = vexpand;
}
static GtkSizeRequestMode
gtk_fixed_get_request_mode (GtkWidget *widget)
{
GtkWidget *w;
int wfh = 0, hfw = 0;
for (w = gtk_widget_get_first_child (widget);
w != NULL;
w = gtk_widget_get_next_sibling (w))
{
GtkSizeRequestMode mode = gtk_widget_get_request_mode (w);
switch (mode)
{
case GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH:
hfw ++;
break;
case GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT:
wfh ++;
break;
case GTK_SIZE_REQUEST_CONSTANT_SIZE:
default:
break;
}
}
if (hfw == 0 && wfh == 0)
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
else
return wfh > hfw ?
GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT :
GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
}
static void
gtk_fixed_dispose (GObject *object)
{
GtkWidget *child;
while ((child = gtk_widget_get_first_child (GTK_WIDGET (object))))
gtk_fixed_remove (GTK_FIXED (object), child);
G_OBJECT_CLASS (gtk_fixed_parent_class)->dispose (object);
}
1997-11-24 22:37:52 +00:00
static void
gtk_fixed_class_init (GtkFixedClass *klass)
1997-11-24 22:37:52 +00:00
{
2020-05-07 19:40:20 +00:00
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
1997-11-24 22:37:52 +00:00
2020-05-07 19:40:20 +00:00
object_class->dispose = gtk_fixed_dispose;
widget_class->compute_expand = gtk_fixed_compute_expand;
widget_class->get_request_mode = gtk_fixed_get_request_mode;
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_FIXED_LAYOUT);
}
2020-05-07 19:40:20 +00:00
static GtkBuildableIface *parent_buildable_iface;
static void
gtk_fixed_buildable_add_child (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
const gchar *type)
{
if (GTK_IS_WIDGET (child))
gtk_fixed_put (GTK_FIXED (buildable), GTK_WIDGET (child), 0, 0);
else
parent_buildable_iface->add_child (buildable, builder, child, type);
}
static void
gtk_fixed_buildable_iface_init (GtkBuildableIface *iface)
{
2020-05-07 19:40:20 +00:00
parent_buildable_iface = g_type_interface_peek_parent (iface);
iface->add_child = gtk_fixed_buildable_add_child;
1997-11-24 22:37:52 +00:00
}
static void
gtk_fixed_init (GtkFixed *self)
1997-11-24 22:37:52 +00:00
{
GtkFixedPrivate *priv = gtk_fixed_get_instance_private (self);
gtk_widget_set_overflow (GTK_WIDGET (self), GTK_OVERFLOW_HIDDEN);
2020-05-07 19:40:20 +00:00
priv->layout = gtk_widget_get_layout_manager (GTK_WIDGET (self));
1997-11-24 22:37:52 +00:00
}
/**
* gtk_fixed_new:
*
* Creates a new #GtkFixed.
*
* Returns: a new #GtkFixed.
*/
1997-11-24 22:37:52 +00:00
GtkWidget*
configure.in acheader.h gdk/gdkwindow.c Check for Shape extension both on Sun May 3 13:38:22 1998 Owen Taylor <otaylor@gtk.org> * configure.in acheader.h gdk/gdkwindow.c Check for Shape extension both on the client and server side. (And, more importantly, check for the shape extension so we may include -lXext even when compiling with --disable-xshm) Don't set override_redirect on all shaped windows. It isn't necessary. * gdk/gdkwindow.c: Set ->colormap to NULL for root and foreign windows. Use this to check if we need to get the colormap from X. Fri May 1 22:32:47 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkbutton.c (gtk_button_paint): Draw the areas between the default and the button always in GTK_STATE_NORMAL. * gtk/gtkrange.c (gtk_range_style_set): Added a style_set callback. Fri May 1 16:40:57 1998 Owen Taylor <otaylor@gtk.org> * gdk/gdkpixmap.c (gdk_pixmap_colormap_create_from_xpmp[_d]): Fix a buffer overflow on pixmaps that claim to have more than 31 characters per pixel. (gdk_pixmap_read_string): Don't wrap around strings longer than half of address space ;-) * gtk/gtk[vh]ruler.c gtk/gtkinputdialog.c: Expand some buffers that were used for printing integers. * */* (almost): Style: All int foo () { ... } changed to int foo (void) { ... } ^^^^^^^ This is why some many files changed Even where there were proper prototypes elsewhere. * gdk/gxid.c (handle_claim_device): Some extra checks. It isn't safe against being fed bad X id's, but at least it should be safe against deleting all your files.
1998-05-03 22:41:32 +00:00
gtk_fixed_new (void)
1997-11-24 22:37:52 +00:00
{
return g_object_new (GTK_TYPE_FIXED, NULL);
1997-11-24 22:37:52 +00:00
}
/**
* gtk_fixed_put:
* @fixed: a #GtkFixed.
* @widget: the widget to add.
* @x: the horizontal position to place the widget at.
* @y: the vertical position to place the widget at.
*
* Adds a widget to a #GtkFixed container and assigns a translation
* transformation to the given @x and @y coordinates to it.
*/
1997-11-24 22:37:52 +00:00
void
2010-10-27 02:28:24 +00:00
gtk_fixed_put (GtkFixed *fixed,
GtkWidget *widget,
gint x,
gint y)
1997-11-24 22:37:52 +00:00
{
GtkFixedPrivate *priv = gtk_fixed_get_instance_private (fixed);
GtkFixedLayoutChild *child_info;
GskTransform *transform = NULL;
1997-11-24 22:37:52 +00:00
g_return_if_fail (GTK_IS_FIXED (fixed));
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (_gtk_widget_get_parent (widget) == NULL);
1997-11-24 22:37:52 +00:00
gtk_widget_set_parent (widget, GTK_WIDGET (fixed));
child_info = GTK_FIXED_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (x, y));
gtk_fixed_layout_child_set_transform (child_info, transform);
gsk_transform_unref (transform);
fix a typo. 2001-08-07 Havoc Pennington <hp@pobox.com> * gtk/gtkfilesel.c (open_ref_dir): fix a typo. * gtk/gtkplug.c (gtk_plug_init): remove setting of auto_shrink; some fixage is needed here, but nothing simple. Owen understands it. ;-) * gtk/gtkwindow.h, gtk/gtkwindow.c: Rework code and API for window sizing and positioning. Also, fix bug in compute_geometry_hints (width/height confusion for setting min size). (gtk_window_move): new function (gtk_window_resize): new function (gtk_window_get_size): new function (gtk_window_get_position): new function (gtk_window_parse_geometry): new function * gtk/gtkwidget.c (gtk_widget_set_size_request): new function (gtk_widget_get_size_request): new function (gtk_widget_get_usize): delete, that was a short-lived function ;-) (gtk_widget_set_usize): deprecate (gtk_widget_set_uposition): deprecate, make it a trivial gtk_window_move() wrapper (gtk_widget_class_init): remove x/y/width/height properties, add width_request height_request * demos/*: update to avoid deprecated functions * gtk/gtklayout.c: add x/y child properties * gtk/gtkfixed.c: add x/y child properties, and get rid of uses of "gint16" * tests/testgtk.c (create_window_sizing): lots of tweaks to window sizing test * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ensure that configure events on toplevel windows are always in root window coordinates, following ICCCM spec that all synthetic events are in root window coords already, while real events are in parent window coords. Previously the code assumed that coords of 0,0 were parent window coords, which was really broken. * gtk/gtkcontainer.c (gtk_container_get_focus_chain): fix warning * gdk/gdkwindow.h (GdkWindowHints): add GDK_HINT_USER_POS and GDK_HINT_USER_SIZE so we can set USSize and USPosition hints in gtk_window_parse_geometry() * gdk/x11/gdkwindow-x11.c (gdk_window_set_geometry_hints): support new USER_POS USER_SIZE hints
2001-08-10 03:46:08 +00:00
}
/**
* gtk_fixed_get_child_position:
* @fixed: a #GtkFixed
* @widget: a child of @fixed
* @x: (out): the horizontal position of the @widget
* @y: (out): the vertical position of the @widget
*
* Retrieves the translation transformation of the given child #GtkWidget
* in the given #GtkFixed container.
*
* See also: gtk_fixed_get_child_transform().
*/
void
gtk_fixed_get_child_position (GtkFixed *fixed,
GtkWidget *widget,
int *x,
int *y)
fix a typo. 2001-08-07 Havoc Pennington <hp@pobox.com> * gtk/gtkfilesel.c (open_ref_dir): fix a typo. * gtk/gtkplug.c (gtk_plug_init): remove setting of auto_shrink; some fixage is needed here, but nothing simple. Owen understands it. ;-) * gtk/gtkwindow.h, gtk/gtkwindow.c: Rework code and API for window sizing and positioning. Also, fix bug in compute_geometry_hints (width/height confusion for setting min size). (gtk_window_move): new function (gtk_window_resize): new function (gtk_window_get_size): new function (gtk_window_get_position): new function (gtk_window_parse_geometry): new function * gtk/gtkwidget.c (gtk_widget_set_size_request): new function (gtk_widget_get_size_request): new function (gtk_widget_get_usize): delete, that was a short-lived function ;-) (gtk_widget_set_usize): deprecate (gtk_widget_set_uposition): deprecate, make it a trivial gtk_window_move() wrapper (gtk_widget_class_init): remove x/y/width/height properties, add width_request height_request * demos/*: update to avoid deprecated functions * gtk/gtklayout.c: add x/y child properties * gtk/gtkfixed.c: add x/y child properties, and get rid of uses of "gint16" * tests/testgtk.c (create_window_sizing): lots of tweaks to window sizing test * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ensure that configure events on toplevel windows are always in root window coordinates, following ICCCM spec that all synthetic events are in root window coords already, while real events are in parent window coords. Previously the code assumed that coords of 0,0 were parent window coords, which was really broken. * gtk/gtkcontainer.c (gtk_container_get_focus_chain): fix warning * gdk/gdkwindow.h (GdkWindowHints): add GDK_HINT_USER_POS and GDK_HINT_USER_SIZE so we can set USSize and USPosition hints in gtk_window_parse_geometry() * gdk/x11/gdkwindow-x11.c (gdk_window_set_geometry_hints): support new USER_POS USER_SIZE hints
2001-08-10 03:46:08 +00:00
{
GtkFixedPrivate *priv = gtk_fixed_get_instance_private (fixed);
GtkFixedLayoutChild *child_info;
float pos_x = 0.f, pos_y = 0.f;
GskTransform *transform;
fix a typo. 2001-08-07 Havoc Pennington <hp@pobox.com> * gtk/gtkfilesel.c (open_ref_dir): fix a typo. * gtk/gtkplug.c (gtk_plug_init): remove setting of auto_shrink; some fixage is needed here, but nothing simple. Owen understands it. ;-) * gtk/gtkwindow.h, gtk/gtkwindow.c: Rework code and API for window sizing and positioning. Also, fix bug in compute_geometry_hints (width/height confusion for setting min size). (gtk_window_move): new function (gtk_window_resize): new function (gtk_window_get_size): new function (gtk_window_get_position): new function (gtk_window_parse_geometry): new function * gtk/gtkwidget.c (gtk_widget_set_size_request): new function (gtk_widget_get_size_request): new function (gtk_widget_get_usize): delete, that was a short-lived function ;-) (gtk_widget_set_usize): deprecate (gtk_widget_set_uposition): deprecate, make it a trivial gtk_window_move() wrapper (gtk_widget_class_init): remove x/y/width/height properties, add width_request height_request * demos/*: update to avoid deprecated functions * gtk/gtklayout.c: add x/y child properties * gtk/gtkfixed.c: add x/y child properties, and get rid of uses of "gint16" * tests/testgtk.c (create_window_sizing): lots of tweaks to window sizing test * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ensure that configure events on toplevel windows are always in root window coordinates, following ICCCM spec that all synthetic events are in root window coords already, while real events are in parent window coords. Previously the code assumed that coords of 0,0 were parent window coords, which was really broken. * gtk/gtkcontainer.c (gtk_container_get_focus_chain): fix warning * gdk/gdkwindow.h (GdkWindowHints): add GDK_HINT_USER_POS and GDK_HINT_USER_SIZE so we can set USSize and USPosition hints in gtk_window_parse_geometry() * gdk/x11/gdkwindow-x11.c (gdk_window_set_geometry_hints): support new USER_POS USER_SIZE hints
2001-08-10 03:46:08 +00:00
g_return_if_fail (GTK_IS_FIXED (fixed));
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (x != NULL);
g_return_if_fail (y != NULL);
g_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (fixed));
fix a typo. 2001-08-07 Havoc Pennington <hp@pobox.com> * gtk/gtkfilesel.c (open_ref_dir): fix a typo. * gtk/gtkplug.c (gtk_plug_init): remove setting of auto_shrink; some fixage is needed here, but nothing simple. Owen understands it. ;-) * gtk/gtkwindow.h, gtk/gtkwindow.c: Rework code and API for window sizing and positioning. Also, fix bug in compute_geometry_hints (width/height confusion for setting min size). (gtk_window_move): new function (gtk_window_resize): new function (gtk_window_get_size): new function (gtk_window_get_position): new function (gtk_window_parse_geometry): new function * gtk/gtkwidget.c (gtk_widget_set_size_request): new function (gtk_widget_get_size_request): new function (gtk_widget_get_usize): delete, that was a short-lived function ;-) (gtk_widget_set_usize): deprecate (gtk_widget_set_uposition): deprecate, make it a trivial gtk_window_move() wrapper (gtk_widget_class_init): remove x/y/width/height properties, add width_request height_request * demos/*: update to avoid deprecated functions * gtk/gtklayout.c: add x/y child properties * gtk/gtkfixed.c: add x/y child properties, and get rid of uses of "gint16" * tests/testgtk.c (create_window_sizing): lots of tweaks to window sizing test * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ensure that configure events on toplevel windows are always in root window coordinates, following ICCCM spec that all synthetic events are in root window coords already, while real events are in parent window coords. Previously the code assumed that coords of 0,0 were parent window coords, which was really broken. * gtk/gtkcontainer.c (gtk_container_get_focus_chain): fix warning * gdk/gdkwindow.h (GdkWindowHints): add GDK_HINT_USER_POS and GDK_HINT_USER_SIZE so we can set USSize and USPosition hints in gtk_window_parse_geometry() * gdk/x11/gdkwindow-x11.c (gdk_window_set_geometry_hints): support new USER_POS USER_SIZE hints
2001-08-10 03:46:08 +00:00
child_info = GTK_FIXED_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
transform = gtk_fixed_layout_child_get_transform (child_info);
gsk_transform_to_translate (transform, &pos_x, &pos_y);
2010-10-27 02:28:24 +00:00
*x = floorf (pos_x);
*y = floorf (pos_y);
1997-11-24 22:37:52 +00:00
}
/**
* gtk_fixed_set_child_transform:
* @fixed: a #GtkFixed
* @widget: a #GtkWidget, child of @fixed
2019-08-25 13:02:57 +00:00
* @transform: (nullable): the transformation assigned to @widget or %NULL
* to reset @widget's transform
*
* Sets the transformation for @widget.
*
* This is a convenience function that retrieves the #GtkFixedLayoutChild
* instance associated to @widget and calls gtk_fixed_layout_child_set_transform().
*/
void
gtk_fixed_set_child_transform (GtkFixed *fixed,
GtkWidget *widget,
GskTransform *transform)
{
GtkFixedPrivate *priv = gtk_fixed_get_instance_private (fixed);
GtkFixedLayoutChild *child_info;
g_return_if_fail (GTK_IS_FIXED (fixed));
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (fixed));
child_info = GTK_FIXED_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
gtk_fixed_layout_child_set_transform (child_info, transform);
}
/**
* gtk_fixed_get_child_transform:
* @fixed: a #GtkFixed
* @widget: a #GtkWidget, child of @fixed
*
* Retrieves the transformation for @widget set using
* gtk_fixed_set_child_transform().
*
2019-08-25 13:02:57 +00:00
* Returns: (transfer none) (nullable): a #GskTransform or %NULL
* in case no transform has been set on @widget
*/
GskTransform *
gtk_fixed_get_child_transform (GtkFixed *fixed,
GtkWidget *widget)
{
GtkFixedPrivate *priv = gtk_fixed_get_instance_private (fixed);
GtkFixedLayoutChild *child_info;
g_return_val_if_fail (GTK_IS_FIXED (fixed), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
g_return_val_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (fixed), NULL);
child_info = GTK_FIXED_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
return gtk_fixed_layout_child_get_transform (child_info);
}
/**
* gtk_fixed_move:
* @fixed: a #GtkFixed.
* @widget: the child widget.
* @x: the horizontal position to move the widget to.
* @y: the vertical position to move the widget to.
*
* Sets a translation transformation to the given @x and @y coordinates to
* the child @widget of the given #GtkFixed container.
*/
1997-11-24 22:37:52 +00:00
void
2010-10-27 02:28:24 +00:00
gtk_fixed_move (GtkFixed *fixed,
GtkWidget *widget,
gint x,
gint y)
fix a typo. 2001-08-07 Havoc Pennington <hp@pobox.com> * gtk/gtkfilesel.c (open_ref_dir): fix a typo. * gtk/gtkplug.c (gtk_plug_init): remove setting of auto_shrink; some fixage is needed here, but nothing simple. Owen understands it. ;-) * gtk/gtkwindow.h, gtk/gtkwindow.c: Rework code and API for window sizing and positioning. Also, fix bug in compute_geometry_hints (width/height confusion for setting min size). (gtk_window_move): new function (gtk_window_resize): new function (gtk_window_get_size): new function (gtk_window_get_position): new function (gtk_window_parse_geometry): new function * gtk/gtkwidget.c (gtk_widget_set_size_request): new function (gtk_widget_get_size_request): new function (gtk_widget_get_usize): delete, that was a short-lived function ;-) (gtk_widget_set_usize): deprecate (gtk_widget_set_uposition): deprecate, make it a trivial gtk_window_move() wrapper (gtk_widget_class_init): remove x/y/width/height properties, add width_request height_request * demos/*: update to avoid deprecated functions * gtk/gtklayout.c: add x/y child properties * gtk/gtkfixed.c: add x/y child properties, and get rid of uses of "gint16" * tests/testgtk.c (create_window_sizing): lots of tweaks to window sizing test * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ensure that configure events on toplevel windows are always in root window coordinates, following ICCCM spec that all synthetic events are in root window coords already, while real events are in parent window coords. Previously the code assumed that coords of 0,0 were parent window coords, which was really broken. * gtk/gtkcontainer.c (gtk_container_get_focus_chain): fix warning * gdk/gdkwindow.h (GdkWindowHints): add GDK_HINT_USER_POS and GDK_HINT_USER_SIZE so we can set USSize and USPosition hints in gtk_window_parse_geometry() * gdk/x11/gdkwindow-x11.c (gdk_window_set_geometry_hints): support new USER_POS USER_SIZE hints
2001-08-10 03:46:08 +00:00
{
GtkFixedPrivate *priv = gtk_fixed_get_instance_private (fixed);
GtkFixedLayoutChild *child_info;
GskTransform *transform = NULL;
2010-10-27 02:28:24 +00:00
g_return_if_fail (GTK_IS_FIXED (fixed));
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (fixed));
2010-10-27 02:28:24 +00:00
child_info = GTK_FIXED_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (x, y));
gtk_fixed_layout_child_set_transform (child_info, transform);
gsk_transform_unref (transform);
1997-11-24 22:37:52 +00:00
}
/**
* gtk_fixed_remove:
* @fixed: a #GtkFixed
* @widget: the child widget to remove
*
* Removes a child from @fixed, after it has been added
* with gtk_fixed_put().
*/
void
gtk_fixed_remove (GtkFixed *fixed,
GtkWidget *widget)
1997-11-24 22:37:52 +00:00
{
g_return_if_fail (GTK_IS_FIXED (fixed));
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (fixed));
gtk_widget_unparent (widget);
1997-11-24 22:37:52 +00:00
}