2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
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.
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.
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
19 #ifndef GNASH_DRAG_STATE_H
20 #define GNASH_DRAG_STATE_H
23 #include "DisplayObject.h"
25 // Forward declarations
32 /// What is being dragged and how
37 DragState(DisplayObject
* d
)
46 bool isLockCentered() const {
47 return _lock_centered
;
50 void setLockCentered(bool lock
) {
51 _lock_centered
= lock
;
54 /// Set displacement offset from origin
55 /// at time of drag start.
56 /// Coordinates are in stage space (twips)
58 void setOffset(boost::int32_t x
, boost::int32_t y
) {
63 boost::int32_t xOffset() const { return _xoffset
; }
64 boost::int32_t yOffset() const { return _yoffset
; }
66 bool hasBounds() const {
71 /// Get the boundaries to constraint
74 /// Coordinates of the rectangle are
75 /// expected in TWIPS.
77 /// Note that if hasBounds() is false
78 /// the returned rectangle is the NULL
79 /// rectangle - see SWFRect::is_null().
81 const SWFRect
& getBounds() const { return _bounds
; }
84 /// Set the boundaries to constraint
87 /// Coordinates of the rectangle are
88 /// expected in TWIPS.
90 void setBounds(const SWFRect
& bounds
) {
95 /// May return NULL !!
96 DisplayObject
* getCharacter() const {
97 return _displayObject
;
100 /// Reset drag state to its initial condition
105 _lock_centered
= false;
108 /// Mark DisplayObject as reachable (if any)
109 void markReachableResources() const {
110 if (_displayObject
) _displayObject
->setReachable();
117 /// Boundaries to constrain the drag into.
118 /// Coordinates in TWIPS.
121 DisplayObject
* _displayObject
;
125 /// Offsets of displacement from DisplayObject origin
126 /// at time of drag start. These are used for non
127 /// lock-centered dragging.
128 /// Coordinates are in stage space (TWIPS)
129 boost::int32_t _xoffset
;
130 boost::int32_t _yoffset
;
137 #endif // GNASH_DRAG_STATE_H