Gnash  0.8.10
StaticText.h
Go to the documentation of this file.
00001 // StaticText.h:  StaticText DisplayObject implementation for Gnash.
00002 // 
00003 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
00004 //   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 "DisplayObject.h" // for inheritance
00024 #include "swf/DefineTextTag.h"
00025 
00026 #include <vector>
00027 #include <boost/dynamic_bitset.hpp>
00028 #include <boost/intrusive_ptr.hpp>
00029 #include <cassert>
00030 
00031 // Forward declarations
00032 namespace gnash {
00033     namespace SWF {
00034         class TextRecord;
00035     }
00036 }
00037 
00038 namespace gnash {
00039 
00041 //
00043 class StaticText : public DisplayObject
00044 {
00045 public:
00046 
00047         StaticText(movie_root& mr, as_object* object, const SWF::DefineTextTag* def,
00048             DisplayObject* parent)
00049                 :
00050         DisplayObject(mr, object, parent),
00051         _def(def),
00052         _selectionColor(0, 255, 255, 255)
00053         {
00054         assert(_def);
00055         }
00056 
00058     //
00061     //
00067     virtual StaticText* getStaticText(std::vector<const SWF::TextRecord*>& to,
00068             size_t& numChars);
00069 
00070         virtual void display(Renderer& renderer, const Transform& xform);
00071 
00072     void setSelected(size_t pos, bool selected) {
00073         _selectedText.set(pos, selected);
00074     }
00075 
00077     //
00084     const boost::dynamic_bitset<>& getSelected() const {
00085         return _selectedText;
00086     }
00087 
00088     void setSelectionColor(boost::uint32_t color);
00089 
00090     virtual SWFRect getBounds() const {
00091         return _def->bounds();
00092     }
00093 
00094     virtual bool pointInShape(boost::int32_t x, boost::int32_t y) const;
00095 
00096     const rgba& selectionColor() const {
00097         return _selectionColor;
00098     }
00099 
00100 private:
00101 
00102     const boost::intrusive_ptr<const SWF::DefineTextTag> _def;
00103 
00105     //
00108     boost::dynamic_bitset<> _selectedText;
00109 
00111     //
00113     rgba _selectionColor;
00114 
00115 };
00116 
00117 
00118 }       // end namespace gnash
00119 
00120 
00121 #endif 
00122 
00123 
00124 // Local Variables:
00125 // mode: C++
00126 // indent-tabs-mode: t
00127 // End: