Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GNASH_DRAG_STATE_H
00020 #define GNASH_DRAG_STATE_H
00021
00022 #include <boost/optional.hpp>
00023
00024 #include "SWFRect.h"
00025 #include "DisplayObject.h"
00026
00027
00028 namespace gnash {
00029 class DisplayObject;
00030 }
00031
00032 namespace gnash {
00033
00035 class DragState
00036 {
00037 public:
00038
00039 DragState(DisplayObject* d, bool lock)
00040 :
00041 _displayObject(d),
00042 _lock_centered(lock)
00043 {
00044 }
00045
00046 bool isLockCentered() const {
00047 return _lock_centered;
00048 }
00049
00054 void setOffset(boost::int32_t x, boost::int32_t y) {
00055 _xoffset = x;
00056 _yoffset = y;
00057 }
00058
00059 boost::int32_t xOffset() const { return _xoffset; }
00060 boost::int32_t yOffset() const { return _yoffset; }
00061
00062 bool hasBounds() const {
00063 return (_bounds);
00064 }
00065
00069
00077 const SWFRect& getBounds() const { return *_bounds; }
00078
00082
00086 void setBounds(const SWFRect& bounds) {
00087 _bounds = bounds;
00088 }
00089
00091 DisplayObject* getCharacter() const {
00092 return _displayObject;
00093 }
00094
00096 void reset() {
00097 _displayObject = 0;
00098 _bounds.reset();
00099 _lock_centered = false;
00100 }
00101
00103 void markReachableResources() const {
00104 if (_displayObject) _displayObject->setReachable();
00105 }
00106
00107 private:
00108
00111 boost::optional<SWFRect> _bounds;
00112
00113 DisplayObject* _displayObject;
00114
00115 bool _lock_centered;
00116
00121 boost::int32_t _xoffset;
00122 boost::int32_t _yoffset;
00123
00124 };
00125
00126
00127 }
00128
00129 #endif // GNASH_DRAG_STATE_H