本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}