Esempio n. 1
0
File: testimage.c Progetto: BYC/gtk
static void 
_print_image_info(AtkObject *obj) {

  gint height, width;
  G_CONST_RETURN gchar *desc;
  G_CONST_RETURN gchar *name = atk_object_get_name (obj);
  G_CONST_RETURN gchar *type_name = g_type_name(G_TYPE_FROM_INSTANCE (obj));

  height = width = 0;


  if(!ATK_IS_IMAGE(obj)) 
	return;

  g_print("atk_object_get_name : %s\n", name ? name : "<NULL>");
  g_print("atk_object_get_type_name : %s\n",type_name ?type_name :"<NULL>");
  g_print("*** Start Image Info ***\n");
  desc = atk_image_get_image_description(ATK_IMAGE(obj));
  g_print ("atk_image_get_image_desc returns : %s\n",desc ? desc:"<NULL>");
  atk_image_get_image_size(ATK_IMAGE(obj), &height ,&width);
  g_print("atk_image_get_image_size returns: height %d width %d\n",
											height,width);
  if(atk_image_set_image_description(ATK_IMAGE(obj),"New image Description")){
	desc = atk_image_get_image_description(ATK_IMAGE(obj));
	g_print ("atk_image_get_image_desc now returns : %s\n",desc?desc:"<NULL>");
  }
  g_print("*** End Image Info ***\n");


}
Esempio n. 2
0
/**
 * @brief Implementation of get_image_size from AtkImage interface
 *
 * @param image EailButton instance
 * @param [out] width width image
 * @param [out] height height image
 */
static void
eail_button_get_image_size(AtkImage *image,
                           gint     *width,
                           gint     *height)
{
    Evas_Object *widget;
    Evas_Object *button_image;
    AtkObject *obj;

    widget = eail_widget_get_widget(EAIL_WIDGET(image));
    if (!widget)
    {
        *width = -1;
        *height = -1;
        return;
    }

    button_image = elm_object_part_content_get(widget, "icon");
    if (button_image)
    {
        obj = eail_factory_get_accessible(button_image);
        atk_image_get_image_size(ATK_IMAGE(obj), width, height);
    }
    else
    {
        *width = -1;
        *height = -1;
    }
}
Esempio n. 3
0
File: gailbutton.c Progetto: BYC/gtk
static gboolean
gail_button_set_image_description (AtkImage    *image,
                                   const gchar *description)
{
  GtkWidget *widget;
  GtkImage  *button_image;
  AtkObject *obj;

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));

  if (widget == NULL)
    /*
     * State is defunct
     */
    return FALSE;

  button_image = get_image_from_button (widget);

  if (button_image != NULL) 
    {
      obj = gtk_widget_get_accessible (GTK_WIDGET (button_image));
      return atk_image_set_image_description (ATK_IMAGE (obj), description);
    }
  else 
    return FALSE;
}
Esempio n. 4
0
/**
 * @brief Implementation of get_image_position from AtkImage interface
 *
 * @param image EailButton instance
 * @param [out] x horizontal coordinate
 * @param [out] y vertical coordinate
 * @param coord_type coord type
 */
static void
eail_button_get_image_position(AtkImage     *image,
                               gint         *x,
                               gint         *y,
                               AtkCoordType  coord_type)
{
    Evas_Object *button_image;
    Evas_Object *widget;
    AtkObject *obj;

    widget = eail_widget_get_widget(EAIL_WIDGET(image));
    if (!widget)
    {
        *x = G_MININT;
        *y = G_MININT;
        return;
    }

    button_image = elm_object_part_content_get(widget, "icon");
    if (button_image)
    {
        obj = eail_factory_get_accessible(button_image);
        atk_image_get_image_position(ATK_IMAGE(obj), x, y, coord_type);
    }
    else
    {
        *x = G_MININT;
        *y = G_MININT;
    }
}
Esempio n. 5
0
File: gailbutton.c Progetto: BYC/gtk
static void
gail_button_get_image_size (AtkImage *image,
                            gint     *width,
                            gint     *height)
{
  GtkWidget *widget;
  GtkImage  *button_image;
  AtkObject *obj;

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));

  if (widget == NULL)
    {
    /*
     * State is defunct
     */
      *width = -1;
      *height = -1;
      return;
    }

  button_image = get_image_from_button (widget);

  if (button_image != NULL)
    {
      obj = gtk_widget_get_accessible (GTK_WIDGET (button_image));
      atk_image_get_image_size (ATK_IMAGE (obj), width, height); 
    }
  else
    {
      *width = -1;
      *height = -1;
    }
}
Esempio n. 6
0
static void
_do_test(AtkObject *obj)
{
   const char *desc;
   const char *desc_test = "top secret";
   int height = 0, width = 0;
   int x = -1, y = -1;

   atk_image_get_image_position(ATK_IMAGE(obj), &x, &y, ATK_XY_SCREEN);
   _printf("atk_image_get_image_position on screen: x: %d y %d\n", x, y);

   g_assert(NULL == atk_image_get_image_description(ATK_IMAGE(obj)));
   g_assert(TRUE == atk_image_set_image_description(ATK_IMAGE(obj), desc_test));
   desc = atk_image_get_image_description(ATK_IMAGE(obj));
   g_assert_cmpstr(desc_test, ==, desc);

   atk_image_get_image_size(ATK_IMAGE(obj), &height, &width);
   g_assert(ICON_SIZE == height && ICON_SIZE == width);

   eailu_test_code_called = 1;
}
Esempio n. 7
0
static void
_do_test_photo(AtkObject *obj)
{
   const char *name = atk_object_get_name(obj);
   const char *type_name = g_type_name(G_TYPE_FROM_INSTANCE(obj));
   const char * const desc_test = "top secret";
   const char *desc;
   int height = 0, width  = 0;
   int x = -1, y = -1;

   _printf("_get_name: %s\n", name ? name : "NULL");
   _printf("_get_type_name: %s\n", type_name ? type_name : "NULL");

   g_assert(ATK_IS_IMAGE(obj));

   AtkStateSet *state_set = atk_object_ref_state_set(obj);
   g_object_unref(state_set);

   // test AtkImage
   atk_image_get_image_position(ATK_IMAGE(obj), &x, &y, ATK_XY_SCREEN);
   _printf("atk_image_get_image_position on screen: x: %d y %d\n", x, y);

   g_assert(NULL == atk_image_get_image_description(ATK_IMAGE(obj)));
   g_assert(TRUE == atk_image_set_image_description(ATK_IMAGE(obj), desc_test));
   desc = atk_image_get_image_description(ATK_IMAGE(obj));
   _printf("atk_image_get_image_description: %s\n", desc ? desc : "NULL");
   g_assert(NULL != desc);
   g_assert_cmpstr(desc_test, ==, desc);

   atk_image_get_image_size(ATK_IMAGE(obj), &height, &width);
   _printf("atk_image_get_image_size: height %d width %d\n", height, width);

   // test AtkAction
   g_assert(ACTIONS_NUMBER == atk_action_get_n_actions(ATK_ACTION(obj)));
   eailu_test_action_activate(ATK_ACTION(obj), "click");
   g_assert((eailu_get_action_number(ATK_ACTION(obj), "typo")) == -1);
   eailu_test_action_description_all(ATK_ACTION(obj));
}
Esempio n. 8
0
static gboolean
cb_query_tooltip (GtkWidget  *button,
                  gint        x,
                  gint        y,
                  gboolean    keyboard_mode,
                  GtkTooltip *tooltip,
                  gpointer    user_data)
{
    GtkScaleButton *scale_button = GTK_SCALE_BUTTON (button);
    GtkAdjustment *adjustment;
    gdouble val;
    char *str;
    AtkImage *image;

    image = ATK_IMAGE (gtk_widget_get_accessible (button));

    adjustment = gtk_scale_button_get_adjustment (scale_button);
    val = gtk_scale_button_get_value (scale_button);

    if (val < (gtk_adjustment_get_lower (adjustment) + EPSILON))
    {
        str = g_strdup (_("Muted"));
    }
    else if (val >= (gtk_adjustment_get_upper (adjustment) - EPSILON))
    {
        str = g_strdup (_("Full Volume"));
    }
    else
    {
        int percent;

        percent = (int) (100. * val / (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment)) + .5);

        /* Translators: this is the percentage of the current volume,
         * as used in the tooltip, eg. "49 %".
         * Translate the "%d" to "%Id" if you want to use localised digits,
         * or otherwise translate the "%d" to "%d".
         */
        str = g_strdup_printf (C_("volume percentage", "%d %%"), percent);
    }

    gtk_tooltip_set_text (tooltip, str);
    atk_image_set_image_description (image, str);
    g_free (str);

    return TRUE;
}
Esempio n. 9
0
static gboolean
on_scale_button_query_tooltip (GtkWidget  *button,
                               gint        x,
                               gint        y,
                               gboolean    keyboard_mode,
                               GtkTooltip *tooltip,
                               gpointer    user_data)
{
  GtkScaleButton *scale_button = GTK_SCALE_BUTTON (button);
  GtkAdjustment *adjustment;
  gdouble val;
  gchar *str;
  AtkImage *image;

  image = ATK_IMAGE (gtk_widget_get_accessible (button));

  adjustment = gtk_scale_button_get_adjustment (scale_button);
  val = gtk_scale_button_get_value (scale_button);

  if (val < (gtk_adjustment_get_lower (adjustment) + EPSILON))
    {
      str = g_strdup (_("Muted"));
    }
  else if (val >= (gtk_adjustment_get_upper (adjustment) - EPSILON))
    {
      str = g_strdup (_("Full Volume"));
    }
  else
    {
      gint percent;

      percent = (gint) (100. * val / (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment)) + .5);

      str = g_strdup_printf (C_("volume percentage", "%d %%"), percent);
    }

  gtk_tooltip_set_text (tooltip, str);
  atk_image_set_image_description (image, str);
  g_free (str);

  return TRUE;
}
Esempio n. 10
0
File: gailbutton.c Progetto: BYC/gtk
static G_CONST_RETURN gchar* 
gail_button_get_image_description (AtkImage *image) {

  GtkWidget *widget;
  GtkImage  *button_image;
  AtkObject *obj;

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
  if (widget == NULL)
    /*
     * State is defunct
     */
    return NULL;

  button_image = get_image_from_button (widget);

  if (button_image != NULL)
    {
      obj = gtk_widget_get_accessible (GTK_WIDGET (button_image));
      return atk_image_get_image_description (ATK_IMAGE (obj));
    }
  else 
    return NULL;
}