vdr-plugin-skindesigner/libskindesignerapi/osdelements.c

203 lines
6.0 KiB
C
Raw Normal View History

2015-04-02 15:09:41 +02:00
#include "osdelements.h"
/**********************************************************************
* cOsdElement
**********************************************************************/
2016-01-26 18:32:38 +01:00
skindesignerapi::cOsdElement::cOsdElement(skindesignerapi::ISkinDisplayPlugin *view, int viewId) {
2015-04-02 15:09:41 +02:00
this->view = view;
2016-01-26 18:32:38 +01:00
this->viewId = viewId;
tk = NULL;
2015-04-02 15:09:41 +02:00
}
skindesignerapi::cOsdElement::~cOsdElement() {
}
void skindesignerapi::cOsdElement::ClearTokens(void) {
2016-01-26 18:32:38 +01:00
tk->Clear();
2015-04-02 15:09:41 +02:00
}
2016-01-26 18:32:38 +01:00
int skindesignerapi::cOsdElement::GetLoopIndex(const char *loop) {
return tk->LoopIndex(loop);
2015-04-02 15:09:41 +02:00
}
2016-01-26 18:32:38 +01:00
void skindesignerapi::cOsdElement::SetLoop(vector<int> loopInfo) {
tk->CreateLoopTokenContainer(&loopInfo);
2015-04-02 15:09:41 +02:00
}
2016-01-26 18:32:38 +01:00
void skindesignerapi::cOsdElement::AddStringToken(int index, const char *value) {
tk->AddStringToken(index, value);
}
void skindesignerapi::cOsdElement::AddIntToken(int index, int value) {
tk->AddIntToken(index, value);
}
void skindesignerapi::cOsdElement::AddLoopToken(int loopIndex, int row, int index, const char *value) {
tk->AddLoopToken(loopIndex, row, index, value);
2015-04-02 15:09:41 +02:00
}
bool skindesignerapi::cOsdElement::ChannelLogoExists(string channelId) {
return view->ChannelLogoExists(channelId);
}
string skindesignerapi::cOsdElement::GetEpgImagePath(void) {
2016-01-26 18:32:38 +01:00
return view->GetEpgImagePath();
2015-04-02 15:09:41 +02:00
}
2016-01-26 18:32:38 +01:00
void skindesignerapi::cOsdElement::DebugTokenContainer(void) {
tk->Debug();
}
2015-04-02 15:09:41 +02:00
/**********************************************************************
* cViewElement
**********************************************************************/
2016-01-26 18:32:38 +01:00
skindesignerapi::cViewElement::cViewElement(skindesignerapi::ISkinDisplayPlugin *view, int viewId, int viewElementId) : cOsdElement(view, viewId) {
this->viewElementId = viewElementId;
2015-04-02 15:09:41 +02:00
}
skindesignerapi::cViewElement::~cViewElement() {
2016-01-26 18:32:38 +01:00
view->ClearViewElement(viewElementId, viewId);
2015-04-02 15:09:41 +02:00
}
void skindesignerapi::cViewElement::Clear(void) {
2016-01-26 18:32:38 +01:00
view->ClearViewElement(viewElementId, viewId);
2015-04-02 15:09:41 +02:00
}
void skindesignerapi::cViewElement::Display(void) {
2016-01-26 18:32:38 +01:00
view->SetViewElementTokens(viewElementId, viewId, tk);
view->DisplayViewElement(viewElementId, viewId);
2015-04-02 15:09:41 +02:00
}
/**********************************************************************
* cViewGrid
**********************************************************************/
2016-01-26 18:32:38 +01:00
skindesignerapi::cViewGrid::cViewGrid(skindesignerapi::ISkinDisplayPlugin *view, int viewId, int viewGridId) : cOsdElement(view, viewId) {
this->viewGridId = viewGridId;
2015-04-02 15:09:41 +02:00
}
skindesignerapi::cViewGrid::~cViewGrid() {
2016-01-26 18:32:38 +01:00
view->ClearGrids(viewId, viewGridId);
2015-04-02 15:09:41 +02:00
}
2016-01-26 18:32:38 +01:00
void skindesignerapi::cViewGrid::SetGrid(long gridId, double x, double y, double width, double height) {
view->SetGrid(gridId, viewId, viewGridId, x, y, width, height, tk);
2015-04-02 15:09:41 +02:00
}
2016-01-26 18:32:38 +01:00
void skindesignerapi::cViewGrid::SetCurrent(long gridId, bool current) {
view->SetGridCurrent(gridId, viewId, viewGridId, current);
2015-04-02 15:09:41 +02:00
}
2016-01-26 18:32:38 +01:00
void skindesignerapi::cViewGrid::MoveGrid(long gridId, double x, double y, double width, double height) {
view->SetGrid(gridId, viewId, viewGridId, x, y, width, height, NULL);
2015-04-02 15:09:41 +02:00
}
2016-01-26 18:32:38 +01:00
void skindesignerapi::cViewGrid::Delete(long gridId) {
view->DeleteGrid(gridId, viewId, viewGridId);
2015-04-02 15:09:41 +02:00
}
void skindesignerapi::cViewGrid::Clear(void) {
2016-01-26 18:32:38 +01:00
view->ClearGrids(viewId, viewGridId);
2015-04-02 15:09:41 +02:00
}
void skindesignerapi::cViewGrid::Display(void) {
2016-01-26 18:32:38 +01:00
view->DisplayGrids(viewId, viewGridId);
2015-04-02 15:09:41 +02:00
}
/**********************************************************************
* cViewTab
**********************************************************************/
2016-01-26 18:32:38 +01:00
skindesignerapi::cViewTab::cViewTab(skindesignerapi::ISkinDisplayPlugin *view, int viewId) : cOsdElement(view, viewId) {
2015-04-02 15:09:41 +02:00
}
skindesignerapi::cViewTab::~cViewTab() {
2016-01-26 18:32:38 +01:00
view->ClearTab(viewId);
2015-04-02 15:09:41 +02:00
}
void skindesignerapi::cViewTab::Init(void) {
2016-01-26 18:32:38 +01:00
view->SetTabTokens(viewId, tk);
2015-04-02 15:09:41 +02:00
}
void skindesignerapi::cViewTab::Left(void) {
2016-01-26 18:32:38 +01:00
view->TabLeft(viewId);
2015-04-02 15:09:41 +02:00
}
void skindesignerapi::cViewTab::Right(void) {
2016-01-26 18:32:38 +01:00
view->TabRight(viewId);
2015-04-02 15:09:41 +02:00
}
void skindesignerapi::cViewTab::Up(void) {
2016-01-26 18:32:38 +01:00
view->TabUp(viewId);
2015-04-02 15:09:41 +02:00
}
void skindesignerapi::cViewTab::Down(void) {
2016-01-26 18:32:38 +01:00
view->TabDown(viewId);
2015-04-02 15:09:41 +02:00
}
void skindesignerapi::cViewTab::Display(void) {
2016-01-26 18:32:38 +01:00
view->DisplayTabs(viewId);
2015-04-02 15:09:41 +02:00
}
/**********************************************************************
* cOsdView
**********************************************************************/
2016-01-26 18:32:38 +01:00
skindesignerapi::cOsdView::cOsdView(skindesignerapi::cPluginStructure *plugStruct, skindesignerapi::ISkinDisplayPlugin *displayPlugin, int viewId) {
this->plugStruct = plugStruct;
2015-04-02 15:09:41 +02:00
this->displayPlugin = displayPlugin;
2016-01-26 18:32:38 +01:00
this->viewId = viewId;
2015-04-02 15:09:41 +02:00
}
skindesignerapi::cOsdView::~cOsdView() {
2016-01-26 18:32:38 +01:00
if (displayPlugin && (viewId == 0))
displayPlugin->CloseOsd();
2015-04-02 15:09:41 +02:00
}
void skindesignerapi::cOsdView::Deactivate(bool hide) {
if (!displayPlugin)
return;
2016-01-26 18:32:38 +01:00
displayPlugin->Deactivate(viewId, hide);
2015-04-02 15:09:41 +02:00
}
void skindesignerapi::cOsdView::Activate(void) {
if (!displayPlugin)
return;
2016-01-26 18:32:38 +01:00
displayPlugin->Activate(viewId);
2015-04-02 15:09:41 +02:00
}
2016-01-26 18:32:38 +01:00
skindesignerapi::cViewElement *skindesignerapi::cOsdView::GetViewElement(int viewElementId) {
2015-04-02 15:09:41 +02:00
if (!displayPlugin)
return NULL;
2016-01-26 18:32:38 +01:00
cTokenContainer *tk = plugStruct->GetTokenContainerVE(viewId, viewElementId);
if (!tk)
return NULL;
skindesignerapi::cViewElement *ve = new cViewElement(displayPlugin, viewId, viewElementId);
ve->SetTokenContainer(tk);
return ve;
2015-04-02 15:09:41 +02:00
}
2016-01-26 18:32:38 +01:00
skindesignerapi::cViewGrid *skindesignerapi::cOsdView::GetViewGrid(int viewGridId) {
2015-04-02 15:09:41 +02:00
if (!displayPlugin)
return NULL;
2016-01-26 18:32:38 +01:00
cTokenContainer *tk = plugStruct->GetTokenContainerGE(viewId, viewGridId);
if (!tk)
return NULL;
skindesignerapi::cViewGrid *ge = new cViewGrid(displayPlugin, viewId, viewGridId);
ge->SetTokenContainer(tk);
return ge;
2015-04-02 15:09:41 +02:00
}
skindesignerapi::cViewTab *skindesignerapi::cOsdView::GetViewTabs(void) {
if (!displayPlugin)
return NULL;
2016-01-26 18:32:38 +01:00
cTokenContainer *tk = plugStruct->GetTokenContainerTab(viewId);
if (!tk)
return NULL;
skindesignerapi::cViewTab *tab = new cViewTab(displayPlugin, viewId);
tab->SetTokenContainer(tk);
return tab;
2015-04-02 15:09:41 +02:00
}
void skindesignerapi::cOsdView::Display(void) {
2016-01-26 18:32:38 +01:00
if (displayPlugin)
displayPlugin->Flush();
2015-04-02 15:09:41 +02:00
}