本文整理汇总了C++中rocket::core::Element::IsClassSet方法的典型用法代码示例。如果您正苦于以下问题:C++ Element::IsClassSet方法的具体用法?C++ Element::IsClassSet怎么用?C++ Element::IsClassSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rocket::core::Element
的用法示例。
在下文中一共展示了Element::IsClassSet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDocumentLoad
void RocketMenuPlugin::OnDocumentLoad(Rocket::Core::ElementDocument* document) {
DocumentData *doc_data = new DocumentData();
doc_data->cursor_left = document->GetElementById("cursor-left");
doc_data->cursor_right = document->GetElementById("cursor-right");
doc_data->menu = document->GetElementById("menu");
if (doc_data->menu == NULL) {
for (int i = 0, n = document->GetNumChildren(); i!=n; i++) {
Rocket::Core::Element *element = document->GetChild(i);
if (element->IsClassSet("game-menu")) {
doc_data->menu = element;
break;
}
}
}
if (doc_data->menu != NULL) {
for (int i = 0, n = doc_data->menu->GetNumChildren(); i < n; i++) {
Rocket::Core::Element *e = doc_data->menu->GetChild(i);
SetupMenuItem(e);
}
SetDocumentData(document, doc_data);
} else {
delete doc_data;
}
}
示例2: listKeyDown
void SaveMenu::listKeyDown(Rocket::Core::Event& event)
{
Rocket::Core::Input::KeyIdentifier key = static_cast<Rocket::Core::Input::KeyIdentifier>(event.GetParameter<int>("key_identifier", Rocket::Core::Input::KI_UNKNOWN));
switch(key)
{
case Rocket::Core::Input::KI_UP:
case Rocket::Core::Input::KI_DOWN:
case Rocket::Core::Input::KI_RETURN:
break;
default:
return;
}
Rocket::Core::Element* list = m_menuDocument->GetElementById("menu");
if(list == nullptr)
{
return;
}
Rocket::Core::Element* child = list->GetFirstChild();
while(child != nullptr)
{
if(child->IsClassSet("selected"))
{
break;
}
child = child->GetNextSibling();
}
if(child == nullptr)
{
return;
}
if(key == Rocket::Core::Input::KI_RETURN)
{
child->Click();
}
else if(key == Rocket::Core::Input::KI_UP)
{
Rocket::Core::Element* previousSibling = child->GetPreviousSibling();
if(previousSibling != nullptr)
{
child->SetClass("selected", false /*activate*/);
previousSibling->SetClass("selected", true /*activate*/);
}
}
else if(key == Rocket::Core::Input::KI_DOWN)
{
Rocket::Core::Element* nextSibling = child->GetNextSibling();
if(nextSibling != nullptr)
{
child->SetClass("selected", false /*activate*/);
nextSibling->SetClass("selected", true /*activate*/);
}
}
}
示例3: while
Rocket::Core::Element* RocketMenuPlugin::FindPreviousItem(Rocket::Core::Element *menu_item) {
Rocket::Core::Element *next = menu_item;
do {
next = next->GetPreviousSibling();
if (next == NULL) {
next = menu_item->GetParentNode()->GetChild(menu_item->GetParentNode()->GetNumChildren()-1);
}
} while (next->IsClassSet("disabled") && next != menu_item);
return next;
}