Back to index

unity  6.0.0
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
PlacesVScrollBar Class Reference

#include <PlacesVScrollBar.h>

List of all members.

Public Member Functions

 PlacesVScrollBar (NUX_FILE_LINE_PROTO)
 ~PlacesVScrollBar ()

Protected Member Functions

virtual void PreLayoutManagement ()
virtual long PostLayoutManagement (long LayoutResult)
void Draw (nux::GraphicsEngine &gfxContext, bool forceDraw)

Private Member Functions

void UpdateTexture ()

Private Attributes

nux::BaseTexture * _slider_texture

Detailed Description

Definition at line 30 of file PlacesVScrollBar.h.


Constructor & Destructor Documentation

PlacesVScrollBar::PlacesVScrollBar ( NUX_FILE_LINE_PROTO  )

Definition at line 27 of file PlacesVScrollBar.cpp.

  : VScrollBar(NUX_FILE_LINE_PARAM),
    _slider_texture(NULL)
{
  _scroll_up_button->SetMaximumHeight(15);
  _scroll_up_button->SetMinimumHeight(15);

  _scroll_down_button->SetMaximumHeight(15);
  _scroll_down_button->SetMinimumHeight(15);

  _slider->SetMinimumWidth(3);
  _slider->SetMaximumWidth(3);
  SetMinimumWidth(3);
  SetMaximumWidth(3);
}

Definition at line 43 of file PlacesVScrollBar.cpp.

{
  if (_slider_texture)
    _slider_texture->UnReference();
}

Member Function Documentation

void PlacesVScrollBar::Draw ( nux::GraphicsEngine &  gfxContext,
bool  forceDraw 
) [protected]

Definition at line 65 of file PlacesVScrollBar.cpp.

{
  nux::Color color = nux::color::White;
  nux::Geometry const& base  = GetGeometry();
  nux::TexCoordXForm texxform;

  gfxContext.PushClippingRectangle(base);

  nux::GetPainter().PaintBackground(gfxContext, base);

  // check if textures have been computed... if they haven't, exit function
  if (!_slider_texture)
    return;

  texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_SCALE_COORD);

  gfxContext.GetRenderStates().SetBlend(true);
  gfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);

  if (content_height_ > container_height_)
  {
    nux::Geometry const& slider_geo = _slider->GetGeometry();

    gfxContext.QRP_1Tex(slider_geo.x,
                        slider_geo.y,
                        slider_geo.width,
                        slider_geo.height,
                        _slider_texture->GetDeviceTexture(),
                        texxform,
                        color);
  }

  gfxContext.GetRenderStates().SetBlend(false);
  gfxContext.PopClippingRectangle();
  gfxContext.GetRenderStates().SetBlend(true);
}
long PlacesVScrollBar::PostLayoutManagement ( long  LayoutResult) [protected, virtual]

Definition at line 56 of file PlacesVScrollBar.cpp.

{
  long ret = nux::VScrollBar::PostLayoutManagement(LayoutResult);

  UpdateTexture();
  return ret;
}

Here is the call graph for this function:

void PlacesVScrollBar::PreLayoutManagement ( ) [protected, virtual]

Definition at line 50 of file PlacesVScrollBar.cpp.

void PlacesVScrollBar::UpdateTexture ( ) [private]

Definition at line 102 of file PlacesVScrollBar.cpp.

{
  nux::CairoGraphics* cairoGraphics = NULL;
  cairo_t*            cr            = NULL;

  // update texture of slider
  int width  = _slider->GetBaseWidth();
  int height = _slider->GetBaseHeight();
  cairoGraphics = new nux::CairoGraphics(CAIRO_FORMAT_ARGB32, width, height);
  cr = cairoGraphics->GetContext();

  cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
  cairo_paint(cr);

  cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
  cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
  cairoGraphics->DrawRoundedRectangle(cr,
                                      1.0f,
                                      0.0,
                                      0.0,
                                      1.5,
                                      3.0,
                                      (double) height - 3.0);
  cairo_fill(cr);

  if (_slider_texture)
    _slider_texture->UnReference();
  _slider_texture = texture_from_cairo_graphics(*cairoGraphics);

  cairo_destroy(cr);
  delete cairoGraphics;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

nux::BaseTexture* PlacesVScrollBar::_slider_texture [private]

Definition at line 47 of file PlacesVScrollBar.h.


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