Add an ignore-hidden property with getter and setter. (#171612, Christian

2005-06-19  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtk.symbols:
	* gtk/gtksizegroup.[hc]: Add an ignore-hidden property
	with getter and setter.  (#171612, Christian Neumair)
This commit is contained in:
Matthias Clasen 2005-06-19 04:16:28 +00:00 committed by Matthias Clasen
parent e109b31b0a
commit b6e4e4cb0c
7 changed files with 105 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2005-06-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk.symbols:
* gtk/gtksizegroup.[hc]: Add an ignore-hidden property
with getter and setter. (#171612, Christian Neumair)
2005-06-18 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkuimanager.c (gtk_ui_manager_add_ui): Make this

View File

@ -1,3 +1,9 @@
2005-06-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk.symbols:
* gtk/gtksizegroup.[hc]: Add an ignore-hidden property
with getter and setter. (#171612, Christian Neumair)
2005-06-18 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkuimanager.c (gtk_ui_manager_add_ui): Make this

View File

@ -1,3 +1,9 @@
2005-06-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk.symbols:
* gtk/gtksizegroup.[hc]: Add an ignore-hidden property
with getter and setter. (#171612, Christian Neumair)
2005-06-18 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkuimanager.c (gtk_ui_manager_add_ui): Make this

View File

@ -1,3 +1,7 @@
2005-06-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk-sections.txt: Updates.
2005-06-18 Matthias Clasen <mclasen@redhat.com>
* gtk/tmpl/gtkuimanager.sgml: Document that

View File

@ -2821,6 +2821,8 @@ GtkSizeGroupMode
gtk_size_group_new
gtk_size_group_set_mode
gtk_size_group_get_mode
gtk_size_group_set_ignore_hidden
gtk_size_group_get_ignore_hidden
gtk_size_group_add_widget
gtk_size_group_remove_widget
<SUBSECTION Standard>

View File

@ -27,7 +27,8 @@
enum {
PROP_0,
PROP_MODE
PROP_MODE,
PROP_IGNORE_HIDDEN
};
static void gtk_size_group_set_property (GObject *object,
@ -246,6 +247,23 @@ gtk_size_group_class_init (GtkSizeGroupClass *klass)
GTK_TYPE_SIZE_GROUP_MODE,
GTK_SIZE_GROUP_HORIZONTAL,
GTK_PARAM_READWRITE));
/**
* GtkSizeGroup:ignore-hidden:
*
* If %TRUE, hidden widgets are ignored when determining
* the size of the group.
*
* Since: 2.8
*/
g_object_class_install_property (gobject_class,
PROP_IGNORE_HIDDEN,
g_param_spec_boolean ("ignore-hidden",
P_("Ignore hidden"),
P_("If TRUE, hidden widgets are ignored "
"when determining the size of the group"),
FALSE,
GTK_PARAM_READWRITE));
}
static void
@ -255,6 +273,7 @@ gtk_size_group_init (GtkSizeGroup *size_group)
size_group->mode = GTK_SIZE_GROUP_HORIZONTAL;
size_group->have_width = 0;
size_group->have_height = 0;
size_group->ignore_hidden = 0;
}
GType
@ -297,6 +316,9 @@ gtk_size_group_set_property (GObject *object,
case PROP_MODE:
gtk_size_group_set_mode (size_group, g_value_get_enum (value));
break;
case PROP_IGNORE_HIDDEN:
gtk_size_group_set_ignore_hidden (size_group, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -316,6 +338,9 @@ gtk_size_group_get_property (GObject *object,
case PROP_MODE:
g_value_set_enum (value, size_group->mode);
break;
case PROP_IGNORE_HIDDEN:
g_value_set_boolean (value, size_group->ignore_hidden);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -386,6 +411,51 @@ gtk_size_group_get_mode (GtkSizeGroup *size_group)
return size_group->mode;
}
/**
* gtk_size_group_set_ignore_hidden:
* @size_group: a #GtkSizeGroup
* @ignore_hidden: whether hidden widgets should be ignored
* when calculating the size
*
* Sets whether invisible widgets should be ignored when
* calculating the size.
*
* Since: 2.8
*/
void
gtk_size_group_set_ignore_hidden (GtkSizeGroup *size_group,
gboolean ignore_hidden)
{
g_return_if_fail (GTK_IS_SIZE_GROUP (size_group));
ignore_hidden = ignore_hidden != FALSE;
if (size_group->ignore_hidden != ignore_hidden)
{
size_group->ignore_hidden = ignore_hidden;
g_object_notify (G_OBJECT (size_group), "ignore-hidden");
}
}
/**
* gtk_size_group_get_ignore_hidden:
* @size_group: a #GtkSizeGroup
*
* Returns if invisible widgets are ignored when calculating the size.
*
* Returns: %TRUE if invisible widgets are ignored.
*
* Since: 2.8
*/
gboolean
gtk_size_group_get_ignore_hidden (GtkSizeGroup *size_group)
{
g_return_val_if_fail (GTK_IS_SIZE_GROUP (size_group), FALSE);
return size_group->ignore_hidden;
}
static void
gtk_size_group_widget_destroyed (GtkWidget *widget,
GtkSizeGroup *size_group)
@ -542,9 +612,12 @@ compute_dimension (GtkWidget *widget,
gint dimension = compute_base_dimension (tmp_widget, mode);
if (dimension > result)
result = dimension;
if (GTK_WIDGET_VISIBLE (tmp_widget) || !group->ignore_hidden)
{
if (dimension > result)
result = dimension;
}
tmp_list = tmp_list->next;
}

View File

@ -46,6 +46,7 @@ struct _GtkSizeGroup
guint have_width : 1;
guint have_height : 1;
guint ignore_hidden : 1;
GtkRequisition requisition;
};
@ -84,6 +85,9 @@ 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,