summaryrefslogtreecommitdiff
path: root/glcdskin/object.h
diff options
context:
space:
mode:
Diffstat (limited to 'glcdskin/object.h')
-rw-r--r--glcdskin/object.h90
1 files changed, 82 insertions, 8 deletions
diff --git a/glcdskin/object.h b/glcdskin/object.h
index 0dd996d..cb2f180 100644
--- a/glcdskin/object.h
+++ b/glcdskin/object.h
@@ -24,6 +24,8 @@
#include "type.h"
#include "string.h"
+#include <glcddrivers/driver.h>
+
namespace GLCD
{
@@ -58,6 +60,54 @@ enum eTextVerticalAlignment
tvaBottom
};
+enum eEffect
+{
+ tfxNone,
+ tfxShadow,
+ tfxOutline
+};
+
+enum eScale
+{
+ tscNone,
+ tscAuto,
+ tscAutoX,
+ tscAutoY,
+ tscFill
+};
+
+enum eGradient
+{
+ tgrdNone,
+ tgrdTotal,
+ tgrdCurrent,
+ tgrdVertical
+};
+
+
+
+class cSkinColor
+{
+private:
+ cSkinObject * mObject;
+ uint32_t mColor;
+ std::string mVarId;
+public:
+ cSkinColor(cSkinObject *Parent, uint32_t color):mVarId("") { mObject = Parent; mColor = color; }
+ cSkinColor(cSkinObject *Parent, cColor color):mVarId("") { mObject = Parent; mColor = (uint32_t)color; }
+ cSkinColor(cSkinObject *Parent, const std::string varId) { mObject = Parent; mVarId = varId; }
+ ~cSkinColor() {};
+
+ void SetColor(uint32_t color) { mVarId = ""; mColor = color; }
+ void SetColor(cColor color) { mVarId = ""; mColor = (uint32_t)color; }
+ void SetVarId(const std::string varId) { mVarId = varId; }
+
+ uint32_t GetColor(void);
+
+ operator uint32_t(void) { return GetColor(); }
+};
+
+
class cSkinObject
{
friend bool StartElem(const std::string & name, std::map<std::string,std::string> & attrs);
@@ -77,6 +127,7 @@ public:
text,
scrolltext,
scrollbar,
+ button,
block,
list,
item,
@@ -87,9 +138,16 @@ private:
cSkinDisplay * mDisplay; // parent display
cSkin * mSkin;
eType mType; // type of object, one of enum eType
- tPoint mPos1;
- tPoint mPos2;
- eColor mColor;
+ //tPoint mPos1;
+ //tPoint mPos2;
+ cSkinString mX1; // either mX1 and mWidth or mX1 and mX2 are defined. not all three
+ cSkinString mY1;
+ cSkinString mX2;
+ cSkinString mY2;
+ cSkinString mWidth;
+ cSkinString mHeight;
+ cSkinColor mColor;
+ cSkinColor mBackgroundColor;
bool mFilled;
int mRadius;
int mArc;
@@ -98,11 +156,16 @@ private:
eTextVerticalAlignment mVerticalAlign;
bool mMultiline;
cSkinString mPath;
- cSkinString mCurrent;
- cSkinString mTotal;
+ cSkinString mCurrent; // progress bar: current value
+ cSkinString mTotal; // progress bar: maximum valid value
+ cSkinString mPeak; // progress bar: peak value (<= 0: disabled)
cSkinString mFont;
cSkinString mText;
cSkinFunction * mCondition;
+ eEffect mEffect; // effect: none, shadow, or outline
+ cSkinColor mEffectColor; // effect colour (= shadow colour or colour of outline)
+ cSkinColor mPeakGradientColor; // colour of peak marker or gradient color (mutual exclusive)
+ eGradient mGradient; // use gradient effect for progress bar (overrules peak!)
uint64_t mLastChange; // timestamp: last change in dynamic object (scroll, frame change, ...)
int mChangeDelay; // delay between two changes (frame change, scrolling, ...)
@@ -111,6 +174,8 @@ private:
std::string mStoredImagePath; // stored image path
int mImageFrameId; // frame ID of image
+ int mOpacity; // opacity of an image ([0, 255], default 255)
+ eScale mScale; // image scaling (['none', 'autox', 'autoy', 'fill'], default: none)
int mScrollLoopMode; // scroll (text) or loop (image) mode: -1: default, 0: never, 1: once, 2: always
bool mScrollLoopReached; // if scroll/loop == once: already looped once?
@@ -121,6 +186,10 @@ private:
std::string mAltText; // alternative text source for text-objects
cSkinFunction * mAltCondition; // condition when alternative sources are used
+ std::string mAction; // action attached to this object
+
+ int mMultilineScrollPosition; // current scolling position of mMultiline
+ cSkinString mMultilineRelScroll;// relative scrolling amount of mMultiline (default: 0)
cSkinObjects * mObjects; // used for block objects such as <list>
@@ -130,14 +199,17 @@ public:
~cSkinObject();
bool ParseType(const std::string &Text);
- bool ParseColor(const std::string &Text);
+ bool ParseColor(const std::string &Text, cSkinColor & ParamColor);
bool ParseCondition(const std::string &Text);
bool ParseAlignment(const std::string &Text);
bool ParseVerticalAlignment(const std::string &Text);
+ bool ParseEffect(const std::string &Text);
+ bool ParseScale(const std::string &Text);
+ bool ParseGradient(const std::string &Text);
bool ParseFontFace(const std::string &Text);
bool ParseIntParam(const std::string &Text, int & Param);
- bool ParseWidth(const std::string &Text);
- bool ParseHeight(const std::string &Text);
+ //bool ParseWidth(const std::string &Text);
+ //bool ParseHeight(const std::string &Text);
bool ParseScrollLoopMode(const std::string & Text); // parse scroll mode ([never|once|always])
bool ParseScrollSpeed(const std::string & Text); // parse scroll speed
@@ -164,6 +236,8 @@ public:
// check if update is required for dynamic objects (image, text, progress, pane)
// false: no update required, true: update required
bool NeedsUpdate(uint64_t CurrentTime);
+
+ std::string CheckAction(cGLCDEvent * ev);
};
class cSkinObjects: public std::vector<cSkinObject *>