Back to index

unity  6.0.0
Public Member Functions | Protected Member Functions | Protected Attributes
unity::HSeparator Class Reference

#include <LineSeparator.h>

Inheritance diagram for unity::HSeparator:
Inheritance graph
[legend]
Collaboration diagram for unity::HSeparator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 HSeparator ()
 HSeparator (nux::Color const &color, float alpha0, float alpha1, int border)
 ~HSeparator ()
void SetColor (nux::Color const &color)
void SetAlpha (float alpha0, float alpha1)
void SetBorderSize (int border)

Protected Member Functions

virtual bool AcceptKeyNavFocus ()
virtual void Draw (nux::GraphicsEngine &GfxContext, bool force_draw)
virtual void DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw)

Protected Attributes

nux::Color color_
float alpha0_
float alpha1_
int border_size_

Detailed Description

Definition at line 28 of file LineSeparator.h.


Constructor & Destructor Documentation

Definition at line 27 of file LineSeparator.cpp.

{
  SetMinimumHeight(1);
  SetMaximumHeight(1);
}
unity::HSeparator::HSeparator ( nux::Color const &  color,
float  alpha0,
float  alpha1,
int  border 
)

Definition at line 33 of file LineSeparator.cpp.

  : AbstractSeparator(color, alpha0, alpha1, border)
{
  SetMinimumHeight(1);
  SetMaximumHeight(1);
}

Definition at line 40 of file LineSeparator.cpp.

{
}

Member Function Documentation

virtual bool unity::HSeparator::AcceptKeyNavFocus ( ) [inline, protected, virtual]

Definition at line 37 of file LineSeparator.h.

{ return false; }
void unity::HSeparator::Draw ( nux::GraphicsEngine &  GfxContext,
bool  force_draw 
) [protected, virtual]

Definition at line 44 of file LineSeparator.cpp.

{
  nux::Geometry const& base = GetGeometry();
  int y0 = base.y + base.GetHeight() / 2;

  unsigned int alpha = 0, src = 0, dest = 0;
  GfxContext.GetRenderStates().GetBlend(alpha, src, dest);
  nux::GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

  if (base.GetWidth() - 2 * border_size_ > 0)
  {
    nux::Color color0 = color_ * alpha0_;
    nux::Color color1 = color_ * alpha1_;
    nux::GetPainter().Draw2DLine(GfxContext, base.x, y0, base.x + border_size_, y0, color0, color1);
    nux::GetPainter().Draw2DLine(GfxContext, base.x + border_size_, y0, base.x + base.GetWidth() - border_size_, y0, color1, color1);
    nux::GetPainter().Draw2DLine(GfxContext, base.x + base.GetWidth() - border_size_, y0, base.x + base.GetWidth(), y0, color1, color0);
  }
  else
  {
    nux::Color color1 = color_ *  alpha1_;
    nux::GetPainter().Draw2DLine(GfxContext, base.x, y0, base.x + base.GetWidth(), y0, color1, color1);
  }

  GfxContext.GetRenderStates().SetBlend(alpha, src, dest);
}
virtual void unity::HSeparator::DrawContent ( nux::GraphicsEngine &  GfxContext,
bool  force_draw 
) [inline, protected, virtual]

Definition at line 39 of file LineSeparator.h.

{};
void unity::AbstractSeparator::SetAlpha ( float  alpha0,
float  alpha1 
) [inherited]

Definition at line 57 of file AbstractSeparator.cpp.

{
  alpha0_ = alpha0;
  alpha1_ = alpha1;
}
void unity::AbstractSeparator::SetBorderSize ( int  border) [inherited]

Definition at line 63 of file AbstractSeparator.cpp.

{
  border_size_ = border;
}
void unity::AbstractSeparator::SetColor ( nux::Color const &  color) [inherited]

Definition at line 52 of file AbstractSeparator.cpp.

{
  color_ = color;
}

Member Data Documentation

float unity::AbstractSeparator::alpha0_ [protected, inherited]

Definition at line 42 of file AbstractSeparator.h.

float unity::AbstractSeparator::alpha1_ [protected, inherited]

Definition at line 43 of file AbstractSeparator.h.

int unity::AbstractSeparator::border_size_ [protected, inherited]

Definition at line 44 of file AbstractSeparator.h.

nux::Color unity::AbstractSeparator::color_ [protected, inherited]

Definition at line 41 of file AbstractSeparator.h.


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