00001 // 00002 // Copyright (C) 2007, 2008, 2009, 2010 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" // for inheritance 00022 #include "SWF.h" // for TagType definition 00023 #include "MovieClip.h" // for inlines (execute) 00024 #include "movie_definition.h" // for inlines (loader) 00025 #include "log.h" // for log_parse 00026 #include "RGBA.h" // for rgba class 00027 00028 // Forward declarations 00029 namespace gnash { 00030 class SWFStream; 00031 class movie_definition; 00032 } 00033 00034 namespace gnash { 00035 namespace SWF { 00036 00038 // 00039 class SetBackgroundColorTag : public ControlTag 00040 { 00041 00042 private: 00043 00046 rgba m_color; 00047 00049 // 00054 void read(SWFStream& in) 00055 { 00056 // may throw ParserException 00057 m_color = readRGB(in); 00058 00059 IF_VERBOSE_PARSE( 00060 log_parse(_(" SetBackgroundColor: %s"), m_color); 00061 ); 00062 } 00063 00064 00065 public: 00066 00070 // 00074 SetBackgroundColorTag(SWFStream& in) 00075 { 00076 read(in); 00077 } 00078 00079 void executeState(MovieClip* m, DisplayList& /*dlist*/) const { 00080 m->set_background_color(m_color); 00081 } 00082 00084 static void loader(SWFStream& in, TagType tag, movie_definition& m, 00085 const RunResources& /*r*/) 00086 { 00087 assert(tag == SWF::SETBACKGROUNDCOLOR); // 9 00088 00089 // this one may throw, we'll let caller catch it 00090 SetBackgroundColorTag* t = new SetBackgroundColorTag(in); 00091 m.addControlTag(t); // takes ownership 00092 } 00093 }; 00094 00095 00096 00097 00098 } // namespace gnash::SWF 00099 } // namespace gnash 00100 00101 00102 #endif // GNASH_SWF_SETBACKGROUNDCOLOR_TAG_H 00103 00104 00105 // Local Variables: 00106 // mode: C++ 00107 // indent-tabs-mode: t 00108 // End: