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


C++ Element::SetProperty方法代码示例

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


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

示例1: set_debugger_size

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
}
开发者ID:i8degrees,项目名称:nomlib,代码行数:50,代码来源:UIContext.cpp

示例2: updateTime

void TimeWindow::updateTime()
{
	Time & t = game->time;
	
	window->GetElementById("watch")->SetAttribute<float>("time", t.hour);
	
	Rocket::Core::Element * weekday = window->GetElementById("date-weekday");
	Rocket::Core::Element * weekend = window->GetElementById("date-weekend");
	weekday->SetInnerRML(t.day == 0 ? "1st WD" : "2nd WD");
	weekday->SetProperty("display", (t.day == 2 ? "none" : "inline"));
	weekend->SetProperty("display", (t.day != 2 ? "none" : "inline"));
	
	char c[128];
	snprintf(c, 128, "%iQ", t.quarter);
	window->GetElementById("date-quarter")->SetInnerRML(c);
	
	const char * suffix = "th";
	int yl = (t.year % 10);
	if (yl == 1) suffix = "st";
	if (yl == 2) suffix = "nd";
	if (yl == 3) suffix = "rd";
	snprintf(c, 128, "%i%s", t.year, suffix);
	window->GetElementById("date-year")->SetInnerRML(c);
}
开发者ID:Hmaal,项目名称:OpenSkyscraper,代码行数:24,代码来源:TimeWindow.cpp

示例3: Rocket_SetPropertyById

void Rocket_SetPropertyById( const char *id, const char *property, const char *value )
{
    if ( *id )
    {
        Rocket::Core::ElementDocument *document = menuContext->GetFocusElement()->GetOwnerDocument();

        if ( document )
        {
            Rocket::Core::Element *element = document->GetElementById( id );

            if ( element )
            {
                element->SetProperty( property, value );
            }
        }
    }

    else if ( activeElement )
    {
        activeElement->SetProperty( property, value );
    }
}
开发者ID:JacksonTech,项目名称:Unvanquished,代码行数:22,代码来源:rocket_element.cpp

示例4: UiBase

InteractMenu::InteractMenu(WindowFramework* window, Rocket::Core::Context* context, InstanceDynamicObject& object) : UiBase(window, context)
{
    Interactions::InteractionList& interactions = object.GetInteractions();

    _done = false;
    root = context->LoadDocument("data/interact_menu.rml");
    if (root)
    {
        Rocket::Core::Element* element = root->GetElementById("menu");

        if (element)
        {
            // Positioning the interact_menu
            {
                std::stringstream strTop, strLeft, maxHeight;
                MouseData    pointer = window->get_graphics_window()->get_pointer(0);

                strTop    << (pointer.get_y());
                strLeft   << (pointer.get_x());
                maxHeight << (window->get_graphics_window()->get_y_size() - pointer.get_y());
                element->SetProperty("position", "absolute");
                element->SetProperty("top",  strTop.str().c_str());
                element->SetProperty("left", strLeft.str().c_str());
                element->SetProperty("max-height", maxHeight.str().c_str());
            }

            // Generating and setting the RML for the interact_menu
            {
                std::stringstream rml;

                for_each(interactions.begin(), interactions.end(), [&rml](Interactions::Interaction& interaction)
                {
                    rml << "<div id='interaction-" << interaction.name << "'>";
                    rml << "<button id='" << interaction.name << "' class='interact_button'>";
                    rml << "<img src='../textures/buttons/" + interaction.name + "-normal.png' />";
                    rml << "</button></div>";
                });

                element->SetInnerRML(rml.str().c_str());
            }

            int it = 0;
            _listeners.resize(interactions.size());

            for_each(interactions.begin(), interactions.end(), [this, &it](Interactions::Interaction& interaction)
            {
                ToggleEventListener(true, interaction.name, "click",     _buttonListener);
                ToggleEventListener(true, interaction.name, "mouseover", _buttonHover);
                ToggleEventListener(true, interaction.name, "mouseout",  _buttonHover);
                ToggleEventListener(true, interaction.name, "mousedown", _buttonClick);
                ToggleEventListener(true, interaction.name, "mouseup",   _buttonClick);
                _listeners[it] = &interaction;
                _obs.Connect(_buttonListener.EventReceived, *this, &InteractMenu::ButtonClicked);
                _obs.Connect(_buttonHover.EventReceived,    *this, &InteractMenu::ButtonHovered);
                _obs.Connect(_buttonClick.EventReceived,    *this, &InteractMenu::MouseButton);
                ++it;
            });
        }
        Show();
    }
}
开发者ID:655473,项目名称:fallout-equestria,代码行数:61,代码来源:interact_menu.cpp


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