示例#1
0
static void _property_change_handler (AtkObject   *obj,
                                      AtkPropertyValues   *values)
{
  G_CONST_RETURN gchar *type_name = g_type_name (G_TYPE_FROM_INSTANCE (obj));
  G_CONST_RETURN gchar *name = atk_object_get_name (obj);

  g_print ("_property_change_handler: Accessible Type: %s\n",
           type_name ? type_name : "NULL");
  g_print ("_property_change_handler: Accessible name: %s\n",
           name ? name : "NULL");
  g_print ("_property_change_handler: PropertyName: %s\n",
           values->property_name ? values->property_name: "NULL");
  if (strcmp (values->property_name, "accessible-value") == 0)
  {
    GValue *value, val;
    int position;
    value = &val;

    memset (value, 0, sizeof (GValue));
    atk_value_get_current_value (ATK_VALUE (obj), value);
    g_return_if_fail (G_VALUE_HOLDS_INT (value));
    position = g_value_get_int (value); 
    g_print ("Position is  %d previous position was %d\n", 
             position, last_position);
    last_position = position;
    atk_value_get_minimum_value (ATK_VALUE (obj), value);
    g_return_if_fail (G_VALUE_HOLDS_INT (value));
    position = g_value_get_int (value); 
    g_print ("Minimum Value is  %d\n", position); 
    atk_value_get_maximum_value (ATK_VALUE (obj), value);
    g_return_if_fail (G_VALUE_HOLDS_INT (value));
    position = g_value_get_int (value); 
    g_print ("Maximum Value is  %d\n", position); 
  }
}
示例#2
0
static VALUE
rg_min(VALUE self)
{
    GValue gval = G_VALUE_INIT;
    atk_value_get_minimum_value(_SELF(self), &gval);

    return GVAL2RVAL(&gval);
}
示例#3
0
double AccessibilityUIElement::minValue()
{
    if (!ATK_IS_VALUE(m_element))
        return 0;

    GValue value = G_VALUE_INIT;
    atk_value_get_minimum_value(ATK_VALUE(m_element), &value);
    if (!G_VALUE_HOLDS_FLOAT(&value))
        return 0;
    return g_value_get_float(&value);
}
示例#4
0
double AccessibilityUIElement::minValue()
{
    if (!m_element || !ATK_IS_OBJECT(m_element.get()))
        return 0.0f;

    GValue value = G_VALUE_INIT;
    atk_value_get_minimum_value(ATK_VALUE(m_element.get()), &value);
    if (!G_VALUE_HOLDS_FLOAT(&value))
        return 0.0f;

    return g_value_get_float(&value);
}
double AccessibilityUIElement::minValue()
{
    GValue value = { 0, { { 0 } } };

    if (!ATK_IS_VALUE(m_element))
        return 0.0f;

    atk_value_get_minimum_value(ATK_VALUE(m_element), &value);

    if (G_VALUE_HOLDS_DOUBLE(&value))
        return g_value_get_double(&value);
    else if (G_VALUE_HOLDS_INT(&value))
        return static_cast<double>(g_value_get_int(&value));
    else
        return 0.0f;
}
示例#6
0
文件: gailspinbutton.c 项目: BYC/gtk
static void 
gail_spin_button_get_minimum_value (AtkValue       *obj,
                                    GValue         *value)
{
 GailSpinButton *spin_button;

  g_return_if_fail (GAIL_IS_SPIN_BUTTON (obj));

  spin_button = GAIL_SPIN_BUTTON (obj);
  if (spin_button->adjustment == NULL)
    /*
     * Adjustment has not been specified
     */
    return;

  atk_value_get_minimum_value (ATK_VALUE (spin_button->adjustment), value);
}
示例#7
0
static void _value_change_handler (AtkObject   *obj,
                                   AtkPropertyValues   *values)
{
  const gchar *type_name = g_type_name (G_TYPE_FROM_INSTANCE (obj));
   GValue *value_back, val;

  value_back = &val;
    
  if (!ATK_IS_VALUE (obj)) { 
   	return;
  }

  if (strcmp (values->property_name, "accessible-value") == 0) {
	g_print ("_value_change_handler: Accessible Type: %s\n",
           type_name ? type_name : "NULL");
	if(G_VALUE_HOLDS_DOUBLE (&values->new_value))
    {
		g_print( "adjustment value changed : new value: %f\n", 
		g_value_get_double (&values->new_value));
 	}

	g_print("Now calling the AtkValue interface functions\n");

  	atk_value_get_current_value (ATK_VALUE(obj), value_back);
  	g_return_if_fail (G_VALUE_HOLDS_DOUBLE (value_back));
  	g_print ("atk_value_get_current_value returns %f\n",
			g_value_get_double (value_back)	);

  	atk_value_get_maximum_value (ATK_VALUE (obj), value_back);
  	g_return_if_fail (G_VALUE_HOLDS_DOUBLE (value_back));
  	g_print ("atk_value_get_maximum returns %f\n",
			g_value_get_double (value_back));

  	atk_value_get_minimum_value (ATK_VALUE (obj), value_back);
  	g_return_if_fail (G_VALUE_HOLDS_DOUBLE (value_back));
  	g_print ("atk_value_get_minimum returns %f\n", 
			g_value_get_double (value_back));
	
 
    }
  
}
示例#8
0
static void
_do_test(AtkObject *obj)
{
   int child_count = 0;
   child_count = atk_object_get_n_accessible_children(obj);
   g_assert(child_count == 2);
   _printf("n_accessible_children - done\n");

   AtkStateSet *state_set = atk_object_ref_state_set(obj);
   gboolean v_contains = atk_state_set_contains_state(state_set,
                                                      ATK_STATE_VERTICAL);
   gboolean h_contains = atk_state_set_contains_state(state_set,
                                                      ATK_STATE_HORIZONTAL);
   g_object_unref(state_set);
   g_assert(v_contains || h_contains);
   _printf("ref_state_set - done\n");

   /*AtkValue iface tests*/
   g_assert(ATK_IS_VALUE(obj));
   GValue value = G_VALUE_INIT;
   double d_value;
   atk_value_get_maximum_value(ATK_VALUE(obj), &value);
   d_value = g_value_get_double(&value);
   g_assert(d_value == 1.0);
   atk_value_get_minimum_value(ATK_VALUE(obj), &value);
   d_value = g_value_get_double(&value);
   g_assert(d_value == 0.0);
   g_value_set_double(&value, 0.3);
   gboolean success = atk_value_set_current_value(ATK_VALUE(obj), &value);
   g_assert(success);
   atk_value_get_current_value(ATK_VALUE(obj), &value);
   g_assert(G_VALUE_HOLDS_DOUBLE(&value));
   d_value = g_value_get_double(&value);
   g_assert(d_value == 0.3);
   _printf("atk_value - done\n");

   eailu_test_atk_focus(obj, TRUE);
}