Gnash  0.8.11dev
DefineTextTag.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef GNASH_SWF_DEFINETEXTTAG_H
20 #define GNASH_SWF_DEFINETEXTTAG_H
21 
22 #include <vector>
23 #include "DefinitionTag.h" // for inheritance
24 #include "SWFRect.h" // for composition
25 #include "SWF.h"
26 #include "SWFMatrix.h"
27 #include "TextRecord.h"
28 
29 namespace gnash {
30  class movie_definition;
31  class SWFStream;
32  class RunResources;
33  class StaticText;
34  class Transform;
35 }
36 
37 namespace gnash {
38 namespace SWF {
39 
40 
43 {
44 public:
45 
46  static void loader(SWFStream& in, TagType tag, movie_definition& m,
47  const RunResources& r);
48 
50  void display(Renderer& renderer, const Transform& xform) const;
51 
52  const SWFRect& bounds() const {
53  // TODO: There is a _matrix field in the definition(!) that's
54  // currently ignored. Don't know if it needs to be transformed...
55  return _rect;
56  }
57 
59  //
64  bool extractStaticText(std::vector<const TextRecord*>& to, size_t& size)
65  const;
66 
68  DisplayObject* parent) const;
69 
70 private:
71 
73  friend class DefineText2Tag;
74 
76  //
79  boost::uint16_t id)
80  :
81  DefinitionTag(id)
82  {
83  read(in, m, tag);
84  }
85 
86  SWFRect _rect;
87 
88  SWFMatrix _matrix;
89 
90  void read(SWFStream& in, movie_definition& m, TagType tag);
91 
92  TextRecord::TextRecords _textRecords;
93 };
94 
96 //
99 {
100 public:
101  static void loader(SWFStream& in, TagType tag, movie_definition& m,
102  const RunResources& r);
103 };
104 
105 } // namespace SWF
106 } // namespace gnash
107 
108 #endif