Gnash  0.8.11dev
SetBackgroundColorTag.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 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_SETBACKGROUNDCOLOR_TAG_H
20 #define GNASH_SWF_SETBACKGROUNDCOLOR_TAG_H
21 
22 #include "ControlTag.h"
23 #include "TypesParser.h"
24 #include "SWF.h"
25 #include "MovieClip.h"
26 #include "movie_definition.h"
27 #include "log.h"
28 #include "RGBA.h"
29 
30 // Forward declarations
31 namespace gnash {
32  class SWFStream;
33  class movie_definition;
34 }
35 
36 namespace gnash {
37 namespace SWF {
38 
40 //
42 {
43 
44 private:
45 
48  rgba m_color;
49 
51  //
56  void read(SWFStream& in)
57  {
58  // may throw ParserException
59  m_color = readRGB(in);
60 
62  log_parse(_(" SetBackgroundColor: %s"), m_color);
63  );
64  }
65 
66 
67 public:
68 
72  //
77  {
78  read(in);
79  }
80 
81  void executeState(MovieClip* m, DisplayList& /*dlist*/) const {
82  m->set_background_color(m_color);
83  }
84 
86  static void loader(SWFStream& in, TagType tag, movie_definition& m,
87  const RunResources& /*r*/)
88  {
89  assert(tag == SWF::SETBACKGROUNDCOLOR); // 9
90 
91  // this one may throw, we'll let caller catch it
92  boost::intrusive_ptr<ControlTag> t(new SetBackgroundColorTag(in));
93  m.addControlTag(t); // takes ownership
94  }
95 };
96 
97 
98 
99 
100 } // namespace gnash::SWF
101 } // namespace gnash
102 
103 
104 #endif // GNASH_SWF_SETBACKGROUNDCOLOR_TAG_H
105 
106 
107 // Local Variables:
108 // mode: C++
109 // indent-tabs-mode: t
110 // End:
gnash::SWF::ControlTag
Control tags are swf tags that control the operation of the movie.
Definition: ControlTag.h:44
TypesParser.h
ControlTag.h
gnash::SWF::TagType
TagType
SWF tag types. Symbolic names copied from Ming.
Definition: SWF.h:31
gnash::rgba
A basic RGBA type.
Definition: RGBA.h:36
_
#define _(String)
Definition: log.h:44
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::key::m
@ m
Definition: GnashKey.h:159
gnash::SWF::SetBackgroundColorTag::executeState
void executeState(MovieClip *m, DisplayList &) const
Execute "state" or "DisplayList" tags.
Definition: SetBackgroundColorTag.h:81
gnash::MovieClip
A MovieClip is a container for DisplayObjects.
Definition: MovieClip.h:84
gnash::movie_definition
Client program's interface to the definition of a movie or sprite.
Definition: movie_definition.h:96
gnash::DisplayList
A list of on-stage DisplayObjects, ordered by depth.
Definition: DisplayList.h:65
gnash::key::t
@ t
Definition: GnashKey.h:166
RGBA.h
MovieClip.h
gnash::RunResources
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:54
gnash::SWF::SetBackgroundColorTag::loader
static void loader(SWFStream &in, TagType tag, movie_definition &m, const RunResources &)
Set background color tag loader (SWF::SETBACKGROUNDCOLOR)
Definition: SetBackgroundColorTag.h:86
IF_VERBOSE_PARSE
#define IF_VERBOSE_PARSE(x)
Definition: log.h:378
gnash::log_parse
void log_parse(StringType msg, Args... args)
Definition: log.h:313
log.h
gnash::readRGB
rgba readRGB(SWFStream &in)
Read an RGB rgba from input stream.
Definition: TypesParser.cpp:106
SWF.h
gnash::SWF::SetBackgroundColorTag
SWF Tag SetBackgroundColor (9)
Definition: SetBackgroundColorTag.h:42
movie_definition.h
gnash::SWF::SetBackgroundColorTag::SetBackgroundColorTag
SetBackgroundColorTag(SWFStream &in)
Construct a SetBackgroundColorTag by reading it from the given SWF stream.
Definition: SetBackgroundColorTag.h:76
gnash::SWFStream
SWF stream wrapper class.
Definition: SWFStream.h:59
gnash::SWF::SETBACKGROUNDCOLOR
@ SETBACKGROUNDCOLOR
Definition: SWF.h:41
gnash::key::SWF
@ SWF
Definition: GnashKey.h:331