MythTV
0.27pre
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Groups
Pages
libs
libmythfreemheg
Root.h
Go to the documentation of this file.
1
/* Root.h
2
3
Copyright (C) David C. J. Matthews 2004 dm at prolingua.co.uk
4
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 2
8
of the License, or (at your option) any later version.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
Or, point your browser to http://www.gnu.org/copyleft/gpl.html
19
20
*/
21
22
23
#if !defined(ROOTCLASS_H)
24
#define ROOTCLASS_H
25
26
#include "
BaseClasses.h
"
27
#include "
BaseActions.h
"
28
class
MHParseNode
;
29
class
MHLink
;
30
class
MHIngredient
;
31
class
MHEngine
;
32
33
enum
EventType
{
EventIsAvailable
= 1,
EventContentAvailable
,
EventIsDeleted
,
EventIsRunning
,
EventIsStopped
,
34
EventUserInput
,
EventAnchorFired
,
EventTimerFired
,
EventAsyncStopped
,
EventInteractionCompleted
,
35
EventTokenMovedFrom
,
EventTokenMovedTo
,
EventStreamEvent
,
EventStreamPlaying
,
EventStreamStopped
,
36
EventCounterTrigger
,
EventHighlightOn
,
EventHighlightOff
,
EventCursorEnter
,
EventCursorLeave
,
37
EventIsSelected
,
EventIsDeselected
,
EventTestEvent
,
EventFirstItemPresented
,
EventLastItemPresented
,
38
EventHeadItems
,
EventTailItems
,
EventItemSelected
,
EventItemDeselected
,
EventEntryFieldFull
,
39
EventEngineEvent
,
40
// The next two events are added in UK MHEG.
41
EventFocusMoved
,
EventSliderValueChanged
};
42
43
class
MHRoot
44
{
45
public
:
46
MHRoot
():
m_fAvailable
(
false
),
m_fRunning
(
false
) {}
47
MHRoot
(
const
MHRoot
&
/*ref*/
):
m_fAvailable
(
false
),
m_fRunning
(
false
) {}
48
virtual
~MHRoot
() {}
49
// Initialise - set up the item from the parse tree.
50
virtual
void
Initialise
(
MHParseNode
*
p
,
MHEngine
*engine);
// Set this up from the parse tree.
51
// Print this item.
52
virtual
void
PrintMe
(
FILE
*fd,
int
nTabs)
const
;
53
// Test for shared status.
54
virtual
bool
IsShared
() {
return
false
; }
55
56
// MHEG Actions.
57
// Preparation - sets up the run-time representation. Sets m_fAvailable and generates IsAvailable event.
58
virtual
void
Preparation
(
MHEngine
*engine);
59
// Activation - starts running the object. Sets m_fRunning and generates IsRunning event.
60
virtual
void
Activation
(
MHEngine
*engine);
61
// Deactivation - stops running the object. Clears m_fRunning
62
virtual
void
Deactivation
(
MHEngine
*engine);
63
// Destruction - deletes the run-time representation. Clears m_fAvailable.
64
virtual
void
Destruction
(
MHEngine
*engine);
65
// Prepare the content - This action is added in the corrigendum to the standard.
66
virtual
void
ContentPreparation
(
MHEngine
*) {}
67
68
// Return an object with a given object number. In the root class this returns this object
69
// if it matches. Group and Stream classes also search their components.
70
virtual
MHRoot
*
FindByObjectNo
(
int
n
);
71
72
// Actions. The default behaviour if a sub-class doesn't override them is to fail.
73
74
// Actions on Root class
75
virtual
bool
GetAvailabilityStatus
() {
return
m_fAvailable
; }
76
virtual
bool
GetRunningStatus
() {
return
m_fRunning
; }
77
78
// Actions on Groups
79
virtual
void
SetTimer
(
int
/*nTimerId*/
,
bool
/*fAbsolute*/
,
int
/*nMilliSecs*/
,
MHEngine
*) {
InvalidAction
(
"SetTimer"
); }
80
// This isn't an MHEG action as such but is used as part of the implementation of "Clone"
81
virtual
void
MakeClone
(
MHRoot
*
/*pTarget*/
,
MHRoot
*
/*pRef*/
,
MHEngine
*) {
InvalidAction
(
"MakeClone"
); }
82
virtual
void
SetInputRegister
(
int
/*nReg*/
,
MHEngine
*) {
InvalidAction
(
"SetInputRegister"
); }
83
84
// Actions on Ingredients.
85
virtual
void
SetData
(
const
MHOctetString
&
/*included*/
,
MHEngine
*) {
InvalidAction
(
"SetData"
); }
86
virtual
void
SetData
(
const
MHContentRef
&
/*referenced*/
,
bool
/*fSizeGiven*/
,
int
/*size*/
,
bool
/*fCCGiven*/
,
int
/*cc*/
,
MHEngine
*)
87
{
InvalidAction
(
"SetData"
); }
88
virtual
void
Preload
(
MHEngine
*) {
InvalidAction
(
"Preload"
); }
89
virtual
void
Unload
(
MHEngine
*) {
InvalidAction
(
"Unload"
); }
90
// The UK MHEG profile only requires cloning for Text, Bitmap and Rectangle.
91
virtual
MHIngredient
*
Clone
(
MHEngine
*) {
InvalidAction
(
"Clone"
);
return
NULL; }
92
93
// Actions on Presentables. The Run/Stop actions on presentables and the Activate/Deactivate actions
94
// on Links have identical effects. They could be merged.
95
virtual
void
Run
(
MHEngine
*) {
InvalidAction
(
"Run"
); }
96
virtual
void
Stop
(
MHEngine
*) {
InvalidAction
(
"Stop"
); }
97
98
// Actions on variables.
99
virtual
void
TestVariable
(
int
/*nOp*/
,
const
MHUnion
&
/*parm*/
,
MHEngine
*) {
InvalidAction
(
"TestVariable"
); }
100
virtual
void
GetVariableValue
(
MHUnion
&,
MHEngine
*) {
InvalidAction
(
"GetVariableValue"
); }
101
virtual
void
SetVariableValue
(
const
MHUnion
&) {
InvalidAction
(
"SetVariableValue"
); }
102
103
// Actions on Text objects
104
virtual
void
GetTextData
(
MHRoot
*
/*pDestination*/
,
MHEngine
*) {
InvalidAction
(
"GetTextData"
); }
105
virtual
void
SetBackgroundColour
(
const
MHColour
&
/*colour*/
,
MHEngine
*) {
InvalidAction
(
"SetBackgroundColour"
); }
106
virtual
void
SetTextColour
(
const
MHColour
&
/*colour*/
,
MHEngine
*) {
InvalidAction
(
"SetTextColour"
); }
107
virtual
void
SetFontAttributes
(
const
MHOctetString
&
/*fontAttrs*/
,
MHEngine
*) {
InvalidAction
(
"SetFontAttributes"
); }
108
109
// Actions on Links
110
virtual
void
Activate
(
bool
/*f*/
,
MHEngine
*) {
InvalidAction
(
"Activate/Deactivate"
); }
// Activate/Deactivate
111
112
// Actions on Programs.
113
virtual
void
CallProgram
(
bool
/*fIsFork*/
,
const
MHObjectRef
&
/*success*/
,
114
const
MHSequence<MHParameter *>
&
/*args*/
,
MHEngine
*) {
InvalidAction
(
"CallProgram"
); }
115
116
// Actions on TokenGroups
117
virtual
void
CallActionSlot
(
int
,
MHEngine
*) {
InvalidAction
(
"CallActionSlot"
); }
118
virtual
void
Move
(
int
,
MHEngine
*) {
InvalidAction
(
"Move"
); }
119
virtual
void
MoveTo
(
int
,
MHEngine
*) {
InvalidAction
(
"MoveTo"
); }
120
virtual
void
GetTokenPosition
(
MHRoot
*
/*pResult*/
,
MHEngine
*) {
InvalidAction
(
"GetTokenPosition"
); }
121
122
// Actions on ListGroups
123
virtual
void
AddItem
(
int
/*nIndex*/
,
MHRoot
*
/*pItem*/
,
MHEngine
*) {
InvalidAction
(
"GetCellItem"
); }
124
virtual
void
DelItem
(
MHRoot
*
/*pItem*/
,
MHEngine
*) {
InvalidAction
(
"GetCellItem"
); }
125
virtual
void
GetCellItem
(
int
/*nCell*/
,
const
MHObjectRef
&
/*itemDest*/
,
MHEngine
*) {
InvalidAction
(
"GetCellItem"
); }
126
virtual
void
GetListItem
(
int
/*nCell*/
,
const
MHObjectRef
&
/*itemDest*/
,
MHEngine
*) {
InvalidAction
(
"GetCellItem"
); }
127
virtual
void
GetItemStatus
(
int
/*nCell*/
,
const
MHObjectRef
&
/*itemDest*/
,
MHEngine
*) {
InvalidAction
(
"GetItemStatus"
); }
128
virtual
void
SelectItem
(
int
/*nCell*/
,
MHEngine
*) {
InvalidAction
(
"SelectItem"
); }
129
virtual
void
DeselectItem
(
int
/*nCell*/
,
MHEngine
*) {
InvalidAction
(
"DeselectItem"
); }
130
virtual
void
ToggleItem
(
int
/*nCell*/
,
MHEngine
*) {
InvalidAction
(
"ToggleItem"
); }
131
virtual
void
ScrollItems
(
int
/*nCell*/
,
MHEngine
*) {
InvalidAction
(
"ScrollItems"
); }
132
virtual
void
SetFirstItem
(
int
/*nCell*/
,
MHEngine
*) {
InvalidAction
(
"SetFirstItem"
); }
133
virtual
void
GetFirstItem
(
MHRoot
*
/*pResult*/
,
MHEngine
*) {
InvalidAction
(
"GetFirstItem"
); }
134
virtual
void
GetListSize
(
MHRoot
*
/*pResult*/
,
MHEngine
*) {
InvalidAction
(
"GetListSize"
); }
135
136
// Actions on Visibles.
137
virtual
void
SetPosition
(
int
/*nXPosition*/
,
int
/*nYPosition*/
,
MHEngine
*) {
InvalidAction
(
"SetPosition"
); }
138
virtual
void
GetPosition
(
MHRoot
*
/*pXPosN*/
,
MHRoot
*
/*pYPosN*/
) {
InvalidAction
(
"GetPosition"
); }
139
virtual
void
SetBoxSize
(
int
/*nWidth*/
,
int
/*nHeight*/
,
MHEngine
*) {
InvalidAction
(
"SetBoxSize"
); }
140
virtual
void
GetBoxSize
(
MHRoot
*
/*pWidthDest*/
,
MHRoot
*
/*HeightDest*/
) {
InvalidAction
(
"GetBoxSize"
); }
141
virtual
void
SetPaletteRef
(
const
MHObjectRef
/*newPalette*/
,
MHEngine
*) {
InvalidAction
(
"SetPaletteRef"
); }
142
virtual
void
BringToFront
(
MHEngine
*) {
InvalidAction
(
"BringToFront"
); }
143
virtual
void
SendToBack
(
MHEngine
*) {
InvalidAction
(
"SendToBack"
); }
144
virtual
void
PutBefore
(
const
MHRoot
*
/*pRef*/
,
MHEngine
*) {
InvalidAction
(
"PutBefore"
); }
145
virtual
void
PutBehind
(
const
MHRoot
*
/*pRef*/
,
MHEngine
*) {
InvalidAction
(
"PutBehind"
); }
146
virtual
void
ResetPosition
() {
InvalidAction
(
"ResetPosition"
); }
// Used internally by ListGroup
147
148
// Actions on LineArt
149
virtual
void
SetFillColour
(
const
MHColour
&
/*colour*/
,
MHEngine
*) {
InvalidAction
(
"SetFillColour"
); }
150
virtual
void
SetLineColour
(
const
MHColour
&
/*colour*/
,
MHEngine
*) {
InvalidAction
(
"SetLineColour"
); }
151
virtual
void
SetLineWidth
(
int
/*nWidth*/
,
MHEngine
*) {
InvalidAction
(
"SetLineWidth"
); }
152
virtual
void
SetLineStyle
(
int
/*nStyle*/
,
MHEngine
*) {
InvalidAction
(
"SetLineStyle"
); }
153
154
// Actions on Bitmaps
155
virtual
void
SetTransparency
(
int
/*nTransPerCent*/
,
MHEngine
*) {
InvalidAction
(
"SetTransparency"
); }
156
virtual
void
ScaleBitmap
(
int
/*xScale*/
,
int
/*yScale*/
,
MHEngine
*) {
InvalidAction
(
"ScaleBitmap"
); }
157
virtual
void
SetBitmapDecodeOffset
(
int
/*newXOffset*/
,
int
/*newYOffset*/
,
MHEngine
*) {
InvalidAction
(
"SetBitmapDecodeOffset"
); }
158
virtual
void
GetBitmapDecodeOffset
(
MHRoot
*
/*pXOffset*/
,
MHRoot
*
/*pYOffset*/
) {
InvalidAction
(
"GetBitmapDecodeOffset"
); }
159
160
// Actions on Dynamic Line Art
161
virtual
void
Clear
() {
InvalidAction
(
""
); }
162
virtual
void
GetLineWidth
(
MHRoot
*
/*pResult*/
) {
InvalidAction
(
"GetLineWidth"
); }
163
virtual
void
GetLineStyle
(
MHRoot
*
/*pResult*/
) {
InvalidAction
(
"GetLineStyle"
); }
164
virtual
void
GetLineColour
(
MHRoot
*
/*pResult*/
) {
InvalidAction
(
"GetLineColour"
); }
165
virtual
void
GetFillColour
(
MHRoot
*
/*pResult*/
) {
InvalidAction
(
"GetFillColour"
); }
166
virtual
void
DrawArcSector
(
bool
/*fIsSector*/
,
int
/*x*/
,
int
/*y*/
,
int
/*width*/
,
int
/*height*/
,
int
/*start*/
,
167
int
/*arc*/
,
MHEngine
*) {
InvalidAction
(
"DrawArc/Sector"
); }
168
virtual
void
DrawLine
(
int
/*x1*/
,
int
/*y1*/
,
int
/*x2*/
,
int
/*y2*/
,
MHEngine
*) {
InvalidAction
(
"DrawLine"
); }
169
virtual
void
DrawOval
(
int
/*x1*/
,
int
/*y1*/
,
int
/*width*/
,
int
/*height*/
,
MHEngine
*) {
InvalidAction
(
"DrawOval"
); }
170
virtual
void
DrawRectangle
(
int
/*x1*/
,
int
/*y1*/
,
int
/*x2*/
,
int
/*y2*/
,
MHEngine
*) {
InvalidAction
(
"DrawRectangle"
); }
171
virtual
void
DrawPoly
(
bool
/*fIsPolygon*/
,
int
/*nPoints*/
,
const
int
*
/*xArray*/
,
const
int
*
/*yArray*/
,
MHEngine
*)
172
{
InvalidAction
(
"DrawPoly(gon/line)"
); }
173
174
// Actions on Video streams.
175
virtual
void
ScaleVideo
(
int
/*xScale*/
,
int
/*yScale*/
,
MHEngine
*) {
InvalidAction
(
"ScaleVideo"
); }
176
virtual
void
SetVideoDecodeOffset
(
int
/*newXOffset*/
,
int
/*newYOffset*/
,
MHEngine
*) {
InvalidAction
(
"SetVideoDecodeOffset"
); }
177
virtual
void
GetVideoDecodeOffset
(
MHRoot
*
/*pXOffset*/
,
MHRoot
*
/*pYOffset*/
,
MHEngine
*) {
InvalidAction
(
"GetVideoDecodeOffset"
); }
178
virtual
void
GetCounterPosition
(
MHRoot
*
/*pPos*/
,
MHEngine
*) {
InvalidAction
(
"GetCounterPosition"
); }
179
virtual
void
GetCounterMaxPosition
(
MHRoot
*
/*pPos*/
,
MHEngine
*) {
InvalidAction
(
"GetCounterMaxPosition"
); }
180
virtual
void
SetCounterPosition
(
int
/*pos*/
,
MHEngine
*) {
InvalidAction
(
"SetCounterPosition"
); }
181
virtual
void
SetSpeed
(
int
/*speed 0=stop*/
,
MHEngine
*) {
InvalidAction
(
"SetSpeed"
); }
182
183
// Actions on Interactibles.
184
virtual
void
SetInteractionStatus
(
bool
/*newStatus*/
,
MHEngine
*) {
InvalidAction
(
"SetInteractionStatus"
); }
185
virtual
bool
GetInteractionStatus
(
void
) {
InvalidAction
(
"GetInteractionStatus"
);
return
false
; }
186
virtual
void
SetHighlightStatus
(
bool
/*newStatus*/
,
MHEngine
*engine) {
InvalidAction
(
"SetHighlightStatus"
); }
187
virtual
bool
GetHighlightStatus
(
void
) {
InvalidAction
(
"GetHighlightStatus"
);
return
false
; }
188
189
// Actions on Sliders.
190
virtual
void
Step
(
int
/*nbSteps*/
,
MHEngine
*
/*engine*/
) {
InvalidAction
(
"Step"
); }
191
virtual
void
SetSliderValue
(
int
/*nbSteps*/
,
MHEngine
*
/*engine*/
) {
InvalidAction
(
"SetSliderValue"
); }
192
virtual
int
GetSliderValue
(
void
) {
InvalidAction
(
"GetSliderValue"
);
return
0; }
193
virtual
void
SetPortion
(
int
/*newPortion*/
,
MHEngine
*
/*engine*/
) {
InvalidAction
(
"SetPortion"
); }
194
virtual
int
GetPortion
(
void
) {
InvalidAction
(
"GetPortion"
);
return
0; }
195
// Additional action defined in UK MHEG.
196
virtual
void
SetSliderParameters
(
int
/*newMin*/
,
int
/*newMax*/
,
int
/*newStep*/
,
MHEngine
*
/*engine*/
)
197
{
InvalidAction
(
"SetSliderParameters"
); }
198
199
protected
:
200
201
void
InvalidAction
(
const
char
*actionName);
202
public
:
203
MHObjectRef
m_ObjectReference
;
// Identifier of this object.
204
205
virtual
const
char
*
ClassName
() = 0;
// For debugging messages.
206
protected
:
207
bool
m_fAvailable
;
// Set once Preparation has completed.
208
bool
m_fRunning
;
// Set once Activation has completed.
209
210
friend
class
MHEngine
;
211
};
212
213
// Get Availability Status - Does the object exist and is it available?.
214
class
MHGetAvailabilityStatus
:
public
MHElemAction
215
{
216
public
:
217
MHGetAvailabilityStatus
():
MHElemAction
(
":GetAvailabilityStatus"
) {}
218
virtual
void
Initialise
(
MHParseNode
*
p
,
MHEngine
*engine);
219
virtual
void
Perform
(
MHEngine
*engine);
220
protected
:
221
virtual
void
PrintArgs
(
FILE
*fd,
int
/*nTabs*/
)
const
{
m_ResultVar
.
PrintMe
(fd, 0); }
222
MHObjectRef
m_ResultVar
;
223
};
224
225
// Get Running Status - Is the object running?.
226
class
MHGetRunningStatus
:
public
MHActionObjectRef
227
{
228
public
:
229
MHGetRunningStatus
():
MHActionObjectRef
(
":GetRunningStatus"
) {}
230
virtual
void
CallAction
(
MHEngine
*,
MHRoot
*pTarget,
MHRoot
*pResult) { pResult->
SetVariableValue
(pTarget->
GetRunningStatus
());}
231
};
232
233
#endif
Generated on Wed May 22 2013 06:59:48 for MythTV by
1.8.1.2