~ci-train-bot/unity/unity-ubuntu-xenial-landing-028

« back to all changes in this revision

Viewing changes to hud/HudView.cpp

  • Committer: CI Train Bot
  • Author(s): Marco Trevisan (Treviño)
  • Date: 2016-04-01 23:11:21 UTC
  • mfrom: (4093.2.30 themed-texture-cache)
  • Revision ID: ci-train-bot@canonical.com-20160401231121-or6ge8fgw25y4m41
TextureCache: add support for loading themed textures

When a themed texture is requested, we add it to a list so that we can invalidate
it on theme changes.

Use themed textures in any case we load local files, falling back to the default path if
theme doesn't provide any customized asset. Fixes: #903179, #1208790
Approved by: Andrea Azzarone

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
#include "unity-shared/Introspectable.h"
32
32
 
 
33
#include "unity-shared/BackgroundEffectHelper.h"
33
34
#include "unity-shared/UBusMessages.h"
34
35
#include "unity-shared/UnitySettings.h"
35
36
#include "unity-shared/DashStyle.h"
66
67
  , last_known_height_(0)
67
68
  , current_height_(0)
68
69
  , selected_button_(0)
69
 
  , show_embedded_icon_(true)
70
70
  , keyboard_stole_focus_(false)
71
71
  , overlay_window_buttons_(new OverlayWindowButtons())
72
72
{
302
302
void View::ShowEmbeddedIcon(bool show)
303
303
{
304
304
  LOG_DEBUG(logger) << "Hide icon called";
305
 
  if (show == show_embedded_icon_)
 
305
  if (show == icon_.IsValid())
306
306
    return;
307
307
 
308
 
  show_embedded_icon_ = show;
309
 
 
310
 
  if (show_embedded_icon_)
 
308
  if (show)
311
309
  {
312
 
    layout_->AddView(icon_.GetPointer(), 0, nux::MINOR_POSITION_START,
313
 
                     nux::MINOR_SIZE_FULL, 100.0f, nux::LayoutPosition::NUX_LAYOUT_BEGIN);
314
 
    AddChild(icon_.GetPointer());
 
310
    if (!icon_)
 
311
    {
 
312
      icon_ = new Icon();
 
313
      layout_->AddView(icon_.GetPointer(), 0, nux::MINOR_POSITION_START,
 
314
                      nux::MINOR_SIZE_FULL, 100.0f, nux::LayoutPosition::NUX_LAYOUT_BEGIN);
 
315
      AddChild(icon_.GetPointer());
 
316
    }
315
317
  }
316
 
  else
 
318
  else if (icon_)
317
319
  {
318
320
    layout_->RemoveChildObject(icon_.GetPointer());
319
321
    RemoveChild(icon_.GetPointer());
 
322
    icon_ = nullptr;
320
323
  }
321
324
 
322
325
  UpdateLayoutGeometry();
331
334
  int width = DEFAULT_WIDTH.CP(scale);
332
335
  int height = DEFAULT_HEIGHT.CP(scale);
333
336
 
334
 
  if (show_embedded_icon_)
 
337
  if (icon_)
335
338
    width += icon_->GetGeometry().width;
336
339
 
337
340
  LOG_DEBUG (logger) << "best fit is, " << width << ", " << height;
369
372
  nux::VLayout* super_layout = new nux::VLayout();
370
373
  layout_ = new nux::HLayout();
371
374
  {
372
 
    // fill layout with icon
373
 
    icon_ = new Icon();
374
 
    {
375
 
      AddChild(icon_.GetPointer());
376
 
      layout_->AddView(icon_.GetPointer(), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL);
377
 
    }
378
 
 
379
375
    // fill the content layout
380
376
    content_layout_ = new nux::VLayout();
381
377
    {