Gnash  0.8.10
TextFormat_as.h
Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006, 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 // 
00020 //
00021 
00022 #ifndef GNASH_TEXTFORMAT_H
00023 #define GNASH_TEXTFORMAT_H
00024 
00025 #include <vector>
00026 #include <boost/cstdint.hpp> 
00027 #include <string>
00028 #include <boost/optional.hpp>
00029 
00030 #include "TextField.h"
00031 #include "RGBA.h" 
00032 
00033 namespace gnash {
00034     class as_object;
00035 }
00036 
00037 namespace gnash {  
00038 
00040 //
00042 //
00044 class TextFormat_as : public Relay
00045 {
00046 public:
00047   
00048     TextFormat_as();
00049 
00050     ~TextFormat_as() {}
00051 
00053     const boost::optional<bool>& underlined() const { return _underline; }
00054     
00056     const boost::optional<bool>& bold() const { return _bold; }
00057 
00059     const boost::optional<bool>& italic() const { return _italic; }
00060 
00062     const boost::optional<rgba>& color() const { return _color; }
00063 
00065     const boost::optional<bool>& bullet() const { return _bullet; }
00066 
00068     //
00070     TextField::TextFormatDisplay display() const {
00071         return _display;
00072     }
00073 
00074     const boost::optional<std::vector<int> >& tabStops() const {
00075         return _tabStops;
00076     }
00077 
00079     const boost::optional<boost::uint16_t>& indent() const { return _indent; }
00080     
00082     const boost::optional<TextField::TextAlignment>& align() const { return _align; }
00083 
00085     const boost::optional<std::string>& font() const { return _font; }
00086 
00087     // See doc for _target member
00088     const boost::optional<std::string>& target() const { return _target; }
00089 
00090     // See doc for _url member
00091     const boost::optional<std::string>& url() const { return _url; }
00092 
00094     const boost::optional<boost::uint32_t>& blockIndent() const {
00095         return _blockIndent;
00096     }
00097 
00100     const boost::optional<boost::uint16_t>& leading() const { return _leading; }
00101 
00103     const boost::optional<boost::uint16_t>& leftMargin() const { return _leftMargin; }
00104 
00106     const boost::optional<boost::uint16_t>& rightMargin() const {
00107         return _rightMargin;
00108     }
00109 
00111     const boost::optional<boost::uint16_t>& size() const { return _pointSize; }
00112 
00114 
00115     void targetSet(const boost::optional<std::string>& s) { _target=s; }
00116 
00117     void urlSet(const boost::optional<std::string>& s) { _url=s; }
00118 
00119     void underlinedSet(const boost::optional<bool>& x) { _underline = x; }
00120 
00121     void italicSet(const boost::optional<bool>& x) { _italic = x; }
00122 
00123     void boldSet(const boost::optional<bool>& x) { _bold = x; }
00124 
00125     void bulletSet(const boost::optional<bool>& x) { _bullet = x; }
00126 
00127     void colorSet(const boost::optional<rgba>& x) { _color = x; }
00128 
00129     void indentSet(const boost::optional<boost::uint16_t>& x) { _indent = x; }
00130 
00131     void fontSet(const boost::optional<std::string>& font) { _font=font; }
00132     
00133     void alignSet(const boost::optional<TextField::TextAlignment>& x) { _align = x; }
00134     
00135     void alignSet(const std::string& align);
00136     
00137     void blockIndentSet(const boost::optional<boost::uint32_t>& x) {
00138         _blockIndent = x;
00139     }
00140     
00141     void leadingSet(const boost::optional<boost::uint16_t>& x) { _leading = x; }
00142 
00143     void leftMarginSet(const boost::optional<boost::uint16_t>& x) { _leftMargin = x; }
00144 
00145     void rightMarginSet(const boost::optional<boost::uint16_t>& x) {
00146         _rightMargin = x;
00147     }
00148 
00149     void sizeSet(const boost::optional<boost::uint16_t>& x) { _pointSize = x; }
00150 
00151     void tabStopsSet(const std::vector<int>& tabStops) { _tabStops = tabStops; }
00152 
00154     void displaySet(TextField::TextFormatDisplay x) { _display = x; }
00155     void displaySet(const std::string& display);
00156 private:
00157 
00159     boost::optional<bool> _underline;
00160 
00162     boost::optional<bool> _bold;
00163 
00165     boost::optional<bool> _italic;
00166 
00167     // 
00168     boost::optional<bool> _bullet;
00169     
00170     TextField::TextFormatDisplay _display;
00171   
00173     //
00178     boost::optional<TextField::TextAlignment> _align;
00179 
00180     // 
00181     boost::optional<boost::uint32_t> _blockIndent;
00182 
00184     //
00187     boost::optional<rgba> _color;    
00188 
00189     // The name of a font for text as a string.
00190     boost::optional<std::string> _font;    
00191 
00194     boost::optional<boost::uint16_t> _indent;
00195 
00198     boost::optional<boost::uint16_t> _leading;
00199 
00201     boost::optional<boost::uint16_t> _leftMargin;
00202 
00204     boost::optional<boost::uint16_t> _rightMargin;
00205 
00207     boost::optional<boost::uint16_t> _pointSize;
00208 
00210     boost::optional<std::vector<int> > _tabStops;
00211 
00217     boost::optional<std::string> _target;
00218 
00221     boost::optional<std::string> _url;    
00222 };
00223 
00224 void textformat_class_init(as_object& global, const ObjectURI& uri);
00225 
00226 void registerTextFormatNative(as_object& global);
00227 
00228 } // end of gnash namespace
00229 
00230 #endif
00231