本文整理汇总了C++中accessibilityobject::AccessibilityChildrenVector::size方法的典型用法代码示例。如果您正苦于以下问题:C++ AccessibilityChildrenVector::size方法的具体用法?C++ AccessibilityChildrenVector::size怎么用?C++ AccessibilityChildrenVector::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类accessibilityobject::AccessibilityChildrenVector
的用法示例。
在下文中一共展示了AccessibilityChildrenVector::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: webkitAccessibleSelectionGetSelectionCount
static gint webkitAccessibleSelectionGetSelectionCount(AtkSelection* selection)
{
g_return_val_if_fail(ATK_SELECTION(selection), 0);
returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(selection), 0);
AccessibilityObject* coreSelection = core(selection);
if (!coreSelection || !coreSelection->isAccessibilityRenderObject())
return 0;
if (coreSelection->isListBox()) {
AccessibilityObject::AccessibilityChildrenVector selectedItems;
coreSelection->selectedChildren(selectedItems);
return static_cast<gint>(selectedItems.size());
}
if (coreSelection->isMenuList()) {
RenderObject* renderer = coreSelection->renderer();
if (!renderer)
return 0;
int selectedIndex = downcast<HTMLSelectElement>(renderer->node())->selectedIndex();
return selectedIndex >= 0 && selectedIndex < static_cast<int>(downcast<HTMLSelectElement>(renderer->node())->listItems().size());
}
return 0;
}
示例2: optionFromSelection
static AccessibilityObject* optionFromSelection(AtkSelection* selection, gint index)
{
// i is the ith selection as opposed to the ith child.
AccessibilityObject* coreSelection = core(selection);
if (!coreSelection || !coreSelection->isAccessibilityRenderObject() || index < 0)
return 0;
AccessibilityObject::AccessibilityChildrenVector selectedItems;
if (coreSelection->isListBox())
coreSelection->selectedChildren(selectedItems);
else if (coreSelection->isMenuList()) {
RenderObject* renderer = coreSelection->renderer();
if (!renderer)
return 0;
HTMLSelectElement* selectNode = toHTMLSelectElement(renderer->node());
int selectedIndex = selectNode->selectedIndex();
const Vector<HTMLElement*> listItems = selectNode->listItems();
if (selectedIndex < 0 || selectedIndex >= static_cast<int>(listItems.size()))
return 0;
return optionFromList(selection, selectedIndex);
}
if (index < static_cast<gint>(selectedItems.size()))
return selectedItems.at(index).get();
return 0;
}
示例3: webkitAccessibleGetIndexInParent
static gint webkitAccessibleGetIndexInParent(AtkObject* object)
{
AccessibilityObject* coreObject = core(object);
AccessibilityObject* parent = coreObject->parentObjectUnignored();
if (!parent && isRootObject(coreObject)) {
AtkObject* atkParent = atkParentOfRootObject(object);
if (!atkParent)
return -1;
unsigned count = atk_object_get_n_accessible_children(atkParent);
for (unsigned i = 0; i < count; ++i) {
AtkObject* child = atk_object_ref_accessible_child(atkParent, i);
bool childIsObject = child == object;
g_object_unref(child);
if (childIsObject)
return i;
}
}
// Need to calculate the index of the cell in the table, as
// rows won't be exposed to assistive technologies in GTK.
if (parent && parent->isTableRow() && coreObject->isTableCell())
return getIndexInParentForCellInRow(coreObject);
AccessibilityObject::AccessibilityChildrenVector children = parent->children();
unsigned count = children.size();
for (unsigned i = 0; i < count; ++i) {
if (children[i] == coreObject)
return i;
}
return -1;
}
示例4: listObjectForSelection
static AccessibilityObject* listObjectForSelection(AtkSelection* selection)
{
AccessibilityObject* coreSelection = core(selection);
// Only list boxes and menu lists supported so far.
if (!coreSelection->isListBox() && !coreSelection->isMenuList())
return 0;
// For list boxes the list object is just itself.
if (coreSelection->isListBox())
return coreSelection;
// For menu lists we need to return the first accessible child,
// with role MenuListPopupRole, since that's the one holding the list
// of items with role MenuListOptionRole.
AccessibilityObject::AccessibilityChildrenVector children = coreSelection->children();
if (!children.size())
return 0;
AccessibilityObject* listObject = children.at(0).get();
if (!listObject->isMenuListPopup())
return 0;
return listObject;
}
示例5: webkitAccessibleSelectionSelectAllSelection
static gboolean webkitAccessibleSelectionSelectAllSelection(AtkSelection* selection)
{
AccessibilityObject* coreSelection = core(selection);
if (!coreSelection || !coreSelection->isMultiSelectable())
return FALSE;
AccessibilityObject::AccessibilityChildrenVector children = coreSelection->children();
if (coreSelection->isListBox()) {
AccessibilityListBox* listBox = static_cast<AccessibilityListBox*>(coreSelection);
listBox->setSelectedChildren(children);
AccessibilityObject::AccessibilityChildrenVector selectedItems;
listBox->selectedChildren(selectedItems);
return selectedItems.size() == children.size();
}
return FALSE;
}
示例6: cellAtIndex
static AccessibilityTableCell* cellAtIndex(AtkTable* table, gint index)
{
AccessibilityObject* accTable = core(table);
if (accTable->isAccessibilityRenderObject()) {
AccessibilityObject::AccessibilityChildrenVector allCells;
toAccessibilityTable(accTable)->cells(allCells);
if (0 <= index && static_cast<unsigned>(index) < allCells.size()) {
AccessibilityObject* accCell = allCells.at(index).get();
return toAccessibilityTableCell(accCell);
}
}
return 0;
}
示例7: childrenContainOnlyStaticText
static bool childrenContainOnlyStaticText(const AccessibilityObject::AccessibilityChildrenVector& children)
{
if (!children.size())
return false;
for (const auto& child : children) {
if (child->roleValue() == AccessibilityRole::StaticText)
continue;
if (child->roleValue() == AccessibilityRole::Group) {
if (!childrenContainOnlyStaticText(child->children()))
return false;
} else
return false;
}
return true;
}
示例8: webkit_accessible_table_get_row_header
static AtkObject* webkit_accessible_table_get_row_header(AtkTable* table, gint row)
{
AccessibilityObject* accTable = core(table);
if (accTable->isAccessibilityRenderObject()) {
AccessibilityObject::AccessibilityChildrenVector allRowHeaders;
static_cast<AccessibilityTable*>(accTable)->rowHeaders(allRowHeaders);
unsigned rowCount = allRowHeaders.size();
for (unsigned k = 0; k < rowCount; ++k) {
AccessibilityObject* rowObject = allRowHeaders[k]->parentObject();
if (static_cast<AccessibilityTableRow*>(rowObject)->rowIndex() == row)
return allRowHeaders[k]->wrapper();
}
}
return 0;
}
示例9: webkit_accessible_get_index_in_parent
static gint webkit_accessible_get_index_in_parent(AtkObject* object)
{
AccessibilityObject* coreObject = core(object);
AccessibilityObject* parent = coreObject->parentObjectUnignored();
g_return_val_if_fail(parent, 0);
AccessibilityObject::AccessibilityChildrenVector children = parent->children();
unsigned count = children.size();
for (unsigned i = 0; i < count; ++i) {
if (children[i] == coreObject)
return i;
}
return 0;
}
示例10: webkitAccessibleSelectionClearSelection
static gboolean webkitAccessibleSelectionClearSelection(AtkSelection* selection)
{
AccessibilityObject* coreSelection = core(selection);
if (!coreSelection)
return FALSE;
AccessibilityObject::AccessibilityChildrenVector selectedItems;
if (coreSelection->isListBox() || coreSelection->isMenuList()) {
// Set the list of selected items to an empty list; then verify that it worked.
AccessibilityListBox* listBox = static_cast<AccessibilityListBox*>(coreSelection);
listBox->setSelectedChildren(selectedItems);
listBox->selectedChildren(selectedItems);
return !selectedItems.size();
}
return FALSE;
}
示例11: optionFromList
static AccessibilityObject* optionFromList(AtkSelection* selection, gint index)
{
AccessibilityObject* coreSelection = core(selection);
if (!coreSelection || index < 0)
return 0;
// Need to select the proper list object depending on the type.
AccessibilityObject* listObject = listObjectForSelection(selection);
if (!listObject)
return 0;
AccessibilityObject::AccessibilityChildrenVector options = listObject->children();
if (index < static_cast<gint>(options.size()))
return options.at(index).get();
return 0;
}
示例12: webkitAccessibleTableGetRowHeader
static AtkObject* webkitAccessibleTableGetRowHeader(AtkTable* table, gint row)
{
AccessibilityObject* accTable = core(table);
if (accTable->isAccessibilityRenderObject()) {
AccessibilityObject::AccessibilityChildrenVector allRowHeaders;
static_cast<AccessibilityTable*>(accTable)->rowHeaders(allRowHeaders);
unsigned rowCount = allRowHeaders.size();
for (unsigned k = 0; k < rowCount; ++k) {
pair<unsigned, unsigned> rowRange;
AccessibilityTableCell* cell = static_cast<AccessibilityTableCell*>(allRowHeaders.at(k).get());
cell->rowIndexRange(rowRange);
if (rowRange.first <= static_cast<unsigned>(row) && static_cast<unsigned>(row) < rowRange.first + rowRange.second)
return allRowHeaders[k]->wrapper();
}
}
return 0;
}
示例13: childrenContainUnrelatedControls
static bool childrenContainUnrelatedControls(const AccessibilityObject::AccessibilityChildrenVector& children, AccessibilityObject* controlForLabel)
{
if (!children.size())
return false;
for (const auto& child : children) {
if (child->isControl()) {
if (child == controlForLabel)
continue;
return true;
}
if (childrenContainUnrelatedControls(child->children(), controlForLabel))
return true;
}
return false;
}
示例14: webkitAccessibleSelectionClearSelection
static gboolean webkitAccessibleSelectionClearSelection(AtkSelection* selection)
{
g_return_val_if_fail(ATK_SELECTION(selection), FALSE);
returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(selection), FALSE);
AccessibilityObject* coreSelection = core(selection);
if (!coreSelection)
return FALSE;
AccessibilityObject::AccessibilityChildrenVector selectedItems;
if (coreSelection->isListBox() || coreSelection->isMenuList()) {
// Set the list of selected items to an empty list; then verify that it worked.
AccessibilityListBox* listBox = toAccessibilityListBox(coreSelection);
listBox->setSelectedChildren(selectedItems);
listBox->selectedChildren(selectedItems);
return !selectedItems.size();
}
return FALSE;
}
示例15: webkitAccessibleTableGetRowHeader
static AtkObject* webkitAccessibleTableGetRowHeader(AtkTable* table, gint row)
{
g_return_val_if_fail(ATK_TABLE(table), 0);
returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0);
AccessibilityObject* accTable = core(table);
if (accTable->isAccessibilityRenderObject()) {
AccessibilityObject::AccessibilityChildrenVector allRowHeaders;
toAccessibilityTable(accTable)->rowHeaders(allRowHeaders);
unsigned rowCount = allRowHeaders.size();
for (unsigned k = 0; k < rowCount; ++k) {
pair<unsigned, unsigned> rowRange;
AccessibilityTableCell* cell = toAccessibilityTableCell(allRowHeaders.at(k).get());
cell->rowIndexRange(rowRange);
if (rowRange.first <= static_cast<unsigned>(row) && static_cast<unsigned>(row) < rowRange.first + rowRange.second)
return allRowHeaders[k]->wrapper();
}
}
return 0;
}