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