Back to index

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

#include <FilterGenreWidget.h>

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

List of all members.

Public Types

typedef std::list
< Introspectable * > 
IntrospectableList

Public Member Functions

 FilterGenre (int columns, NUX_FILE_LINE_PROTO)
virtual ~FilterGenre ()
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

void InitTheme ()
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 (FilterGenre, FilterExpanderLabel)
void OnOptionAdded (FilterOption::Ptr const &new_filter)
void OnOptionRemoved (FilterOption::Ptr const &removed_filter)

Private Attributes

nux::GridHLayout * genre_layout_
FilterAllButtonall_button_
std::vector< FilterGenreButton * > buttons_
CheckOptionFilter::Ptr filter_

Detailed Description

Definition at line 44 of file FilterGenreWidget.h.


Member Typedef Documentation

Definition at line 34 of file Introspectable.h.


Constructor & Destructor Documentation

unity::dash::FilterGenre::FilterGenre ( int  columns,
NUX_FILE_LINE_PROTO   
)

Definition at line 39 of file FilterGenreWidget.cpp.

 : FilterExpanderLabel(_("Categories"), NUX_FILE_LINE_PARAM)
{
  dash::Style& style = dash::Style::Instance();

  InitTheme();

  all_button_ = new FilterAllButton(NUX_TRACKER_LOCATION);

  genre_layout_ = new nux::GridHLayout(NUX_TRACKER_LOCATION);
  genre_layout_->ForceChildrenSize(true);
  genre_layout_->MatchContentSize(true);
  genre_layout_->SetTopAndBottomPadding(style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding(), style.GetFilterHighlightPadding());
  genre_layout_->EnablePartialVisibility(false);

  if (columns == 3)
  {
    genre_layout_->SetChildrenSize((style.GetFilterBarWidth() - 12 * 2) / 3, style.GetFilterButtonHeight());
    genre_layout_->SetSpaceBetweenChildren (12, 12);
  }
  else
  {
    genre_layout_->SetChildrenSize((style.GetFilterBarWidth() - 10 ) / 2, style.GetFilterButtonHeight());
    genre_layout_->SetSpaceBetweenChildren (10, 12);
  }

  SetRightHandView(all_button_);
  SetContents(genre_layout_);
}

Here is the call graph for this function:

Definition at line 69 of file FilterGenreWidget.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:

std::string unity::dash::FilterGenre::GetFilterType ( ) [virtual]

Implements unity::dash::FilterExpanderLabel.

Definition at line 116 of file FilterGenreWidget.cpp.

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

Definition at line 121 of file FilterGenreWidget.cpp.

{
  //FIXME - build theme here - store images, cache them, fun fun fun
}

Here is the caller 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::dash::FilterGenre::OnOptionAdded ( FilterOption::Ptr const &  new_filter) [private]

Definition at line 90 of file FilterGenreWidget.cpp.

{
  std::string tmp_label(new_filter->name);

  glib::String escape(g_markup_escape_text(tmp_label.c_str(), -1));
  std::string label(escape.Value());

  FilterGenreButton* button = new FilterGenreButton(label, NUX_TRACKER_LOCATION);
  button->SetFilter(new_filter);
  genre_layout_->AddView(button, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
  buttons_.push_back(button);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::dash::FilterGenre::OnOptionRemoved ( FilterOption::Ptr const &  removed_filter) [private]

Definition at line 103 of file FilterGenreWidget.cpp.

{
  for (auto it=buttons_.begin() ; it != buttons_.end(); ++it)
  {
    if ((*it)->GetFilter() == removed_filter)
    {
      genre_layout_->RemoveChildObject(*it);
      buttons_.erase(it);
      break;
    }
  }
}

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:

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::FilterGenre::SetFilter ( Filter::Ptr const &  filter) [virtual]

Implements unity::dash::FilterExpanderLabel.

Definition at line 73 of file FilterGenreWidget.cpp.

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

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

  filter_->option_added.connect(sigc::mem_fun(this, &FilterGenre::OnOptionAdded));
  filter_->option_removed.connect(sigc::mem_fun(this, &FilterGenre::OnOptionRemoved));

  // finally - make sure we are up-todate with our filter list
  for (auto it : filter_->options())
    OnOptionAdded(it);

  SetLabel(filter_->name);
}

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 62 of file FilterGenreWidget.h.

Definition at line 64 of file FilterGenreWidget.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 65 of file FilterGenreWidget.h.

nux::GridHLayout* unity::dash::FilterGenre::genre_layout_ [private]

Definition at line 61 of file FilterGenreWidget.h.


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