Gnash 0.8.10dev
SetBackgroundColorTag.h
Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
00003 // 
00004 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation; either version 3 of the License, or
00007 // (at your option) any later version.
00008 // 
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 // 
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00017 
00018 #ifndef GNASH_SWF_SETBACKGROUNDCOLOR_TAG_H
00019 #define GNASH_SWF_SETBACKGROUNDCOLOR_TAG_H
00020 
00021 #include "ControlTag.h" 
00022 #include "TypesParser.h"
00023 #include "SWF.h" 
00024 #include "MovieClip.h" 
00025 #include "movie_definition.h" 
00026 #include "log.h" 
00027 #include "RGBA.h" 
00028 
00029 // Forward declarations
00030 namespace gnash {
00031         class SWFStream;
00032         class movie_definition;
00033 }
00034 
00035 namespace gnash {
00036 namespace SWF {
00037 
00039 //
00040 class SetBackgroundColorTag : public ControlTag
00041 {
00042 
00043 private:
00044 
00047         rgba m_color;
00048 
00050         //
00055         void read(SWFStream& in)
00056         {
00057                 // may throw ParserException
00058                 m_color = readRGB(in);
00059 
00060                 IF_VERBOSE_PARSE(
00061             log_parse(_("  SetBackgroundColor: %s"), m_color);
00062                 );
00063         }
00064 
00065 
00066 public:
00067 
00071         //
00075         SetBackgroundColorTag(SWFStream& in)
00076     {
00077                 read(in);
00078         }
00079 
00080         void executeState(MovieClip* m, DisplayList& /*dlist*/) const {
00081                 m->set_background_color(m_color);
00082         }
00083 
00085         static void loader(SWFStream& in, TagType tag, movie_definition& m, 
00086             const RunResources& /*r*/)
00087         {
00088                 assert(tag == SWF::SETBACKGROUNDCOLOR); // 9
00089 
00090                 // this one may throw, we'll let caller catch it
00091                 boost::intrusive_ptr<ControlTag> t(new SetBackgroundColorTag(in));
00092                 m.addControlTag(t); // takes ownership
00093         }
00094 };
00095 
00096 
00097 
00098 
00099 } // namespace gnash::SWF
00100 } // namespace gnash
00101 
00102 
00103 #endif // GNASH_SWF_SETBACKGROUNDCOLOR_TAG_H
00104 
00105 
00106 // Local Variables:
00107 // mode: C++
00108 // indent-tabs-mode: t
00109 // End: