* AT-SPI - Assistive Technology Service Provider Interface
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
*
- * Copyright 2001 Sun Microsystems Inc.
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
atk_state_types[Accessibility_STATE_VERTICAL] = ATK_STATE_VERTICAL;
accessible_state_types[ATK_STATE_VISIBLE] = Accessibility_STATE_VISIBLE;
atk_state_types[Accessibility_STATE_VISIBLE] = ATK_STATE_VISIBLE;
+ accessible_state_types[ATK_STATE_MANAGES_DESCENDANTS] = Accessibility_STATE_MANAGES_DESCENDANTS;
+ atk_state_types[Accessibility_STATE_MANAGES_DESCENDANTS] = ATK_STATE_MANAGES_DESCENDANTS;
return TRUE;
}
+static inline AtkState
+state_spi_to_atk (Accessibility_StateType state)
+{
+ guint idx = state;
+ if (idx < Accessibility_STATE_LAST_DEFINED)
+ return atk_state_types [idx];
+ else
+ return ATK_STATE_INVALID;
+}
+AtkState
+spi_atk_state_from_spi_state (Accessibility_StateType state)
+{
+ spi_init_state_type_tables ();
+ return state_spi_to_atk (state);
+}
static AtkStateSet *
atk_state_set_from_servant (PortableServer_Servant servant)
return ATK_STATE_SET(base->gobj);
}
+AtkStateSet *
+spi_state_set_cache_from_sequence (const Accessibility_StateSeq *seq)
+{
+ int i;
+ AtkStateSet *set;
+ AtkStateType *states;
+ spi_init_state_type_tables ();
+
+ states = g_newa (AtkStateType, seq->_length);
+ for (i = 0; i < seq->_length; i++)
+ states [i] = state_spi_to_atk (seq->_buffer [i]);
+
+ set = atk_state_set_new ();
+ atk_state_set_add_states (set, states, seq->_length);
+
+ return set;
+}
static AtkStateSet *
atk_state_set_from_accessibility_state_set (Accessibility_StateSet set, CORBA_Environment *ev)
{
- AtkStateType *states, *tmp;
AtkStateSet *rv;
- gint i;
Accessibility_StateSeq *seq;
seq = Accessibility_StateSet_getStates (set, ev);
- states = tmp = g_new (AtkStateType, seq->_length);
- for (i = 0; i < seq->_length; i++)
- *tmp++ = atk_state_types[seq->_buffer[i]];
- rv = atk_state_set_new ();
- atk_state_set_add_states (rv, states, seq->_length);
+ rv = spi_state_set_cache_from_sequence (seq);
CORBA_free (seq);
- g_free (states);
+
return rv;
}
-
SpiStateSet *
spi_state_set_new (AtkStateSet *obj)
{
}
-
static CORBA_boolean
impl_contains (PortableServer_Servant servant,
const Accessibility_StateType state,
AtkStateSet *set = atk_state_set_from_servant (servant);
g_return_val_if_fail (set, FALSE);
- return atk_state_set_contains_state (set, atk_state_types[state]);
+ return atk_state_set_contains_state (set, state_spi_to_atk (state));
}
-
static void
-impl_add(PortableServer_Servant servant,
- const Accessibility_StateType state,
- CORBA_Environment * ev)
+impl_add (PortableServer_Servant servant,
+ const Accessibility_StateType state,
+ CORBA_Environment * ev)
{
AtkStateSet *set = atk_state_set_from_servant (servant);
g_return_if_fail (set);
- atk_state_set_add_state (set, atk_state_types[state]);
+ atk_state_set_add_state (set, state_spi_to_atk (state));
}
-
static void
impl_remove (PortableServer_Servant servant,
const Accessibility_StateType state,
AtkStateSet *set = atk_state_set_from_servant (servant);
g_return_if_fail (set);
- atk_state_set_remove_state (set, atk_state_types[state]);
+ atk_state_set_remove_state (set, state_spi_to_atk (state));
}
-
static CORBA_boolean
impl_equals (PortableServer_Servant servant,
const Accessibility_StateSet stateSet,
}
-
static Accessibility_StateSet
impl_compare (PortableServer_Servant servant,
const Accessibility_StateSet compareState,
}
-
static CORBA_boolean
impl_isEmpty (PortableServer_Servant servant,
CORBA_Environment * ev)
}
-
static Accessibility_StateSeq *
impl_getStates (PortableServer_Servant servant,
CORBA_Environment * ev)
states = g_slist_append (states, (gpointer) Accessibility_STATE_VERTICAL);
if (atk_state_set_contains_state (set, ATK_STATE_VISIBLE))
states = g_slist_append (states, (gpointer) Accessibility_STATE_VISIBLE);
+ if (atk_state_set_contains_state (set, ATK_STATE_MANAGES_DESCENDANTS))
+ states = g_slist_append (states, (gpointer) Accessibility_STATE_MANAGES_DESCENDANTS);
rv = Accessibility_StateSeq__alloc ();
rv->_length = rv->_maximum = g_slist_length (states);
}
-
static void
spi_state_set_class_init (SpiStateSetClass *klass)
{