594
by Alessandro
Reworked construction of tags |
1 |
/**************************************************************************
|
2 |
Lightspark, a free flash player implementation
|
|
3 |
||
4 |
Copyright (C) 2009,2010 Alessandro Pignotti (a.pignotti@sssup.it)
|
|
5 |
||
6 |
This program is free software: you can redistribute it and/or modify
|
|
7 |
it under the terms of the GNU General Public License as published by
|
|
8 |
the Free Software Foundation, either version 3 of the License, or
|
|
9 |
(at your option) any later version.
|
|
10 |
||
11 |
This program is distributed in the hope that it will be useful,
|
|
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
GNU General Public License for more details.
|
|
15 |
||
16 |
You should have received a copy of the GNU General Public License
|
|
17 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18 |
**************************************************************************/
|
|
19 |
||
20 |
#include "flashtext.h" |
|
21 |
#include "class.h" |
|
22 |
||
23 |
using namespace std; |
|
24 |
using namespace lightspark; |
|
25 |
||
26 |
REGISTER_CLASS_NAME2(lightspark::Font,"Font"); |
|
27 |
REGISTER_CLASS_NAME(TextField); |
|
28 |
||
29 |
void lightspark::Font::sinit(Class_base* c) |
|
30 |
{
|
|
31 |
// c->constructor=new Function(_constructor);
|
|
32 |
c->setConstructor(NULL); |
|
33 |
c->setVariableByQName("enumerateFonts","",new Function(enumerateFonts)); |
|
34 |
}
|
|
35 |
||
36 |
ASFUNCTIONBODY(lightspark::Font,enumerateFonts) |
|
37 |
{
|
|
38 |
return Class<Array>::getInstanceS(true)->obj; |
|
39 |
}
|
|
40 |
||
41 |
void TextField::sinit(Class_base* c) |
|
42 |
{
|
|
43 |
c->setConstructor(NULL); |
|
44 |
c->super=Class<DisplayObject>::getClass(); |
|
45 |
c->max_level=c->super->max_level+1; |
|
46 |
}
|
|
47 |
||
48 |
void TextField::buildTraits(ASObject* o) |
|
49 |
{
|
|
50 |
o->setGetterByQName("width","",new Function(TextField::_getWidth)); |
|
51 |
o->setSetterByQName("width","",new Function(TextField::_setWidth)); |
|
52 |
o->setGetterByQName("height","",new Function(TextField::_getHeight)); |
|
53 |
o->setSetterByQName("height","",new Function(TextField::_setHeight)); |
|
54 |
}
|
|
55 |
||
56 |
bool TextField::getBounds(number_t& xmin, number_t& xmax, number_t& ymin, number_t& ymax) const |
|
57 |
{
|
|
58 |
xmin=0; |
|
59 |
xmax=width; |
|
60 |
ymin=0; |
|
61 |
ymax=height; |
|
62 |
return true; |
|
63 |
}
|
|
64 |
||
65 |
ASFUNCTIONBODY(TextField,_getWidth) |
|
66 |
{
|
|
67 |
TextField* th=Class<TextField>::cast(obj->implementation); |
|
68 |
return abstract_i(th->width); |
|
69 |
}
|
|
70 |
||
71 |
ASFUNCTIONBODY(TextField,_setWidth) |
|
72 |
{
|
|
73 |
TextField* th=Class<TextField>::cast(obj->implementation); |
|
74 |
assert(argslen==1); |
|
75 |
th->width=args[0]->toInt(); |
|
76 |
return NULL; |
|
77 |
}
|
|
78 |
||
79 |
ASFUNCTIONBODY(TextField,_getHeight) |
|
80 |
{
|
|
81 |
TextField* th=Class<TextField>::cast(obj->implementation); |
|
82 |
return abstract_i(th->height); |
|
83 |
}
|
|
84 |
||
85 |
ASFUNCTIONBODY(TextField,_setHeight) |
|
86 |
{
|
|
87 |
TextField* th=Class<TextField>::cast(obj->implementation); |
|
88 |
assert(argslen==1); |
|
89 |
th->height=args[0]->toInt(); |
|
90 |
return NULL; |
|
91 |
}
|
|
92 |
||
93 |
void TextField::Render() |
|
94 |
{
|
|
95 |
//TODO: implement
|
|
96 |
LOG(LOG_NOT_IMPLEMENTED,"TextField::Render"); |
|
97 |
}
|