Back to index

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

#include <FilterAllButton.h>

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

List of all members.

Public Member Functions

 FilterAllButton (NUX_FILE_LINE_PROTO)
 ~FilterAllButton ()
void SetFilter (Filter::Ptr const &filter)

Protected Types

typedef std::unique_ptr
< nux::CairoWrapper > 
NuxCairoPtr

Protected Member Functions

virtual long ComputeContentSize ()
virtual void Draw (nux::GraphicsEngine &GfxContext, bool force_draw)
void Init ()
void InitTheme ()
void RedrawTheme (nux::Geometry const &geom, cairo_t *cr, nux::ButtonVisualState faked_state)
void RedrawFocusOverlay (nux::Geometry const &geom, cairo_t *cr)

Protected Attributes

NuxCairoPtr prelight_
NuxCairoPtr active_
NuxCairoPtr normal_
NuxCairoPtr focus_
nux::Geometry cached_geometry_

Private Member Functions

void OnFilteringChanged (bool filtering)
void OnStateChanged (nux::View *view)

Private Attributes

Filter::Ptr filter_
sigc::connection filtering_connection_

Detailed Description

Definition at line 36 of file FilterAllButton.h.


Member Typedef Documentation

typedef std::unique_ptr<nux::CairoWrapper> unity::dash::FilterBasicButton::NuxCairoPtr [protected, inherited]

Definition at line 52 of file FilterBasicButton.h.


Constructor & Destructor Documentation

Definition at line 34 of file FilterAllButton.cpp.

 : FilterBasicButton(_("All"), NUX_FILE_LINE_PARAM)
{
  SetActive(true);
  SetInputEventSensitivity(false);

  state_change.connect(sigc::mem_fun(this, &FilterAllButton::OnStateChanged));
}

Here is the call graph for this function:

Definition at line 43 of file FilterAllButton.cpp.

{
}

Member Function Documentation

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

Definition at line 111 of file FilterBasicButton.cpp.

{
  long ret = nux::Button::ComputeContentSize();

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

  if (cached_geometry_ != geo)
  {
    prelight_->Invalidate(geo);
    active_->Invalidate(geo);
    normal_->Invalidate(geo);
    focus_->Invalidate(geo);

    cached_geometry_ = geo;
  }

  return ret;
}
void unity::dash::FilterBasicButton::Draw ( nux::GraphicsEngine &  GfxContext,
bool  force_draw 
) [protected, virtual, inherited]

Definition at line 130 of file FilterBasicButton.cpp.

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

  gPainter.PaintBackground(GfxContext, geo);
  // set up our texture mode
  nux::TexCoordXForm texxform;
  texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
  texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);

  // clear what is behind us
  unsigned int alpha = 0, src = 0, dest = 0;
  GfxContext.GetRenderStates().GetBlend(alpha, src, dest);
  GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

  nux::Color col = nux::color::Black;
  col.alpha = 0;
  GfxContext.QRP_Color(geo.x,
                       geo.y,
                       geo.width,
                       geo.height,
                       col);

  nux::BaseTexture* texture = normal_->GetTexture();
  if (Active())
    texture = active_->GetTexture();
  else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)
    texture = prelight_->GetTexture();
  else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
    texture = active_->GetTexture();

  GfxContext.QRP_1Tex(geo.x,
                      geo.y,
                      geo.width,
                      geo.height,
                      texture->GetDeviceTexture(),
                      texxform,
                      nux::Color(1.0f, 1.0f, 1.0f, 1.0f));

  if (HasKeyboardFocus())
  {
    GfxContext.QRP_1Tex(geo.x,
                        geo.y,
                        geo.width,
                        geo.height,
                        focus_->GetTexture()->GetDeviceTexture(),
                        texxform,
                        nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
  }

  GfxContext.GetRenderStates().SetBlend(alpha, src, dest);
}
void unity::dash::FilterBasicButton::Init ( ) [protected, inherited]

Definition at line 66 of file FilterBasicButton.cpp.

{

  InitTheme();
  SetAcceptKeyNavFocusOnMouseDown(false);
  SetAcceptKeyNavFocusOnMouseEnter(true);

  key_nav_focus_change.connect([&] (nux::Area*, bool, nux::KeyNavDirection)
  {
    QueueDraw();
  });

  key_nav_focus_activate.connect([&](nux::Area*)
  {
    if (GetInputEventSensitivity())
      Active() ? Deactivate() : Activate();
  });
}

Here is the call graph for this function:

void unity::dash::FilterBasicButton::InitTheme ( ) [protected, inherited]

Definition at line 85 of file FilterBasicButton.cpp.

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

    prelight_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)));
    active_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED)));
    normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));
    focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &FilterBasicButton::RedrawFocusOverlay)));
  }

  SetMinimumHeight(kMinButtonHeight);
  SetMinimumWidth(kMinButtonWidth);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::dash::FilterAllButton::OnFilteringChanged ( bool  filtering) [private]

Definition at line 65 of file FilterAllButton.cpp.

{
  SetActive(!filtering);
  SetInputEventSensitivity(filtering);
}

Here is the caller graph for this function:

void unity::dash::FilterAllButton::OnStateChanged ( nux::View *  view) [private]

Definition at line 58 of file FilterAllButton.cpp.

{
  if (filter_ and Active())
    filter_->Clear();
  QueueDraw();
}

Here is the caller graph for this function:

void unity::dash::FilterBasicButton::RedrawFocusOverlay ( nux::Geometry const &  geom,
cairo_t *  cr 
) [protected, inherited]

Definition at line 106 of file FilterBasicButton.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::dash::FilterBasicButton::RedrawTheme ( nux::Geometry const &  geom,
cairo_t *  cr,
nux::ButtonVisualState  faked_state 
) [protected, inherited]

Definition at line 101 of file FilterBasicButton.cpp.

{
  Style::Instance().Button(cr, faked_state, label_, -1, Alignment::CENTER, true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 47 of file FilterAllButton.cpp.

{
  if (filtering_connection_.connected())
    filtering_connection_.disconnect();

  filter_ = filter;
  OnFilteringChanged(filter_->filtering); // Evil hack ;)

  filtering_connection_ = filter_->filtering.changed.connect(sigc::mem_fun(this, &FilterAllButton::OnFilteringChanged));
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 55 of file FilterBasicButton.h.

nux::Geometry unity::dash::FilterBasicButton::cached_geometry_ [protected, inherited]

Definition at line 59 of file FilterBasicButton.h.

Definition at line 48 of file FilterAllButton.h.

Definition at line 49 of file FilterAllButton.h.

Definition at line 57 of file FilterBasicButton.h.

Definition at line 56 of file FilterBasicButton.h.

Definition at line 54 of file FilterBasicButton.h.


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