Gnash  0.8.10
DefineTextTag.h
Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
00003 //   Free Software 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 #ifndef GNASH_SWF_DEFINETEXTTAG_H
00020 #define GNASH_SWF_DEFINETEXTTAG_H
00021 
00022 #include <vector>
00023 #include "DefinitionTag.h" // for inheritance
00024 #include "SWFRect.h" // for composition
00025 #include "SWF.h"
00026 #include "SWFMatrix.h"
00027 #include "TextRecord.h"
00028 
00029 namespace gnash {
00030     class movie_definition;
00031     class SWFStream;
00032     class RunResources;
00033     class StaticText;
00034     class Transform;
00035 }
00036 
00037 namespace gnash {
00038 namespace SWF {
00039 
00040 
00042 class DefineTextTag : public DefinitionTag
00043 {
00044 public:
00045 
00046     static void loader(SWFStream& in, TagType tag, movie_definition& m, 
00047             const RunResources& r);
00048 
00050     void display(Renderer& renderer, const Transform& xform) const;
00051         
00052         const SWFRect& bounds() const {
00053         // TODO: There is a _matrix field in the definition(!) that's
00054         // currently ignored. Don't know if it needs to be transformed... 
00055         return _rect; 
00056     }
00057 
00059     //
00064     bool extractStaticText(std::vector<const TextRecord*>& to, size_t& size)
00065       const;
00066 
00067     virtual DisplayObject* createDisplayObject(Global_as& gl,
00068             DisplayObject* parent) const;
00069 
00070 private:
00071 
00073     friend class DefineText2Tag;
00074 
00076     //
00078         DefineTextTag(SWFStream& in, movie_definition& m, TagType tag,
00079             boost::uint16_t id)
00080         :
00081         DefinitionTag(id)
00082     {
00083         read(in, m, tag);
00084     }
00085 
00086         SWFRect _rect;
00087 
00088         SWFMatrix _matrix;
00089 
00090         void read(SWFStream& in, movie_definition& m, TagType tag);
00091         
00092     TextRecord::TextRecords _textRecords;
00093 };
00094 
00096 //
00098 class DefineText2Tag
00099 {
00100 public:
00101     static void loader(SWFStream& in, TagType tag, movie_definition& m, 
00102             const RunResources& r);
00103 };
00104 
00105 } // namespace SWF
00106 } // namespace gnash
00107 
00108 #endif