ArduinoDumbDisplay v0.9.9-r34
DumbDisplay Arduino Library -- https://github.com/trevorwslee/Arduino-DumbDisplay
 
Loading...
Searching...
No Matches
DDLayer Class Reference

Base class for the different layers support by DumbDisplay; created with various layer creation methods of DumbDisplay, DumbDisplay::createLedGridLayer() More...

#include <dumbdisplay.h>

Inheritance diagram for DDLayer:
DDObject DumbDisplayWindowDDLayer JoystickDDLayer LcdDDLayer LedGridDDLayer MbDDLayer MultiLevelDDLayer PlotterDDLayer SelectionDDLayer SevenSegmentRowDDLayer TerminalDDLayer TomTomMapDDLayer WebViewDDLayer

Public Member Functions

void border (float size, const String &color, const String &shape="flat", float extraSize=0)
 
void noBorder ()
 
void padding (float size)
 
void padding (float left, float top, float right, float bottom)
 
void noPadding ()
 
void margin (float size)
 
void margin (float left, float top, float right, float bottom)
 
void noMargin ()
 
void backgroundColor (const String &color, int opacity=100)
 
void noBackgroundColor ()
 
void visible (bool visible)
 
void transparent (bool transparent)
 
void disabled (bool disabled=true)
 
void opacity (int opacity)
 
void alpha (int alpha)
 
void blend (const String &color, int alpha=255, const String &mode="darken")
 
void noblend ()
 
void clear ()
 clear the layer
 
void flash ()
 normally used for "feedback" – flash the default way (layer + border)
 
void flashArea (int x, int y)
 normally used for "feedback" – flash the area (x, y) where the layer is clicked
 
void explicitFeedback (int16_t x=0, int16_t y=0, const String &text="", DDFeedbackType type=CLICK, const String &option="")
 
const String & getLayerId () const
 
void setFeedbackHandler (DDFeedbackHandler handler, const String &autoFeedbackMethod="", const String &allowFeedbackTypes="")
 
void enableFeedback (const String &autoFeedbackMethod="", const String &allowFeedbackTypes="")
 
void disableFeedback ()
 disable "feedback"
 
const DDFeedbackgetFeedback ()
 
void debugOnly (int i)
 for debug use
 
DDFeedbackManager * getFeedbackManager () const
 
DDFeedbackHandler getFeedbackHandler () const
 

Protected Member Functions

 DDLayer (int8_t layerId)
 
void _enableFeedback ()
 

Protected Attributes

String layerId
 
DDFeedbackManager * pFeedbackManager
 
DDFeedbackHandler feedbackHandler
 

Additional Inherited Members

- Public Attributes inherited from DDObject
int8_t objectType
 object type – DD_OBJECT_TYPE_LAYER or DD_OBJECT_TYPE_TUNNEL
 
String customData
 custom data
 

Detailed Description

Base class for the different layers support by DumbDisplay; created with various layer creation methods of DumbDisplay, DumbDisplay::createLedGridLayer()

Member Function Documentation

◆ alpha()

void DDLayer::alpha ( int  alpha)

set layer's alpha channel; it combines with opacity

Parameters
alpha0 - 255
Note
layer property

◆ backgroundColor()

void DDLayer::backgroundColor ( const String &  color,
int  opacity = 100 
)

set layer background color

Parameters
colorDD_COLOR_XXX; DD_RGB_COLOR(...); can also be common "color name"
opacitybackground opacity (0 - 100); it combines with layer opacity and alpha
Note
layer property

◆ blend()

void DDLayer::blend ( const String &  color,
int  alpha = 255,
const String &  mode = "darken" 
)

blending with "film" of color over the layer

Parameters
color
alpha
modexfermode "darken" / "lighten" / "screen" / "overlay" / "" (no xfermode)
Note
layer property

◆ border()

void DDLayer::border ( float  size,
const String &  color,
const String &  shape = "flat",
float  extraSize = 0 
)

set border for each size

Parameters
sizesize unit is pixel:
  • LcdLayer – each character is composed of pixels
  • 7SegmentRowLayer – each 7-segment is composed of fixed 220 x 320 pixels
  • LedGridLayer – a LED is considered as a pixel
colorDD_COLOR_XXX; DD_RGB_COLOR(...); can also be common "color name"
shapecan be "flat", "hair", "round", "raised" or "sunken"
extraSizesimply add to size; however if shape is "round", it affects the "roundness"
Note
layer property

◆ disabled()

void DDLayer::disabled ( bool  disabled = true)

set layer disabled or not; if disabled, layer will not have "feedback", and its appearance will be like disabled

Note
layer property

◆ enableFeedback()

void DDLayer::enableFeedback ( const String &  autoFeedbackMethod = "",
const String &  allowFeedbackTypes = "" 
)

rely on getFeedback() being called

Parameters
autoFeedbackMethod
  • "" – no auto feedback flash (the default)
  • "f" – flash the standard way (layer + border)
  • "fl" – flash the layer
  • "fa" – flash the area where the layer is clicked
  • "fas" – flash the area (as a spot) where the layer is clicked
  • "fs" – flash the spot where the layer is clicked (regardless of any area boundary)
allowedFeedbackTypecan be comma-delimited list of "CLICK", "LONGPRESS" and "DOUBLECLICK"
Note
if you will not be making use of "feedback", you can disable it by defining DD_NO_FEEDBACK in order to reduce footprint

◆ explicitFeedback()

void DDLayer::explicitFeedback ( int16_t  x = 0,
int16_t  y = 0,
const String &  text = "",
DDFeedbackType  type = CLICK,
const String &  option = "" 
)

trigger explicit "feedback" to the layer (similar to implicit "feedback" when layer is clicked)

Parameters
typeother than CLICK etc, can be CUSTOM (which is only possible with explicit "feedback");
optioncan be "" / "keys" / "numkeys" / "confirm";
  • in case of "keys" / "numkeys", input box will be popped up for user to enter the "text" of the "feedback"; and the "text" in the parameter will be the "hint"
  • in case of "confirm", a confirmation dialog will be popped up with "text" as the message, and the "feedback" "text" will be "Yes" or "No";
Note
feedback must be enabled for this to work

◆ getFeedback()

const DDFeedback * DDLayer::getFeedback ( )

get "feedback" DDFeedback

Returns
NULL if no pending "feedback"

◆ getFeedbackHandler()

DDFeedbackHandler DDLayer::getFeedbackHandler ( ) const
inline
Attention
used internally

◆ getFeedbackManager()

DDFeedbackManager * DDLayer::getFeedbackManager ( ) const
inline
Attention
used internally

◆ margin() [1/2]

void DDLayer::margin ( float  left,
float  top,
float  right,
float  bottom 
)

set margin for each side; for unit, see DDLayer::border()

Note
layer property

◆ margin() [2/2]

void DDLayer::margin ( float  size)

set margin for all sides

Parameters
sizefor size unit, see border()
Note
layer property

◆ noBackgroundColor()

void DDLayer::noBackgroundColor ( )

set no layer background color

Note
layer property

◆ noblend()

void DDLayer::noblend ( )

no blending

Note
layer property

◆ noBorder()

void DDLayer::noBorder ( )

set no border

Note
layer property

◆ noMargin()

void DDLayer::noMargin ( )

set no margin

Note
layer property

◆ noPadding()

void DDLayer::noPadding ( )

set no padding

Note
layer property

◆ opacity()

void DDLayer::opacity ( int  opacity)

set layer opacity percentage

Parameters
opacity0 - 100
Note
layer property

◆ padding() [1/2]

void DDLayer::padding ( float  left,
float  top,
float  right,
float  bottom 
)

set padding for each side; for unit, see border()

Note
layer property

◆ padding() [2/2]

void DDLayer::padding ( float  size)

set padding for all sides

Parameters
sizefor size unit, see border()
Note
layer property

◆ setFeedbackHandler()

void DDLayer::setFeedbackHandler ( DDFeedbackHandler  handler,
const String &  autoFeedbackMethod = "",
const String &  allowFeedbackTypes = "" 
)

set explicit (and more responsive) "feedback" handler (and enable feedback)

Parameters
handler"feedback" handler; see DDFeedbackHandler
autoFeedbackMethodsee DDLayer::enableFeedback()
allowedFeedbackTypecan be comma-delimited list of "CLICK", "LONGPRESS" and "DOUBLECLICK"
Note
if you will not be making use of "feedback", you can disable it by defining DD_NO_FEEDBACK in order to reduce footprint

◆ transparent()

void DDLayer::transparent ( bool  transparent)

set whether layer is transparent

Note
layer property

◆ visible()

void DDLayer::visible ( bool  visible)

set whether layer visible (not visible means hidden)

Note
layer property