Back to index

unity  6.0.0
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes
unity::dash::FilterRatingsWidget Class Reference

#include <FilterRatingsWidget.h>

Inheritance diagram for unity::dash::FilterRatingsWidget:
Inheritance graph
[legend]
Collaboration diagram for unity::dash::FilterRatingsWidget:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::list
< Introspectable * > 
IntrospectableList

Public Member Functions

 FilterRatingsWidget (NUX_FILE_LINE_PROTO)
virtual ~FilterRatingsWidget ()
void SetFilter (Filter::Ptr const &filter)
std::string GetFilterType ()
void SetRightHandView (nux::View *view)
void SetLabel (std::string const &label)
void SetContents (nux::Layout *layout)
GVariant * Introspect ()
void AddChild (Introspectable *child)
void RemoveChild (Introspectable *child)
virtual IntrospectableList GetIntrospectableChildren ()
guint64 GetIntrospectionId () const

Public Attributes

nux::Property< bool > expanded
nux::Property< bool > draw_separator

Protected Member Functions

virtual bool AcceptKeyNavFocus ()
virtual void Draw (nux::GraphicsEngine &GfxContext, bool force_draw)
virtual void DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw)
virtual std::string GetName () const
virtual void AddProperties (GVariantBuilder *builder)
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 (FilterRatingsWidget, FilterExpanderLabel)

Private Attributes

FilterAllButtonall_button_
FilterRatingsButtonratings_
RatingsFilter::Ptr filter_

Detailed Description

Definition at line 43 of file FilterRatingsWidget.h.


Member Typedef Documentation

Definition at line 34 of file Introspectable.h.


Constructor & Destructor Documentation

Definition at line 46 of file FilterRatingsWidget.cpp.

  : FilterExpanderLabel(_("Rating"), NUX_FILE_LINE_PARAM)
{
  all_button_ = new FilterAllButton(NUX_TRACKER_LOCATION);

  dash::Style& style = dash::Style::Instance();
  const int top_padding    = style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding() - 1; // -1 (PNGs have an 1px top padding)
  const int bottom_padding = style.GetFilterHighlightPadding();

  nux::VLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION);
  layout->SetTopAndBottomPadding(top_padding, bottom_padding);
  ratings_ = new FilterRatingsButton(NUX_TRACKER_LOCATION);
  ratings_->SetMinimumHeight(star_size);

  layout->AddView(ratings_);

  SetRightHandView(all_button_);
  SetContents(layout);
}

Here is the call graph for this function:

Definition at line 66 of file FilterRatingsWidget.cpp.

{
}

Member Function Documentation

bool unity::dash::FilterExpanderLabel::AcceptKeyNavFocus ( ) [protected, virtual, inherited]

Definition at line 305 of file FilterExpanderLabel.cpp.

{
  return true;
}

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::dash::FilterExpanderLabel::AddProperties ( GVariantBuilder *  builder) [protected, virtual, inherited]

Implements unity::debug::Introspectable.

Definition at line 318 of file FilterExpanderLabel.cpp.

{
  unity::variant::BuilderWrapper wrapper(builder);

  wrapper.add("expander-has-focus", expander_view_->HasKeyFocus());
}

Here is the call graph for this function:

void unity::dash::FilterExpanderLabel::Draw ( nux::GraphicsEngine &  GfxContext,
bool  force_draw 
) [protected, virtual, inherited]

Definition at line 266 of file FilterExpanderLabel.cpp.

{
  nux::Geometry const& base = GetGeometry();

  GfxContext.PushClippingRectangle(base);
  nux::GetPainter().PaintBackground(GfxContext, base);

  if (ShouldBeHighlighted())
  {
    nux::Geometry geo(top_bar_layout_->GetGeometry());
    geo.x = base.x;
    geo.width = base.width;

    if (!highlight_layer_)
      highlight_layer_.reset(dash::Style::Instance().FocusOverlay(geo.width, geo.height));

    highlight_layer_->SetGeometry(geo);
    highlight_layer_->Renderlayer(GfxContext);
  }

  GfxContext.PopClippingRectangle();
}

Here is the call graph for this function:

void unity::dash::FilterExpanderLabel::DrawContent ( nux::GraphicsEngine &  GfxContext,
bool  force_draw 
) [protected, virtual, inherited]

Definition at line 289 of file FilterExpanderLabel.cpp.

{
  GfxContext.PushClippingRectangle(GetGeometry());

  if (ShouldBeHighlighted() && highlight_layer_ && !IsFullRedraw())
  {
    nux::GetPainter().PushLayer(GfxContext, highlight_layer_->GetGeometry(), highlight_layer_.get());
  }

  GetLayout()->ProcessDraw(GfxContext, force_draw);
  GfxContext.PopClippingRectangle();
}

Here is the call 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:

Implements unity::dash::FilterExpanderLabel.

Definition at line 82 of file FilterRatingsWidget.cpp.

{
  return "FilterRatingsWidget";
}
Introspectable::IntrospectableList unity::debug::Introspectable::GetIntrospectableChildren ( ) [virtual, inherited]

Reimplemented in unity::hud::View, unity::launcher::LauncherModel, unity::QuicklistView, and unity::dash::ResultView.

Definition at line 41 of file Introspectable.cpp.

{
  return _children;
}

Here is the caller 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::dash::FilterExpanderLabel::GetName ( ) const [protected, virtual, inherited]

Implements unity::debug::Introspectable.

Definition at line 313 of file FilterExpanderLabel.cpp.

{
  return "FilterExpanderLabel";
}
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:

Definition at line 85 of file Introspectable.cpp.

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

Here is the caller graph for this function:

void unity::dash::FilterExpanderLabel::SetContents ( nux::Layout *  layout) [inherited]

Definition at line 152 of file FilterExpanderLabel.cpp.

{
  // Since the contents is initially unowned, we don't want to Adopt it, just assign.
  contents_ = contents;

  layout_->AddLayout(contents_.GetPointer(), 1, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL);

  QueueDraw();
}

Here is the caller graph for this function:

void unity::dash::FilterRatingsWidget::SetFilter ( Filter::Ptr const &  filter) [virtual]

Implements unity::dash::FilterExpanderLabel.

Definition at line 70 of file FilterRatingsWidget.cpp.

{
  filter_ = std::static_pointer_cast<RatingsFilter>(filter);

  all_button_->SetFilter(filter_);
  expanded = !filter_->collapsed();
  ratings_->SetFilter(filter_);

  SetLabel(filter_->name);
  NeedRedraw();
}

Here is the call graph for this function:

void unity::dash::FilterExpanderLabel::SetLabel ( std::string const &  label) [inherited]

Definition at line 135 of file FilterExpanderLabel.cpp.

{
  raw_label_ = label;

  cairo_label_->SetText(label.c_str());
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::dash::FilterExpanderLabel::SetRightHandView ( nux::View *  view) [inherited]

Definition at line 142 of file FilterExpanderLabel.cpp.

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

  right_hand_contents_ = view;
  right_hand_contents_->SetMinimumHeight(style.GetAllButtonHeight());
  right_hand_contents_->SetMaximumHeight(style.GetAllButtonHeight());
  top_bar_layout_->AddView(right_hand_contents_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 54 of file FilterRatingsWidget.h.

nux::Property<bool> unity::dash::FilterExpanderLabel::draw_separator [inherited]

Definition at line 67 of file FilterExpanderLabel.h.

nux::Property<bool> unity::dash::FilterExpanderLabel::expanded [inherited]

Definition at line 66 of file FilterExpanderLabel.h.

Definition at line 56 of file FilterRatingsWidget.h.

Definition at line 55 of file FilterRatingsWidget.h.


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