summaryrefslogtreecommitdiff
path: root/libskindesignerapi/osdelements.c
blob: 74524d798a1bfa796f8491a7feb9dab59ab2b7d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#include "osdelements.h"

/**********************************************************************
* cOsdElement
**********************************************************************/
skindesignerapi::cOsdElement::cOsdElement(skindesignerapi::ISkinDisplayPlugin *view) {
    this->view = view;
}

skindesignerapi::cOsdElement::~cOsdElement() {
}

void skindesignerapi::cOsdElement::ClearTokens(void) {
    stringTokens.clear();
    intTokens.clear();
    loopTokens.clear();
}

void skindesignerapi::cOsdElement::AddStringToken(string key, string value) {
    stringTokens.insert(pair<string,string>(key, value));
}

void skindesignerapi::cOsdElement::AddIntToken(string key, int value) {
    intTokens.insert(pair<string,int>(key, value));
}

void skindesignerapi::cOsdElement::AddLoopToken(string loopName, map<string, string> &tokens) {
    map<string, vector<map<string, string> > >::iterator hitLoop = loopTokens.find(loopName);
    if (hitLoop == loopTokens.end()) {
        vector<map<string, string> > tokenVector;
        tokenVector.push_back(tokens);
        loopTokens.insert(pair<string, vector<map<string, string> > >(loopName, tokenVector));
    } else {
        vector<map<string, string> > *tokenVector = &hitLoop->second;
        tokenVector->push_back(tokens);
    }
}

bool skindesignerapi::cOsdElement::ChannelLogoExists(string channelId) {
    return view->ChannelLogoExists(channelId);
}

string skindesignerapi::cOsdElement::GetEpgImagePath(void) {
    return view->GetEpgImagePath();    
}


/**********************************************************************
* cViewElement
**********************************************************************/
skindesignerapi::cViewElement::cViewElement(skindesignerapi::ISkinDisplayPlugin *view, int viewElementID) : cOsdElement(view) {
    this->viewElementID = viewElementID;
}

skindesignerapi::cViewElement::~cViewElement() {
}

void skindesignerapi::cViewElement::Clear(void) {
    if (!view)
        return;
    view->ClearViewElement(viewElementID);
}

void skindesignerapi::cViewElement::Display(void) {
    if (!view)
        return;
    view->SetViewElementIntTokens(&intTokens);
    view->SetViewElementStringTokens(&stringTokens);
    view->SetViewElementLoopTokens(&loopTokens);
    view->DisplayViewElement(viewElementID);
}

/**********************************************************************
* cViewGrid
**********************************************************************/
skindesignerapi::cViewGrid::cViewGrid(skindesignerapi::ISkinDisplayPlugin *view, int viewGridID) : cOsdElement(view) {
    this->viewGridID = viewGridID;
}

skindesignerapi::cViewGrid::~cViewGrid() {
}

void skindesignerapi::cViewGrid::SetGrid(long gridID, double x, double y, double width, double height) {
    if (!view)
        return;
    view->SetGrid(viewGridID, gridID, x, y, width, height, &intTokens, &stringTokens);
}

void skindesignerapi::cViewGrid::SetCurrent(long gridID, bool current) {
    if (!view)
        return;
    view->SetGridCurrent(viewGridID, gridID, current);
}

void skindesignerapi::cViewGrid::MoveGrid(long gridID, double x, double y, double width, double height) {
    if (!view)
        return;
    view->SetGrid(viewGridID, gridID, x, y, width, height, NULL, NULL);
}

void skindesignerapi::cViewGrid::Delete(long gridID) {
    if (!view)
        return;
    view->DeleteGrid(viewGridID, gridID);
}

void skindesignerapi::cViewGrid::Clear(void) {
    if (!view)
        return;
    view->ClearGrids(viewGridID);    
}

void skindesignerapi::cViewGrid::Display(void) {
    if (!view)
        return;
    view->DisplayGrids(viewGridID);
}

/**********************************************************************
* cViewTab
**********************************************************************/
skindesignerapi::cViewTab::cViewTab(skindesignerapi::ISkinDisplayPlugin *view) : cOsdElement(view) {
}

skindesignerapi::cViewTab::~cViewTab() {
}

void skindesignerapi::cViewTab::Init(void) {
    view->SetTabIntTokens(&intTokens);
    view->SetTabStringTokens(&stringTokens);
    view->SetTabLoopTokens(&loopTokens);
    view->SetTabs();    
}

void skindesignerapi::cViewTab::Left(void) {
    view->TabLeft();
}

void skindesignerapi::cViewTab::Right(void) {
    view->TabRight();
}

void skindesignerapi::cViewTab::Up(void) {
    view->TabUp();
}

void skindesignerapi::cViewTab::Down(void) {
    view->TabDown();
}

void skindesignerapi::cViewTab::Display(void) {
    if (!view)
        return;
    view->DisplayTabs();
}

/**********************************************************************
* cOsdView
**********************************************************************/
skindesignerapi::cOsdView::cOsdView(skindesignerapi::ISkinDisplayPlugin *displayPlugin) {
    this->displayPlugin = displayPlugin;
}

skindesignerapi::cOsdView::~cOsdView() {
    delete displayPlugin;
}

void skindesignerapi::cOsdView::Deactivate(bool hide) {
    if (!displayPlugin)
        return;
    displayPlugin->Deactivate(hide);
}

void skindesignerapi::cOsdView::Activate(void) {
    if (!displayPlugin)
        return;
    displayPlugin->Activate();
}

skindesignerapi::cViewElement *skindesignerapi::cOsdView::GetViewElement(int viewElementID) {
    if (!displayPlugin)
        return NULL;
    return new cViewElement(displayPlugin, viewElementID);
}

skindesignerapi::cViewGrid *skindesignerapi::cOsdView::GetViewGrid(int viewGridID) {
    if (!displayPlugin)
        return NULL;
    displayPlugin->InitGrids(viewGridID);
    return new cViewGrid(displayPlugin, viewGridID);
}

skindesignerapi::cViewTab *skindesignerapi::cOsdView::GetViewTabs(void) {
    if (!displayPlugin)
        return NULL;
    return new cViewTab(displayPlugin);
}

void skindesignerapi::cOsdView::Display(void) {
    if (!displayPlugin)
        return;
    displayPlugin->Flush();   
}