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: