Back to index

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

#include <FilterBar.h>

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

List of all members.

Public Types

typedef std::list
< Introspectable * > 
IntrospectableList

Public Member Functions

 FilterBar (NUX_FILE_LINE_PROTO)
 ~FilterBar ()
void SetFilters (Filters::Ptr const &filters)
void AddFilter (Filter::Ptr const &filter)
void RemoveFilter (Filter::Ptr const &filter)
GVariant * Introspect ()
void AddChild (Introspectable *child)
void RemoveChild (Introspectable *child)
virtual IntrospectableList GetIntrospectableChildren ()
guint64 GetIntrospectionId () const

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 (FilterBar, nux::View)
void Init ()
void UpdateDrawSeparators ()

Private Attributes

FilterFactory factory_
Filters::Ptr filters_
std::map< Filter::Ptr,
FilterExpanderLabel * > 
filter_map_

Detailed Description

Definition at line 40 of file FilterBar.h.


Member Typedef Documentation

Definition at line 34 of file Introspectable.h.


Constructor & Destructor Documentation

unity::dash::FilterBar::FilterBar ( NUX_FILE_LINE_PROTO  )

Definition at line 44 of file FilterBar.cpp.

  : View(NUX_FILE_LINE_PARAM)
{
  // TODO - does the filterbar associate itself with a model of some sort?
  // does libunity provide a Lens.Filters model or something that we can update on?
  // don't want to associate a Filterbar with just a lens model, its a filter bar not a
  // lens parser
  Init();
}

Here is the call graph for this function:

Definition at line 54 of file FilterBar.cpp.

{
}

Member Function Documentation

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

Definition at line 145 of file FilterBar.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:

Definition at line 73 of file FilterBar.cpp.

{
  if (filter_map_.count(filter) > 0)
  {
    LOG_WARN(logger) << "Attempting to add a filter that has already been added";
    return;
  }

  FilterExpanderLabel* filter_view = factory_.WidgetForFilter(filter);
  AddChild(filter_view);
  filter_map_[filter] = filter_view;
  GetLayout()->AddView(filter_view, 0, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL);

  UpdateDrawSeparators();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::dash::FilterBar::AddProperties ( GVariantBuilder *  builder) [protected, virtual]

Implements unity::debug::Introspectable.

Definition at line 158 of file FilterBar.cpp.

{
  variant::BuilderWrapper(builder)
    .add("x", GetAbsoluteX())
    .add("y", GetAbsoluteY())
    .add("width", GetAbsoluteWidth())
    .add("height", GetAbsoluteHeight());
}

Here is the call graph for this function:

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

Definition at line 106 of file FilterBar.cpp.

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

  GfxContext.PushClippingRectangle(geo);
  nux::GetPainter().PaintBackground(GfxContext, geo);
  GfxContext.PopClippingRectangle();
}
void unity::dash::FilterBar::DrawContent ( nux::GraphicsEngine &  GfxContext,
bool  force_draw 
) [protected, virtual]

Definition at line 115 of file FilterBar.cpp.

{
  GfxContext.PushClippingRectangle(GetGeometry());
  GetLayout()->ProcessDraw(GfxContext, force_draw);

  GfxContext.PopClippingRectangle();
}
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:

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::FilterBar::GetName ( ) const [protected, virtual]

Implements unity::debug::Introspectable.

Definition at line 153 of file FilterBar.cpp.

{
  return "FilterBar";
}
void unity::dash::FilterBar::Init ( ) [private]

Definition at line 58 of file FilterBar.cpp.

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

  nux::LinearLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION);
  layout->SetTopAndBottomPadding(style.GetFilterBarTopPadding() - style.GetFilterHighlightPadding());
  layout->SetSpaceBetweenChildren(style.GetSpaceBetweenFilterWidgets() - style.GetFilterHighlightPadding());
  SetLayout(layout);
}

Here is the call graph for this function:

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:

Definition at line 85 of file Introspectable.cpp.

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

Here is the caller graph for this function:

Definition at line 89 of file FilterBar.cpp.

{
  for (auto iter: filter_map_)
  {
    if (iter.first->id == filter->id)
    {
      FilterExpanderLabel* filter_view = iter.second;
      RemoveChild(filter_view);
      filter_map_.erase(filter_map_.find(iter.first));
      GetLayout()->RemoveChildObject(filter_view);
      break;
    }
  }

  UpdateDrawSeparators();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 68 of file FilterBar.cpp.

{
  filters_ = filters;
}

Definition at line 123 of file FilterBar.cpp.

{
  std::list<Area*> children = GetLayout()->GetChildren();
  std::list<Area*>::reverse_iterator rit;
  bool found_one = false;

  for (rit = children.rbegin(); rit != children.rend(); ++rit)
  {
    FilterExpanderLabel* widget = dynamic_cast<FilterExpanderLabel*>(*rit);

    if (!widget)
      continue;

    widget->draw_separator = found_one;
    found_one = true;
  }
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 65 of file FilterBar.h.

Definition at line 67 of file FilterBar.h.

Definition at line 66 of file FilterBar.h.


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