Rocket::Core::ElementDocument *RocketModule::loadDocument( int contextId, const char *filename, bool show, void *user_data ) { auto *context = contextForId( contextId ); ASUI::UI_ScriptDocument *document = dynamic_cast<ASUI::UI_ScriptDocument *>(context->LoadDocument( filename )); if( !document ) { return NULL; } if( show ) { // 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; }
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; }