• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

DefineEditTextTag.h

Go to the documentation of this file.
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_DEFINEEDITTEXTTAG_H
00019 #define GNASH_SWF_DEFINEEDITTEXTTAG_H
00020 
00021 #include "SWFRect.h"
00022 #include "DefinitionTag.h"
00023 #include "SWF.h" // for TagType definition
00024 #include "RGBA.h"
00025 #include "TextField.h"
00026 
00027 #include <boost/intrusive_ptr.hpp>
00028 #include <string>
00029 #include <boost/cstdint.hpp> // for boost::uint16_t and friends
00030  
00031 
00032 // Forward declarations
00033 namespace gnash {
00034         class SWFStream;
00035         class movie_definition;
00036         class RunResources;
00037     class Font;
00038 }
00039 
00040 namespace gnash {
00041 namespace SWF {
00042 
00044 //
00055 class DefineEditTextTag : public DefinitionTag
00056 {
00057 
00058 public:
00059 
00060     ~DefineEditTextTag() {}
00061 
00063         static void loader(SWFStream& in, TagType tag, movie_definition& m,
00064             const RunResources& r);
00065 
00066     const SWFRect& bounds() const { return _rect; }
00067 
00068     DisplayObject* createDisplayObject(Global_as& gl,
00069             DisplayObject* parent) const;
00070 
00073         const std::string& defaultText() const {
00074                 return _defaultText;
00075         }
00076 
00082         const std::string& variableName() const {
00083                 return _variableName;
00084         }
00085 
00087         //
00090         unsigned int maxChars() const {
00091                 return _maxChars;
00092         }
00093 
00095         boost::uint16_t rightMargin() const {
00096                 return _rightMargin;
00097         }
00098 
00100         boost::uint16_t leftMargin() const {
00101                 return _leftMargin;
00102         }
00103 
00105         boost::uint16_t indent() const {
00106                 return _indent;
00107         }
00108 
00110         // @@ what if has_font is false ??
00111         boost::uint16_t textHeight() const {
00112                 return _textHeight;
00113         }
00114 
00116         const rgba& color() const {
00117                 return _color;
00118         }
00119 
00122         //
00124         boost::uint16_t leading() const {
00125                 return _leading;
00126         }
00127 
00128     bool multiline() const {
00129         return _multiline;
00130     }
00131 
00132     bool password() const {
00133         return _password;
00134     }
00135 
00137     TextField::TextAlignment alignment() const {
00138                 return _alignment;
00139         }
00140 
00142         bool border() const {
00143                 return _border;
00144         }
00145 
00146     bool autoSize() const {
00147         return _autoSize;
00148     }
00149 
00151         bool wordWrap() const {
00152                 return _wordWrap;
00153         }
00154 
00156         bool hasText() const {
00157                 return _hasText;
00158         }
00159 
00160         bool readOnly() const
00161         {
00162                 return _readOnly;
00163         }
00164 
00165         bool noSelect() const 
00166         {
00167              return _noSelect;
00168         }
00169         
00171         bool html() const { return _html; }
00172 
00174         // 
00177         bool getUseEmbeddedGlyphs() const 
00178         {
00179                 return _useOutlines;
00180         }
00181 
00182     boost::intrusive_ptr<Font> getFont() const
00183     {
00184         return _font;
00185     }
00186 
00187 private:
00188 
00190     //
00192         DefineEditTextTag(SWFStream& in, movie_definition& m, boost::uint16_t id);
00193 
00195     void read(SWFStream& in, movie_definition& m);
00196 
00197         SWFRect _rect;
00198 
00199         std::string _variableName;
00200 
00201     // For an SWF-defined textfield we'll read
00202     // this from the tag. Dynamic textfields should
00203     // behave as always having text by default (not tested).
00204         bool _hasText;
00205         bool _wordWrap;
00206         bool _multiline;
00207 
00209         bool _password;
00210         bool _readOnly;
00212         bool _autoSize;
00213         bool _noSelect;
00214 
00217         bool _border;
00218 
00220         //
00243         bool _html;
00244 
00251     // For an SWF-defined textfield we'll read
00252     // this from the tag. Dynamic textfields should
00253         // use device fonts by default (so not use outline ones)
00254         bool _useOutlines;
00255 
00256         int     _fontID;
00257         boost::intrusive_ptr<Font> _font;
00258 
00260     // TODO: initialize to a meaningful value (see MovieClip::add_textfield)
00261     //       and make sure get_font_height is not called for rendering purposes
00262     //       (instead call a method of TextField) (?)
00263         boost::uint16_t _textHeight;
00264 
00266         rgba _color;
00267 
00269         //
00272         unsigned int _maxChars;
00273 
00274     TextField::TextAlignment _alignment;
00275         
00277         boost::uint16_t _leftMargin;
00278 
00280         boost::uint16_t _rightMargin;
00281 
00283         boost::uint16_t _indent;
00284 
00288         boost::uint16_t _leading;
00289 
00291         std::string     _defaultText;
00292 };
00293 
00294 
00295 } // namespace gnash::SWF
00296 } // namespace gnash
00297 
00298 #endif

Generated on Fri Mar 16 2012 15:46:09 for Gnash by  doxygen 1.7.1