2014-09-27 09:25:14 +02:00
|
|
|
#ifndef __TEMPLATEPIXMAP_H
|
|
|
|
#define __TEMPLATEPIXMAP_H
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <set>
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
#include "globals.h"
|
|
|
|
#include "templateloopfunction.h"
|
2015-07-07 17:58:10 +02:00
|
|
|
#include "../views/viewhelpers.h"
|
2014-09-27 09:25:14 +02:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2015-07-07 17:58:10 +02:00
|
|
|
// --- cTemplatePixmapNode -------------------------------------------------------------
|
|
|
|
class cTemplatePixmapNode {
|
|
|
|
protected:
|
|
|
|
bool isContainer;
|
|
|
|
cGlobals *globals;
|
|
|
|
cTemplateFunction *parameters;
|
|
|
|
int containerX;
|
|
|
|
int containerY;
|
|
|
|
int containerWidth;
|
|
|
|
int containerHeight;
|
|
|
|
public:
|
|
|
|
cTemplatePixmapNode(void);
|
|
|
|
virtual ~cTemplatePixmapNode(void);
|
|
|
|
void SetParameters(vector<stringpair> ¶ms);
|
|
|
|
void SetContainer(int x, int y, int w, int h);
|
|
|
|
bool IsContainer(void) { return isContainer; };
|
|
|
|
bool DoExecute(void) { return parameters->DoExecute(); };
|
|
|
|
bool DoDebug(void) { return parameters->DoDebug(); };
|
|
|
|
virtual void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
|
|
|
virtual bool CalculateParameters(void) { return false; };
|
|
|
|
virtual void SetWidth(int width) {};
|
|
|
|
virtual void SetHeight(int height) {};
|
|
|
|
virtual int NumPixmaps(void) { return 0; };
|
|
|
|
virtual void Debug(void) {};
|
|
|
|
};
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
// --- cTemplatePixmap -------------------------------------------------------------
|
2015-07-07 17:58:10 +02:00
|
|
|
class cTemplatePixmapContainer;
|
2014-09-27 09:25:14 +02:00
|
|
|
|
2015-07-07 17:58:10 +02:00
|
|
|
class cTemplatePixmap : public cTemplatePixmapNode {
|
2014-09-27 09:25:14 +02:00
|
|
|
protected:
|
2015-07-07 17:58:10 +02:00
|
|
|
cTemplatePixmapContainer *pixContainer;
|
2014-09-27 09:25:14 +02:00
|
|
|
bool scrolling;
|
2015-03-28 11:57:51 +01:00
|
|
|
bool background;
|
2014-09-27 09:25:14 +02:00
|
|
|
vector<cTemplateFunction*> functions;
|
|
|
|
vector<cTemplateFunction*>::iterator funcIt;
|
|
|
|
//functions replacing {width(label)} and {height(label)} tokens
|
2015-03-30 18:05:53 +02:00
|
|
|
bool ReplaceWidthFunctions(void);
|
2015-05-30 16:43:59 +02:00
|
|
|
bool ReplaceHeightFunctions(map < string, vector< map< string, string > > > *loopTokens);
|
2014-09-27 09:25:14 +02:00
|
|
|
//functions replacing {posx(label)} and {posy(label)} tokens
|
2015-03-30 18:05:53 +02:00
|
|
|
bool ReplacePosXFunctions(void);
|
|
|
|
bool ReplacePosYFunctions(void);
|
2014-09-27 09:25:14 +02:00
|
|
|
//Get Scrolling Function
|
|
|
|
cTemplateFunction *GetScrollFunction(void);
|
|
|
|
public:
|
|
|
|
cTemplatePixmap(void);
|
|
|
|
virtual ~cTemplatePixmap(void);
|
|
|
|
//Setter Functions
|
2015-07-07 17:58:10 +02:00
|
|
|
void SetPixmapContainer(cTemplatePixmapContainer *pixContainer) { this->pixContainer = pixContainer; };
|
2014-09-27 09:25:14 +02:00
|
|
|
void SetScrolling(void) { scrolling = true; };
|
|
|
|
void SetWidth(int width);
|
|
|
|
void SetHeight(int height);
|
|
|
|
void SetX(int x);
|
|
|
|
void SetY(int y);
|
2015-02-12 18:50:58 +01:00
|
|
|
void SetWidthPercent(double width);
|
|
|
|
void SetHeightPercent(double height);
|
|
|
|
void SetXPercent(double x);
|
|
|
|
void SetYPercent(double y);
|
2015-07-07 17:58:10 +02:00
|
|
|
void SetParameter(eParamType type, string value);
|
2014-09-27 09:25:14 +02:00
|
|
|
void AddFunction(string name, vector<pair<string, string> > ¶ms);
|
|
|
|
void AddLoopFunction(cTemplateLoopFunction *lf);
|
|
|
|
//PreCache Parameters
|
|
|
|
bool CalculateParameters(void);
|
|
|
|
//clear dynamically set function parameters
|
|
|
|
void ClearDynamicFunctionParameters(void);
|
|
|
|
//Clear dynamically set pixmap parameters
|
|
|
|
void ClearDynamicParameters(void);
|
|
|
|
//Parse pixmap parameters with dynamically set Tokens
|
2015-04-10 16:44:29 +02:00
|
|
|
void ParseDynamicParameters(map <string,string> *stringTokens, map <string,int> *intTokens, bool initFuncs);
|
2014-09-27 09:25:14 +02:00
|
|
|
//Parse all function parameters with dynamically set Tokens
|
2015-05-30 16:43:59 +02:00
|
|
|
void ParseDynamicFunctionParameters(map <string,string> *stringTokens, map <string,int> *intTokens, map < string, vector< map< string, string > > > *loopTokens);
|
2014-09-27 09:25:14 +02:00
|
|
|
//Calculate size of drawport in case area scrolls
|
|
|
|
bool CalculateDrawPortSize(cSize &size, map < string, vector< map< string, string > > > *loopTokens = NULL);
|
|
|
|
//Set max width for text in scrollarea
|
|
|
|
void SetScrollingTextWidth(void);
|
|
|
|
//Getter Functions
|
2015-07-07 17:58:10 +02:00
|
|
|
int NumPixmaps(void) { return 1; };
|
2014-09-27 09:25:14 +02:00
|
|
|
cRect GetPixmapSize(void);
|
|
|
|
int GetNumericParameter(eParamType type);
|
|
|
|
bool Scrolling(void) { return scrolling; };
|
|
|
|
bool Ready(void);
|
2015-03-28 11:57:51 +01:00
|
|
|
bool BackgroundArea(void) { return background; };
|
2015-07-07 17:58:10 +02:00
|
|
|
bool ParameterSet(eParamType type);
|
|
|
|
cTemplateFunction *GetFunction(string name);
|
2014-09-27 09:25:14 +02:00
|
|
|
//Traverse Functions
|
2015-07-07 17:58:10 +02:00
|
|
|
void InitFunctionIterator(void);
|
2014-09-27 09:25:14 +02:00
|
|
|
cTemplateFunction *GetNextFunction(void);
|
|
|
|
//Debug
|
|
|
|
void Debug(void);
|
|
|
|
};
|
|
|
|
|
2015-07-07 17:58:10 +02:00
|
|
|
class cTemplatePixmapContainer : public cTemplatePixmapNode {
|
|
|
|
private:
|
|
|
|
vector<cTemplatePixmap*> pixmaps;
|
|
|
|
vector<cTemplatePixmap*>::iterator pixmapIterator;
|
|
|
|
public:
|
|
|
|
cTemplatePixmapContainer(void);
|
|
|
|
virtual ~cTemplatePixmapContainer(void);
|
|
|
|
void SetGlobals(cGlobals *globals);
|
|
|
|
void SetWidth(int width);
|
|
|
|
void SetHeight(int height);
|
|
|
|
void AddPixmap(cTemplatePixmap *pix);
|
|
|
|
//PreCache Parameters
|
|
|
|
bool CalculateParameters(void);
|
|
|
|
void ParseDynamicParameters(map <string,string> *stringTokens, map <string,int> *intTokens);
|
|
|
|
int NumPixmaps(void) { return pixmaps.size(); };
|
|
|
|
void InitIterator(void);
|
|
|
|
cTemplatePixmap *GetNextPixmap(void);
|
|
|
|
cTemplateFunction *GetFunction(string name);
|
|
|
|
void Debug(void);
|
|
|
|
};
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
#endif //__TEMPLATEPIXMAP_H
|