• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

drag_state.h

Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
00003 //   Foundation, Inc
00004 // 
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 
00020 
00021 #ifndef GNASH_DRAG_STATE_H
00022 #define GNASH_DRAG_STATE_H
00023 
00024 #include "SWFRect.h" // for composition
00025 
00026 namespace gnash
00027 {
00028 
00029 // Forward declarations
00030 class DisplayObject;
00031 
00032 
00034 class drag_state
00035 {
00036 
00037         bool _hasbounds;
00038 
00041         SWFRect _bounds;
00042 
00043         DisplayObject* _displayObject;
00044 
00045         bool    _lock_centered;
00046 
00051         boost::int32_t  _xoffset;
00052         boost::int32_t  _yoffset;
00053 
00054 public:
00055 
00056         bool isLockCentered() const {
00057                 return _lock_centered;
00058         }
00059 
00060         void setLockCentered(bool lock) {
00061                 _lock_centered = lock;
00062         }
00063 
00068         void setOffset(boost::int32_t x, boost::int32_t y)
00069         {
00070                 _xoffset = x;
00071                 _yoffset = y;
00072         }
00073 
00074         boost::int32_t xOffset() const { return _xoffset; }
00075         boost::int32_t yOffset() const { return _yoffset; }
00076 
00077         bool hasBounds() const {return _hasbounds; }
00078 
00082         //
00090         const SWFRect& getBounds() const { return _bounds; }
00091 
00095         //
00099         void setBounds(const SWFRect& bounds) {
00100                 _bounds = bounds;
00101                 _hasbounds = true;
00102         }
00103 
00105         DisplayObject* getCharacter() const {
00106                 return _displayObject;
00107         }
00108 
00110         void setCharacter(DisplayObject* ch) {
00111                 _displayObject = ch;
00112         }
00113 
00115         void reset()
00116         {
00117                 _displayObject = NULL;
00118                 _hasbounds = false;
00119                 _bounds.set_null();
00120                 _lock_centered = false;
00121         }
00122 
00123         drag_state()
00124                 :
00125                 _hasbounds(false),
00126                 _bounds(),
00127                 _displayObject(0),
00128                 _lock_centered(false)
00129         {
00130         }
00131 
00133         void markReachableResources() const
00134         {
00135                 if (_displayObject) _displayObject->setReachable();
00136         }
00137 };
00138 
00139 
00140 } // namespace gnash
00141 
00142 #endif // GNASH_DRAG_STATE_H

Generated on Fri Mar 16 2012 15:46:09 for Gnash by  doxygen 1.7.1