Gnash 0.8.9
|
00001 // StaticText.h: StaticText DisplayObject implementation for Gnash. 00002 // 00003 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 00004 // 2011 Free Software Foundation, Inc 00005 // 00006 // This program is free software; you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 3 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // This program is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with this program; if not, write to the Free Software 00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 00020 #ifndef GNASH_STATIC_TEXT_H 00021 #define GNASH_STATIC_TEXT_H 00022 00023 #include "smart_ptr.h" 00024 #include "DisplayObject.h" // for inheritance 00025 #include "swf/DefineTextTag.h" 00026 00027 #include <vector> 00028 #include <boost/dynamic_bitset.hpp> 00029 #include <boost/intrusive_ptr.hpp> 00030 #include <cassert> 00031 00032 // Forward declarations 00033 namespace gnash { 00034 namespace SWF { 00035 class TextRecord; 00036 } 00037 } 00038 00039 namespace gnash { 00040 00042 // 00044 class StaticText : public DisplayObject 00045 { 00046 public: 00047 00048 StaticText(movie_root& mr, as_object* object, const SWF::DefineTextTag* def, 00049 DisplayObject* parent) 00050 : 00051 DisplayObject(mr, object, parent), 00052 _def(def), 00053 _selectionColor(0, 255, 255, 255) 00054 { 00055 assert(_def); 00056 } 00057 00059 // 00062 // 00068 virtual StaticText* getStaticText(std::vector<const SWF::TextRecord*>& to, 00069 size_t& numChars); 00070 00071 virtual void display(Renderer& renderer, const Transform& xform); 00072 00073 void setSelected(size_t pos, bool selected) { 00074 _selectedText.set(pos, selected); 00075 } 00076 00078 // 00085 const boost::dynamic_bitset<>& getSelected() const { 00086 return _selectedText; 00087 } 00088 00089 void setSelectionColor(boost::uint32_t color); 00090 00091 virtual SWFRect getBounds() const { 00092 return _def->bounds(); 00093 } 00094 00095 virtual bool pointInShape(boost::int32_t x, boost::int32_t y) const; 00096 00097 const rgba& selectionColor() const { 00098 return _selectionColor; 00099 } 00100 00101 private: 00102 00103 const boost::intrusive_ptr<const SWF::DefineTextTag> _def; 00104 00106 // 00109 boost::dynamic_bitset<> _selectedText; 00110 00112 // 00114 rgba _selectionColor; 00115 00116 }; 00117 00118 00119 } // end namespace gnash 00120 00121 00122 #endif 00123 00124 00125 // Local Variables: 00126 // mode: C++ 00127 // indent-tabs-mode: t 00128 // End: