static AtkObject*
refSelectionCB(AtkSelection *aSelection, gint i)
{
  AtkObject* atkObj = nullptr;
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
  if (accWrap && accWrap->IsSelect()) {
    Accessible* selectedItem = accWrap->GetSelectedItem(i);
    if (!selectedItem) {
      return nullptr;
    }

    atkObj = AccessibleWrap::GetAtkObject(selectedItem);
  } else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aSelection))) {
    ProxyAccessible* selectedItem = proxy->GetSelectedItem(i);
    if (selectedItem) {
      atkObj = GetWrapperFor(selectedItem);
    }
  }

  if (atkObj) {
    g_object_ref(atkObj);
  }

  return atkObj;
}
static gboolean
selectAllSelectionCB(AtkSelection *aSelection)
{
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
  if (!accWrap || !accWrap->IsSelect())
    return FALSE;

  return accWrap->SelectAll();
}
static gboolean
removeSelectionCB(AtkSelection *aSelection, gint i)
{
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
  if (!accWrap || !accWrap->IsSelect())
    return FALSE;

  return accWrap->RemoveItemFromSelection(i);
}
static gboolean
isChildSelectedCB(AtkSelection *aSelection, gint i)
{
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
  if (!accWrap || !accWrap->IsSelect())
    return FALSE;

  return accWrap->IsItemSelected(i);
}
static gint
getSelectionCountCB(AtkSelection *aSelection)
{
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
  if (!accWrap || !accWrap->IsSelect())
    return -1;

  return accWrap->SelectedItemCount();
}
static gboolean
addSelectionCB(AtkSelection *aSelection, gint i)
{
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
  if (!accWrap || !accWrap->IsSelect())
    return FALSE;

  return accWrap->AddItemToSelection(i);
}
static gboolean
isChildSelectedCB(AtkSelection *aSelection, gint i)
{
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
  if (accWrap && accWrap->IsSelect()) {
    return accWrap->IsItemSelected(i);
  }

  if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aSelection))) {
    return proxy->IsItemSelected(i);
  }

  return FALSE;
}
static gint
getSelectionCountCB(AtkSelection *aSelection)
{
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
  if (accWrap && accWrap->IsSelect()) {
    return accWrap->SelectedItemCount();
  }

  if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aSelection))) {
    return proxy->SelectedItemCount();
  }

  return -1;
}
static gboolean
clearSelectionCB(AtkSelection *aSelection)
{
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
  if (accWrap && accWrap->IsSelect()) {
    return accWrap->UnselectAll();
  }

  if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aSelection))) {
    return proxy->UnselectAll();
  }

  return FALSE;
}
示例#10
0
static gboolean
removeSelectionCB(AtkSelection *aSelection, gint i)
{
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
  if (accWrap && accWrap->IsSelect()) {
    return accWrap->RemoveItemFromSelection(i);
  }

  if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aSelection))) {
    return proxy->RemoveItemFromSelection(i);
  }

  return FALSE;
}
static AtkObject*
refSelectionCB(AtkSelection *aSelection, gint i)
{
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
  if (!accWrap || !accWrap->IsSelect())
    return nullptr;

  Accessible* selectedItem = accWrap->GetSelectedItem(i);
  if (!selectedItem)
    return nullptr;

  AtkObject* atkObj = AccessibleWrap::GetAtkObject(selectedItem);
  if (atkObj)
    g_object_ref(atkObj);

  return atkObj;
}