vdr-plugin-skindesigner/libtemplate/templateview.h

207 lines
7.3 KiB
C
Raw Normal View History

2014-09-27 09:25:14 +02:00
#ifndef __TEMPLATEVIEW_H
#define __TEMPLATEVIEW_H
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include "templateviewelement.h"
#include "templateviewlist.h"
#include "templatepixmap.h"
#include "templateviewtab.h"
#include "templatefunction.h"
using namespace std;
// --- cTemplateView -------------------------------------------------------------
enum eSubView {
svUndefined,
svMenuDefault,
svMenuMain,
svMenuSetup,
svMenuSchedules,
svMenuTimers,
svMenuRecordings,
svMenuChannels,
svMenuDetailedEpg,
svMenuDetailedRecording,
2014-11-15 09:47:22 +01:00
svMenuDetailedText,
svMenuPlugin,
2014-09-27 09:25:14 +02:00
};
class cTemplateView {
private:
protected:
cGlobals *globals;
//view parameters
string viewName;
cTemplateFunction *parameters;
int containerX;
int containerY;
int containerWidth;
int containerHeight;
//basic view data structures
map < eViewElement, cTemplateViewElement* > viewElements;
map < eViewList, cTemplateViewList* > viewLists;
map < eSubView, cTemplateView* > subViews;
vector< cTemplateViewTab* > viewTabs;
2014-11-15 09:47:22 +01:00
map < string, map< int, cTemplateView*> > pluginViews;
2014-09-27 09:25:14 +02:00
//helpers to iterate data structures
map < eViewElement, cTemplateViewElement* >::iterator veIt;
map < eViewList, cTemplateViewList* >::iterator vlIt;
map < eSubView, cTemplateView* >::iterator svIt;
vector< cTemplateViewTab* >::iterator vtIt;
//helpers to check valid xml templates
set<string> subViewsAllowed;
set<string> viewElementsAllowed;
set<string> viewListsAllowed;
map < string, set < string > > funcsAllowed;
void SetFunctionDefinitions(void);
public:
cTemplateView(void);
virtual ~cTemplateView(void);
virtual string GetSubViewName(eSubView sv) { return ""; };
virtual string GetViewElementName(eViewElement ve) { return ""; };
virtual string GetViewListName(eViewList vl) { return ""; };
2014-11-15 09:47:22 +01:00
virtual void AddSubView(string sSubView, cTemplateView *subView) {};
virtual void AddPluginView(string plugName, int templNo, cTemplateView *plugView) {};
virtual void AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) {};
2014-09-27 09:25:14 +02:00
virtual void AddViewList(string sViewList, cTemplateViewList *viewList) {};
virtual void AddViewTab(cTemplateViewTab *viewTab) {};
//Setter Functions
void SetGlobals(cGlobals *globals) { this->globals = globals; };
void SetParameters(vector<pair<string, string> > &params);
void SetContainer(int x, int y, int width, int height);
//access view elements
cTemplateViewElement *GetViewElement(eViewElement ve);
void InitViewElementIterator(void);
cTemplateViewElement *GetNextViewElement(void);
//access list elements
cTemplateViewList *GetViewList(eViewList vl);
void InitViewListIterator(void);
cTemplateViewList *GetNextViewList(void);
2014-11-15 09:47:22 +01:00
bool IsListView(void) { return viewLists.size() > 0 ? true : false; };
2014-09-27 09:25:14 +02:00
//access tabs
void InitViewTabIterator(void);
cTemplateViewTab *GetNextViewTab(void);
//access sub views
cTemplateView *GetSubView(eSubView sv);
void InitSubViewIterator(void);
cTemplateView *GetNextSubView(void);
2014-11-15 09:47:22 +01:00
//access plugin views
cTemplateView *GetPluginView(string pluginName, int pluginMenu);
2014-09-27 09:25:14 +02:00
//Getter Functions
const char *GetViewName(void) { return viewName.c_str(); };
int GetNumericParameter(eParamType type);
cRect GetOsdSize(void);
int GetNumPixmaps(void);
int GetNumPixmapsViewElement(eViewElement ve);
int GetNumListViewMenuItems(void);
bool GetScalingWindow(cRect &scalingWindow);
map<string,string> GetCustomTokens(void) { return globals->customTokens; };
2014-09-27 09:25:14 +02:00
//Checks for parsing template XML files
bool ValidSubView(const char *subView);
bool ValidViewElement(const char *viewElement);
bool ValidViewList(const char *viewList);
bool ValidFunction(const char *func);
bool ValidAttribute(const char *func, const char *att);
//Caching
void Translate(void);
void PreCache(bool isSubview);
//Debug
void Debug(void);
};
// --- cTemplateViewChannel -------------------------------------------------------------
class cTemplateViewChannel : public cTemplateView {
private:
void SetViewElements(void);
void SetViewLists(void);
public:
cTemplateViewChannel(void);
virtual ~cTemplateViewChannel(void);
string GetViewElementName(eViewElement ve);
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
2014-09-27 09:25:14 +02:00
};
// --- cTemplateViewMenu -------------------------------------------------------------
class cTemplateViewMenu : public cTemplateView {
private:
void SetSubViews(void);
void SetViewElements(void);
void SetViewLists(void);
public:
cTemplateViewMenu(void);
virtual ~cTemplateViewMenu(void);
string GetSubViewName(eSubView sv);
string GetViewElementName(eViewElement ve);
string GetViewListName(eViewList vl);
void AddSubView(string sSubView, cTemplateView *subView);
2014-11-15 09:47:22 +01:00
void AddPluginView(string plugName, int templNo, cTemplateView *plugView);
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
2014-09-27 09:25:14 +02:00
void AddViewList(string sViewList, cTemplateViewList *viewList);
void AddViewTab(cTemplateViewTab *viewTab);
};
// --- cTemplateViewMessage -------------------------------------------------------------
class cTemplateViewMessage : public cTemplateView {
private:
void SetViewElements(void);
public:
cTemplateViewMessage(void);
virtual ~cTemplateViewMessage(void);
string GetViewElementName(eViewElement ve);
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
2014-09-27 09:25:14 +02:00
};
// --- cTemplateViewReplay -------------------------------------------------------------
class cTemplateViewReplay : public cTemplateView {
private:
void SetViewElements(void);
public:
cTemplateViewReplay(void);
virtual ~cTemplateViewReplay(void);
string GetViewElementName(eViewElement ve);
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
2014-09-27 09:25:14 +02:00
};
// --- cTemplateViewVolume -------------------------------------------------------------
class cTemplateViewVolume : public cTemplateView {
private:
void SetViewElements(void);
public:
cTemplateViewVolume(void);
virtual ~cTemplateViewVolume(void);
string GetViewElementName(eViewElement ve);
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
2014-09-27 09:25:14 +02:00
};
// --- cTemplateViewAudioTracks -------------------------------------------------------------
class cTemplateViewAudioTracks : public cTemplateView {
private:
void SetViewElements(void);
void SetViewLists(void);
public:
cTemplateViewAudioTracks(void);
virtual ~cTemplateViewAudioTracks(void);
string GetViewElementName(eViewElement ve);
string GetViewListName(eViewList vl);
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
2014-09-27 09:25:14 +02:00
void AddViewList(string sViewList, cTemplateViewList *viewList);
};
#endif //__TEMPLATEVIEW_H