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  std::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
Client program&#39;s interface to the definition of a movie or sprite.
Definition: movie_definition.h:95
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:168
TagType
SWF tag types. Symbolic names copied from Ming.
Definition: SWF.h:30
Definition: SWFMatrix.h:53
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
Immutable data representing the definition of a movie display element.
Definition: DefinitionTag.h:47
Base class for render handlers.
Definition: Renderer.h:188
bool extractStaticText(std::vector< const TextRecord *> &to, size_t &size) const
Extract static text from TextRecords.
Definition: DefineTextTag.cpp:66
Definition: GnashKey.h:164
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:53
std::vector< TextRecord > TextRecords
Definition: TextRecord.h:51
Parse a DefineText2Tag.
Definition: DefineTextTag.h:98
void display(Renderer &renderer, const Transform &xform) const
Draw the string.
Definition: DefineTextTag.cpp:126
The Global object ultimately contains all objects in an ActionScript run.
Definition: Global_as.h:49
static void loader(SWFStream &in, TagType tag, movie_definition &m, const RunResources &r)
Definition: DefineTextTag.cpp:42
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:44
Definition: GnashKey.h:159
virtual DisplayObject * createDisplayObject(Global_as &gl, DisplayObject *parent) const
Create a DisplayObject with the given parent.
Definition: DefineTextTag.cpp:59
const SWFRect & bounds() const
Definition: DefineTextTag.h:52
Definition: GnashKey.h:331
The Transform class expresses a stage in a cumulative transformation.
Definition: Transform.h:33
SWF stream wrapper class.
Definition: SWFStream.h:58
Static text definition tag.
Definition: DefineTextTag.h:42