Back to index

unity  6.0.0
Defines | Functions
nux-view-accessible.cpp File Reference
#include "nux-view-accessible.h"
#include "unitya11y.h"
#include "nux-base-window-accessible.h"
#include <Nux/Layout.h>
#include <Nux/Area.h>

Go to the source code of this file.

Defines

#define NUX_VIEW_ACCESSIBLE_GET_PRIVATE(obj)

Functions

static void nux_view_accessible_class_init (NuxViewAccessibleClass *klass)
 SECTION:nux-view-accessible : NuxViewAccessible : Implementation of the ATK interfaces for #nux::View : nux::View.
static void nux_view_accessible_init (NuxViewAccessible *view_accessible)
static void nux_view_accessible_initialize (AtkObject *accessible, gpointer data)
static AtkStateSet * nux_view_accessible_ref_state_set (AtkObject *obj)
static gint nux_view_accessible_get_n_children (AtkObject *obj)
static AtkObject * nux_view_accessible_ref_child (AtkObject *obj, gint i)
static gboolean nux_view_accessible_check_pending_notification (NuxAreaAccessible *self)
static void on_layout_changed_cb (nux::View *view, nux::Layout *layout, AtkObject *accessible, gboolean is_add)
static void on_change_keyboard_receiver_cb (AtkObject *accessible, gboolean focus_in)
 G_DEFINE_TYPE (NuxViewAccessible, nux_view_accessible, NUX_TYPE_AREA_ACCESSIBLE) struct _NuxViewAccessiblePrivate
AtkObject * nux_view_accessible_new (nux::Object *object)

Define Documentation

Value:
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), NUX_TYPE_VIEW_ACCESSIBLE,        \
                                NuxViewAccessiblePrivate))

Function Documentation

G_DEFINE_TYPE ( NuxViewAccessible  ,
nux_view_accessible  ,
NUX_TYPE_AREA_ACCESSIBLE   
)

Definition at line 63 of file nux-view-accessible.cpp.

{
  /* focused using InputArea OnStartKeyboardReceiver and OnStop... signals */
  gboolean key_focused;

  /* if the state from key_focused was notified or not */
  gboolean pending_notification;
};
static gboolean nux_view_accessible_check_pending_notification ( NuxAreaAccessible *  self) [static]

Definition at line 273 of file nux-view-accessible.cpp.

{
  NuxViewAccessible* self = NULL;
  nux::Object* nux_object = NULL;

  /* We also call parent implementation, as we are not totally
     overriding check_pending_notification, just adding extra
     functionality*/
  NUX_AREA_ACCESSIBLE_CLASS(nux_view_accessible_parent_class)->check_pending_notification(area_accessible);

  g_return_val_if_fail(NUX_IS_VIEW_ACCESSIBLE(area_accessible), FALSE);
  self = NUX_VIEW_ACCESSIBLE(area_accessible);

  if (self->priv->pending_notification == FALSE)
    return FALSE;

  nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(self));
  if (nux_object == NULL) /* defunct */
    return FALSE;

  g_signal_emit_by_name(self, "focus_event", self->priv->key_focused);
  atk_focus_tracker_notify(ATK_OBJECT(self));
  self->priv->pending_notification = FALSE;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void nux_view_accessible_class_init ( NuxViewAccessibleClass *  klass) [static]

SECTION:nux-view-accessible : NuxViewAccessible : Implementation of the ATK interfaces for #nux::View : nux::View.

NuxViewAccessible implements the required ATK interfaces of

nux::View

Definition at line 82 of file nux-view-accessible.cpp.

{
  GObjectClass* gobject_class = G_OBJECT_CLASS(klass);
  AtkObjectClass* atk_class = ATK_OBJECT_CLASS(klass);
  NuxAreaAccessibleClass* area_class = NUX_AREA_ACCESSIBLE_CLASS(klass);

  /* AtkObject */
  atk_class->initialize = nux_view_accessible_initialize;
  atk_class->ref_state_set = nux_view_accessible_ref_state_set;
  atk_class->ref_child = nux_view_accessible_ref_child;
  atk_class->get_n_children = nux_view_accessible_get_n_children;

  /* NuxAreaAccessible */
  area_class->check_pending_notification = nux_view_accessible_check_pending_notification;

  g_type_class_add_private(gobject_class, sizeof(NuxViewAccessiblePrivate));
}

Here is the call graph for this function:

static gint nux_view_accessible_get_n_children ( AtkObject *  obj) [static]

Definition at line 177 of file nux-view-accessible.cpp.

{
  nux::Object* nux_object = NULL;
  nux::View* view = NULL;
  nux::Layout* layout = NULL;

  g_return_val_if_fail(NUX_IS_VIEW_ACCESSIBLE(obj), 0);

  nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(obj));
  if (nux_object == NULL) /* state is defunct */
    return 0;

  view = dynamic_cast<nux::View*>(nux_object);

  layout = view->GetLayout();

  if (layout == NULL)
    return 0;
  else
    return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void nux_view_accessible_init ( NuxViewAccessible *  view_accessible) [static]

Definition at line 101 of file nux-view-accessible.cpp.

{
  NuxViewAccessiblePrivate* priv =
    NUX_VIEW_ACCESSIBLE_GET_PRIVATE(view_accessible);

  view_accessible->priv = priv;
}
static void nux_view_accessible_initialize ( AtkObject *  accessible,
gpointer  data 
) [static]

Definition at line 125 of file nux-view-accessible.cpp.

{
  nux::Object* nux_object = NULL;
  nux::View* view = NULL;

  ATK_OBJECT_CLASS(nux_view_accessible_parent_class)->initialize(accessible, data);

  accessible->role = ATK_ROLE_UNKNOWN;

  nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(accessible));
  view = dynamic_cast<nux::View*>(nux_object);

  view->LayoutAdded.connect(sigc::bind(sigc::ptr_fun(on_layout_changed_cb),
                                       accessible, TRUE));
  view->LayoutRemoved.connect(sigc::bind(sigc::ptr_fun(on_layout_changed_cb),
                                         accessible, FALSE));

  /* Some extra focus things as Focusable is not used on Launcher and
     some BaseWindow */
  view->begin_key_focus.connect(sigc::bind(sigc::ptr_fun(on_change_keyboard_receiver_cb),
                                           accessible, TRUE));
  view->end_key_focus.connect(sigc::bind(sigc::ptr_fun(on_change_keyboard_receiver_cb),
                                         accessible, FALSE));
}

Here is the call graph for this function:

Here is the caller graph for this function:

AtkObject* nux_view_accessible_new ( nux::Object *  object)

Definition at line 110 of file nux-view-accessible.cpp.

{
  AtkObject* accessible = NULL;

  g_return_val_if_fail(dynamic_cast<nux::View*>(object), NULL);

  accessible = ATK_OBJECT(g_object_new(NUX_TYPE_VIEW_ACCESSIBLE, NULL));

  atk_object_initialize(accessible, object);

  return accessible;
}

Here is the caller graph for this function:

static AtkObject * nux_view_accessible_ref_child ( AtkObject *  obj,
gint  i 
) [static]

Definition at line 200 of file nux-view-accessible.cpp.

{
  nux::Object* nux_object = NULL;
  nux::View* view = NULL;
  nux::Layout* layout = NULL;
  AtkObject* layout_accessible = NULL;
  gint num = 0;

  g_return_val_if_fail(NUX_IS_VIEW_ACCESSIBLE(obj), 0);

  num = atk_object_get_n_accessible_children(obj);
  g_return_val_if_fail((i < num) && (i >= 0), NULL);

  nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(obj));
  if (nux_object == NULL) /* state is defunct */
    return 0;

  view = dynamic_cast<nux::View*>(nux_object);

  layout = view->GetLayout();

  layout_accessible = unity_a11y_get_accessible(layout);

  if (layout_accessible != NULL)
    g_object_ref(layout_accessible);

  return layout_accessible;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static AtkStateSet * nux_view_accessible_ref_state_set ( AtkObject *  obj) [static]

Definition at line 152 of file nux-view-accessible.cpp.

{
  AtkStateSet* state_set = NULL;
  nux::Object* nux_object = NULL;
  NuxViewAccessible* self = NULL;

  g_return_val_if_fail(NUX_IS_VIEW_ACCESSIBLE(obj), NULL);
  self = NUX_VIEW_ACCESSIBLE(obj);

  state_set = ATK_OBJECT_CLASS(nux_view_accessible_parent_class)->ref_state_set(obj);

  nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(obj));

  if (nux_object == NULL) /* defunct */
    return state_set;

  /* HasKeyboardFocus is not a reliable here:
     see bug https://bugs.launchpad.net/nux/+bug/745049 */
  if (self->priv->key_focused)
    atk_state_set_add_state(state_set, ATK_STATE_FOCUSED);

  return state_set;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void on_change_keyboard_receiver_cb ( AtkObject *  accessible,
gboolean  focus_in 
) [static]

Definition at line 253 of file nux-view-accessible.cpp.

{
  NuxViewAccessible* self = NULL;

  g_return_if_fail(NUX_IS_VIEW_ACCESSIBLE(accessible));
  self = NUX_VIEW_ACCESSIBLE(accessible);

  if (self->priv->key_focused != focus_in)
  {
    self->priv->key_focused = focus_in;

    /* we always led the focus notification to
       _check_pending_notification, in order to allow the proper
       window_activate -> focus_change order */
    self->priv->pending_notification = TRUE;
  }
}

Here is the caller graph for this function:

static void on_layout_changed_cb ( nux::View *  view,
nux::Layout *  layout,
AtkObject *  accessible,
gboolean  is_add 
) [static]

Definition at line 231 of file nux-view-accessible.cpp.

{
  const gchar* signal_name = NULL;
  AtkObject* atk_child = NULL;

  g_return_if_fail(NUX_IS_VIEW_ACCESSIBLE(accessible));

  atk_child = unity_a11y_get_accessible(layout);

  if (is_add)
    signal_name = "children-changed::add";
  else
    signal_name = "children-changed::remove";

  /* index is always 0 as there is always just one layout */
  g_signal_emit_by_name(accessible, signal_name, 0, atk_child, NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function: