Gnash  0.8.11dev
TextFormat_as.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 //
20 //
21 
22 #ifndef GNASH_TEXTFORMAT_H
23 #define GNASH_TEXTFORMAT_H
24 
25 #include <vector>
26 #include <cstdint>
27 #include <string>
28 #include <boost/optional.hpp>
29 
30 #include "TextField.h"
31 #include "RGBA.h"
32 
33 namespace gnash {
34  class as_object;
35 }
36 
37 namespace gnash {
38 
40 //
42 //
44 class TextFormat_as : public Relay
45 {
46 public:
47 
48  TextFormat_as();
49 
51 
53  const boost::optional<bool>& underlined() const { return _underline; }
54 
56  const boost::optional<bool>& bold() const { return _bold; }
57 
59  const boost::optional<bool>& italic() const { return _italic; }
60 
62  const boost::optional<rgba>& color() const { return _color; }
63 
65  const boost::optional<bool>& bullet() const { return _bullet; }
66 
68  //
71  return _display;
72  }
73 
74  const boost::optional<std::vector<int> >& tabStops() const {
75  return _tabStops;
76  }
77 
79  const boost::optional<std::uint16_t>& indent() const { return _indent; }
80 
82  const boost::optional<TextField::TextAlignment>& align() const { return _align; }
83 
85  const boost::optional<std::string>& font() const { return _font; }
86 
87  // See doc for _target member
88  const boost::optional<std::string>& target() const { return _target; }
89 
90  // See doc for _url member
91  const boost::optional<std::string>& url() const { return _url; }
92 
94  const boost::optional<std::uint32_t>& blockIndent() const {
95  return _blockIndent;
96  }
97 
100  const boost::optional<std::uint16_t>& leading() const { return _leading; }
101 
103  const boost::optional<std::uint16_t>& leftMargin() const { return _leftMargin; }
104 
106  const boost::optional<std::uint16_t>& rightMargin() const {
107  return _rightMargin;
108  }
109 
111  const boost::optional<std::uint16_t>& size() const { return _pointSize; }
112 
114 
115  void targetSet(const boost::optional<std::string>& s) { _target=s; }
116 
117  void urlSet(const boost::optional<std::string>& s) { _url=s; }
118 
119  void underlinedSet(const boost::optional<bool>& x) { _underline = x; }
120 
121  void italicSet(const boost::optional<bool>& x) { _italic = x; }
122 
123  void boldSet(const boost::optional<bool>& x) { _bold = x; }
124 
125  void bulletSet(const boost::optional<bool>& x) { _bullet = x; }
126 
127  void colorSet(const boost::optional<rgba>& x) { _color = x; }
128 
129  void indentSet(const boost::optional<std::uint16_t>& x) { _indent = x; }
130 
131  void fontSet(const boost::optional<std::string>& font) { _font=font; }
132 
133  void alignSet(const boost::optional<TextField::TextAlignment>& x) { _align = x; }
134 
135  void alignSet(const std::string& align);
136 
137  void blockIndentSet(const boost::optional<std::uint32_t>& x) {
138  _blockIndent = x;
139  }
140 
141  void leadingSet(const boost::optional<std::uint16_t>& x) { _leading = x; }
142 
143  void leftMarginSet(const boost::optional<std::uint16_t>& x) { _leftMargin = x; }
144 
145  void rightMarginSet(const boost::optional<std::uint16_t>& x) {
146  _rightMargin = x;
147  }
148 
149  void sizeSet(const boost::optional<std::uint16_t>& x) { _pointSize = x; }
150 
151  void tabStopsSet(const std::vector<int>& tabStops) { _tabStops = tabStops; }
152 
155  void displaySet(const std::string& display);
156 private:
157 
159  boost::optional<bool> _underline;
160 
162  boost::optional<bool> _bold;
163 
165  boost::optional<bool> _italic;
166 
167  //
168  boost::optional<bool> _bullet;
169 
171 
173  //
178  boost::optional<TextField::TextAlignment> _align;
179 
180  //
181  boost::optional<std::uint32_t> _blockIndent;
182 
184  //
187  boost::optional<rgba> _color;
188 
194  boost::optional<std::string> _font;
195 
198  boost::optional<std::uint16_t> _indent;
199 
202  boost::optional<std::uint16_t> _leading;
203 
205  boost::optional<std::uint16_t> _leftMargin;
206 
208  boost::optional<std::uint16_t> _rightMargin;
209 
211  boost::optional<std::uint16_t> _pointSize;
212 
214  boost::optional<std::vector<int> > _tabStops;
215 
221  boost::optional<std::string> _target;
222 
225  boost::optional<std::string> _url;
226 };
227 
228 void textformat_class_init(as_object& global, const ObjectURI& uri);
229 
230 void registerTextFormatNative(as_object& global);
231 
232 } // end of gnash namespace
233 
234 #endif
235 
void rightMarginSet(const boost::optional< std::uint16_t > &x)
Definition: TextFormat_as.h:145
void fontSet(const boost::optional< std::string > &font)
Definition: TextFormat_as.h:131
The TextFormat_as Relay type stores text properties.
Definition: TextFormat_as.h:44
const boost::optional< bool > & italic() const
Return a Boolean value that indicates whether the text is italicized.
Definition: TextFormat_as.h:59
const boost::optional< bool > & bullet() const
Whether the text should have a bullet.
Definition: TextFormat_as.h:65
void underlinedSet(const boost::optional< bool > &x)
Definition: TextFormat_as.h:119
const boost::optional< std::uint32_t > & blockIndent() const
The block indent.
Definition: TextFormat_as.h:94
const boost::optional< std::string > & url() const
Definition: TextFormat_as.h:91
void leftMarginSet(const boost::optional< std::uint16_t > &x)
Definition: TextFormat_as.h:143
void indentSet(const boost::optional< std::uint16_t > &x)
Definition: TextFormat_as.h:129
const boost::optional< rgba > & color() const
Return the color of text using this text format.
Definition: TextFormat_as.h:62
uri
Definition: test.py:12
const boost::optional< std::string > & font() const
Font name.
Definition: TextFormat_as.h:85
void bulletSet(const boost::optional< bool > &x)
Definition: TextFormat_as.h:125
void alignSet(const boost::optional< TextField::TextAlignment > &x)
Definition: TextFormat_as.h:133
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
const boost::optional< bool > & underlined() const
Return a Boolean value that indicates whether the text is underlined.
Definition: TextFormat_as.h:53
void leadingSet(const boost::optional< std::uint16_t > &x)
Definition: TextFormat_as.h:141
The base class for all ActionScript objects.
Definition: as_object.h:161
const boost::optional< std::uint16_t > & size() const
Return a float that indicates the point size in twips.
Definition: TextFormat_as.h:111
const boost::optional< std::string > & target() const
Definition: TextFormat_as.h:88
const boost::optional< std::uint16_t > & indent() const
Indentation from left margin to the first character in the paragraph.
Definition: TextFormat_as.h:79
const boost::optional< std::uint16_t > & rightMargin() const
Indicates the right margin of the paragraph in twips.
Definition: TextFormat_as.h:106
void boldSet(const boost::optional< bool > &x)
Definition: TextFormat_as.h:123
void colorSet(const boost::optional< rgba > &x)
Definition: TextFormat_as.h:127
A URI for describing as_objects.
Definition: ObjectURI.h:44
void italicSet(const boost::optional< bool > &x)
Definition: TextFormat_as.h:121
void displaySet(TextField::TextFormatDisplay x)
These are not optional!
Definition: TextFormat_as.h:154
const boost::optional< std::vector< int > > & tabStops() const
Definition: TextFormat_as.h:74
void registerTextFormatNative(as_object &o)
Definition: TextFormat_as.cpp:241
const boost::optional< bool > & bold() const
Return a Boolean value that indicates whether the text is boldface.
Definition: TextFormat_as.h:56
void targetSet(const boost::optional< std::string > &s)
Setters.
Definition: TextFormat_as.h:115
const boost::optional< std::uint16_t > & leftMargin() const
Indicates the left margin of the paragraph, in points.
Definition: TextFormat_as.h:103
TextFormatDisplay
Text format display values.
Definition: TextField.h:73
std::int32_t x
Definition: BitmapData_as.cpp:434
const boost::optional< std::uint16_t > & leading() const
Definition: TextFormat_as.h:100
void blockIndentSet(const boost::optional< std::uint32_t > &x)
Definition: TextFormat_as.h:137
void urlSet(const boost::optional< std::string > &s)
Definition: TextFormat_as.h:117
This is the base class for type-specific object data.
Definition: Relay.h:49
const boost::optional< TextField::TextAlignment > & align() const
Paragraph alignment.
Definition: TextFormat_as.h:82
TextFormat_as()
Definition: TextFormat_as.cpp:216
void tabStopsSet(const std::vector< int > &tabStops)
Definition: TextFormat_as.h:151
TextField::TextFormatDisplay display() const
The display type (block or inline).
Definition: TextFormat_as.h:70
Definition: GnashKey.h:165
void textformat_class_init(as_object &global, const ObjectURI &uri)
Definition: TextFormat_as.cpp:374
~TextFormat_as()
Definition: TextFormat_as.h:50
void sizeSet(const boost::optional< std::uint16_t > &x)
Definition: TextFormat_as.h:149