当前位置: 首页>>代码示例>>C++>>正文


C++ ElementDocument::Focus方法代码示例

本文整理汇总了C++中rocket::core::ElementDocument::Focus方法的典型用法代码示例。如果您正苦于以下问题:C++ ElementDocument::Focus方法的具体用法?C++ ElementDocument::Focus怎么用?C++ ElementDocument::Focus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rocket::core::ElementDocument的用法示例。


在下文中一共展示了ElementDocument::Focus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

Rocket::Core::ElementDocument *RocketModule::loadDocument( const char *filename, bool show )
{
	Rocket::Core::ElementDocument *document;

	// YES I really had to make a function for this!
	document = context->LoadDocument( filename );

	if( show && document )
	{
		// load documents with autofocus disabled
		document->Show( Rocket::Core::ElementDocument::NONE );
		document->Focus();

		// reference counting may bog on us if we cache documents!
		document->RemoveReference();

		// optional element specific eventlisteners here

		// only for UI documents! FIXME: we are already doing this in NavigationStack
		Rocket::Core::EventListener *listener = UI_GetMainListener();
		document->AddEventListener( "keydown", listener );
		document->AddEventListener( "change", listener );
	}

	return document;
}
开发者ID:ewirch,项目名称:qfusion,代码行数:26,代码来源:ui_rocketmodule.cpp

示例2: LoadWindow

// Loads a window and binds the event handler for it.
bool EventManager::LoadWindow(const Rocket::Core::String& window_name)
{
    // Set the event handler for the new screen, if one has been registered.
    EventHandler* old_event_handler = event_handler;
    EventHandlerMap::iterator iterator = event_handlers.find(window_name);
    if (iterator != event_handlers.end())
        event_handler = (*iterator).second;
    else
        event_handler = NULL;

    // Attempt to load the referenced RML document.

    char path[1024];
    GetMmoResourcePath(path, 1024, (window_name + ".rml").CString());

    Rocket::Core::ElementDocument* document = gContext->LoadDocument(path);
    if (document == NULL)
    {
        event_handler = old_event_handler;
        return false;
    }

    // Set the element's title on the title; IDd 'title' in the RML.
    Rocket::Core::Element* title = document->GetElementById("title");
    if (title != NULL)
        title->SetInnerRML(document->GetTitle());

    document->Focus();
    document->Show();

    // Remove the caller's reference.
    document->RemoveReference();

    return true;
}
开发者ID:ktj007,项目名称:mmo,代码行数:36,代码来源:EventManager.cpp

示例3:

// Loads a window and binds the event handler for it.
Rocket::Core::ElementDocument* EventManager::LoadWindow(const Rocket::Core::String& window_name)
{
    // Set the event handler for the new screen, if one has been registered.
    EventHandler* old_event_handler = event_handler;
    EventHandlerMap::iterator iterator = event_handlers.find(window_name);
    if (iterator != event_handlers.end())
    {
        event_handler = iterator->second;
        //Rocket::Core::Log::Message(Rocket::Core::Log::LT_INFO, "%s", window_name.CString());
    }
    else
        event_handler = NULL;

    // Attempt to load the referenced RML document.
    Rocket::Core::String document_path = Rocket::Core::String("data/") + window_name + Rocket::Core::String(".rml");
    Rocket::Core::ElementDocument* document = Context->LoadDocument(document_path.CString());
    if (document == nullptr)
    {
        event_handler = old_event_handler;
        return nullptr;
    }

    document->SetId(window_name);

    // Set the element's title on the title; IDd 'title' in the RML.
    Rocket::Core::Element* title = document->GetElementById("title");
    if (title != NULL)
        title->SetInnerRML(document->GetTitle());

    document->Focus();
    document->Show();

    // Remove the caller's reference.
    document->RemoveReference();

    return document;
}
开发者ID:hahahahaman,项目名称:Lights-Demo,代码行数:38,代码来源:EventManager.cpp


注:本文中的rocket::core::ElementDocument::Focus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。