Back to index

unity  6.0.0
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes
unity::hud::View Class Reference

#include <HudView.h>

Inheritance diagram for unity::hud::View:
Inheritance graph
[legend]
Collaboration diagram for unity::hud::View:
Collaboration graph
[legend]

List of all members.

Public Types

typedef nux::ObjectPtr< ViewPtr
typedef std::list
< Introspectable * > 
IntrospectableList

Public Member Functions

 View ()
 ~View ()
void ResetToDefault ()
void Relayout ()
nux::View * default_focus () const
std::list< HudButton::Ptr > const & buttons () const
void SetQueries (Hud::Queries queries)
void SetIcon (std::string const &icon_name, unsigned int tile_size, unsigned int size, unsigned int padding)
void ShowEmbeddedIcon (bool show)
void SearchFinished ()
void AboutToShow ()
void AboutToHide ()
void SetWindowGeometry (nux::Geometry const &absolute_geo, nux::Geometry const &geo)
GVariant * Introspect ()
void AddChild (Introspectable *child)
void RemoveChild (Introspectable *child)
guint64 GetIntrospectionId () const

Public Attributes

sigc::signal< void, std::string > search_changed
sigc::signal< void, std::string > search_activated
sigc::signal< void, Query::Ptrquery_activated
sigc::signal< void, Query::Ptrquery_selected

Protected Member Functions

virtual Area * FindKeyFocusArea (unsigned int event_type, unsigned long x11_key_code, unsigned long special_keys_state)
void SetupViews ()
void OnSearchChanged (std::string const &search_string)
virtual long PostLayoutManagement (long LayoutResult)
virtual std::string GetChildsName () const
 Please don't override this unless you really need to. The only valid reason is if you have a property that simply must be called 'Children'.

Private Member Functions

 NUX_DECLARE_OBJECT_TYPE (View, AbstractView)
void OnMouseButtonDown (int x, int y, unsigned long button, unsigned long key)
void OnKeyDown (unsigned long event_type, unsigned long event_keysym, unsigned long event_state, const TCHAR *character, unsigned short key_repeat_count)
void Draw (nux::GraphicsEngine &gfx_context, bool force_draw)
void DrawContent (nux::GraphicsEngine &gfx_context, bool force_draw)
bool InspectKeyEvent (unsigned int eventType, unsigned int key_sym, const char *character)
void OnSearchbarActivated ()
bool AcceptKeyNavFocus ()
nux::Geometry GetBestFitGeometry (nux::Geometry const &for_geo)
void ProcessGrowShrink ()
std::string GetName () const
void AddProperties (GVariantBuilder *builder)
IntrospectableList GetIntrospectableChildren ()

Private Attributes

UBusManager ubus
nux::ObjectPtr< nux::Layout > layout_
nux::ObjectPtr< nux::Layout > content_layout_
nux::ObjectPtr< nux::VLayout > button_views_
std::list< HudButton::Ptrbuttons_
IntrospectableList introspectable_children_
SearchBar::Ptr search_bar_
Icon::Ptr icon_
bool visible_
Hud::Queries queries_
nux::Geometry content_geo_
OverlayRenderer renderer_
nux::Geometry window_geometry_
nux::Geometry absolute_window_geometry_
glib::Source::UniquePtr timeline_idle_
guint64 start_time_
int last_known_height_
int current_height_
bool timeline_need_more_draw_
int selected_button_
bool show_embedded_icon_
bool activated_signal_sent_

Detailed Description

Definition at line 40 of file HudView.h.


Member Typedef Documentation

Definition at line 34 of file Introspectable.h.

typedef nux::ObjectPtr<View> unity::hud::View::Ptr

Reimplemented from unity::hud::AbstractView.

Definition at line 44 of file HudView.h.


Constructor & Destructor Documentation

Definition at line 60 of file HudView.cpp.

  : AbstractView()
  , button_views_(nullptr)
  , start_time_(0)
  , last_known_height_(0)
  , current_height_(0)
  , timeline_need_more_draw_(false)
  , selected_button_(0)
  , show_embedded_icon_(true)
{
  renderer_.SetOwner(this);
  renderer_.need_redraw.connect([this] () {
    QueueDraw();
  });

  SetupViews();
  search_bar_->key_down.connect (sigc::mem_fun (this, &View::OnKeyDown));

  search_bar_->activated.connect (sigc::mem_fun (this, &View::OnSearchbarActivated));

  search_bar_->text_entry()->SetLoseKeyFocusOnKeyNavDirectionUp(false);
  search_bar_->text_entry()->SetLoseKeyFocusOnKeyNavDirectionDown(false);

  search_bar_->text_entry()->key_nav_focus_change.connect([&](nux::Area *area, bool receiving, nux::KeyNavDirection direction)
  {
    // We get here when the Hud closes.
    // The TextEntry should always have the keyboard focus as long as the hud is open.

    if (buttons_.empty())
      return;// early return on empty button list

    if (receiving)
    {
      if (!buttons_.empty())
      {
        // If the search_bar gets focus, fake focus the first button if it exists
        buttons_.back()->fake_focused = true;
      }
    }
    else
    {
      // The hud is closing and there are HudButtons visible. Remove the fake_focus.
      // There should be only one HudButton with the fake_focus set to true.
      std::list<HudButton::Ptr>::iterator it;
      for(it = buttons_.begin(); it != buttons_.end(); ++it)
      {
        if ((*it)->fake_focused)
        {
          (*it)->fake_focused = false;
        }
      }
    }
  });

  mouse_down.connect(sigc::mem_fun(this, &View::OnMouseButtonDown));

  Relayout();
}

Here is the call graph for this function:

Definition at line 119 of file HudView.cpp.

{
}

Member Function Documentation

void unity::hud::View::AboutToHide ( ) [virtual]

Implements unity::hud::AbstractView.

Definition at line 340 of file HudView.cpp.

Here is the call graph for this function:

void unity::hud::View::AboutToShow ( ) [virtual]

Implements unity::hud::AbstractView.

Definition at line 335 of file HudView.cpp.

Here is the call graph for this function:

Definition at line 489 of file HudView.cpp.

{
  return false;
}

Definition at line 78 of file Introspectable.cpp.

{
  _children.push_back(child);
  child->_parents.push_back(this);
}

Here is the caller graph for this function:

void unity::hud::View::AddProperties ( GVariantBuilder *  builder) [private, virtual]

Implements unity::debug::Introspectable.

Definition at line 500 of file HudView.cpp.

{
  unsigned num_buttons = buttons_.size();
  variant::BuilderWrapper(builder)
    .add(GetGeometry())
    .add("selected_button", selected_button_)
    .add("num_buttons", num_buttons);
}

Here is the call graph for this function:

std::list< HudButton::Ptr > const & unity::hud::View::buttons ( ) const

Definition at line 214 of file HudView.cpp.

{
  return buttons_;
}
nux::View * unity::hud::View::default_focus ( ) const [virtual]

Implements unity::hud::AbstractView.

Definition at line 209 of file HudView.cpp.

{
  return search_bar_->text_entry();
}
void unity::hud::View::Draw ( nux::GraphicsEngine &  gfx_context,
bool  force_draw 
) [private]

Definition at line 432 of file HudView.cpp.

{
  if (timeline_need_more_draw_)
  {
    ProcessGrowShrink();
  }

  nux::Geometry draw_content_geo(layout_->GetGeometry());
  draw_content_geo.height = current_height_;
  renderer_.DrawFull(gfx_context, draw_content_geo, absolute_window_geometry_, window_geometry_, true);
}

Here is the call graph for this function:

void unity::hud::View::DrawContent ( nux::GraphicsEngine &  gfx_context,
bool  force_draw 
) [private]

Definition at line 444 of file HudView.cpp.

{
  nux::Geometry draw_content_geo(layout_->GetGeometry());
  draw_content_geo.height = current_height_;

  renderer_.DrawInner(gfx_context, draw_content_geo, absolute_window_geometry_, window_geometry_);

  gfx_context.PushClippingRectangle(draw_content_geo);

  if (IsFullRedraw())
  {
    nux::GetPainter().PushBackgroundStack();

    if (!buttons_.empty()) // See bug #1008603.
    {
      int height = 3;
      int x = search_bar_->GetBaseX() + 1;
      int y = search_bar_->GetBaseY() + search_bar_->GetBaseHeight() - height;
      nux::GetPainter().Draw2DLine(gfx_context, x, y, x, y + height, nux::color::White * 0.13);
      x += content_width - 1;
      nux::GetPainter().Draw2DLine(gfx_context, x, y, x, y + height, nux::color::White * 0.13);
    }

    GetLayout()->ProcessDraw(gfx_context, force_draw);
    nux::GetPainter().PopBackgroundStack();
  }
  else
  {
    GetLayout()->ProcessDraw(gfx_context, force_draw);
  }
  gfx_context.PopClippingRectangle();

  renderer_.DrawInnerCleanup(gfx_context, draw_content_geo, absolute_window_geometry_, window_geometry_);

  if (timeline_need_more_draw_ && !timeline_idle_)
  {
    timeline_idle_.reset(new glib::Idle([&] () {
      QueueDraw();
      timeline_idle_.reset();
      return false;
    }));
  }
}

Here is the call graph for this function:

nux::Area * unity::hud::View::FindKeyFocusArea ( unsigned int  event_type,
unsigned long  x11_key_code,
unsigned long  special_keys_state 
) [protected, virtual]

Definition at line 564 of file HudView.cpp.

{
  nux::KeyNavDirection direction = nux::KEY_NAV_NONE;
  switch (x11_key_code)
  {
  case NUX_VK_UP:
    direction = nux::KEY_NAV_UP;
    break;
  case NUX_VK_DOWN:
    direction = nux::KEY_NAV_DOWN;
    break;
  case NUX_VK_LEFT:
    direction = nux::KEY_NAV_LEFT;
    break;
  case NUX_VK_RIGHT:
    direction = nux::KEY_NAV_RIGHT;
    break;
  case NUX_VK_LEFT_TAB:
    direction = nux::KEY_NAV_TAB_PREVIOUS;
    break;
  case NUX_VK_TAB:
    direction = nux::KEY_NAV_TAB_NEXT;
    break;
  case NUX_VK_ENTER:
  case NUX_KP_ENTER:
    // Not sure if Enter should be a navigation key
    direction = nux::KEY_NAV_ENTER;
    break;
  case NUX_VK_F4:
    if (special_keys_state == nux::NUX_STATE_ALT)
    {
      ubus.SendMessage(UBUS_HUD_CLOSE_REQUEST);
    }
    break;
  default:
    direction = nux::KEY_NAV_NONE;
    break;
  }


  if ((event_type == nux::NUX_KEYDOWN) && (x11_key_code == NUX_VK_ESCAPE))
  {
    // Escape key! This is how it works:
    //    -If there is text, clear it and give the focus to the text entry view.
    //    -If there is no text text, then close the hud.

    if (search_bar_->search_string == "")
    {
      ubus.SendMessage(UBUS_HUD_CLOSE_REQUEST);
    }
    else
    {
      search_bar_->search_string = "";
      return search_bar_->text_entry();
    }
    return NULL;
  }

  if (search_bar_->text_entry()->HasKeyFocus() && !search_bar_->im_preedit)
  {
    if (direction == nux::KEY_NAV_NONE ||
        direction == nux::KEY_NAV_UP ||
        direction == nux::KEY_NAV_DOWN ||
        direction == nux::KEY_NAV_LEFT ||
        direction == nux::KEY_NAV_RIGHT)
    {
      // We have received a key character or a keyboard arrow Up or Down (navigation keys).
      // Because we have called "SetLoseKeyFocusOnKeyNavDirectionUp(false);" and "SetLoseKeyFocusOnKeyNavDirectionDown(false);"
      // on the text entry, the text entry will not loose the keyboard focus.
      // All that we need to do here is set the fake_focused value on the HudButton.

      if (!buttons_.empty())
      {
        if (event_type == nux::NUX_KEYDOWN && direction == nux::KEY_NAV_UP)
        {
          std::list<HudButton::Ptr>::iterator it;
          for(it = buttons_.begin(); it != buttons_.end(); ++it)
          {
            if ((*it)->fake_focused)
            {
              std::list<HudButton::Ptr>::iterator next = it;
              ++next;
              if (next != buttons_.end())
              {
                // The button with the current fake_focus looses it.
                (*it)->fake_focused = false;
                // The next button gets the fake_focus
                (*next)->fake_focused = true;
                query_selected.emit((*next)->GetQuery());
                --selected_button_;
              }
              break;
            }
          }
        }

        if (event_type == nux::NUX_KEYDOWN && direction == nux::KEY_NAV_DOWN)
        {
          std::list<HudButton::Ptr>::reverse_iterator rit;
          for(rit = buttons_.rbegin(); rit != buttons_.rend(); ++rit)
          {
            if ((*rit)->fake_focused)
            {
              std::list<HudButton::Ptr>::reverse_iterator next = rit;
              ++next;
              if(next != buttons_.rend())
              {
                // The button with the current fake_focus looses it.
                (*rit)->fake_focused = false;
                // The next button bellow gets the fake_focus.
                (*next)->fake_focused = true;
                query_selected.emit((*next)->GetQuery());
                ++selected_button_;
              }
              break;
            }
          }
        }
      }
      return search_bar_->text_entry();
    }

    if (event_type == nux::NUX_KEYDOWN && direction == nux::KEY_NAV_ENTER)
    {
      // We still choose the text_entry as the receiver of the key focus.
      return search_bar_->text_entry();
    }
  }
  else if (direction == nux::KEY_NAV_NONE || search_bar_->im_preedit)
  {
    return search_bar_->text_entry();
  }
  else if (next_object_to_key_focus_area_)
  {
    return next_object_to_key_focus_area_->FindKeyFocusArea(event_type, x11_key_code, special_keys_state);
  }
  return search_bar_->text_entry();
}

Here is the call graph for this function:

nux::Geometry unity::hud::View::GetBestFitGeometry ( nux::Geometry const &  for_geo) [private]

Definition at line 320 of file HudView.cpp.

{
  //FIXME - remove magic values, replace with scalable text depending on DPI
  // requires smarter font settings really...
  int width = default_width;
  int height = default_height;

  if (show_embedded_icon_)
    width += icon_->GetGeometry().width;

  LOG_DEBUG (logger) << "best fit is, " << width << ", " << height;

  return nux::Geometry(0, 0, width, height);
}

Here is the caller graph for this function:

std::string unity::debug::Introspectable::GetChildsName ( ) const [protected, virtual, inherited]

Please don't override this unless you really need to. The only valid reason is if you have a property that simply must be called 'Children'.

Definition at line 92 of file Introspectable.cpp.

{
  return "Children";
}

Here is the caller graph for this function:

Reimplemented from unity::debug::Introspectable.

Definition at line 509 of file HudView.cpp.

Here is the call graph for this function:

guint64 unity::debug::Introspectable::GetIntrospectionId ( ) const [inherited]

Definition at line 97 of file Introspectable.cpp.

{
  return _id;
}

Here is the caller graph for this function:

std::string unity::hud::View::GetName ( ) const [private, virtual]

Implements unity::debug::Introspectable.

Definition at line 495 of file HudView.cpp.

{
  return "HudView";
}
bool unity::hud::View::InspectKeyEvent ( unsigned int  eventType,
unsigned int  key_sym,
const char *  character 
) [private]

Definition at line 521 of file HudView.cpp.

{
  if ((eventType == nux::NUX_KEYDOWN) && (key_sym == NUX_VK_ESCAPE))
  {
    if (search_bar_->search_string == "")
    {
      ubus.SendMessage(UBUS_HUD_CLOSE_REQUEST);
    }
    else
    {
      search_bar_->search_string = "";
    }
    return true;
  }
  return false;
}

Here is the call graph for this function:

GVariant * unity::debug::Introspectable::Introspect ( ) [inherited]

Definition at line 47 of file Introspectable.cpp.

{
  GVariantBuilder  builder;
  GVariantBuilder  child_builder;
  gint             n_children = 0;

  g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}"));
  g_variant_builder_add(&builder, "{sv}", "id", g_variant_new_uint64(_id));

  AddProperties(&builder);

  g_variant_builder_init(&child_builder, G_VARIANT_TYPE("as"));

  auto children = GetIntrospectableChildren();
  for (auto it = children.begin(); it != children.end(); it++)
  {
    if ((*it)->GetName() != "")
    {
      g_variant_builder_add(&child_builder, "s", (*it)->GetName().c_str());
      n_children++;
    }
  }

  GVariant* child_results = g_variant_builder_end(&child_builder);

  if (n_children > 0)
    g_variant_builder_add(&builder, "{sv}", GetChildsName().c_str(), child_results);
  return g_variant_builder_end(&builder);
}

Here is the call graph for this function:

void unity::hud::View::OnKeyDown ( unsigned long  event_type,
unsigned long  event_keysym,
unsigned long  event_state,
const TCHAR *  character,
unsigned short  key_repeat_count 
) [private]

Definition at line 411 of file HudView.cpp.

{
  if (keysym == NUX_VK_ESCAPE)
  {
    LOG_DEBUG(logger) << "got escape key";
    ubus.SendMessage(UBUS_HUD_CLOSE_REQUEST);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::hud::View::OnMouseButtonDown ( int  x,
int  y,
unsigned long  button,
unsigned long  key 
) [private]

Definition at line 422 of file HudView.cpp.

{
  nux::Geometry current_geo(content_geo_);
  current_geo.height = current_height_;
  if (!current_geo.IsPointInside(x, y))
  {
    ubus.SendMessage(UBUS_HUD_CLOSE_REQUEST);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 545 of file HudView.cpp.

{
  // The "Enter" key has been received and the text entry has the key focus.
  // If one of the button has the fake_focus, we get it to emit the query_activated signal.
  if (!buttons_.empty())
  {
    std::list<HudButton::Ptr>::iterator it;
    for(it = buttons_.begin(); it != buttons_.end(); ++it)
    {
      if ((*it)->fake_focused)
      {
        query_activated.emit((*it)->GetQuery());
        return;
      }
    }
  }
  search_activated.emit(search_bar_->search_string);
}

Here is the caller graph for this function:

void unity::hud::View::OnSearchChanged ( std::string const &  search_string) [protected]

Definition at line 396 of file HudView.cpp.

{
  LOG_DEBUG(logger) << "got search change";
  search_changed.emit(search_string);

  for(auto button : buttons_)
  {
    button->fake_focused = false;
  }

  if (!buttons_.empty())
    buttons_.back()->fake_focused = true;
}

Here is the caller graph for this function:

long unity::hud::View::PostLayoutManagement ( long  LayoutResult) [protected, virtual]

Definition at line 188 of file HudView.cpp.

{
  Relayout();
  if (GetGeometry().height != last_known_height_)
  {
    // Start the timeline of drawing the dash resize
    if (timeline_need_more_draw_)
    {
      // already started, just reset the last known height
      last_known_height_ = current_height_;
    }

    timeline_need_more_draw_ = true;
    start_time_ = g_get_monotonic_time();
    QueueDraw();
  }

  return LayoutResult;
}

Here is the call graph for this function:

Definition at line 123 of file HudView.cpp.

{
  float diff = g_get_monotonic_time() - start_time_;
  int target_height = content_layout_->GetGeometry().height;
  // only animate if we are after our defined pause time
  if (diff > pause_before_grow_length)
  {
   float progress = (diff - pause_before_grow_length) / grow_anim_length;
   int last_height = last_known_height_;
   int new_height = 0;

   if (last_height < target_height)
   {
     // grow
     new_height = last_height + ((target_height - last_height) * progress);
   }
   else
   {
     //shrink
     new_height = last_height - ((last_height - target_height) * progress);
   }

   LOG_DEBUG(logger) << "resizing to " << target_height << " (" << new_height << ")"
                     << "View height: " << GetGeometry().height;
   current_height_ = new_height;
  }

  for (auto button : buttons_)
  {
    button->SetSkipDraw((button->GetAbsoluteY() + button->GetBaseHeight()) > (GetAbsoluteY() + current_height_));
  }

  QueueDraw();

  if (diff > grow_anim_length + pause_before_grow_length)
  {
    // ensure we are at our final location and update last known height
    current_height_ = target_height;
    last_known_height_ = target_height;
    timeline_need_more_draw_ = false;
  }
}

Here is the caller graph for this function:

void unity::hud::View::Relayout ( ) [virtual]

Implements unity::hud::AbstractView.

Definition at line 176 of file HudView.cpp.

{
  nux::Geometry const& geo = GetGeometry();
  content_geo_ = GetBestFitGeometry(geo);
  LOG_DEBUG(logger) << "content_geo: " << content_geo_.width << "x" << content_geo_.height;

  layout_->SetMinimumWidth(content_geo_.width);
  layout_->SetMaximumSize(content_geo_.width, content_geo_.height);

  QueueDraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 85 of file Introspectable.cpp.

{
  _children.remove(child);
  child->_parents.remove(this);
}

Here is the caller graph for this function:

Implements unity::hud::AbstractView.

Definition at line 167 of file HudView.cpp.

{
  SetQueries(Hud::Queries());
  current_height_ = content_layout_->GetBaseHeight();;

  search_bar_->search_string = "";
  search_bar_->search_hint = _("Type your command");
}

Here is the call graph for this function:

Implements unity::hud::AbstractView.

Definition at line 540 of file HudView.cpp.

{
  search_bar_->SearchFinished();
}
void unity::hud::View::SetIcon ( std::string const &  icon_name,
unsigned int  tile_size,
unsigned int  size,
unsigned int  padding 
) [virtual]

Implements unity::hud::AbstractView.

Definition at line 277 of file HudView.cpp.

{
  if (!icon_)
    return;

  LOG_DEBUG(logger) << "Setting icon to " << icon_name;

  icon_->SetIcon(icon_name, size, tile_size);
  icon_->SetMinimumWidth(tile_size + padding);

  /* We need to compute this value manually, since the _content_layout height changes */
  int content_height = search_bar_->GetBaseHeight() + top_padding + bottom_padding;
  icon_->SetMinimumHeight(std::max(icon_->GetMinimumHeight(), content_height));

  QueueDraw();
}
void unity::hud::View::SetQueries ( Hud::Queries  queries) [virtual]

Implements unity::hud::AbstractView.

Definition at line 219 of file HudView.cpp.

{
  // early exit, if the user is key navigating on the hud, we don't want to set new
  // queries under them, that is just rude
  if (!buttons_.empty() && buttons_.back()->fake_focused == false)
    return;

  // remove the previous children
  for (auto button : buttons_)
  {
    RemoveChild(button.GetPointer());
  }

  selected_button_ = 0;
  queries_ = queries_;
  buttons_.clear();
  button_views_->Clear();
  int found_items = 0;
  for (auto query : queries)
  {
    if (found_items >= 5)
      break;

    HudButton::Ptr button(new HudButton());
    buttons_.push_front(button);
    button->SetMinimumWidth(content_width);
    button->SetMaximumWidth(content_width);
    button->SetQuery(query);

    button_views_->AddView(button.GetPointer(), 0, nux::MINOR_POSITION_LEFT);

    button->click.connect([&](nux::View* view) {
      query_activated.emit(dynamic_cast<HudButton*>(view)->GetQuery());
    });

    button->key_nav_focus_activate.connect([&](nux::Area* area) {
      query_activated.emit(dynamic_cast<HudButton*>(area)->GetQuery());
    });

    button->key_nav_focus_change.connect([&](nux::Area* area, bool recieving, nux::KeyNavDirection direction){
      if (recieving)
        query_selected.emit(dynamic_cast<HudButton*>(area)->GetQuery());
    });

    ++found_items;
  }

  if (found_items)
  {
    buttons_.front()->is_rounded = true;
    buttons_.back()->fake_focused = true;
    selected_button_ = 1;
  }

  QueueRelayout();
  QueueDraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::hud::View::SetupViews ( ) [protected]

Definition at line 353 of file HudView.cpp.

{
  dash::Style& style = dash::Style::Instance();

  nux::VLayout* super_layout = new nux::VLayout();
  layout_ = new nux::HLayout();
  {
    // fill layout with icon
    icon_ = new Icon();
    {
      AddChild(icon_.GetPointer());
      layout_->AddView(icon_.GetPointer(), 0, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL);
    }

    // fill the content layout
    content_layout_ = new nux::VLayout();
    {
      // Set the layout paddings
      content_layout_->SetLeftAndRightPadding(left_padding, right_padding);
      content_layout_->SetTopAndBottomPadding(top_padding, bottom_padding);

      // add the search bar to the composite
      search_bar_ = new unity::SearchBar(true);
      search_bar_->SetMinimumHeight(style.GetSearchBarHeight());
      search_bar_->SetMaximumHeight(style.GetSearchBarHeight());
      search_bar_->search_hint = _("Type your command");
      search_bar_->live_search_reached.connect(sigc::mem_fun(this, &View::OnSearchChanged));
      AddChild(search_bar_.GetPointer());
      content_layout_->AddView(search_bar_.GetPointer(), 0, nux::MINOR_POSITION_LEFT);

      button_views_ = new nux::VLayout();
      button_views_->SetMaximumWidth(content_width);

      content_layout_->AddLayout(button_views_.GetPointer(), 1, nux::MINOR_POSITION_LEFT);
    }

    layout_->AddLayout(content_layout_.GetPointer(), 1, nux::MINOR_POSITION_TOP);
  }

  super_layout->AddLayout(layout_.GetPointer(), 0);
  SetLayout(super_layout);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::hud::View::SetWindowGeometry ( nux::Geometry const &  absolute_geo,
nux::Geometry const &  geo 
) [virtual]

Implements unity::hud::AbstractView.

Definition at line 345 of file HudView.cpp.

void unity::hud::View::ShowEmbeddedIcon ( bool  show) [virtual]

Implements unity::hud::AbstractView.

Definition at line 294 of file HudView.cpp.

{
  LOG_DEBUG(logger) << "Hide icon called";
  if (show == show_embedded_icon_)
    return;

  show_embedded_icon_ = show;

  if (show_embedded_icon_)
  {
    layout_->AddView(icon_.GetPointer(), 0, nux::MINOR_POSITION_LEFT,
                     nux::MINOR_SIZE_FULL, 100.0f, nux::LayoutPosition::NUX_LAYOUT_BEGIN);
    AddChild(icon_.GetPointer());
  }
  else
  {
    layout_->RemoveChildObject(icon_.GetPointer());
    RemoveChild(icon_.GetPointer());
  }

  Relayout();
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 109 of file HudView.h.

Definition at line 118 of file HudView.h.

nux::ObjectPtr<nux::VLayout> unity::hud::View::button_views_ [private]

Definition at line 96 of file HudView.h.

Definition at line 97 of file HudView.h.

nux::Geometry unity::hud::View::content_geo_ [private]

Definition at line 106 of file HudView.h.

nux::ObjectPtr<nux::Layout> unity::hud::View::content_layout_ [private]

Definition at line 95 of file HudView.h.

Definition at line 114 of file HudView.h.

Definition at line 102 of file HudView.h.

Definition at line 98 of file HudView.h.

Definition at line 113 of file HudView.h.

nux::ObjectPtr<nux::Layout> unity::hud::View::layout_ [private]

Definition at line 94 of file HudView.h.

Definition at line 105 of file HudView.h.

sigc::signal<void, Query::Ptr> unity::hud::AbstractView::query_activated [inherited]

Definition at line 59 of file HudAbstractView.h.

sigc::signal<void, Query::Ptr> unity::hud::AbstractView::query_selected [inherited]

Definition at line 60 of file HudAbstractView.h.

Definition at line 107 of file HudView.h.

sigc::signal<void, std::string> unity::hud::AbstractView::search_activated [inherited]

Definition at line 58 of file HudAbstractView.h.

Definition at line 101 of file HudView.h.

sigc::signal<void, std::string> unity::hud::AbstractView::search_changed [inherited]

Definition at line 57 of file HudAbstractView.h.

Definition at line 116 of file HudView.h.

Definition at line 117 of file HudView.h.

guint64 unity::hud::View::start_time_ [private]

Definition at line 112 of file HudView.h.

Definition at line 110 of file HudView.h.

Definition at line 115 of file HudView.h.

Definition at line 93 of file HudView.h.

Definition at line 103 of file HudView.h.

nux::Geometry unity::hud::View::window_geometry_ [private]

Definition at line 108 of file HudView.h.


The documentation for this class was generated from the following files: