forked from AuroraMiddleware/gtk
stack: Add GtkStackPage:visible accessors
This commit is contained in:
parent
9660ae5556
commit
188f00e05a
@ -5783,15 +5783,17 @@ gtk_header_bar_get_type
|
||||
<SECTION>
|
||||
<FILE>gtkstack</FILE>
|
||||
<TITLE>GtkStack</TITLE>
|
||||
GtkStack
|
||||
GtkStackPage
|
||||
gtk_stack_page_get_visible
|
||||
gtk_stack_page_set_visible
|
||||
gtk_stack_page_get_child
|
||||
GtkStack
|
||||
gtk_stack_new
|
||||
gtk_stack_add_named
|
||||
gtk_stack_add_titled
|
||||
gtk_stack_get_child_by_name
|
||||
gtk_stack_get_page
|
||||
gtk_stack_get_pages
|
||||
gtk_stack_page_get_child
|
||||
gtk_stack_set_visible_child
|
||||
gtk_stack_get_visible_child
|
||||
gtk_stack_set_visible_child_name
|
||||
|
@ -189,19 +189,22 @@ enum
|
||||
LAST_CHILD_PROP
|
||||
};
|
||||
|
||||
struct _GtkStackPage {
|
||||
GObject instance;
|
||||
struct _GtkStackPage
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GtkWidget *widget;
|
||||
gchar *name;
|
||||
gchar *title;
|
||||
gchar *icon_name;
|
||||
char *name;
|
||||
char *title;
|
||||
char *icon_name;
|
||||
gboolean needs_attention;
|
||||
gboolean visible;
|
||||
GtkWidget *last_focus;
|
||||
};
|
||||
|
||||
typedef struct _GtkStackPageClass GtkStackPageClass;
|
||||
struct _GtkStackPageClass {
|
||||
struct _GtkStackPageClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
@ -264,7 +267,7 @@ gtk_stack_page_get_property (GObject *object,
|
||||
break;
|
||||
|
||||
case CHILD_PROP_VISIBLE:
|
||||
g_value_set_boolean (value, info->visible);
|
||||
g_value_set_boolean (value, gtk_stack_page_get_visible (info));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -344,13 +347,7 @@ gtk_stack_page_set_property (GObject *object,
|
||||
break;
|
||||
|
||||
case CHILD_PROP_VISIBLE:
|
||||
if (info->visible != g_value_get_boolean (value))
|
||||
{
|
||||
info->visible = g_value_get_boolean (value);
|
||||
if (info->widget)
|
||||
gtk_widget_set_visible (info->widget, info->visible);
|
||||
g_object_notify_by_pspec (object, pspec);
|
||||
}
|
||||
gtk_stack_page_set_visible (info, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -2592,3 +2589,43 @@ gtk_stack_get_pages (GtkStack *stack)
|
||||
|
||||
return priv->pages;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_stack_page_get_visible:
|
||||
* @page: a #GtkStackPage
|
||||
*
|
||||
* Returns whether @page is visible in its #GtkStack.
|
||||
* This is independent from the #GtkWidget:visible value of its
|
||||
* #GtkWidget.
|
||||
*/
|
||||
gboolean
|
||||
gtk_stack_page_get_visible (GtkStackPage *page)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_STACK_PAGE (page), FALSE);
|
||||
|
||||
return page->visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_stack_page_set_visible:
|
||||
* @page: a #GtkStackPage
|
||||
* @visible: The new property value
|
||||
*
|
||||
* Sets the new value of the #GtkStackPage:visible property
|
||||
* to @visible.
|
||||
*/
|
||||
void
|
||||
gtk_stack_page_set_visible (GtkStackPage *page,
|
||||
gboolean visible)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_STACK_PAGE (page));
|
||||
|
||||
visible = !!visible;
|
||||
|
||||
if (visible != page->visible)
|
||||
{
|
||||
page->visible = visible;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (page), stack_child_props[CHILD_PROP_VISIBLE]);
|
||||
}
|
||||
}
|
||||
|
@ -72,6 +72,13 @@ typedef enum {
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_stack_page_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget * gtk_stack_page_get_child (GtkStackPage *page);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_stack_page_get_visible (GtkStackPage *page);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_stack_page_set_visible (GtkStackPage *page,
|
||||
gboolean visible);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_stack_get_type (void) G_GNUC_CONST;
|
||||
@ -91,9 +98,6 @@ GtkStackPage * gtk_stack_add_titled (GtkStack
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkStackPage * gtk_stack_get_page (GtkStack *stack,
|
||||
GtkWidget *child);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget * gtk_stack_page_get_child (GtkStackPage *page);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget * gtk_stack_get_child_by_name (GtkStack *stack,
|
||||
const gchar *name);
|
||||
|
Loading…
Reference in New Issue
Block a user