當前位置: 首頁>>代碼示例>>C++>>正文


C++ GTK_ACCESSIBLE函數代碼示例

本文整理匯總了C++中GTK_ACCESSIBLE函數的典型用法代碼示例。如果您正苦於以下問題:C++ GTK_ACCESSIBLE函數的具體用法?C++ GTK_ACCESSIBLE怎麽用?C++ GTK_ACCESSIBLE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GTK_ACCESSIBLE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: gail_label_get_text

static gchar*
gail_label_get_text (AtkText *text,
                     gint    start_pos,
                     gint    end_pos)
{
  GtkWidget *widget;
  GtkLabel  *label;

  const gchar *label_text;

  widget = GTK_ACCESSIBLE (text)->widget;
  if (widget == NULL)
    /* State is defunct */
    return NULL;

  label = GTK_LABEL (widget);

  label_text = gtk_label_get_text (label);
 
  if (label_text == NULL)
    return NULL;
  else
  {
    if (GAIL_LABEL (text)->textutil == NULL) 
      gail_label_init_text_util (GAIL_LABEL (text), widget);
    return gail_text_util_get_substring (GAIL_LABEL(text)->textutil, 
                                         start_pos, end_pos);
  }
}
開發者ID:coapp-packages,項目名稱:gtk,代碼行數:29,代碼來源:gaillabel.c

示例2: gail_expander_get_n_children

static gint
gail_expander_get_n_children (AtkObject* obj)
{
  GtkWidget *widget;
  GList *children;
  gint count = 0;

  g_return_val_if_fail (GAIL_IS_CONTAINER (obj), count);

  widget = GTK_ACCESSIBLE (obj)->widget;
  if (widget == NULL)
    return 0;

  children = gtk_container_get_children (GTK_CONTAINER(widget));
  count = g_list_length (children);
  g_list_free (children);

  /* See if there is a label - if there is, reduce our count by 1
   * since we don't want the label included with the children.
   */
  if (gtk_expander_get_label_widget (GTK_EXPANDER (widget)))
    count -= 1;

  return count; 
}
開發者ID:Aridna,項目名稱:gtk2,代碼行數:25,代碼來源:gailexpander.c

示例3: gail_expander_get_text

static gchar*
gail_expander_get_text (AtkText *text,
                        gint    start_pos,
                        gint    end_pos)
{
  GtkWidget *widget;
  GailExpander *expander;
  const gchar *label_text;

  widget = GTK_ACCESSIBLE (text)->widget;
  if (widget == NULL)
    /* State is defunct */
    return NULL;

  expander = GAIL_EXPANDER (text);
  if (!expander->textutil) 
    gail_expander_init_textutil (expander, GTK_EXPANDER (widget));

  label_text = gail_expander_get_full_text (GTK_EXPANDER (widget));

  if (label_text == NULL)
    return NULL;
  else
    return gail_text_util_get_substring (expander->textutil, 
                                         start_pos, end_pos);
}
開發者ID:Aridna,項目名稱:gtk2,代碼行數:26,代碼來源:gailexpander.c

示例4: panel_menu_button_accessible_get_n_children

static int
panel_menu_button_accessible_get_n_children (AtkObject *obj)
{
	g_return_val_if_fail (PANEL_IS_MENU_BUTTON_ACCESSIBLE (obj), 0);

	return GTK_ACCESSIBLE (obj)->widget ? 1 : 0;
}
開發者ID:guadalinex-archive,項目名稱:guadalinex-v4,代碼行數:7,代碼來源:panel-menu-button.c

示例5: gail_window_get_size

static void
gail_window_get_size (AtkComponent *component,
                      gint         *width,
                      gint         *height)
{
  GtkWidget *widget = GTK_ACCESSIBLE (component)->widget; 
  GdkRectangle rect;

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

  gail_return_if_fail (GTK_IS_WINDOW (widget));

  if (!gtk_widget_is_toplevel (widget))
    {
      AtkComponentIface *parent_iface;

      parent_iface = (AtkComponentIface *) g_type_interface_peek_parent (ATK_COMPONENT_GET_IFACE (component));
      parent_iface->get_size (component, width, height);
      return;
    }
  gdk_window_get_frame_extents (widget->window, &rect);

  *width = rect.width;
  *height = rect.height;
}
開發者ID:Aridna,項目名稱:gtk2,代碼行數:29,代碼來源:gailwindow.c

示例6: gtk_menu_shell_accessible_is_child_selected

static gboolean
gtk_menu_shell_accessible_is_child_selected (AtkSelection *selection,
                                             gint          i)
{
  GtkMenuShell *shell;
  GList *kids;
  gint j;
  GtkWidget *widget;
  GtkWidget *item;

  widget =  gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
  if (widget == NULL)
    return FALSE;

  shell = GTK_MENU_SHELL (widget);
  item = gtk_menu_shell_get_selected_item (shell);
  if (item == NULL)
    return FALSE;

  kids = gtk_container_get_children (GTK_CONTAINER (shell));
  j = g_list_index (kids, item);
  g_list_free (kids);

  return j==i;
}
開發者ID:ceibal-tatu,項目名稱:gtk-3.0,代碼行數:25,代碼來源:gtkmenushellaccessible.c

示例7: gail_label_get_offset_at_point

static gint 
gail_label_get_offset_at_point (AtkText      *text,
                                gint         x,
                                gint         y,
			        AtkCoordType coords)
{ 
  GtkWidget *widget;
  GtkLabel *label;
  gint index, x_layout, y_layout;

  widget = GTK_ACCESSIBLE (text)->widget;
  if (widget == NULL)
    /* State is defunct */
    return -1;
  label = GTK_LABEL (widget);
  
  gtk_label_get_layout_offsets (label, &x_layout, &y_layout);
  
  index = gail_misc_get_index_at_point_in_layout (widget, 
                                              gtk_label_get_layout (label), 
                                              x_layout, y_layout, x, y, coords);
  if (index == -1)
    {
      if (coords == ATK_XY_WINDOW || coords == ATK_XY_SCREEN)
        return g_utf8_strlen (label->text, -1);

      return index;  
    }
  else
    return g_utf8_pointer_to_offset (label->text, label->text + index);  
}
開發者ID:coapp-packages,項目名稱:gtk,代碼行數:31,代碼來源:gaillabel.c

示例8: gail_pixmap_get_image_size

static void  
gail_pixmap_get_image_size (AtkImage       *obj,
                            gint           *width,
                            gint           *height)
{
  GtkWidget *widget;
  GtkPixmap *pixmap;
 
  *width = -1;
  *height = -1;

  g_return_if_fail (GAIL_IS_PIXMAP (obj));

  widget = GTK_ACCESSIBLE (obj)->widget;
  if (widget == 0)
    /* State is defunct */
    return;

  g_return_if_fail (GTK_IS_PIXMAP (widget));

  pixmap = GTK_PIXMAP (widget);

  if (pixmap->pixmap)
    gdk_drawable_get_size (pixmap->pixmap, width, height);
}
開發者ID:Aridna,項目名稱:gtk2,代碼行數:25,代碼來源:gailpixmap.c

示例9: gail_label_set_selection

static gboolean
gail_label_set_selection (AtkText *text,
			  gint	  selection_num,
                          gint    start_pos,
                          gint    end_pos)
{
  GtkWidget *widget;
  GtkLabel  *label;
  gint start, end;

  widget = GTK_ACCESSIBLE (text)->widget;
  if (widget == NULL)
    /* State is defunct */
    return FALSE;

  if (selection_num != 0)
     return FALSE;

  label = GTK_LABEL (widget);

  if (!gtk_label_get_selectable (label))
     return FALSE;

  if (gtk_label_get_selection_bounds (label, &start, &end))
    {
      gtk_label_select_region (label, start_pos, end_pos);
      return TRUE;
    }
  else
    return FALSE;
}
開發者ID:coapp-packages,項目名稱:gtk,代碼行數:31,代碼來源:gaillabel.c

示例10: gail_label_get_selection

static gchar*
gail_label_get_selection (AtkText *text,
			  gint    selection_num,
                          gint    *start_pos,
                          gint    *end_pos)
{
  GtkWidget *widget;
  GtkLabel  *label;

  widget = GTK_ACCESSIBLE (text)->widget;
  if (widget == NULL)
    /* State is defunct */
    return NULL;

  label = GTK_LABEL (widget);

 /* Only let the user get the selection if one is set, and if the
  * selection_num is 0.
  */
  if (!gtk_label_get_selectable( label) || selection_num != 0)
     return NULL;

  if (gtk_label_get_selection_bounds (label, start_pos, end_pos))
    {
      const gchar* label_text = gtk_label_get_text (label);
    
      if (label_text == NULL)
        return 0;
      else
        return gail_text_util_get_substring (GAIL_LABEL (text)->textutil, 
                                             *start_pos, *end_pos);
    }
  else 
    return NULL;
}
開發者ID:coapp-packages,項目名稱:gtk,代碼行數:35,代碼來源:gaillabel.c

示例11: gail_label_get_text_after_offset

static gchar*
gail_label_get_text_after_offset (AtkText         *text,
				  gint            offset,
				  AtkTextBoundary boundary_type,
				  gint            *start_offset,
				  gint            *end_offset)
{
  GtkWidget *widget;
  GtkLabel *label;

  widget = GTK_ACCESSIBLE (text)->widget;
  
  if (widget == NULL)
  {
    /* State is defunct */
    return NULL;
  }
  
  /* Get label */
  label = GTK_LABEL (widget);

  return gail_text_util_get_text (GAIL_LABEL (text)->textutil,
                           gtk_label_get_layout (label), GAIL_AFTER_OFFSET, 
                           boundary_type, offset, start_offset, end_offset);
}
開發者ID:coapp-packages,項目名稱:gtk,代碼行數:25,代碼來源:gaillabel.c

示例12: ev_view_accessible_action_do_action

static gboolean
ev_view_accessible_action_do_action (AtkAction *action,
				     gint      i)
{
	EvViewAccessiblePriv* priv = EV_VIEW_ACCESSIBLE_GET_PRIVATE (action);

	if (gtk_accessible_get_widget (GTK_ACCESSIBLE (action)) == NULL)
		return FALSE;

	if (priv->action_idle_handler)
		return FALSE;

	switch (i) {
	case ACTION_SCROLL_UP:
		priv->idle_scroll = GTK_SCROLL_PAGE_BACKWARD;
		break;
	case ACTION_SCROLL_DOWN:
		priv->idle_scroll = GTK_SCROLL_PAGE_FORWARD;
		break;
	default:
		return FALSE;
	}
	priv->action_idle_handler = g_idle_add (ev_view_accessible_idle_do_action,
	                                        action);
	return TRUE;
}
開發者ID:RavetcoFX,項目名稱:gnome-apps,代碼行數:26,代碼來源:ev-view-accessible.c

示例13: gtk_menu_shell_accessible_add_selection

static gboolean
gtk_menu_shell_accessible_add_selection (AtkSelection *selection,
                                         gint          i)
{
  GList *kids;
  GtkWidget *item;
  guint length;
  GtkWidget *widget;

  widget =  gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
  if (widget == NULL)
    return FALSE;

  kids = gtk_container_get_children (GTK_CONTAINER (widget));
  length = g_list_length (kids);
  if (i < 0 || i > length)
    {
      g_list_free (kids);
      return FALSE;
    }

  item = g_list_nth_data (kids, i);
  g_list_free (kids);
  g_return_val_if_fail (GTK_IS_MENU_ITEM (item), FALSE);
  gtk_menu_shell_select_item (GTK_MENU_SHELL (widget), item);
  return TRUE;
}
開發者ID:ceibal-tatu,項目名稱:gtk-3.0,代碼行數:27,代碼來源:gtkmenushellaccessible.c

示例14: gtk_check_menu_item_accessible_ref_state_set

static AtkStateSet *
gtk_check_menu_item_accessible_ref_state_set (AtkObject *accessible)
{
  AtkStateSet *state_set;
  GtkCheckMenuItem *check_menu_item;
  GtkWidget *widget;

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
  if (widget == NULL)
    return NULL;

  state_set = ATK_OBJECT_CLASS (gtk_check_menu_item_accessible_parent_class)->ref_state_set (accessible);

  check_menu_item = GTK_CHECK_MENU_ITEM (widget);

  if (gtk_check_menu_item_get_active (check_menu_item))
    atk_state_set_add_state (state_set, ATK_STATE_CHECKED);

  if (gtk_check_menu_item_get_inconsistent (check_menu_item))
    {
      atk_state_set_remove_state (state_set, ATK_STATE_ENABLED);
      atk_state_set_add_state (state_set, ATK_STATE_INDETERMINATE);
    }

  return state_set;
}
開發者ID:3v1n0,項目名稱:gtk,代碼行數:26,代碼來源:gtkcheckmenuitemaccessible.c

示例15: gtk_menu_shell_accessible_ref_selection

static AtkObject *
gtk_menu_shell_accessible_ref_selection (AtkSelection *selection,
                                         gint          i)
{
  GtkMenuShell *shell;
  AtkObject *obj;
  GtkWidget *widget;
  GtkWidget *item;

  widget =  gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
  if (widget == NULL)
    return NULL;

  if (i != 0)
    return NULL;

  shell = GTK_MENU_SHELL (widget);

  item = gtk_menu_shell_get_selected_item (shell);
  if (item != NULL)
    {
      obj = gtk_widget_get_accessible (item);
      g_object_ref (obj);
      return obj;
    }
  return NULL;
}
開發者ID:ceibal-tatu,項目名稱:gtk-3.0,代碼行數:27,代碼來源:gtkmenushellaccessible.c


注:本文中的GTK_ACCESSIBLE函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。