forked from AuroraMiddleware/gtk
88cf547029
The geometry widget feature of gtk_window_set_geometry_hints() has never really worked right because the calculation that GTK+ did to compute the base size of the window only worked when the geometry widget had a larger minimum size than anything else in the window. Setup: * Move the GtkSizeGroup private functions to a new private header gtksizegroup-private.h * Add the possibilty to pass flags to _gtk_size_group_queue_resize(), with the flag GTK_QUEUE_RESIZE_INVALIDATE_ONLY to suppress adding the widget's toplevel to the resize queue. * _gtk_container_resize_invalidate() is added to implement that feature * _gtk_widget_override_size_request()/_gtk_widget_restore_size_request() allow temporarily forcing a large minimum size on the geometry widget without creating resize loops. GtkWindow: * Compute the extra width/height around the geometry widget correctly; print a warning if the computation fails. * Always make the minimum size at least the natural minimum size of the toplevel; GTK+ now fails badly with underallocation. * Always set the base size hint; we were failing to set it properly when the specified minimum size was overriden, but it's harmless to always set it. Tests: * New test 'testgeometry' that replaces the 'gridded geometry' test from testgtk. The new test is roughly similar but creates a bunch of windows showing different possibilities. * The testgtk test is removed. No need to have both. https://bugzilla.gnome.org/show_bug.cgi?id=68668
98 lines
3.5 KiB
C
98 lines
3.5 KiB
C
/* GTK - The GIMP Toolkit
|
|
* gtksizegroup.h:
|
|
* Copyright (C) 2000 Red Hat Software
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* 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.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
* Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
|
#error "Only <gtk/gtk.h> can be included directly."
|
|
#endif
|
|
|
|
#ifndef __GTK_SIZE_GROUP_H__
|
|
#define __GTK_SIZE_GROUP_H__
|
|
|
|
#include <gtk/gtkwidget.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
#define GTK_TYPE_SIZE_GROUP (gtk_size_group_get_type ())
|
|
#define GTK_SIZE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SIZE_GROUP, GtkSizeGroup))
|
|
#define GTK_SIZE_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SIZE_GROUP, GtkSizeGroupClass))
|
|
#define GTK_IS_SIZE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SIZE_GROUP))
|
|
#define GTK_IS_SIZE_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SIZE_GROUP))
|
|
#define GTK_SIZE_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SIZE_GROUP, GtkSizeGroupClass))
|
|
|
|
|
|
typedef struct _GtkSizeGroup GtkSizeGroup;
|
|
typedef struct _GtkSizeGroupPrivate GtkSizeGroupPrivate;
|
|
typedef struct _GtkSizeGroupClass GtkSizeGroupClass;
|
|
|
|
struct _GtkSizeGroup
|
|
{
|
|
GObject parent_instance;
|
|
|
|
/* <private> */
|
|
GtkSizeGroupPrivate *priv;
|
|
};
|
|
|
|
struct _GtkSizeGroupClass
|
|
{
|
|
GObjectClass parent_class;
|
|
|
|
/* Padding for future expansion */
|
|
void (*_gtk_reserved1) (void);
|
|
void (*_gtk_reserved2) (void);
|
|
void (*_gtk_reserved3) (void);
|
|
void (*_gtk_reserved4) (void);
|
|
};
|
|
|
|
/**
|
|
* GtkSizeGroupMode:
|
|
* @GTK_SIZE_GROUP_NONE: group has no effect
|
|
* @GTK_SIZE_GROUP_HORIZONTAL: group affects horizontal requisition
|
|
* @GTK_SIZE_GROUP_VERTICAL: group affects vertical requisition
|
|
* @GTK_SIZE_GROUP_BOTH: group affects both horizontal and vertical requisition
|
|
*
|
|
* The mode of the size group determines the directions in which the size
|
|
* group affects the requested sizes of its component widgets.
|
|
**/
|
|
typedef enum {
|
|
GTK_SIZE_GROUP_NONE,
|
|
GTK_SIZE_GROUP_HORIZONTAL,
|
|
GTK_SIZE_GROUP_VERTICAL,
|
|
GTK_SIZE_GROUP_BOTH
|
|
} GtkSizeGroupMode;
|
|
|
|
GType gtk_size_group_get_type (void) G_GNUC_CONST;
|
|
|
|
GtkSizeGroup * gtk_size_group_new (GtkSizeGroupMode mode);
|
|
void gtk_size_group_set_mode (GtkSizeGroup *size_group,
|
|
GtkSizeGroupMode mode);
|
|
GtkSizeGroupMode gtk_size_group_get_mode (GtkSizeGroup *size_group);
|
|
void gtk_size_group_set_ignore_hidden (GtkSizeGroup *size_group,
|
|
gboolean ignore_hidden);
|
|
gboolean gtk_size_group_get_ignore_hidden (GtkSizeGroup *size_group);
|
|
void gtk_size_group_add_widget (GtkSizeGroup *size_group,
|
|
GtkWidget *widget);
|
|
void gtk_size_group_remove_widget (GtkSizeGroup *size_group,
|
|
GtkWidget *widget);
|
|
GSList * gtk_size_group_get_widgets (GtkSizeGroup *size_group);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __GTK_SIZE_GROUP_H__ */
|