Rose
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
rose::FrameElements Class Reference

Encapsulation of the visual elements of a Frame. More...

#include <Frame.h>

Inheritance diagram for rose::FrameElements:
Inheritance graph
[legend]
Collaboration diagram for rose::FrameElements:
Collaboration graph
[legend]

Public Member Functions

 FrameElements (int padding)
 
void set (const CornerStyle cornerStyle)
 Set the CornerStyle.
 
void setState (bool state)
 Set the state, true = inverted.
 
void setAnimateColor (const color::RGBA &color)
 Set the active color.
 
void setInactiveColor (const color::RGBA &color)
 Set the background color.
 
bool getState () const
 
void frameSettings (const FrameSettings &frameSettings)
 

Static Public Member Functions

static gm::Texture createBackgroundMask (gm::Context &context, Size size, int frameWidth, bool roundCorners=false)
 
static void colorBackgroundMask (gm::Context &context, gm::Texture &mask, const color::RGBA &base, const color::RGBA &active, float value)
 

Protected Types

enum  SelectedCorners : uint32_t {
  NoCorners = 0, TopLeftCorner = 0x8, TopRightCorner = 0x4, TopCorners = TopLeftCorner | TopRightCorner,
  BottomLeftCorner = 0x2, BottomRightCorner = 0x1, BottomCorners = BottomLeftCorner | BottomRightCorner, LeftCorners = TopLeftCorner | BottomLeftCorner,
  RightCorners = TopRightCorner | BottomRightCorner, AllCorners = 0xf
}
 Specify corners selected for some process, usually drawing.
 
enum  SelectedSides : uint32_t {
  NoSides = 0, TopSide = 1, BotSide = 2, LeftSide = 4,
  RightSide = 8, AllSides = TopSide | BotSide | LeftSide | RightSide, TabTopSides = TopSide | LeftSide | RightSide
}
 Specify sides selected for some process, usually drawing.
 

Protected Member Functions

void renderSelectedSides (gm::Context &context, FrameElements::SelectedSides selectedSides, BorderStyle useBorder, ImageId corner, const Size &size, int extend=0)
 Render sides as part of a border around the frame. More...
 
void drawBackground (gm::Context &context, Rectangle &src, Rectangle &dst)
 Draw the background for the Frame. More...
 
gm::Texture createBackgroundTexture (gm::Context &context, Rectangle &src, Rectangle &dst, const color::RGBA &color)
 
std::tuple< UseBorder, SelectedCornersdecoration ()
 
void drawFrame (gm::Context &context, Rectangle widgetRect)
 Draw the Frame and background. More...
 
void buttonDisplayStateChange (ButtonDisplayState buttonDisplayState)
 Make visual changes to FrameElements for button display. More...
 

Static Protected Member Functions

static void trimCorners (gm::Surface &surface, color::RGBA color, FrameElements::SelectedCorners selectedCorners, Size cornerSize, Size frameSize)
 Trim corners on a background surface to allow for rounded corners. More...
 
static void renderSelectedCorners (gm::Context &context, SelectedCorners selectedCorners, ImageId corner, const Size &size)
 Render corner images as part of a border around the frame. More...
 

Protected Attributes

color::RGBA mBaseColor
 
color::RGBA mInvertColor
 
color::RGBA mTopColor
 
color::RGBA mBotColor
 
color::RGBA mLeftColor
 
color::RGBA mRightColor
 
color::RGBA mActiveColor
 
color::RGBA mInactiveColor
 
float mColorValue {}
 
int mFrameWidth {2}
 
Padding mFramePadding {}
 
CornerStyle mCornerStyle {CornerStyle::Round}
 
bool mInvert {}
 
gm::Texture mBorder {}
 
gm::Texture mInactiveBG {}
 
gm::Texture mAnimatedBG {}
 
FrameSettings mFrameSettings {}
 

Detailed Description

Encapsulation of the visual elements of a Frame.

Member Function Documentation

◆ buttonDisplayStateChange()

void rose::FrameElements::buttonDisplayStateChange ( ButtonDisplayState  buttonDisplayState)
protected

Make visual changes to FrameElements for button display.

Parameters
buttonDisplayStateThe button display state.

◆ drawBackground()

void rose::FrameElements::drawBackground ( gm::Context context,
Rectangle src,
Rectangle dst 
)
protected

Draw the background for the Frame.

The Frame background is the background color and the border.

Parameters
rendererThe renderer to use.
srcThe source rectangle.
dstThe destination rectangle.

◆ drawFrame()

void rose::FrameElements::drawFrame ( gm::Context context,
Rectangle  widgetRect 
)
protected

Draw the Frame and background.

Parameters
rendererThe Renderer used to draw the Frame.
widgetRectThe Rectangle available to draw in.

◆ renderSelectedCorners()

void rose::FrameElements::renderSelectedCorners ( gm::Context context,
SelectedCorners  selectedCorners,
ImageId  corner,
const Size size 
)
staticprotected

Render corner images as part of a border around the frame.

Parameters
rendererThe Renderer to use
selectedCornersThe corners to render, others are left undecorated.
cornerThe RoseImageId of the corner Texture sheet
sizeThe destination rectangle for the complete frame.

◆ renderSelectedSides()

void rose::FrameElements::renderSelectedSides ( gm::Context context,
FrameElements::SelectedSides  selectedSides,
BorderStyle  useBorder,
ImageId  corner,
const Size size,
int  extend = 0 
)
protected

Render sides as part of a border around the frame.

Parameters
rendererThe Renderer to use
selectedSidesThe sides to render, others are left undecorated.
useBorderThe border style used.
cornerThe RoseImageId of the corner Texture sheet, to get the size of corner images.
sizeThe destination rectangle for the complete frame.
extendIf true, extend the side(s) in the direction of increasing Y or X (down or right).

◆ trimCorners()

void rose::FrameElements::trimCorners ( gm::Surface surface,
color::RGBA  color,
FrameElements::SelectedCorners  selectedCorners,
Size  cornerSize,
Size  frameSize 
)
staticprotected

Trim corners on a background surface to allow for rounded corners.

Parameters
surfaceThe surface to trim
colorThe background fill color.
selectedCornersWhich corners should be trimmed, others are left square.
cornerSizeThe size of the corner in piexels
frameSizeThe size of the frame.

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