本文整理汇总了C++中UIElement::SetVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ UIElement::SetVisible方法的具体用法?C++ UIElement::SetVisible怎么用?C++ UIElement::SetVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIElement
的用法示例。
在下文中一共展示了UIElement::SetVisible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Expand
void ListView::Expand(unsigned index, bool enable, bool recursive)
{
if (!hierarchyMode_)
return;
unsigned numItems = GetNumItems();
if (index >= numItems)
return;
UIElement* item = GetItem(index++);
SetItemExpanded(item, enable);
int baseIndent = item->GetIndent();
PODVector<bool> expanded((unsigned)(baseIndent + 1));
expanded[baseIndent] = enable;
contentElement_->DisableLayoutUpdate();
while (index < numItems)
{
item = GetItem(index++);
int indent = item->GetIndent();
if (indent <= baseIndent)
break;
// Propagate the state to children when it is recursive
if (recursive)
SetItemExpanded(item, enable);
// Use the parent expanded flag to influence the visibility of its children
bool visible = enable && expanded[indent - 1];
item->SetVisible(visible);
if (indent >= (int)expanded.Size())
expanded.Resize((unsigned)(indent + 1));
expanded[indent] = visible && GetItemExpanded(item);
}
contentElement_->EnableLayoutUpdate();
contentElement_->UpdateLayout();
}
示例2: HandleUpdate
void UIDrag::HandleUpdate(StringHash eventType, VariantMap& eventData)
{
auto* ui = GetSubsystem<UI>();
UIElement* root = ui->GetRoot();
auto* input = GetSubsystem<Input>();
unsigned n = input->GetNumTouches();
for (unsigned i = 0; i < n; i++)
{
Text* t = (Text*)root->GetChild("Touch " + String(i));
TouchState* ts = input->GetTouch(i);
t->SetText("Touch " + String(ts->touchID_));
IntVector2 pos = ts->position_;
pos.y_ -= 30;
t->SetPosition(pos);
t->SetVisible(true);
}
for (unsigned i = n; i < 10; i++)
{
Text* t = (Text*)root->GetChild("Touch " + String(i));
t->SetVisible(false);
}
if (input->GetKeyPress(KEY_SPACE))
{
PODVector<UIElement*> elements;
root->GetChildrenWithTag(elements, "SomeTag");
for (PODVector<UIElement*>::ConstIterator i = elements.Begin(); i != elements.End(); ++i)
{
UIElement* element = *i;
element->SetVisible(!element->IsVisible());
}
}
}