Size2i UIContext::debugger_size() const { Size2i dims( Size2i::null ); if( this->valid() ) { Rocket::Core::ElementDocument* target = this->context()->GetDocument("rkt-debug-hook"); NOM_ASSERT( target != nullptr ); if( target ) { // NOM_DUMP( target->GetSourceURL().CString() ); Rocket::Core::Element* body_tag = target->GetParentNode(); NOM_ASSERT( body_tag != nullptr ); if( body_tag ) { Rocket::Core::Element* debug_info = body_tag->GetElementById("rkt-debug-info"); NOM_ASSERT( debug_info != nullptr ); if( debug_info ) { dims.w = debug_info->GetBox().GetSize().x; dims.h = debug_info->GetBox().GetSize().y; } // end if debug_info } // end if body_tag } // end if target } // end if valid context return dims; }
void UIContext::set_beacon_position(const Point2i& pos) { if( this->valid() ) { Rocket::Core::ElementDocument* target = this->context()->GetDocument("rkt-debug-log-beacon"); NOM_ASSERT( target != nullptr ); if( target ) { // NOM_DUMP( target->GetSourceURL().CString() ); Rocket::Core::Element* body_tag = target->GetParentNode(); NOM_ASSERT( body_tag != nullptr ); if( body_tag ) { Rocket::Core::Element* debug_info = body_tag->GetElementById("rkt-debug-log-beacon"); NOM_ASSERT( debug_info != nullptr ); if( debug_info ) { Rocket::Core::Property pos_x( pos.x, Rocket::Core::Property::PX); Rocket::Core::Property pos_y( pos.y, Rocket::Core::Property::PX); debug_info->SetProperty("left", pos_x); debug_info->SetProperty("top", pos_y); } // end if debug_info } // end if body_tag } // end if target } // end if valid context }
void UIContext::set_debugger_size(const Size2i& dims) { if( this->valid() ) { Rocket::Core::ElementDocument* target = this->context()->GetDocument("rkt-debug-hook"); NOM_ASSERT( target != nullptr ); if( target ) { // NOM_DUMP( target->GetSourceURL().CString() ); Rocket::Core::Element* body_tag = target->GetParentNode(); NOM_ASSERT( body_tag != nullptr ); if( body_tag ) { // Sets width of visual debugger's Element Info window Rocket::Core::Element* info = body_tag->GetElementById("rkt-debug-info"); NOM_ASSERT( info != nullptr ); if( info ) { Rocket::Core::Property width(dims.w, Rocket::Core::Property::PX); info->SetProperty("min-width", width); info->SetProperty("width", width); } // end if info // Sets height of visual debugger's Element Info window Rocket::Core::Element* content = body_tag->GetElementById("content"); NOM_ASSERT( content != nullptr ); if( content ) { // As per Rocket/Debugger/MenuSource.h // int menu_height = 32; // Maximum height shall be no more than half the size of the context, // add menu height Rocket::Core::Property max_height( dims.h, Rocket::Core::Property::PX); content->SetProperty("max-height", max_height); } // end if debug_content } // end if body_tag } // end if target } // end if valid context }
void UIContext::set_debugger_position(const Point2i& pos) { if( this->valid() ) { Rocket::Core::ElementDocument* target = this->context()->GetDocument("rkt-debug-hook"); NOM_ASSERT( target != nullptr ); if( target ) { // NOM_DUMP( target->GetSourceURL().CString() ); Rocket::Core::Element* body_tag = target->GetParentNode(); NOM_ASSERT( body_tag != nullptr ); if( body_tag ) { Rocket::Core::Element* debug_info = body_tag->GetElementById("rkt-debug-info"); NOM_ASSERT( debug_info != nullptr ); if( debug_info ) { Rocket::Core::Property pos_x( pos.x, Rocket::Core::Property::PX); Rocket::Core::Property pos_y( pos.y, Rocket::Core::Property::PX); debug_info->SetProperty("left", pos_x); debug_info->SetProperty("top", pos_y); } // end if debug_info } // end if body_tag } // end if target } // end if valid context // for( auto itr = tags.begin(); itr != tags.end(); ++itr ) { // if( (*itr)->GetId() == "rkt-debug-info" ) { // NOM_DUMP( (*itr)->GetTagName().CString() ); // NOM_DUMP( (*itr)->GetId().CString() ); // } // } // end for tags loop }