vdr-plugin-skindesigner/views/view.h

143 lines
5.4 KiB
C
Raw Normal View History

2014-09-27 09:25:14 +02:00
#ifndef __VIEW_H
#define __VIEW_H
#include "string"
#include "map"
#include "../libcore/pixmapcontainer.h"
#include "../libtemplate/template.h"
2015-05-10 12:55:23 +02:00
#include "viewhelpers.h"
#include "animation.h"
2014-09-27 09:25:14 +02:00
using namespace std;
2015-03-22 12:52:10 +01:00
class cViewElement;
2014-09-27 09:25:14 +02:00
class cView : public cPixmapContainer {
private:
void Init(void);
void DoDrawDebugGrid(void);
2014-09-27 09:25:14 +02:00
void DoFill(int num, cTemplateFunction *func);
void DoDrawText(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
2015-03-12 17:28:35 +01:00
void DoDrawTextVertical(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
2014-09-27 09:25:14 +02:00
void DoDrawTextBox(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
void DoDrawFloatingTextBox(int num, cTemplateFunction *func);
void DoDrawRectangle(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
void DoDrawEllipse(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
2014-10-25 16:58:05 +02:00
void DoDrawSlope(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
2014-09-27 09:25:14 +02:00
void DoDrawImage(int num, cTemplateFunction *func, int x0 = 0, int y0 = 0);
void DrawAnimatedImage(int numPix, cTemplateFunction *func, cRect &pos, cImage *image);
void DrawAnimatedText(int numPix, cTemplateFunction *func, cPoint &pos, string text, tColor col, string fontName, int fontSize);
void DrawAnimatedOsdObject(int numPix, cTemplateFunction *func, cRect &pos, tColor col, int quadrant);
cRect CalculateAnimationClip(int numPix, cRect &pos);
2014-09-27 09:25:14 +02:00
void ActivateScrolling(void);
protected:
cTemplateView *tmplView;
2015-03-22 12:52:10 +01:00
cTemplateViewElement *tmplViewElement;
2014-09-27 09:25:14 +02:00
cTemplateViewTab *tmplTab;
2015-03-22 12:52:10 +01:00
//detached viewelements
map < eViewElement, cViewElement* > detachedViewElements;
//animated elements
multimap < int, cAnimation* > animations;
2014-09-27 09:25:14 +02:00
//scaling window
cRect scalingWindow;
bool tvScaled;
bool viewInit;
//true if view is scrollable in general
bool scrolling;
//true if view is actually starting scrolling
bool currentlyScrolling;
eViewElement veScroll;
int scrollingPix;
int scrollOrientation;
int scrollDelay;
int scrollMode;
int scrollSpeed;
int animCat;
2014-09-27 09:25:14 +02:00
void DrawViewElement(eViewElement ve, map <string,string> *stringTokens = NULL, map <string,int> *intTokens = NULL, map < string, vector< map< string, string > > > *loopTokens = NULL);
void ClearViewElement(eViewElement ve);
2015-03-12 17:28:35 +01:00
void DestroyViewElement(eViewElement ve);
void ClearAnimations(int cat);
bool ExecuteViewElement(eViewElement ve);
2015-03-22 08:29:52 +01:00
bool DetachViewElement(eViewElement ve);
2015-03-12 17:28:35 +01:00
bool ViewElementScrolls(eViewElement ve);
2015-03-22 12:52:10 +01:00
cViewElement *GetViewElement(eViewElement ve);
void AddViewElement(eViewElement ve, cViewElement *viewElement);
2014-09-27 09:25:14 +02:00
void CreateViewPixmap(int num, cTemplatePixmap *pix, cRect *size = NULL);
void CreateScrollingPixmap(int num, cTemplatePixmap *pix, cSize &drawportSize);
void DrawPixmap(int num, cTemplatePixmap *pix, map < string, vector< map< string, string > > > *loopTokens = NULL, bool flushPerLoop = false);
void DrawLoop(int numPixmap, cTemplateFunction *func, map < string, vector< map< string, string > > > *loopTokens);
void DebugTokens(string viewElement, map<string,string> *stringTokens, map<string,int> *intTokens, map < string, vector< map< string, string > > > *loopTokens = NULL);
virtual void Action(void);
public:
cView(cTemplateView *tmplView);
2015-03-22 12:52:10 +01:00
cView(cTemplateViewElement *tmplViewElement);
2014-09-27 09:25:14 +02:00
cView(cTemplateViewTab *tmplTab);
void DrawDebugGrid(void);
2014-09-27 09:25:14 +02:00
virtual ~cView();
virtual void Stop(void);
};
2015-03-22 12:52:10 +01:00
class cViewElement : public cView {
private:
protected:
2015-05-10 12:55:23 +02:00
bool init;
eViewElement ve;
2015-03-22 12:52:10 +01:00
int delay;
2015-05-10 12:55:23 +02:00
stringmap stringTokens;
intmap intTokens;
bool (cViewHelpers::*SetTokens)(bool, stringmap&, intmap&);
cViewHelpers *helper;
2015-03-22 12:52:10 +01:00
void Action(void);
void ClearTokens(void);
2015-03-22 12:52:10 +01:00
public:
cViewElement(cTemplateViewElement *tmplViewElement);
2015-05-10 12:55:23 +02:00
cViewElement(cTemplateViewElement *tmplViewElement, cViewHelpers *helper);
2015-03-22 12:52:10 +01:00
virtual ~cViewElement();
2015-05-10 12:55:23 +02:00
void SetCallback(eViewElement ve, bool (cViewHelpers::*SetTokens)(bool, stringmap&, intmap&)) { this->ve = ve; this->SetTokens = SetTokens; };
virtual bool Render(void);
bool Starting(void) { return Running(); };
2015-03-22 12:52:10 +01:00
};
2014-09-27 09:25:14 +02:00
class cViewListItem : public cView {
protected:
int pos;
int numTotal;
cRect container;
int align;
int listOrientation;
void SetListElementPosition(cTemplatePixmap *pix);
public:
cViewListItem(cTemplateViewElement *tmplItem);
virtual ~cViewListItem();
cRect DrawListItem(map <string,string> *stringTokens, map <string,int> *intTokens);
void ClearListItem(void);
};
2015-02-12 18:50:58 +01:00
class cGrid : public cView {
protected:
bool dirty;
bool moved;
bool resized;
bool current;
double x;
double y;
double width;
double height;
map <string,string> stringTokens;
map <string,int> intTokens;
void PositionPixmap(cTemplatePixmap *pix);
public:
cGrid(cTemplateViewElement *tmplGrid);
virtual ~cGrid();
bool Dirty(void) { return dirty; };
bool Moved(void) { return moved; };
bool Resized(void) { return resized; };
void Set(double x, double y, double width, double height, map <string,int> *intTokens, map <string,string> *stringTokens);
void SetCurrent(bool current);
void Move(void);
void Draw(void);
void Clear(void);
void DeletePixmaps(void);
};
2014-09-27 09:25:14 +02:00
#endif //__VIEW_H