Back to index

unity  6.0.0
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes
unity::dash::Style Class Reference

#include <DashStyle.h>

Collaboration diagram for unity::dash::Style:
Collaboration graph
[legend]

List of all members.

Classes

class  Impl

Public Member Functions

 Style ()
 ~Style ()
virtual bool Button (cairo_t *cr, nux::ButtonVisualState state, std::string const &label, int font_size=-1, Alignment alignment=Alignment::CENTER, bool zeromargin=false)
virtual bool SquareButton (cairo_t *cr, nux::ButtonVisualState state, std::string const &label, bool curve_bottom, int font_size=-1, Alignment alignment=Alignment::CENTER, bool zeromargin=false)
virtual nux::AbstractPaintLayer * FocusOverlay (int width, int height)
virtual bool ButtonFocusOverlay (cairo_t *cr)
virtual bool MultiRangeSegment (cairo_t *cr, nux::ButtonVisualState state, std::string const &label, Arrow arrow, Segment segment)
virtual bool MultiRangeFocusOverlay (cairo_t *cr, Arrow arrow, Segment segment)
virtual bool TrackViewNumber (cairo_t *cr, nux::ButtonVisualState state, std::string const &trackNumber)
virtual bool TrackViewPlay (cairo_t *cr, nux::ButtonVisualState state)
virtual bool TrackViewPause (cairo_t *cr, nux::ButtonVisualState state)
virtual bool TrackViewProgress (cairo_t *cr)
virtual bool SeparatorVert (cairo_t *cr)
virtual bool SeparatorHoriz (cairo_t *cr)
virtual int GetButtonGarnishSize ()
virtual int GetSeparatorGarnishSize ()
virtual int GetScrollbarGarnishSize ()
void Blur (cairo_t *cr, int size)
void RoundedRect (cairo_t *cr, double aspect, double x, double y, double cornerRadius, double width, double height)
nux::Color const & GetTextColor () const
int GetDefaultNColumns () const
void SetDefaultNColumns (int n_cols)
int GetTileIconSize () const
int GetTileWidth () const
int GetTileHeight () const
int GetHomeTileIconSize () const
int GetHomeTileWidth () const
int GetHomeTileHeight () const
int GetTextLineHeight () const
nux::BaseTexture * GetDashBottomTile ()
nux::BaseTexture * GetDashBottomTileMask ()
nux::BaseTexture * GetDashRightTile ()
nux::BaseTexture * GetDashRightTileMask ()
nux::BaseTexture * GetDashCorner ()
nux::BaseTexture * GetDashCornerMask ()
nux::BaseTexture * GetDashFullscreenIcon ()
nux::BaseTexture * GetDashLeftEdge ()
nux::BaseTexture * GetDashLeftCorner ()
nux::BaseTexture * GetDashLeftCornerMask ()
nux::BaseTexture * GetDashLeftTile ()
nux::BaseTexture * GetDashTopCorner ()
nux::BaseTexture * GetDashTopCornerMask ()
nux::BaseTexture * GetDashTopTile ()
int GetDashBottomTileHeight () const
int GetDashRightTileWidth () const
nux::BaseTexture * GetDashShine ()
nux::BaseTexture * GetSearchMagnifyIcon ()
nux::BaseTexture * GetSearchCircleIcon ()
nux::BaseTexture * GetSearchCloseIcon ()
nux::BaseTexture * GetSearchSpinIcon ()
nux::BaseTexture * GetGroupUnexpandIcon ()
nux::BaseTexture * GetGroupExpandIcon ()
nux::BaseTexture * GetStarDeselectedIcon ()
nux::BaseTexture * GetStarSelectedIcon ()
nux::BaseTexture * GetStarHighlightIcon ()
int GetVSeparatorSize () const
int GetHSeparatorSize () const
int GetDashViewTopPadding () const
int GetSearchBarLeftPadding () const
int GetSearchBarRightPadding () const
int GetSearchBarHeight () const
int GetFilterResultsHighlightRightPadding () const
int GetFilterResultsHighlightLeftPadding () const
int GetFilterBarTopPadding () const
int GetFilterHighlightPadding () const
int GetSpaceBetweenFilterWidgets () const
int GetAllButtonHeight () const
int GetFilterBarLeftPadding () const
int GetFilterBarRightPadding () const
int GetFilterBarWidth () const
int GetFilterButtonHeight () const
int GetFilterViewRightPadding () const
int GetSpaceBetweenLensAndFilters () const
int GetScrollbarWidth () const
int GetCategoryHighlightHeight () const
int GetPlacesGroupTopSpace () const
int GetCategoryHeaderLeftPadding () const
int GetCategorySeparatorLeftPadding () const
int GetCategorySeparatorRightPadding () const

Static Public Member Functions

static StyleInstance ()

Public Attributes

sigc::signal< void > columns_changed
sigc::signal< void > changed
nux::Property< bool > always_maximised

Private Attributes

Implpimpl

Detailed Description

Definition at line 86 of file DashStyle.h.


Constructor & Destructor Documentation

Definition at line 404 of file DashStyle.cpp.

  : always_maximised(false)
  , pimpl(new Impl(this))
{
  if (style_instance)
  {
    LOG_ERROR(logger) << "More than one dash::Style created.";
  }
  else
  {
    style_instance = this;
  }

  auto formfactor_lambda = [this] () 
  {
    FormFactor formfactor = Settings::Instance().GetFormFactor();
    always_maximised = (formfactor == FormFactor::NETBOOK || formfactor == FormFactor::TV); 
  };

  Settings::Instance().changed.connect(formfactor_lambda);
  formfactor_lambda();
}

Here is the call graph for this function:

Definition at line 427 of file DashStyle.cpp.

{
  delete pimpl;
  if (style_instance == this)
    style_instance = nullptr;
}

Member Function Documentation

void unity::dash::Style::Blur ( cairo_t *  cr,
int  size 
)

Definition at line 647 of file DashStyle.cpp.

{
  pimpl->Blur(cr, size);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool unity::dash::Style::Button ( cairo_t *  cr,
nux::ButtonVisualState  state,
std::string const &  label,
int  font_size = -1,
Alignment  alignment = Alignment::CENTER,
bool  zeromargin = false 
) [virtual]

Definition at line 1532 of file DashStyle.cpp.

{
  // sanity checks
  if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
    return false;

  if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
    return false;

  unsigned int garnish = 0;
  if (zeromargin == false)
   garnish = GetButtonGarnishSize();

  //ButtonOutlinePath(cr, true);
  double w = cairo_image_surface_get_width(cairo_get_target(cr));
  double h = cairo_image_surface_get_height(cairo_get_target(cr));

  cairo_set_line_width(cr, pimpl->button_label_border_size_[state]);

  if (pimpl->button_label_border_size_[state] == 2.0)
    RoundedRect(cr,
                1.0,
                (double) (garnish) + 1.0,
                (double) (garnish) + 1.0,
                7.0,
                w - (double) (2 * garnish) - 2.0,
                h - (double) (2 * garnish) - 2.0);
  else
    RoundedRect(cr,
                1.0,
                (double) (garnish) + 0.5,
                (double) (garnish) + 0.5,
                7.0,
                w - (double) (2 * garnish) - 1.0,
                h - (double) (2 * garnish) - 1.0);


  if (pimpl->button_label_fill_color_[state].alpha != 0.0)
  {
    cairo_set_source_rgba(cr, pimpl->button_label_fill_color_[state]);
    cairo_fill_preserve(cr);
  }
  cairo_set_source_rgba(cr, pimpl->button_label_border_color_[state]);
  cairo_stroke(cr);

  pimpl->DrawOverlay(cr,
                     pimpl->button_label_overlay_opacity_[state],
                     pimpl->button_label_overlay_mode_[state],
                     pimpl->button_label_blur_size_[state] * 0.75);

  pimpl->Text(cr,
              pimpl->button_label_text_color_[state],
              label,
              font_size,
              11.0, // 15px = 11pt
              alignment);

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool unity::dash::Style::ButtonFocusOverlay ( cairo_t *  cr) [virtual]

Definition at line 1745 of file DashStyle.cpp.

{
  // sanity checks
  if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
    return false;

  if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
    return false;

  double w = cairo_image_surface_get_width(cairo_get_target(cr));
  double h = cairo_image_surface_get_height(cairo_get_target(cr));

  nux::Color color(nux::color::White);
  color.alpha = 0.50f;
  cairo_set_line_width(cr, pimpl->button_label_border_size_[nux::VISUAL_STATE_NORMAL]);

  RoundedRect(cr,
              1.0,
              (double) 0.5,
              (double) 0.5,
              7.0,
              w - 1.0,
              h - 1.0);

  cairo_set_source_rgba(cr, color);
  cairo_fill_preserve(cr);
  cairo_stroke(cr);

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nux::AbstractPaintLayer * unity::dash::Style::FocusOverlay ( int  width,
int  height 
) [virtual]

Definition at line 1594 of file DashStyle.cpp.

{
  nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, width, height);
  cairo_t* cr = cg.GetInternalContext();

  RoundedRect(cr,
              1.0f,
              0.0f,
              0.0f,
              2.0f, // radius
              width,
              height);

  cairo_set_source_rgba(cr, nux::Color(1.0f, 1.0f, 1.0f, 0.2f));
  cairo_fill(cr);

  // Create the texture layer
  nux::TexCoordXForm texxform;

  nux::ROPConfig rop;
  rop.Blend = true;
  rop.SrcBlend = GL_ONE;
  rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;

  return (new nux::TextureLayer(texture_ptr_from_cairo_graphics(cg)->GetDeviceTexture(),
                                texxform,
                                nux::color::White,
                                false,
                                rop));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2283 of file DashStyle.cpp.

{
  return 30;
}

Here is the caller graph for this function:

Definition at line 2001 of file DashStyle.cpp.

{
  int maxBlurSize = 0;

  for (int i = 0; i < STATES; i++)
  {
    if (maxBlurSize < pimpl->button_label_blur_size_[i])
      maxBlurSize = pimpl->button_label_blur_size_[i];
  }

  return 2 * maxBlurSize;
}

Here is the caller graph for this function:

Definition at line 2318 of file DashStyle.cpp.

{
  return 20;
}

Here is the caller graph for this function:

Definition at line 2308 of file DashStyle.cpp.

{
  return 24;
}

Definition at line 2323 of file DashStyle.cpp.

{
  return 15;
}

Here is the caller graph for this function:

Definition at line 2328 of file DashStyle.cpp.

{
  return 15;
}

Here is the caller graph for this function:

nux::BaseTexture * unity::dash::Style::GetDashBottomTile ( )

Definition at line 2081 of file DashStyle.cpp.

{
  return pimpl->dash_bottom_texture_.texture();
}

Here is the caller graph for this function:

Definition at line 2201 of file DashStyle.cpp.

{
  return 30;
}

Here is the caller graph for this function:

Definition at line 2086 of file DashStyle.cpp.

{
  return pimpl->dash_bottom_texture_mask_.texture();
}

Here is the caller graph for this function:

nux::BaseTexture * unity::dash::Style::GetDashCorner ( )

Definition at line 2101 of file DashStyle.cpp.

{
  return pimpl->dash_corner_texture_.texture();
}

Here is the caller graph for this function:

nux::BaseTexture * unity::dash::Style::GetDashCornerMask ( )

Definition at line 2106 of file DashStyle.cpp.

{
  return pimpl->dash_corner_texture_mask_.texture();
}

Here is the caller graph for this function:

Definition at line 2146 of file DashStyle.cpp.

{
  return pimpl->dash_fullscreen_icon_.texture();
}
nux::BaseTexture * unity::dash::Style::GetDashLeftCorner ( )

Definition at line 2116 of file DashStyle.cpp.

{
  return pimpl->dash_left_corner_.texture();
}

Here is the caller graph for this function:

Definition at line 2121 of file DashStyle.cpp.

{
  return pimpl->dash_left_corner_mask_.texture();
}

Here is the caller graph for this function:

nux::BaseTexture * unity::dash::Style::GetDashLeftEdge ( )

Definition at line 2111 of file DashStyle.cpp.

{
  return pimpl->dash_left_edge_.texture();
}
nux::BaseTexture * unity::dash::Style::GetDashLeftTile ( )

Definition at line 2126 of file DashStyle.cpp.

{
  return pimpl->dash_left_tile_.texture();
}

Here is the caller graph for this function:

nux::BaseTexture * unity::dash::Style::GetDashRightTile ( )

Definition at line 2091 of file DashStyle.cpp.

{
  return pimpl->dash_right_texture_.texture();
}

Here is the caller graph for this function:

Definition at line 2096 of file DashStyle.cpp.

{
  return pimpl->dash_right_texture_mask_.texture();
}

Here is the caller graph for this function:

Definition at line 2206 of file DashStyle.cpp.

{
  return 30;
}

Here is the caller graph for this function:

nux::BaseTexture * unity::dash::Style::GetDashShine ( )

Definition at line 2196 of file DashStyle.cpp.

{
  return pimpl->dash_shine_.texture();
}

Here is the caller graph for this function:

nux::BaseTexture * unity::dash::Style::GetDashTopCorner ( )

Definition at line 2131 of file DashStyle.cpp.

{
  return pimpl->dash_top_corner_.texture();
}

Here is the caller graph for this function:

Definition at line 2136 of file DashStyle.cpp.

{
  return pimpl->dash_top_corner_mask_.texture();
}

Here is the caller graph for this function:

nux::BaseTexture * unity::dash::Style::GetDashTopTile ( )

Definition at line 2141 of file DashStyle.cpp.

{
  return pimpl->dash_top_tile_.texture();
}

Here is the caller graph for this function:

Definition at line 2238 of file DashStyle.cpp.

{
  return 10;
}

Here is the caller graph for this function:

Definition at line 2029 of file DashStyle.cpp.

Here is the caller graph for this function:

Definition at line 2228 of file DashStyle.cpp.

{
  return 5;
}

Here is the caller graph for this function:

Definition at line 2233 of file DashStyle.cpp.

{
  return 5;
}

Here is the caller graph for this function:

Definition at line 2268 of file DashStyle.cpp.

{
  return 10;
}

Here is the caller graph for this function:

Definition at line 2222 of file DashStyle.cpp.

{
  return 300;
}

Here is the caller graph for this function:

Definition at line 2288 of file DashStyle.cpp.

{
  return 30;
}

Here is the caller graph for this function:

Definition at line 2273 of file DashStyle.cpp.

{
  return 2;
}

Here is the caller graph for this function:

Definition at line 2263 of file DashStyle.cpp.

{
  return 5;
}

Here is the caller graph for this function:

Definition at line 2258 of file DashStyle.cpp.

{
  return 5;
}

Here is the caller graph for this function:

Definition at line 2298 of file DashStyle.cpp.

{
  return 10;
}

Here is the caller graph for this function:

Definition at line 2176 of file DashStyle.cpp.

{
  return pimpl->group_expand_texture_.texture();
}

Here is the caller graph for this function:

Definition at line 2171 of file DashStyle.cpp.

{
  return pimpl->group_unexpand_texture_.texture();
}

Here is the caller graph for this function:

Definition at line 2070 of file DashStyle.cpp.

{
  return GetHomeTileIconSize() + (pimpl->text_height_ * 5);
}

Here is the call graph for this function:

Definition at line 2060 of file DashStyle.cpp.

{
  return 104;
}

Here is the caller graph for this function:

Definition at line 2065 of file DashStyle.cpp.

{
  return pimpl->text_width_ * 1.2;
}

Definition at line 2216 of file DashStyle.cpp.

{
  return 1;

}

Here is the caller graph for this function:

Definition at line 2313 of file DashStyle.cpp.

{
  return 15;
}

Here is the caller graph for this function:

Definition at line 2019 of file DashStyle.cpp.

Definition at line 2303 of file DashStyle.cpp.

{
  return 3;
}

Here is the caller graph for this function:

Definition at line 2253 of file DashStyle.cpp.

{
  return 42;
}

Here is the caller graph for this function:

Definition at line 2243 of file DashStyle.cpp.

{
  return 10;
}

Here is the caller graph for this function:

Definition at line 2248 of file DashStyle.cpp.

{
  return 10;
}

Definition at line 2156 of file DashStyle.cpp.

{
  return pimpl->search_circle_texture_.texture();
}

Here is the caller graph for this function:

Definition at line 2161 of file DashStyle.cpp.

{
  return pimpl->search_close_texture_.texture();
}

Here is the caller graph for this function:

Definition at line 2151 of file DashStyle.cpp.

{
  return pimpl->search_magnify_texture_.texture();
}

Here is the caller graph for this function:

nux::BaseTexture * unity::dash::Style::GetSearchSpinIcon ( )

Definition at line 2166 of file DashStyle.cpp.

{
  return pimpl->search_spin_texture_.texture();
}

Here is the caller graph for this function:

Definition at line 2014 of file DashStyle.cpp.

Definition at line 2278 of file DashStyle.cpp.

{
  return 12;
}

Here is the caller graph for this function:

Definition at line 2293 of file DashStyle.cpp.

{
  return 10;
}

Here is the caller graph for this function:

Definition at line 2181 of file DashStyle.cpp.

{
  return pimpl->star_deselected_texture_.texture();
}

Here is the caller graph for this function:

Definition at line 2191 of file DashStyle.cpp.

{
  return pimpl->star_highlight_texture_.texture();
}

Here is the caller graph for this function:

Definition at line 2186 of file DashStyle.cpp.

{
  return pimpl->star_selected_texture_.texture();
}

Here is the caller graph for this function:

nux::Color const & unity::dash::Style::GetTextColor ( ) const

Definition at line 2024 of file DashStyle.cpp.

{
  return pimpl->text_color_;
}

Definition at line 2075 of file DashStyle.cpp.

{
  return pimpl->text_height_;
}

Definition at line 2054 of file DashStyle.cpp.

{
  return std::max(GetTileIconSize() + (pimpl->text_height_ * 2) + 10,
                  GetTileIconSize() + 50 + 18); // magic design numbers.
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2044 of file DashStyle.cpp.

{
  return 64;
}

Here is the caller graph for this function:

Definition at line 2049 of file DashStyle.cpp.

{
  return std::max(pimpl->text_width_, 150);
}

Here is the caller graph for this function:

Definition at line 2211 of file DashStyle.cpp.

{
  return 1;
}

Here is the caller graph for this function:

Definition at line 434 of file DashStyle.cpp.

{
  if (!style_instance)
  {
    LOG_ERROR(logger) << "No dash::Style created yet.";
  }

  return *style_instance;
}
bool unity::dash::Style::MultiRangeFocusOverlay ( cairo_t *  cr,
Arrow  arrow,
Segment  segment 
) [virtual]

Definition at line 1846 of file DashStyle.cpp.

{
  // sanity checks
  if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
    return false;

  if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
    return false;

  double   x  = 0.0;
  double   y  = 2.0;
  double   w  = cairo_image_surface_get_width(cairo_get_target(cr));
  double   h  = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;

  if (segment == Segment::LEFT)
  {
    x = 2.0;
    w -= 2.0;
  }

  if (segment == Segment::RIGHT)
  {
    w -= 2.0;
  }

  cairo_set_line_width(cr, pimpl->button_label_border_size_[nux::ButtonVisualState::VISUAL_STATE_NORMAL]);

  pimpl->RoundedRectSegment(cr,
                            1.0,
                            x,
                            y,
                            h / 4.0,
                            w,
                            h,
                            segment,
                            arrow,
                            nux::ButtonVisualState::VISUAL_STATE_PRESSED);

  cairo_set_source_rgba(cr, nux::Color(1.0f, 1.0f, 1.0f, 0.5f));
  cairo_fill_preserve(cr);
  cairo_stroke(cr);

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool unity::dash::Style::MultiRangeSegment ( cairo_t *  cr,
nux::ButtonVisualState  state,
std::string const &  label,
Arrow  arrow,
Segment  segment 
) [virtual]

Definition at line 1776 of file DashStyle.cpp.

{
  // sanity checks
  if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
    return false;

  if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
    return false;

  //ButtonOutlinePathSegment(cr, segment);
  double   x  = 0.0;
  double   y  = 2.0;
  double   w  = cairo_image_surface_get_width(cairo_get_target(cr));
  double   h  = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;

       if (segment == Segment::LEFT)
       {
    x = 2.0;
    w -= 2.0;
       }

       if (segment == Segment::RIGHT)
       {
    w -= 2.0;
       }

  cairo_set_line_width(cr, pimpl->button_label_border_size_[state]);

  if (pimpl->button_label_border_size_[state] == 2.0)
    pimpl->RoundedRectSegment(cr,
                              1.0,
                              x+1.0,
                              y+1.0,
                              (h-1.0) / 4.0,
                              w-1.0,
                              h-1.0,
                              segment,
                              arrow,
                              state);
  else
    pimpl->RoundedRectSegment(cr,
                              1.0,
                              x,
                              y,
                              h / 4.0,
                              w,
                              h,
                              segment,
                              arrow,
                              state);

  if (pimpl->button_label_fill_color_[state].alpha != 0.0)
  {
    cairo_set_source_rgba(cr, pimpl->button_label_fill_color_[state]);
    cairo_fill_preserve(cr);
  }
  cairo_set_source_rgba(cr, pimpl->button_label_border_color_[state]);
  cairo_stroke(cr);
  pimpl->Text(cr,
              pimpl->button_label_text_color_[state],
              label,
              10); // 13px = 10pt

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::dash::Style::RoundedRect ( cairo_t *  cr,
double  aspect,
double  x,
double  y,
double  cornerRadius,
double  width,
double  height 
)

Definition at line 444 of file DashStyle.cpp.

{
  // sanity check
  if (cairo_status(cr) != CAIRO_STATUS_SUCCESS &&
      cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
    return;

  bool odd = true;

  odd = cairo_get_line_width (cr) == 2.0 ? false : true;

  double radius = cornerRadius / aspect;

  // top-left, right of the corner
  cairo_move_to(cr, _align (x + radius, odd), _align (y, odd));

  // top-right, left of the corner
  cairo_line_to(cr, _align(x + width - radius, odd), _align(y, odd));

  // top-right, below the corner
  cairo_arc(cr,
            _align(x + width - radius, odd),
            _align(y + radius, odd),
            radius,
            -90.0f * G_PI / 180.0f,
            0.0f * G_PI / 180.0f);

  // bottom-right, above the corner
  cairo_line_to(cr, _align(x + width, odd), _align(y + height - radius, odd));

  // bottom-right, left of the corner
  cairo_arc(cr,
            _align(x + width - radius, odd),
            _align(y + height - radius, odd),
            radius,
            0.0f * G_PI / 180.0f,
            90.0f * G_PI / 180.0f);

  // bottom-left, right of the corner
  cairo_line_to(cr, _align(x + radius, odd), _align(y + height, odd));

  // bottom-left, above the corner
  cairo_arc(cr,
            _align(x + radius, odd),
            _align(y + height - radius, odd),
            radius,
            90.0f * G_PI / 180.0f,
            180.0f * G_PI / 180.0f);

  // top-left, right of the corner
  cairo_arc(cr,
            _align(x + radius, odd),
            _align(y + radius, odd),
            radius,
            180.0f * G_PI / 180.0f,
            270.0f * G_PI / 180.0f);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool unity::dash::Style::SeparatorHoriz ( cairo_t *  cr) [virtual]

Definition at line 1973 of file DashStyle.cpp.

{
  // sanity checks
  if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
    return false;

  if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
    return false;

  double w = cairo_image_surface_get_width(cairo_get_target(cr));
  double h = cairo_image_surface_get_height(cairo_get_target(cr));
  double x = 2.0;
  double y = h / 2.0;

  cairo_set_line_width(cr, pimpl->separator_size_);
  cairo_set_source_rgba(cr, pimpl->separator_color_);
  cairo_move_to(cr, _align(x), _align(y));
  cairo_line_to(cr, _align(w - 4.0), _align(y));
  cairo_stroke(cr);

  pimpl->DrawOverlay(cr,
                     pimpl->separator_overlay_opacity_,
                     pimpl->separator_overlay_mode_,
                     pimpl->separator_blur_size_);

  return true;
}

Here is the call graph for this function:

bool unity::dash::Style::SeparatorVert ( cairo_t *  cr) [virtual]

Definition at line 1945 of file DashStyle.cpp.

{
  // sanity checks
  if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
    return false;

  if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
    return false;

  double w = cairo_image_surface_get_width(cairo_get_target(cr));
  double h = cairo_image_surface_get_height(cairo_get_target(cr));
  double x = w / 2.0;
  double y = 2.0;

  cairo_set_line_width(cr, pimpl->separator_size_);
  cairo_set_source_rgba(cr, pimpl->separator_color_);
  cairo_move_to(cr, _align(x), _align(y));
  cairo_line_to(cr, _align(x), _align(h - 4.0));
  cairo_stroke(cr);

  pimpl->DrawOverlay(cr,
                     pimpl->separator_overlay_opacity_,
                     pimpl->separator_overlay_mode_,
                     pimpl->separator_blur_size_);

  return true;
}

Here is the call graph for this function:

Definition at line 2034 of file DashStyle.cpp.

{
  if (pimpl->number_of_columns_ == n_cols)
    return;

  pimpl->number_of_columns_ = n_cols;

  columns_changed.emit();
}

Here is the caller graph for this function:

bool unity::dash::Style::SquareButton ( cairo_t *  cr,
nux::ButtonVisualState  state,
std::string const &  label,
bool  curve_bottom,
int  font_size = -1,
Alignment  alignment = Alignment::CENTER,
bool  zeromargin = false 
) [virtual]

Definition at line 1625 of file DashStyle.cpp.

{
  // sanity checks
  if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
    return false;

  if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
    return false;

  unsigned int garnish = 0;
  if (zeromargin == false)
    garnish = GetButtonGarnishSize();

  double w = cairo_image_surface_get_width(cairo_get_target(cr));
  double h = cairo_image_surface_get_height(cairo_get_target(cr));

  double x = garnish;
  double y = garnish;

  double width = w - (2.0 * garnish) - 1.0;
  double height = h - (2.0 * garnish) - 1.0;

  bool odd = true;
  double radius = 7.0;

  // draw the grid background
  {
    cairo_set_line_width(cr, 1);
    cairo_move_to(cr, _align(x + width, odd), y);
    if (curve_bottom)
    {
      LOG_DEBUG(logger) << "curve: " << _align(x + width, odd) << " - " << _align(y + height - radius, odd);
      // line to bottom-right corner
      cairo_line_to(cr, _align(x + width, odd), _align(y + height - radius, odd));

      // line to bottom-right, left of the corner
      cairo_arc(cr,
                _align(x + width - radius, odd),
                _align(y + height - radius, odd),
                radius,
                0.0f * G_PI / 180.0f,
                90.0f * G_PI / 180.0f);

      // line to bottom-left, right of the corner
      cairo_line_to(cr, _align(x + radius, odd), _align(y + height, odd));

      // line to bottom-left, above the corner
      cairo_arc(cr,
                _align(x + radius, odd),
                _align(y + height - radius, odd),
                radius,
                90.0f * G_PI / 180.0f,
                180.0f * G_PI / 180.0f);

      // line to top
      cairo_line_to(cr, _align(x, odd), _align(y, odd));
    }
    else
    {
      cairo_line_to(cr, _align(x + width, odd), _align(y + height, odd));
      cairo_line_to(cr, _align(x, odd), _align(y + height, odd));
      cairo_line_to(cr, _align(x, odd), y);
    }

    cairo_set_source_rgba(cr, pimpl->button_label_border_color_[nux::ButtonVisualState::VISUAL_STATE_NORMAL]);
    cairo_stroke(cr);
  }

  cairo_set_line_width(cr, pimpl->button_label_border_size_[state]);
  odd = cairo_get_line_width(cr) == 2.0 ? false : true;


  if (pimpl->button_label_border_size_[state] == 2.0)
  {
    x += 1;
    y += 1;
    width -= 1.0;
    height -= 1.0;
  }

  if (state == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
  {
    RoundedRect(cr,
                1.0,
                _align(x, odd), _align(y, odd),
                5.0,
                _align(width, odd), _align(height, odd));

    if (pimpl->button_label_fill_color_[state].alpha != 0.0)
    {
      cairo_set_source_rgba(cr, pimpl->button_label_fill_color_[state]);
      cairo_fill_preserve(cr);
    }
    cairo_set_source_rgba(cr, pimpl->button_label_border_color_[state]);
    cairo_stroke(cr);
  }

  pimpl->DrawOverlay(cr,
                     pimpl->button_label_overlay_opacity_[state],
                     pimpl->button_label_overlay_mode_[state],
                     pimpl->button_label_blur_size_[state] * 0.75);

  // FIXME - magic value of 42 here for the offset in the HUD,
  // replace with a nicer style system that lets hud override
  // default values when it needs to
  pimpl->Text(cr,
              pimpl->button_label_text_color_[state],
              label,
              font_size,
              42.0 + 10.0,
              alignment);

  cairo_surface_write_to_png(cairo_get_target(cr), "/tmp/wut.png");

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool unity::dash::Style::TrackViewNumber ( cairo_t *  cr,
nux::ButtonVisualState  state,
std::string const &  trackNumber 
) [virtual]

Definition at line 1893 of file DashStyle.cpp.

{
  // sanity checks
  if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
    return false;

  if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
    return false;

  return true;
}
bool unity::dash::Style::TrackViewPause ( cairo_t *  cr,
nux::ButtonVisualState  state 
) [virtual]

Definition at line 1920 of file DashStyle.cpp.

{
  // sanity checks
  if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
    return false;

  if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
    return false;

  return true;
}
bool unity::dash::Style::TrackViewPlay ( cairo_t *  cr,
nux::ButtonVisualState  state 
) [virtual]

Definition at line 1907 of file DashStyle.cpp.

{
  // sanity checks
  if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
    return false;

  if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
    return false;

  return true;
}
bool unity::dash::Style::TrackViewProgress ( cairo_t *  cr) [virtual]

Definition at line 1933 of file DashStyle.cpp.

{
  // sanity checks
  if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
    return false;

  if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
    return false;

  return true;
}

Member Data Documentation

Definition at line 241 of file DashStyle.h.

sigc::signal<void> unity::dash::Style::changed

Definition at line 239 of file DashStyle.h.

Definition at line 156 of file DashStyle.h.

Definition at line 244 of file DashStyle.h.


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