Back to index

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

#include <ResultView.h>

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

List of all members.

Public Types

typedef std::vector< ResultResultList
typedef std::list
< Introspectable * > 
IntrospectableList

Public Member Functions

 NUX_DECLARE_OBJECT_TYPE (ResultView, nux::View)
 ResultView (NUX_FILE_LINE_DECL)
virtual ~ResultView ()
void SetModelRenderer (ResultRenderer *renderer)
void AddResult (Result &result)
void RemoveResult (Result &result)
ResultList GetResultList ()
std::string GetName () const
void AddProperties (GVariantBuilder *builder)
IntrospectableList GetIntrospectableChildren ()
GVariant * Introspect ()
void AddChild (Introspectable *child)
void RemoveChild (Introspectable *child)
guint64 GetIntrospectionId () const

Public Attributes

nux::Property< bool > expanded
nux::Property< int > results_per_row
sigc::signal< void,
std::string const & > 
UriActivated

Protected Member Functions

virtual void Draw (nux::GraphicsEngine &GfxContext, bool force_draw)
virtual void DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw)
virtual long ComputeContentSize ()
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'.

Protected Attributes

ResultRendererrenderer_
ResultList results_
IntrospectableList introspectable_children_

Private Member Functions

void ClearIntrospectableWrappers ()

Detailed Description

Definition at line 40 of file ResultView.h.


Member Typedef Documentation

Definition at line 34 of file Introspectable.h.

Definition at line 45 of file ResultView.h.


Constructor & Destructor Documentation

unity::dash::ResultView::ResultView ( NUX_FILE_LINE_DECL  )

Definition at line 43 of file ResultView.cpp.

  : View(NUX_FILE_LINE_PARAM)
  , expanded(true)
  , renderer_(NULL)
{
  expanded.changed.connect([&](bool value)
  {
    QueueRelayout();
    NeedRedraw();
  });
}

Definition at line 55 of file ResultView.cpp.

{
  ClearIntrospectableWrappers();

  for (auto result : results_)
  {
    renderer_->Unload(result);
  }

  renderer_->UnReference();
}

Here is the call graph for this function:


Member Function Documentation

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::ResultView::AddProperties ( GVariantBuilder *  builder) [virtual]

Implements unity::debug::Introspectable.

Definition at line 139 of file ResultView.cpp.

{
  unity::variant::BuilderWrapper(builder)
    .add("expanded", expanded);
}

Here is the call graph for this function:

Reimplemented in unity::dash::ResultViewGrid.

Definition at line 87 of file ResultView.cpp.

{
  results_.push_back(result);
  renderer_->Preload(result);

  NeedRedraw();
}

Here is the call graph for this function:

Definition at line 156 of file ResultView.cpp.

{
  // delete old results, then add new results
  for (auto old_result: introspectable_children_)
  {
    delete old_result;
  }
  introspectable_children_.clear();
}

Here is the caller graph for this function:

long unity::dash::ResultView::ComputeContentSize ( ) [protected, virtual]

Reimplemented in unity::dash::ResultViewGrid.

Definition at line 117 of file ResultView.cpp.

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

Reimplemented in unity::dash::ResultViewGrid.

Definition at line 67 of file ResultView.cpp.

{

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

Reimplemented in unity::dash::ResultViewGrid.

Definition at line 123 of file ResultView.cpp.

{
  nux::Geometry base = GetGeometry();
  GfxContent.PushClippingRectangle(base);

  if (GetCompositionLayout())
    GetCompositionLayout()->ProcessDraw(GfxContent, force_draw);

  GfxContent.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:

Reimplemented from unity::debug::Introspectable.

Definition at line 145 of file ResultView.cpp.

{
  ClearIntrospectableWrappers();

  for (auto result: results_)
  {
    introspectable_children_.push_back(new debug::ResultWrapper(result));
  }
  return introspectable_children_;
}

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::dash::ResultView::GetName ( ) const [virtual]

Implements unity::debug::Introspectable.

Definition at line 134 of file ResultView.cpp.

{
  return "ResultView";
}

Definition at line 111 of file ResultView.cpp.

{
  return results_;
}

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:

Reimplemented in unity::dash::ResultViewGrid.

Definition at line 95 of file ResultView.cpp.

{
  ResultList::iterator it;
  std::string uri = result.uri;

  for (it = results_.begin(); it != results_.end(); it++)
  {
    if (result.uri == (*it).uri)
    {
      results_.erase(it);
      break;
    }
  }
  renderer_->Unload(result);
}

Here is the call graph for this function:

Reimplemented in unity::dash::ResultViewGrid.

Definition at line 72 of file ResultView.cpp.

{
  if (renderer_ != NULL)
    renderer_->UnReference();

  renderer_ = renderer;
  renderer->NeedsRedraw.connect([&]()
  {
    NeedRedraw();
  });
  renderer_->SinkReference();

  NeedRedraw();
}

Member Data Documentation

nux::Property<bool> unity::dash::ResultView::expanded

Definition at line 57 of file ResultView.h.

Definition at line 74 of file ResultView.h.

Definition at line 72 of file ResultView.h.

Definition at line 73 of file ResultView.h.

Definition at line 58 of file ResultView.h.

sigc::signal<void, std::string const&> unity::dash::ResultView::UriActivated

Definition at line 60 of file ResultView.h.


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