本文整理汇总了C++中UIElement::GetObjectType方法的典型用法代码示例。如果您正苦于以下问题:C++ UIElement::GetObjectType方法的具体用法?C++ UIElement::GetObjectType怎么用?C++ UIElement::GetObjectType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIElement
的用法示例。
在下文中一共展示了UIElement::GetObjectType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: left_walker
void
TabNavigationWalker::Sort (GPtrArray *array, Types *types)
{
int end = array->len;
bool swapped;
do {
end --;
swapped = false;
for (int i = 0; i < end; i++) {
UIElement *left = NULL;
UIElement *right = NULL;
DeepTreeWalker left_walker ((UIElement *) array->pdata [i], Logical, types);
DeepTreeWalker right_walker ((UIElement *) array->pdata [i + 1], Logical, types);
while ((left = left_walker.Step ()) && !types->IsSubclassOf (left->GetObjectType (), Type::CONTROL)) { }
while ((right = right_walker.Step ()) && !types->IsSubclassOf (right->GetObjectType (), Type::CONTROL)) { }
if (TabCompare ((Control *)left, (Control *)right) > 0) {
left = (UIElement *) array->pdata [i];
array->pdata [i] = array->pdata [i + 1];
array->pdata [i + 1] = left;
swapped = true;
}
}
} while (swapped);
}
示例2: child_walker
bool
TabNavigationWalker::FocusChild ()
{
UIElement *child;
bool child_is_control;
int current_index = -1;
// Add each branch of the visual tree to the array and then sort them
// based on the TabIndex of the first Control in each branch
VisualTreeWalker child_walker (root);
while ((child = child_walker.Step ()))
g_ptr_array_add (tab_sorted, child);
if (tab_sorted->len > 1) {
Sort (tab_sorted, types);
if (ReverseTab ()) {
GPtrArray *reverse = g_ptr_array_sized_new (tab_sorted->len);
for (int i = tab_sorted->len - 1; i >= 0; i--)
g_ptr_array_add (reverse, tab_sorted->pdata [i]);
g_ptr_array_free (tab_sorted, true);
tab_sorted = reverse;
}
}
// Find the index of the currently selected node so we know which node to
// tab to next
for (uint i = 0; i < tab_sorted->len; i++)
if (tab_sorted->pdata [i] == current)
current_index = i;
// If a child of the root element is Focused and we're forward-tabbing, it means we should
// skip the entire subtree and go to the next 'root'. If we're reverse-tabbing it means we
// should Focus the root.
if (current_index != -1 && GetActiveNavigationMode (root, types) == KeyboardNavigationModeOnce) {
// If we're tabbing backwards and a child of this control is currently Focused, we
// should focus this control.
if (ReverseTab () && types->IsSubclassOf (root->GetObjectType (), Type::CONTROL))
return TabTo ((Control *)root);
return false;
}
if (tab_sorted->len > 0) {
// If the currently selected element was found at index 'i' we need to tab
// to the *next* index. If the currently selected item was not here, we
// need to start at index 0.
for (unsigned int i = 0; i < tab_sorted->len; i++) {
// If we are not cycling, it means we've tabbed to the last element of this node and so should
if ((i + current_index + 1) == tab_sorted->len && GetActiveNavigationMode (root, types) != KeyboardNavigationModeCycle)
break;
child = (UIElement *) tab_sorted->pdata [(i + current_index + 1) % tab_sorted->len];
child_is_control = types->IsSubclassOf (child->GetObjectType (), Type::CONTROL);
if (child_is_control && !((Control *)child)->GetIsEnabled ())
continue;
// When tabbing backwards, we recurse all children *before* attempting to select this node
if (ReverseTab () && WalkChildren (child))
return true;
if (child_is_control && TabTo ((Control *)child))
return true;
if (ForwardTab () && WalkChildren (child))
return true;
}
}
// If we're tabbing backwards and a child of this control is currently Focused, we
// should focus this control.
if (current_index != -1 && ReverseTab ()) {
if (types->IsSubclassOf (root->GetObjectType (), Type::CONTROL))
return TabTo ((Control *)root);
}
// Nothing could be tabbed to on this visual level
return false;
}