Exemple #1
0
//-----------------------------------------------------------------------------
// Sets the model to be associated with an entity
//-----------------------------------------------------------------------------
void UTIL_SetModel( CBaseEntity *pEntity, const char *pModelName )
{
    // check to see if model was properly precached
    int i = modelinfo->GetModelIndex( pModelName );
    if ( i < 0 )
    {
        Error("%i - %s:  UTIL_SetModel:  not precached: %s\n", VFuncs::entindex(pEntity),
            VFuncs::GetClassname(pEntity), pModelName);
    }

    VFuncs::SetModelIndex(pEntity, i);
    VFuncs::SetModelName( pEntity, AllocPooledString( pModelName ) );
    //VFuncs::SetModelName( pEntity, MAKE_STRING( pModelName ) );

    // brush model
    const model_t *mod = modelinfo->GetModel( i );
    if ( mod )
    {
        Vector mins, maxs;
        modelinfo->GetModelBounds( mod, mins, maxs );
        SetMinMaxSize (pEntity, mins, maxs);
    }
    else
    {
        SetMinMaxSize (pEntity, vec3_origin, vec3_origin);
    }
}
void ScopeBarIcon::UpdateScale(double scale)
{
  int overlay_width  = FOCUS_OVERLAY_WIDTH.CP(scale);
  int overlay_height = FOCUS_OVERLAY_HEIGHT.CP(scale);

  SetMinMaxSize(overlay_width, overlay_height);
  focus_layer_.reset(Style::Instance().FocusOverlay(overlay_width, overlay_height));

  SetSize(TEXTURE_SIZE.CP(scale));
  ReLoadIcon();
  QueueDraw();
}
Exemple #3
0
void SearchBarSpinner::UpdateScale(double scale)
{
  auto& style = dash::Style::Instance();

  magnify_ = style.GetSearchMagnifyIcon(scale);
  circle_ = style.GetSearchCircleIcon(scale);
  close_ = style.GetSearchCloseIcon(scale);
  spin_ = style.GetSearchSpinIcon(scale);

  SetMinMaxSize(magnify_->GetWidth(), magnify_->GetHeight());
  QueueDraw();
}
void PanelView::Resize()
{
  int height = Style::Instance().PanelHeight(monitor_);
  auto const& monitor_geo = UScreen::GetDefault()->GetMonitorGeometry(monitor_);

  SetMinMaxSize(monitor_geo.width, height);
  parent_->SetGeometry({monitor_geo.x, monitor_geo.y, monitor_geo.width, height});

  for (auto* child : layout_->GetChildren())
  {
    child->SetMinimumHeight(height);
    child->SetMaximumHeight(height);
  }

  QueueRelayout();
}
ScopeBarIcon::ScopeBarIcon(std::string id_, std::string icon_hint)
  : IconTexture(icon_hint, TEXTURE_SIZE)
  , id(id_)
  , active(false)
  , scale(DEFAULT_SCALE)
  , inactive_opacity_(0.4f)
{
  SetMinMaxSize(FOCUS_OVERLAY_WIDTH.CP(scale()), FOCUS_OVERLAY_HEIGHT.CP(scale()));

  focus_layer_.reset(Style::Instance().FocusOverlay(FOCUS_OVERLAY_WIDTH.CP(scale()), FOCUS_OVERLAY_HEIGHT.CP(scale())));

  SetOpacity(inactive_opacity_);

  SetAcceptKeyNavFocus(true);
  SetAcceptKeyNavFocusOnMouseDown(false);
  SetAcceptKeyNavFocusOnMouseEnter(true);

  active.changed.connect(sigc::mem_fun(this, &ScopeBarIcon::OnActiveChanged));
  scale.changed.connect(sigc::mem_fun(this, &ScopeBarIcon::UpdateScale));
  key_nav_focus_change.connect([this](nux::Area*, bool, nux::KeyNavDirection){ QueueDraw(); });
}
Exemple #6
0
//-----------------------------------------------------------------------------
// Sets the model size
//-----------------------------------------------------------------------------
void UTIL_SetSize( CBaseEntity *pEnt, const Vector &vecMin, const Vector &vecMax )
{
    SetMinMaxSize (pEnt, vecMin, vecMax);
}