Gnash
0.8.11dev
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
libcore
Button.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3
// Free Software Foundation, Inc
4
//
5
// This program is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation; either version 3 of the License, or
8
// (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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
//
19
20
// SWF buttons. Mouse-sensitive update/display, actions, etc.
21
22
23
#ifndef GNASH_BUTTON_H
24
#define GNASH_BUTTON_H
25
26
#include <boost/intrusive_ptr.hpp>
27
#include <vector>
28
#include <set>
29
30
#include "
InteractiveObject.h
"
31
#include "
GnashKey.h
"
32
33
// Forward declarations.
34
namespace
gnash {
35
namespace
SWF
{
36
class
DefineButtonTag
;
37
}
38
}
39
40
namespace
gnash {
41
43
class
Button
:
public
InteractiveObject
44
{
45
public
:
46
47
typedef
std::vector<DisplayObject*>
DisplayObjects
;
48
typedef
std::vector<const DisplayObject*>
ConstDisplayObjects
;
49
51
typedef
std::set<int>
ActiveRecords
;
52
53
enum
mouse_flags
54
{
55
FLAG_IDLE
= 0,
56
FLAG_OVER
= 1,
57
FLAG_DOWN
= 2,
58
OVER_DOWN
=
FLAG_OVER
|
FLAG_DOWN
,
59
60
// aliases
61
OVER_UP
=
FLAG_OVER
,
62
OUT_DOWN
=
FLAG_DOWN
63
};
64
65
enum
MouseState
66
{
67
MOUSESTATE_UP
= 0,
68
MOUSESTATE_DOWN
,
69
MOUSESTATE_OVER
,
70
MOUSESTATE_HIT
71
};
72
74
//
76
Button
(
as_object
*
object
,
const
SWF::DefineButtonTag
* def,
77
DisplayObject
*
parent
);
78
79
~Button
();
80
81
bool
mouseEnabled
()
const
{
return
true
; }
82
83
virtual
bool
trackAsMenu
();
84
86
void
keyPress
(
key::code
c
);
87
89
virtual
void
display
(
Renderer
& renderer,
const
Transform
& xform);
90
91
void
set_current_state
(
MouseState
new_state);
92
94
//
96
virtual
InteractiveObject
*
topmostMouseEntity
(boost::int32_t
x
,
97
boost::int32_t
y
);
98
100
virtual
void
mouseEvent
(
const
event_id
& event);
101
103
virtual
bool
handleFocus
();
104
105
void
add_invalidated_bounds
(
InvalidatedRanges
& ranges,
bool
force);
106
107
virtual
SWFRect
getBounds
()
const
;
108
109
// See dox in DisplayObject.h
110
bool
pointInShape
(boost::int32_t
x
, boost::int32_t
y
)
const
;
111
112
bool
isEnabled
();
113
115
void
destroy
();
116
118
//
120
//
123
virtual
void
construct
(
as_object
* init = 0);
124
125
#ifdef USE_SWFTREE
126
// Override to append button DisplayObjects info, see dox in DisplayObject.h
127
virtual
InfoTree::iterator getMovieInfo(InfoTree& tr,
128
InfoTree::iterator it);
129
#endif
130
131
protected
:
132
134
virtual
bool
unloadChildren
();
135
137
//
143
void
markOwnResources
()
const
;
144
145
private
:
146
148
//
154
void
getActiveCharacters(
DisplayObjects
& list,
bool
includeUnloaded=
false
);
155
157
//
162
void
getActiveCharacters(
ConstDisplayObjects
& list)
const
;
163
166
//
173
void
get_active_records(
ActiveRecords
& list,
MouseState
state);
174
176
virtual
int
getDefinitionVersion()
const
;
177
178
MouseState
_mouseState;
179
180
const
boost::intrusive_ptr<const SWF::DefineButtonTag> _def;
181
182
DisplayObjects
_stateCharacters;
183
184
DisplayObjects
_hitCharacters;
185
186
};
187
188
std::ostream&
operator<<
(std::ostream&
o
,
const
Button::MouseState
& st);
189
191
void
button_class_init
(as_object& global,
const
ObjectURI& uri);
192
193
void
registerButtonNative
(as_object& global);
194
195
}
// namespace gnash
196
197
198
#endif // GNASH_BUTTON_H
199
200
201
// Local Variables:
202
// mode: C++
203
// c-basic-offset: 8
204
// tab-width: 8
205
// indent-tabs-mode: t
206
// End:
Generated on Wed Oct 23 2013 11:31:08 for Gnash by
1.8.4