void Icon::SetIcon(std::string const& icon_name, unsigned int icon_size, unsigned int tile_size, unsigned int padding)
{
  IconTexture::SetByIconName(icon_name, icon_size);
  icon_renderer_.SetTargetSize(tile_size, icon_size, 0);

  SetMinimumHeight(tile_size + padding);
  SetMinimumWidth(tile_size + padding);
}
Example #2
0
void PlacesVScrollBar::UpdateSize()
{
  _scroll_up_button->SetMaximumHeight(BUTTONS_HEIGHT.CP(scale));
  _scroll_up_button->SetMinimumHeight(BUTTONS_HEIGHT.CP(scale));

  _scroll_down_button->SetMaximumHeight(BUTTONS_HEIGHT.CP(scale));
  _scroll_down_button->SetMinimumHeight(BUTTONS_HEIGHT.CP(scale));

  _slider->SetMinimumWidth(WIDTH.CP(scale));
  _slider->SetMaximumWidth(WIDTH.CP(scale));
  SetMinimumWidth(WIDTH.CP(scale));
  SetMaximumWidth(WIDTH.CP(scale));
}
Example #3
0
void UserPromptView::UpdateSize()
{
  auto width = 8 * Settings::GRID_SIZE.CP(scale);
  auto height = 3 * Settings::GRID_SIZE.CP(scale);

  SetMinimumWidth(width);
  SetMaximumWidth(width);
  SetMinimumHeight(height);

  if (nux::Layout* layout = GetLayout())
  {
    layout->SetLeftAndRightPadding(PADDING.CP(scale));
    layout->SetTopAndBottomPadding(PADDING.CP(scale));
    static_cast<nux::VLayout*>(layout)->SetVerticalInternalMargin(LAYOUT_MARGIN.CP(scale));
  }

  if (username_)
    username_->SetScale(scale);

  if (msg_layout_)
  {
    msg_layout_->SetVerticalInternalMargin(MSG_LAYOUT_MARGIN.CP(scale));

    for (auto* area : msg_layout_->GetChildren())
    {
      area->SetMaximumWidth(width);
      static_cast<StaticCairoText*>(area)->SetScale(scale);
    }
  }

  if (prompt_layout_)
  {
    prompt_layout_->SetVerticalInternalMargin(PROMPT_LAYOUT_MARGIN.CP(scale));

    for (auto* area : prompt_layout_->GetChildren())
    {
      auto* text_input = static_cast<TextInput*>(area);
      text_input->SetMinimumHeight(Settings::GRID_SIZE.CP(scale));
      text_input->SetMaximumHeight(Settings::GRID_SIZE.CP(scale));
      text_input->scale = scale();
    }
  }

  bg_layer_.reset();

  ComputeContentSize();
  QueueRelayout();
  QueueDraw();
}