mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
gail: add/remove horizontal/vertical state based on orientation value
Now, these states are depending on the widget class.
This commit is contained in:
parent
52e1722f35
commit
f130db44ea
@ -26,7 +26,6 @@ static void gail_box_class_init (GailBoxClass *klass);
|
|||||||
static void gail_box_init (GailBox *box);
|
static void gail_box_init (GailBox *box);
|
||||||
static void gail_box_initialize (AtkObject *accessible,
|
static void gail_box_initialize (AtkObject *accessible,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static AtkStateSet* gail_box_ref_state_set (AtkObject *accessible);
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GailBox, gail_box, GAIL_TYPE_CONTAINER)
|
G_DEFINE_TYPE (GailBox, gail_box, GAIL_TYPE_CONTAINER)
|
||||||
|
|
||||||
@ -36,7 +35,6 @@ gail_box_class_init (GailBoxClass *klass)
|
|||||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
class->initialize = gail_box_initialize;
|
class->initialize = gail_box_initialize;
|
||||||
class->ref_state_set = gail_box_ref_state_set;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -52,23 +50,3 @@ gail_box_initialize (AtkObject *accessible,
|
|||||||
|
|
||||||
accessible->role = ATK_ROLE_FILLER;
|
accessible->role = ATK_ROLE_FILLER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static AtkStateSet*
|
|
||||||
gail_box_ref_state_set (AtkObject *accessible)
|
|
||||||
{
|
|
||||||
AtkStateSet *state_set;
|
|
||||||
GtkWidget *widget;
|
|
||||||
|
|
||||||
state_set = ATK_OBJECT_CLASS (gail_box_parent_class)->ref_state_set (accessible);
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
|
||||||
|
|
||||||
if (widget == NULL)
|
|
||||||
return state_set;
|
|
||||||
|
|
||||||
if (GTK_IS_VBOX (widget) || GTK_IS_VBUTTON_BOX (widget))
|
|
||||||
atk_state_set_add_state (state_set, ATK_STATE_VERTICAL);
|
|
||||||
else if (GTK_IS_HBOX (widget) || GTK_IS_HBUTTON_BOX (widget))
|
|
||||||
atk_state_set_add_state (state_set, ATK_STATE_HORIZONTAL);
|
|
||||||
|
|
||||||
return state_set;
|
|
||||||
}
|
|
||||||
|
@ -31,9 +31,6 @@ static void gail_paned_real_initialize (AtkObject *obj,
|
|||||||
gpointer data);
|
gpointer data);
|
||||||
static void gail_paned_size_allocate_gtk (GtkWidget *widget,
|
static void gail_paned_size_allocate_gtk (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
|
|
||||||
static AtkStateSet* gail_paned_ref_state_set (AtkObject *accessible);
|
|
||||||
|
|
||||||
static void atk_value_interface_init (AtkValueIface *iface);
|
static void atk_value_interface_init (AtkValueIface *iface);
|
||||||
static void gail_paned_get_current_value (AtkValue *obj,
|
static void gail_paned_get_current_value (AtkValue *obj,
|
||||||
GValue *value);
|
GValue *value);
|
||||||
@ -52,7 +49,6 @@ gail_paned_class_init (GailPanedClass *klass)
|
|||||||
{
|
{
|
||||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
class->ref_state_set = gail_paned_ref_state_set;
|
|
||||||
class->initialize = gail_paned_real_initialize;
|
class->initialize = gail_paned_real_initialize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,26 +57,6 @@ gail_paned_init (GailPaned *paned)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static AtkStateSet*
|
|
||||||
gail_paned_ref_state_set (AtkObject *accessible)
|
|
||||||
{
|
|
||||||
AtkStateSet *state_set;
|
|
||||||
GtkWidget *widget;
|
|
||||||
|
|
||||||
state_set = ATK_OBJECT_CLASS (gail_paned_parent_class)->ref_state_set (accessible);
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
|
||||||
|
|
||||||
if (widget == NULL)
|
|
||||||
return state_set;
|
|
||||||
|
|
||||||
if (GTK_IS_VPANED (widget))
|
|
||||||
atk_state_set_add_state (state_set, ATK_STATE_VERTICAL);
|
|
||||||
else if (GTK_IS_HPANED (widget))
|
|
||||||
atk_state_set_add_state (state_set, ATK_STATE_HORIZONTAL);
|
|
||||||
|
|
||||||
return state_set;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gail_paned_real_initialize (AtkObject *obj,
|
gail_paned_real_initialize (AtkObject *obj,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
@ -35,9 +35,6 @@ static void gail_range_real_initialize (AtkObject *obj,
|
|||||||
|
|
||||||
static void gail_range_finalize (GObject *object);
|
static void gail_range_finalize (GObject *object);
|
||||||
|
|
||||||
static AtkStateSet* gail_range_ref_state_set (AtkObject *obj);
|
|
||||||
|
|
||||||
|
|
||||||
static void gail_range_real_notify_gtk (GObject *obj,
|
static void gail_range_real_notify_gtk (GObject *obj,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
|
|
||||||
@ -85,7 +82,6 @@ gail_range_class_init (GailRangeClass *klass)
|
|||||||
|
|
||||||
widget_class->notify_gtk = gail_range_real_notify_gtk;
|
widget_class->notify_gtk = gail_range_real_notify_gtk;
|
||||||
|
|
||||||
class->ref_state_set = gail_range_ref_state_set;
|
|
||||||
class->initialize = gail_range_real_initialize;
|
class->initialize = gail_range_real_initialize;
|
||||||
|
|
||||||
gobject_class->finalize = gail_range_finalize;
|
gobject_class->finalize = gail_range_finalize;
|
||||||
@ -130,34 +126,7 @@ gail_range_real_initialize (AtkObject *obj,
|
|||||||
obj->role = ATK_ROLE_SLIDER;
|
obj->role = ATK_ROLE_SLIDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static AtkStateSet*
|
static void
|
||||||
gail_range_ref_state_set (AtkObject *obj)
|
|
||||||
{
|
|
||||||
AtkStateSet *state_set;
|
|
||||||
GtkWidget *widget;
|
|
||||||
GtkRange *range;
|
|
||||||
|
|
||||||
state_set = ATK_OBJECT_CLASS (gail_range_parent_class)->ref_state_set (obj);
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
|
||||||
|
|
||||||
if (widget == NULL)
|
|
||||||
return state_set;
|
|
||||||
|
|
||||||
range = GTK_RANGE (widget);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We do not generate property change for orientation change as there
|
|
||||||
* is no interface to change the orientation which emits a notification
|
|
||||||
*/
|
|
||||||
if (gtk_orientable_get_orientation (GTK_ORIENTABLE (range)) == GTK_ORIENTATION_HORIZONTAL)
|
|
||||||
atk_state_set_add_state (state_set, ATK_STATE_HORIZONTAL);
|
|
||||||
else
|
|
||||||
atk_state_set_add_state (state_set, ATK_STATE_VERTICAL);
|
|
||||||
|
|
||||||
return state_set;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
atk_value_interface_init (AtkValueIface *iface)
|
atk_value_interface_init (AtkValueIface *iface)
|
||||||
{
|
{
|
||||||
iface->get_current_value = gail_range_get_current_value;
|
iface->get_current_value = gail_range_get_current_value;
|
||||||
@ -167,7 +136,7 @@ atk_value_interface_init (AtkValueIface *iface)
|
|||||||
iface->set_current_value = gail_range_set_current_value;
|
iface->set_current_value = gail_range_set_current_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gail_range_get_current_value (AtkValue *obj,
|
gail_range_get_current_value (AtkValue *obj,
|
||||||
GValue *value)
|
GValue *value)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,6 @@ static void gail_separator_class_init (GailSeparatorClass *k
|
|||||||
static void gail_separator_init (GailSeparator *accessible);
|
static void gail_separator_init (GailSeparator *accessible);
|
||||||
static void gail_separator_initialize (AtkObject *accessible,
|
static void gail_separator_initialize (AtkObject *accessible,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static AtkStateSet* gail_separator_ref_state_set (AtkObject *accessible);
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GailSeparator, gail_separator, GAIL_TYPE_WIDGET)
|
G_DEFINE_TYPE (GailSeparator, gail_separator, GAIL_TYPE_WIDGET)
|
||||||
|
|
||||||
@ -36,7 +35,6 @@ gail_separator_class_init (GailSeparatorClass *klass)
|
|||||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
class->initialize = gail_separator_initialize;
|
class->initialize = gail_separator_initialize;
|
||||||
class->ref_state_set = gail_separator_ref_state_set;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -52,23 +50,3 @@ gail_separator_initialize (AtkObject *accessible,
|
|||||||
|
|
||||||
accessible->role = ATK_ROLE_SEPARATOR;
|
accessible->role = ATK_ROLE_SEPARATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static AtkStateSet*
|
|
||||||
gail_separator_ref_state_set (AtkObject *accessible)
|
|
||||||
{
|
|
||||||
AtkStateSet *state_set;
|
|
||||||
GtkWidget *widget;
|
|
||||||
|
|
||||||
state_set = ATK_OBJECT_CLASS (gail_separator_parent_class)->ref_state_set (accessible);
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
|
||||||
|
|
||||||
if (widget == NULL)
|
|
||||||
return state_set;
|
|
||||||
|
|
||||||
if (GTK_IS_VSEPARATOR (widget))
|
|
||||||
atk_state_set_add_state (state_set, ATK_STATE_VERTICAL);
|
|
||||||
else if (GTK_IS_HSEPARATOR (widget))
|
|
||||||
atk_state_set_add_state (state_set, ATK_STATE_HORIZONTAL);
|
|
||||||
|
|
||||||
return state_set;
|
|
||||||
}
|
|
||||||
|
@ -511,6 +511,18 @@ gail_widget_ref_state_set (AtkObject *accessible)
|
|||||||
{
|
{
|
||||||
atk_state_set_add_state (state_set, ATK_STATE_DEFAULT);
|
atk_state_set_add_state (state_set, ATK_STATE_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GTK_IS_ORIENTABLE(widget))
|
||||||
|
switch (gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)))
|
||||||
|
{
|
||||||
|
case GTK_ORIENTATION_HORIZONTAL:
|
||||||
|
atk_state_set_add_state (state_set, ATK_STATE_HORIZONTAL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GTK_ORIENTATION_VERTICAL:
|
||||||
|
atk_state_set_add_state (state_set, ATK_STATE_VERTICAL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return state_set;
|
return state_set;
|
||||||
}
|
}
|
||||||
@ -976,6 +988,15 @@ gail_widget_real_notify_gtk (GObject *obj,
|
|||||||
state = ATK_STATE_SENSITIVE;
|
state = ATK_STATE_SENSITIVE;
|
||||||
value = gtk_widget_get_sensitive (widget);
|
value = gtk_widget_get_sensitive (widget);
|
||||||
}
|
}
|
||||||
|
else if (strcmp (pspec->name, "orientation") == 0)
|
||||||
|
{
|
||||||
|
GtkOrientable *orientable;
|
||||||
|
|
||||||
|
orientable = GTK_ORIENTABLE (widget);
|
||||||
|
|
||||||
|
state = ATK_STATE_HORIZONTAL;
|
||||||
|
value = (gtk_orientable_get_orientation (orientable) == GTK_ORIENTATION_HORIZONTAL);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -983,6 +1004,8 @@ gail_widget_real_notify_gtk (GObject *obj,
|
|||||||
if (state == ATK_STATE_SENSITIVE)
|
if (state == ATK_STATE_SENSITIVE)
|
||||||
atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, value);
|
atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, value);
|
||||||
|
|
||||||
|
if (state == ATK_STATE_HORIZONTAL)
|
||||||
|
atk_object_notify_state_change (atk_obj, ATK_STATE_VERTICAL, !value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user