openMSX
Main Page
Namespaces
Classes
Files
File List
File Members
console
OSDWidget.hh
Go to the documentation of this file.
1
#ifndef OSDWIDGET_HH
2
#define OSDWIDGET_HH
3
4
#include "
StringMap.hh
"
5
#include "
string_ref.hh
"
6
#include <vector>
7
#include <memory>
8
9
namespace
openmsx {
10
11
class
OutputRectangle;
12
class
OutputSurface;
13
class
TclObject;
14
15
class
OSDWidget
16
{
17
public
:
18
virtual
~OSDWidget
();
19
20
const
std::string&
getName
()
const
;
21
double
getX
()
const
{
return
x; }
22
double
getY
()
const
{
return
y; }
23
double
getZ
()
const
{
return
z; }
24
double
getRelX
()
const
{
return
relx; }
25
double
getRelY
()
const
{
return
rely; }
26
27
OSDWidget
*
getParent
();
28
const
OSDWidget
*
getParent
()
const
;
29
OSDWidget
*
findSubWidget
(
string_ref
name);
30
const
OSDWidget
*
findSubWidget
(
string_ref
name)
const
;
31
void
addWidget
(
const
std::shared_ptr<OSDWidget>& widget);
32
void
deleteWidget
(
OSDWidget
& widget);
33
34
virtual
std::vector<string_ref>
getProperties
()
const
;
35
virtual
void
setProperty
(
string_ref
name,
const
TclObject
& value);
36
virtual
void
getProperty
(
string_ref
name,
TclObject
& result)
const
;
37
virtual
double
getRecursiveFadeValue
()
const
;
38
virtual
string_ref
getType
()
const
= 0;
39
40
void
invalidateRecursive
();
41
void
paintSDLRecursive
(
OutputSurface
& output);
42
void
paintGLRecursive
(
OutputSurface
& output);
43
44
int
getScaleFactor
(
const
OutputRectangle
& surface)
const
;
45
void
transformXY
(
const
OutputRectangle
& output,
46
double
x,
double
y,
double
relx,
double
rely,
47
double
& outx,
double
& outy)
const
;
48
void
getBoundingBox
(
const
OutputRectangle
& output,
49
int
& x,
int
& y,
int
& w,
int
& h);
50
virtual
void
getWidthHeight
(
const
OutputRectangle
& output,
51
double
& width,
double
& height)
const
= 0;
52
53
protected
:
54
explicit
OSDWidget
(
const
std::string& name);
55
void
invalidateChildren
();
56
bool
needSuppressErrors
()
const
;
57
58
virtual
void
invalidateLocal
() = 0;
59
virtual
void
paintSDL
(
OutputSurface
& output) = 0;
60
virtual
void
paintGL
(
OutputSurface
& output) = 0;
61
62
private
:
63
void
getMouseCoord(
double
& outx,
double
& outy)
const
;
64
void
transformReverse(
const
OutputRectangle
& output,
65
double
x,
double
y,
66
double
& outx,
double
& outy)
const
;
67
void
setParent(
OSDWidget
* parent);
68
void
resortUp (
OSDWidget
* elem);
69
void
resortDown(
OSDWidget
* elem);
70
71
void
listWidgetNames(
const
std::string& parentName,
72
std::vector<std::string>& result)
const
;
73
friend
class
OSDCommand
;
74
77
// note: must be shared_ptr (not unique_ptr), see OSDWidget::paintSDLRecursive()
78
std::vector<std::shared_ptr<OSDWidget>> subWidgets;
79
83
StringMap<OSDWidget*>
subWidgetsMap;
84
85
OSDWidget
* parent;
86
87
const
std::string name;
88
double
x, y, z;
89
double
relx, rely;
90
bool
scaled;
91
bool
clip
;
92
bool
suppressErrors;
93
};
94
95
}
// namespace openmsx
96
97
#endif
Generated on Mon May 20 2013 12:16:59 for openMSX by
1.8.1.2