Gnash  0.8.11dev
TextField.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 #ifndef GNASH_TEXTFIELD_H
20 #define GNASH_TEXTFIELD_H
21 
22 #include <boost/intrusive_ptr.hpp>
23 #include <map>
24 #include <string>
25 #include <vector>
26 
27 #include "InteractiveObject.h" // for inheritance
28 #include "snappingrange.h"
29 #include "SWFRect.h" // for inlines
30 #include "GnashKey.h"
31 #include "RGBA.h" // for rgba
32 
33 // Forward declarations
34 namespace gnash {
35  namespace SWF {
36  class DefineEditTextTag;
37  class TextRecord;
38  }
39  class TextFormat_as;
40  class Font;
41 }
42 
43 #ifdef __ANDROID__
44 namespace std {
45 typedef basic_string
46  <wchar_t
47  ,std::char_traits<wchar_t>
48  ,std::allocator<wchar_t> >
49 wstring;
50 }
51 #endif
52 
53 namespace gnash {
54 
57 {
58 
59 public:
60 
61  typedef std::vector<size_t> LineStarts;
62 
65  {
66  ALIGN_LEFT = 0,
69  ALIGN_JUSTIFY
70  };
71 
74  {
75  TEXTFORMAT_BLOCK = 0,
76  TEXTFORMAT_INLINE = 1
77  };
78 
80  enum AutoSize {
81 
84 
87 
90 
92  AUTOSIZE_RIGHT
93  };
94 
96  enum TypeValue {
97 
100 
104 
106  typeInput
107  };
108 
110  TextField(as_object* object, DisplayObject* parent,
111  const SWF::DefineEditTextTag& def);
112 
114  //
118  TextField(as_object* object, DisplayObject* parent, SWFRect bounds);
119 
120 
121  ~TextField();
122 
123  // TODO: should this return isSelectable() ?
125  bool mouseEnabled() const { return true; }
126 
128  //
131  InteractiveObject* topmostMouseEntity(std::int32_t x, std::int32_t y);
132 
134  //
136  virtual int getDefinitionVersion() const;
137 
139  void mouseEvent(const event_id& id);
140 
142  void keyInput(key::code k);
143 
144  const std::string& getVariableName() const
145  {
146  return _variable_name;
147  }
148 
151  //
155  void set_variable_name(const std::string& newname);
156 
159  //
163  void updateText(const std::string& s);
164 
166  std::string get_text_value() const;
167 
169  std::string get_htmltext_value() const;
170 
172  bool getTextDefined() const { return _textDefined; }
173 
174  size_t getCaretIndex() const {
175  return m_cursor;
176  }
177 
179  //
182  const std::pair<size_t, size_t>& getSelection() const {
183  return _selection;
184  }
185 
187  //
189  void replaceSelection(const std::string& replace);
190 
192  //
195  //
198  void setSelection(int start, int end);
199 
201  //
203  virtual void setWidth(double width);
204 
206  //
208  virtual void setHeight(double height);
209 
211  virtual void display(Renderer& renderer, const Transform& xform);
212 
213  void add_invalidated_bounds(InvalidatedRanges& ranges, bool force);
214 
216  virtual SWFRect getBounds() const
217  {
218  return _bounds;
219  }
220 
221  // See dox in DisplayObject.h
222  bool pointInShape(std::int32_t x, std::int32_t y) const;
223 
225  bool getDrawBackground() const;
226 
228  //
230  void setDrawBackground(bool draw);
231 
233  rgba getBackgroundColor() const;
234 
236  //
240  void setBackgroundColor(const rgba& col);
241 
243  bool getDrawBorder() const;
244 
246  //
248  void setDrawBorder(bool draw);
249 
251  rgba getBorderColor() const;
252 
254  //
258  void setBorderColor(const rgba& col);
259 
261  const rgba& getTextColor() const
262  {
263  return _textColor;
264  }
265 
267  //
270  void setTextColor(const rgba& col);
271 
275  bool getEmbedFonts() const {
276  return _embedFonts;
277  }
278 
280  std::int32_t maxChars() const {
281  return _maxChars;
282  }
283 
285  //
288  void maxChars(std::int32_t max) {
289  _maxChars = max;
290  }
291 
293  bool multiline() const {
294  return _multiline;
295  }
296 
298  //
301  void multiline(bool b) {
302  _multiline = b;
303  }
304 
306  bool password() const {
307  return _password;
308  }
309 
311  //
314  void password(bool b) {
315  _password = b;
316  }
320  //
322  void setEmbedFonts(bool use);
323 
326  {
327  return _autoSize;
328  }
329 
331  TextAlignment getTextAlignment();
332 
334  //
338  void setAutoSize(AutoSize val);
339 
341  //
345  void setType(TypeValue val) { if (val != typeInvalid) _type=val; }
346 
349  {
350  return _type;
351  }
352 
354  bool isReadOnly() const { return _type != typeInput; }
355 
357  //
363  static TypeValue parseTypeValue(const std::string& val);
364 
366  //
373  static const char* typeValueName(TypeValue val);
374 
379  bool doWordWrap() const {
380  return _wordWrap;
381  }
382 
384  //
391  void setWordWrap(bool on);
392 
394  bool doHtml() const {
395  return _html;
396  }
397 
399  //
402  void setHtml(bool on) {
403  _html = on;
404  }
405 
407  bool isSelectable() const
408  {
409  return _selectable;
410  }
411 
413  //
416  void setSelectable(bool v)
417  {
418  _selectable = v;
419  }
420 
421  // See DisplayObject::isActiveTextField
423  virtual bool isSelectableTextField() const
424  {
425  return isSelectable();
426  }
427 
429  //
436  void removeTextField();
437 
439  //
443  boost::intrusive_ptr<const Font> setFont(
444  boost::intrusive_ptr<const Font> newfont);
445 
446  const Font* getFont() { return _font.get(); }
447 
448 
449  std::uint16_t getFontHeight() const
450  {
451  return _fontHeight;
452  }
453 
454  void setFontHeight(std::uint16_t h);
455 
456  std::uint16_t getLeftMargin() const
457  {
458  return _leftMargin;
459  }
460 
461  void setLeftMargin(std::uint16_t h);
462 
463  std::uint16_t getRightMargin() const
464  {
465  return _rightMargin;
466  }
467 
468  void setRightMargin(std::uint16_t h);
469 
470  std::uint16_t getIndent() const
471  {
472  return _indent;
473  }
474 
475  void setIndent(std::uint16_t h);
476 
477  std::uint16_t getBlockIndent() const
478  {
479  return _blockIndent;
480  }
481 
482  void setBlockIndent(std::uint16_t h);
483 
485  {
486  return _alignment;
487  }
488 
489  void setAlignment(TextAlignment h);
490 
491  std::int16_t getLeading() const
492  {
493  return _leading;
494  }
495 
496  void setLeading(std::int16_t h);
497 
498  bool getUnderlined() const
499  {
500  return _underlined;
501  }
502 
504  {
505  return _display;
506  }
507 
508  bool getBullet() const
509  {
510  return _bullet;
511  }
512 
513  const std::vector<int>& getTabStops() const
514  {
515  return _tabStops;
516  }
517 
518  bool isRestrict() const
519  {
520  return _restrictDefined;
521  }
522 
523  const std::string& getRestrict() const
524  {
525  return _restrict;
526  }
527 
528  size_t getScroll() const
529  {
530  return _scroll;
531  }
532 
533  size_t getMaxScroll() const
534  {
535  return _maxScroll;
536  }
537 
538  size_t getHScroll() const
539  {
540  return _hScroll;
541  }
542 
543  size_t getMaxHScroll() const
544  {
545  return _maxHScroll;
546  }
547 
548  size_t getBottomScroll() const
549  {
550  return _bottomScroll;
551  }
552 
553  void setUnderlined(bool v);
554  void setTabStops(const std::vector<int>& tabStops);
555  void setBullet(bool b);
556  void setURL(std::string url);
557  void setTarget(std::string target);
558  void setRestrict(const std::string& restrict);
559  void setDisplay(TextFormatDisplay display);
560  void setScroll(size_t scroll) {
561  _scroll = scroll;
562  format_text();
563  }
564  void setMaxScroll(size_t maxScroll) {
565  _maxScroll = maxScroll;
566  format_text();
567  }
568  void setHScroll(size_t hScroll) {
569  _hScroll = hScroll;
570  format_text();
571  }
572  void setMaxHScroll(size_t maxHScroll) {
573  _maxHScroll = maxHScroll;
574  format_text();
575  }
576  void setbottomScroll(size_t bottomScroll) {
577  _bottomScroll = bottomScroll;
578  format_text();
579  }
580 
582  //
583  size_t cursorRecord();
584 
585  void setTextFormat(TextFormat_as& tf);
586 
587  const SWFRect& getTextBoundingBox() const {
588  return m_text_bounding_box;
589  }
590 
592  //
595  void setTextValue(const std::wstring& wstr);
596 
597 private:
598 
599  void init();
600 
603  //
607  void updateText(const std::wstring& s);
608 
609  void updateHtmlText(const std::wstring& s);
610 
611  void insertTab(SWF::TextRecord& rec, std::int32_t& x, float scale);
612 
614  //
617  virtual bool handleFocus();
618 
620  virtual void killFocus();
621 
623  void onChanged();
624 
626  void reset_bounding_box(std::int32_t x, std::int32_t y)
627  {
628  m_text_bounding_box.set_to_point(x, y);
629  }
630 
633  void format_text();
634 
636  void scrollLines();
637 
640  void newLine(std::int32_t& x, std::int32_t& y,
641  SWF::TextRecord& rec, int& last_space_glyph,
642  LineStarts::value_type& last_line_start_record, float div);
643 
645  void handleChar(std::wstring::const_iterator& it,
646  const std::wstring::const_iterator& e, std::int32_t& x,
647  std::int32_t& y, SWF::TextRecord& rec, int& last_code,
648  int& last_space_glyph,
649  LineStarts::value_type& last_line_start_record);
650 
661  bool parseHTML(std::wstring& tag,
662  std::map<std::string, std::string>& attributes,
663  std::wstring::const_iterator& it,
664  const std::wstring::const_iterator& e,
665  bool& selfclosing) const;
666 
671  float align_line(TextAlignment align, int last_line_start_record, float x);
672 
674  //
690  void registerTextVariable();
691 
692  typedef std::pair<as_object*, ObjectURI> VariableRef;
693 
698  VariableRef parseTextVariableRef(const std::string& variableName) const;
699 
701  //
704  void show_cursor(Renderer& renderer, const SWFMatrix& mat);
705 
707  //
709  boost::intrusive_ptr<const SWF::DefineEditTextTag> _tag;
710 
712  //
717  std::wstring _text;
718 
720  //
721  std::wstring _htmlText;
722 
724  SWFRect m_text_bounding_box;
725 
726  typedef std::vector<SWF::TextRecord> TextRecords;
727  TextRecords _textRecords;
728 
729  std::vector<size_t> _recordStarts;
730 
731  TextRecords _displayRecords;
732 
733  std::string _url;
734  std::string _target;
735  std::string _restrict;
736  std::set<wchar_t> _restrictedchars;
737  TextFormatDisplay _display;
738  std::vector<int> _tabStops;
739  LineStarts _line_starts;
740 
742  //
746  std::string _variable_name;
747 
748  rgba _backgroundColor;
749 
750  rgba _borderColor;
751 
752  rgba _textColor;
753 
754  TextAlignment _alignment;
755 
756  boost::intrusive_ptr<const Font> _font;
757  size_t m_cursor;
758  size_t _glyphcount;
759  size_t _scroll;
760  size_t _maxScroll;
761  size_t _hScroll;
762  size_t _maxHScroll;
763  size_t _bottomScroll;
764  size_t _linesindisplay;
765 
767  size_t _maxChars;
768 
769  AutoSize _autoSize;
770 
771  TypeValue _type;
772 
774  //
779  SWFRect _bounds;
780 
783  std::pair<size_t, size_t> _selection;
784 
785  std::int16_t _leading;
786  std::uint16_t _indent;
787 
790  std::uint16_t _blockIndent;
791 
792  std::uint16_t _leftMargin;
793 
794  std::uint16_t _rightMargin;
795 
796  std::uint16_t _fontHeight;
797 
802  bool _textDefined;
803 
804  bool _restrictDefined;
805  bool _underlined;
806  bool _bullet;
807 
808  bool m_has_focus;
809 
810 
812  bool _multiline;
813 
815  bool _password;
816 
818  //
822  bool _text_variable_registered;
823 
824  bool _drawBackground;
825 
826  bool _drawBorder;
827 
828  bool _embedFonts;
829 
830  bool _wordWrap;
831 
832  bool _html;
833 
834  bool _selectable;
835 
836 };
837 
838 } // namespace gnash
839 
840 #endif
gnash::geometry::SnappingRanges2d< std::int32_t >
gnash::TextField::AUTOSIZE_CENTER
@ AUTOSIZE_CENTER
Expand TextField, anchor the horizontal center.
Definition: TextField.h:89
gnash::TextFormat_as::bullet
const boost::optional< bool > & bullet() const
Whether the text should have a bullet.
Definition: TextFormat_as.h:65
gnash::TextField::mouseEnabled
bool mouseEnabled() const
Returns true for now, TextField is always "Mouse-Enabled".
Definition: TextField.h:125
gnash::TextField::mouseEvent
void mouseEvent(const event_id &id)
This function is called as a user-input handler.
Definition: TextField.cpp:733
gnash::TextField::getType
TypeValue getType() const
Get type (input, dynamic or invalid)
Definition: TextField.h:348
path
VGPath path
Definition: testr_gtk.cpp:84
gnash::TextField::get_htmltext_value
std::string get_htmltext_value() const
Return value of our htmlText.
Definition: TextField.cpp:867
gnash::MovieClip::getDefinitionVersion
virtual int getDefinitionVersion() const
Return the version of the SWF this MovieClip was parsed from.
Definition: MovieClip.cpp:531
gnash::SWF::TextRecord::displayRecords
static void displayRecords(Renderer &renderer, const Transform &xform, const TextRecords &records, bool embedded=true)
Render the given glyph records.
Definition: TextRecord.cpp:163
gnash::TextField::setWordWrap
void setWordWrap(bool on)
Set wordWrap parameter.
Definition: TextField.cpp:2282
gnash::key::DOWN
@ DOWN
Definition: GnashKey.h:207
gnash::SWFCxForm::transform
rgba transform(const rgba &in) const
Transform the given color, return the result.
Definition: SWFCxForm.cpp:49
gnash::SWF::DefineEditTextTag::defaultText
const std::string & defaultText() const
Definition: DefineEditTextTag.h:74
gnash::TextField::setTextValue
void setTextValue(const std::wstring &wstr)
Set our text to the given string.
Definition: TextField.cpp:825
gnash::SWFRect::expand_to_point
void expand_to_point(std::int32_t x, std::int32_t y)
Expand this rectangle to enclose the given point.
Definition: SWFRect.h:171
Movie.h
movie_root.h
gnash::Transform::colorTransform
SWFCxForm colorTransform
Definition: Transform.h:60
gnash::key::BACKSPACE
@ BACKSPACE
Definition: GnashKey.h:53
gnash::TextField::getAlignment
TextAlignment getAlignment() const
Definition: TextField.h:484
gnash::TextField::setSelection
void setSelection(int start, int end)
Set the current selection.
Definition: TextField.cpp:502
height
@ height
Definition: klash_part.cpp:329
gnash::TextField::~TextField
~TextField()
Definition: TextField.cpp:210
gnash::log_swferror
void log_swferror(StringType msg, Args... args)
Definition: log.h:325
gnash::TextField::typeInput
@ typeInput
Accept user input.
Definition: TextField.h:106
gnash::TextField::setRightMargin
void setRightMargin(std::uint16_t h)
Definition: TextField.cpp:2384
gnash::as_object
The base class for all ActionScript objects.
Definition: as_object.h:162
gnash::MovieClip::remove_display_object
void remove_display_object(const SWF::PlaceObject2Tag *tag, DisplayList &dlist)
Proxy of DisplayList::removeDisplayObject()
Definition: MovieClip.cpp:1368
gnash::DisplayObject::MaskRenderer
Render a dynamic mask for a specified DisplayObject.
Definition: DisplayObject.h:969
gnash::TextField::setType
void setType(TypeValue val)
Set type (input or dynamic)
Definition: TextField.h:345
gnash::TextField::getDisplay
TextFormatDisplay getDisplay() const
Definition: TextField.h:503
gnash::movie_root::mousePosition
std::pair< std::int32_t, std::int32_t > mousePosition() const
Use this to retrieve the last state of the mouse.
Definition: movie_root.cpp:736
ObjectURI.h
gnash::SWF::TextRecord::setFont
void setFont(boost::intrusive_ptr< const Font > f)
Definition: TextRecord.h:113
gnash::TextField::TEXTFORMAT_BLOCK
@ TEXTFORMAT_BLOCK
Definition: TextField.h:75
gnash::Transform::matrix
SWFMatrix matrix
Definition: Transform.h:59
gnash::SWFRect::get_x_max
std::int32_t get_x_max() const
Get the x coordinate of the right-down corner.
Definition: SWFRect.h:122
gnash::TextField::setbottomScroll
void setbottomScroll(size_t bottomScroll)
Definition: TextField.h:576
gnash::TextField::getSelection
const std::pair< size_t, size_t > & getSelection() const
Get a std::pair of size_t with start/end of selection.
Definition: TextField.h:182
gnash::SWFRect::getRange
geometry::Range2d< std::int32_t > getRange() const
Construct and return a Range2d object.
Definition: SWFRect.h:222
gnash::TextFormat_as::blockIndent
const boost::optional< std::uint32_t > & blockIndent() const
The block indent.
Definition: TextFormat_as.h:94
gnash::NSV::PROP_BROADCAST_MESSAGE
@ PROP_BROADCAST_MESSAGE
Definition: namedStrings.h:139
gnash::log_debug
void log_debug(StringType msg, Args... args)
Definition: log.h:301
y
std::int32_t y
Definition: BitmapData_as.cpp:435
gnash::TextField::getCaretIndex
size_t getCaretIndex() const
Definition: TextField.h:174
gnash::TextField::setMaxScroll
void setMaxScroll(size_t maxScroll)
Definition: TextField.h:564
gnash::key::i
@ i
Definition: GnashKey.h:155
gnash::TextField::setEmbedFonts
void setEmbedFonts(bool use)
Set whether this TextField should use embedded font glyphs, or use device font glyphs.
Definition: TextField.cpp:2272
LOG_ONCE
#define LOG_ONCE(x)
Definition: log.h:49
gnash::rgba
A basic RGBA type.
Definition: RGBA.h:36
gnash::SWFMatrix::invert
SWFMatrix & invert()
Invert this SWFMatrix and return the result.
Definition: SWFMatrix.cpp:288
gnash::typeName
std::string typeName(const T &inst)
Definition: utility.h:93
gnash::TextField::setBackgroundColor
void setBackgroundColor(const rgba &col)
Set color of the background.
Definition: TextField.cpp:2250
gnash::TextField::ALIGN_RIGHT
@ ALIGN_RIGHT
Definition: TextField.h:67
gnash::TextField::setDrawBackground
void setDrawBackground(bool draw)
Specify whether to draw the background.
Definition: TextField.cpp:2235
gnash::TextField::topmostMouseEntity
InteractiveObject * topmostMouseEntity(std::int32_t x, std::int32_t y)
Returns a pointer to the topmost InteractiveObject at (x,y)
Definition: TextField.cpp:773
gnash::TextField::removeTextField
void removeTextField()
Remove this textfield from the stage.
Definition: TextField.cpp:215
gnash::TextField::add_invalidated_bounds
void add_invalidated_bounds(InvalidatedRanges &ranges, bool force)
Add the DisplayObject's invalidated bounds to the given ranges list.
Definition: TextField.cpp:379
gnash::TextField::LineStarts
std::vector< size_t > LineStarts
Definition: TextField.h:61
gnash::pixelsToTwips
std::int32_t pixelsToTwips(double a)
Definition: GnashNumeric.h:144
gnash::Renderer::drawLine
virtual void drawLine(const std::vector< point > &coords, const rgba &color, const SWFMatrix &mat)=0
Draw a line-strip directly, using a thin, solid line.
_
#define _(String)
Definition: log.h:44
Renderer.h
gnash::TextField::get_text_value
std::string get_text_value() const
Return value of our text.
Definition: TextField.cpp:851
gnash::Font::name
const std::string & name() const
Get name of this font.
Definition: Font.h:142
gnash::as_environment
Provides information about timeline context.
Definition: as_environment.h:51
gnash::TextField::maxChars
std::int32_t maxChars() const
Get the current maxChars setting of the TextField.
Definition: TextField.h:280
gnash::event_id
A class to identify 'static' SWF events (system events).
Definition: event_id.h:53
gnash::SWFRect::expand_to_rect
DSOEXPORT void expand_to_rect(const SWFRect &r)
Makes union of the given and the current SWFRect.
Definition: SWFRect.cpp:56
gnash::parsePath
bool parsePath(const std::string &var_path_in, std::string &path, std::string &var)
Definition: as_environment.cpp:397
gnash::TextField::setMaxHScroll
void setMaxHScroll(size_t maxHScroll)
Definition: TextField.h:572
Transform.h
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::key::DELETEKEY
@ DELETEKEY
Definition: GnashKey.h:177
gnash::TextFormat_as::underlined
const boost::optional< bool > & underlined() const
Return a Boolean value that indicates whether the text is underlined.
Definition: TextFormat_as.h:53
gnash::SWFRect::is_null
bool is_null() const
returns true if this is a NULL rectangle
Definition: SWFRect.h:75
gnash::SWF::DefineEditTextTag::getFont
boost::intrusive_ptr< Font > getFont() const
Definition: DefineEditTextTag.h:183
gnash::TextField::ALIGN_CENTER
@ ALIGN_CENTER
Definition: TextField.h:68
gnash::event_id::id
EventCode id() const
Return the identifier for this event type.
Definition: event_id.h:141
gnash::SWFRect::get_y_max
std::int32_t get_y_max() const
Get the y coordinate of the right-down corner.
Definition: SWFRect.h:136
gnash::getWorldMatrix
SWFMatrix getWorldMatrix(const DisplayObject &d, bool includeRoot=true)
Get concatenated SWFMatrix (all ancestor transforms and our SWFMatrix)
Definition: DisplayObject.h:1131
gnash::DisplayObject::get_environment
virtual as_environment & get_environment()
Return a reference to the variable scope of this DisplayObject.
Definition: DisplayObject.h:233
gnash::TextField::setDisplay
void setDisplay(TextFormatDisplay display)
Definition: TextField.cpp:2348
gnash::TextField::getFont
const Font * getFont()
Definition: TextField.h:446
gnash::TextField::setBlockIndent
void setBlockIndent(std::uint16_t h)
Definition: TextField.cpp:2375
gnash::Renderer
Base class for render handlers.
Definition: Renderer.h:189
GnashKey.h
gnash::key::m
@ m
Definition: GnashKey.h:159
gnash::key::ASCII
@ ASCII
Definition: GnashKey.h:333
gnash::DisplayObject::m_old_invalidated_ranges
InvalidatedRanges m_old_invalidated_ranges
Bounds of this DisplayObject instance before first invalidation since last call to clear_invalidated(...
Definition: DisplayObject.h:1029
gnash::key::s
@ s
Definition: GnashKey.h:165
gnash::colorFromHexString
rgba colorFromHexString(const std::string &color)
Create an RGBA value from a hex string (e.g. FF0000)
Definition: RGBA.cpp:41
gnash::TextField::setFont
boost::intrusive_ptr< const Font > setFont(boost::intrusive_ptr< const Font > newfont)
Set our font, return previously set one.
Definition: TextField.cpp:945
gnash::SWFRect::set_to_rect
void set_to_rect(std::int32_t x1, std::int32_t y1, std::int32_t x2, std::int32_t y2)
Definition: SWFRect.h:161
start
@ start
Definition: klash_part.cpp:330
gnash::movie_root::getURL
void getURL(const std::string &urlstr, const std::string &target, const std::string &data, MovieClip::VariablesMethod method)
Send a request to the hosting application (e.g. browser).
Definition: movie_root.cpp:2177
gnash::TextField::getBorderColor
rgba getBorderColor() const
Return color of the border.
Definition: TextField.cpp:2214
Global_as.h
gnash::SWFCxForm
Color transformation record.
Definition: SWFCxForm.h:35
gnash::TextField::TextFormatDisplay
TextFormatDisplay
Text format display values.
Definition: TextField.h:74
gnash::DisplayObject::transform
const Transform & transform() const
Definition: DisplayObject.h:292
gnash::TextField::AUTOSIZE_RIGHT
@ AUTOSIZE_RIGHT
Expand TextField, anchor the top-right side.
Definition: TextField.h:92
gnash::TextFormat_as
The TextFormat_as Relay type stores text properties.
Definition: TextFormat_as.h:45
gnash::DisplayObject::getTarget
std::string DSOEXPORT getTarget() const
Return full path to this object, in dot notation.
Definition: DisplayObject.cpp:621
gnash::TextField::password
bool password() const
Get the current password setting of the TextField.
Definition: TextField.h:306
gnash::TextField::setHtml
void setHtml(bool on)
Set html parameter.
Definition: TextField.h:402
SWFRect.h
gnash::MovieClip
A MovieClip is a container for DisplayObjects.
Definition: MovieClip.h:84
gnash::TextField::setLeading
void setLeading(std::int16_t h)
Definition: TextField.cpp:2292
gnash::getVM
VM & getVM(const as_environment &env)
Definition: as_environment.h:222
TextRecord.h
gnash::TextField::typeDynamic
@ typeDynamic
Definition: TextField.h:103
gnash::TextFormat_as::color
const boost::optional< rgba > & color() const
Return the color of text using this text format.
Definition: TextFormat_as.h:62
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::TextFormat_as::size
const boost::optional< std::uint16_t > & size() const
Return a float that indicates the point size in twips.
Definition: TextFormat_as.h:111
gnash::SWF::TextRecord::getURL
const std::string & getURL() const
Definition: TextRecord.h:121
gnash::TextField::getHScroll
size_t getHScroll() const
Definition: TextField.h:538
gnash::key::PGUP
@ PGUP
Definition: GnashKey.h:213
gnash::TextField::cursorRecord
size_t cursorRecord()
Returns the number of the record that the cursor is in.
Definition: TextField.cpp:274
gnash::key::LEFT
@ LEFT
Definition: GnashKey.h:209
gnash::key::k
@ k
Definition: GnashKey.h:157
gnash::InteractiveObject
The base class for interactive objects.
Definition: InteractiveObject.h:45
gnash::TextField::set_variable_name
void set_variable_name(const std::string &newname)
Definition: TextField.cpp:2163
gnash::key::RIGHT
@ RIGHT
Definition: GnashKey.h:208
IF_VERBOSE_MALFORMED_SWF
#define IF_VERBOSE_MALFORMED_SWF(x)
Definition: log.h:404
gnash::TextField::setTextFormat
void setTextFormat(TextFormat_as &tf)
Definition: TextField.cpp:875
gnash::SWFRect
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:45
gnash::TextField::getDrawBackground
bool getDrawBackground() const
Return true if the 'background' should be drawn.
Definition: TextField.cpp:2229
gnash::TextField::pointInShape
bool pointInShape(std::int32_t x, std::int32_t y) const
Return true if the given point falls in this DisplayObject's shape.
Definition: TextField.cpp:2190
gnash::key::t
@ t
Definition: GnashKey.h:166
color
const VGfloat color[4]
Definition: testr_gtk.cpp:82
DefineEditTextTag.h
gnash::callMethod
as_value callMethod(fn_call::Args &args, as_object *obj, const ObjectURI &uri)
Call a member function of this object in an AS-compatible way.
Definition: Global_as.h:219
gnash::TextField::setDrawBorder
void setDrawBorder(bool draw)
Specify whether to draw the border.
Definition: TextField.cpp:2205
gnash::TextField::getMaxScroll
size_t getMaxScroll() const
Definition: TextField.h:533
gnash::SWF::TextRecord::addGlyph
void addGlyph(const GlyphEntry &ge, Glyphs::size_type num=1)
Definition: TextRecord.h:103
gnash::TextField::parseTypeValue
static TypeValue parseTypeValue(const std::string &val)
Parse type string value.
Definition: TextField.cpp:2412
gnash::SWF::TextRecord::getTarget
const std::string & getTarget() const
Definition: TextRecord.h:129
gnash::TextFormat_as::rightMargin
const boost::optional< std::uint16_t > & rightMargin() const
Indicates the right margin of the paragraph in twips.
Definition: TextFormat_as.h:106
gnash::TextField::ALIGN_LEFT
@ ALIGN_LEFT
Definition: TextField.h:66
gnash::SWF::TextRecord::setColor
void setColor(const rgba &color)
Definition: TextRecord.h:180
gnash::fontlib::get_font
Font * get_font(const std::string &name, bool bold, bool italic)
Definition: fontlib.cpp:50
gnash::TextField::getRightMargin
std::uint16_t getRightMargin() const
Definition: TextField.h:463
gnash::renderer::opengl::for_each
void for_each(C &container, R(T::*pmf)(const A &), const A &arg)
Definition: Renderer_ogl.cpp:690
gnash::TextField::getBounds
virtual SWFRect getBounds() const
Get bounding SWFRect of this TextField.
Definition: TextField.h:216
gnash::geometry::Point2d::x
std::int32_t x
The x coordinate.
Definition: Point2d.h:43
gnash::DisplayObject::get_depth
int get_depth() const
Definition: DisplayObject.h:268
gnash::SWFRect::get_x_min
std::int32_t get_x_min() const
Get the x coordinate of the left-up corner.
Definition: SWFRect.h:115
gnash::TextField::isRestrict
bool isRestrict() const
Definition: TextField.h:518
gnash::TextField::TextAlignment
TextAlignment
Text alignment values.
Definition: TextField.h:65
gnash::key::codeMap
const unsigned char codeMap[KEYCOUNT][TYPES]
Definition: GnashKey.h:337
StringPredicates.h
gnash::TextField::isSelectable
bool isSelectable() const
Return true if the TextField text is selectable.
Definition: TextField.h:407
gnash::key::INSERT
@ INSERT
Definition: GnashKey.h:210
gnash::key::PGDN
@ PGDN
Definition: GnashKey.h:214
gnash::key::END
@ END
Definition: GnashKey.h:212
gnash::TextField::multiline
void multiline(bool b)
Set the current multiline setting of the TextField.
Definition: TextField.h:301
gnash::TextFormat_as::target
const boost::optional< std::string > & target() const
Definition: TextFormat_as.h:88
IF_VERBOSE_ASCODING_ERRORS
#define IF_VERBOSE_ASCODING_ERRORS(x)
Definition: log.h:397
gnash::TextFormat_as::tabStops
const boost::optional< std::vector< int > > & tabStops() const
Definition: TextFormat_as.h:74
gnash::TextField::setLeftMargin
void setLeftMargin(std::uint16_t h)
Definition: TextField.cpp:2393
gnash::key::code
code
Definition: GnashKey.h:44
MouseButtonState.h
gnash::SWFMatrix::transform
void transform(geometry::Point2d &p) const
Transform a given point by our SWFMatrix.
Definition: SWFMatrix.cpp:99
Point2d.h
gnash::key::ENTER
@ ENTER
Definition: GnashKey.h:58
gnash::key::h
@ h
Definition: GnashKey.h:154
gnash::TextField::doHtml
bool doHtml() const
Return true if HTML markup in text should be rendered.
Definition: TextField.h:394
gnash::StringNoCaseEqual
A case-insensitive string equality operator.
Definition: StringPredicates.h:42
gnash::TextField::setBorderColor
void setBorderColor(const rgba &col)
Set color of the border.
Definition: TextField.cpp:2220
gnash::SWFMatrix::concatenate_translation
void concatenate_translation(int _tx, int _ty)
Concatenate a translation onto the front of our SWFMatrix.
Definition: SWFMatrix.cpp:165
gnash::TextFormat_as::indent
const boost::optional< std::uint16_t > & indent() const
Indentation from left margin to the first character in the paragraph.
Definition: TextFormat_as.h:79
PADDING_TWIPS
#define PADDING_TWIPS
Definition: TextField.cpp:64
gnash::TextField::getDefinitionVersion
virtual int getDefinitionVersion() const
Return the version of the SWF this was parsed from.
Definition: TextField.cpp:1882
RGBA.h
gnash::TextField::updateText
void updateText(const std::string &s)
Set our text to the given string by effect of an update of a.
Definition: TextField.cpp:790
MovieClip.h
gnash::SWFRect::height
std::int32_t height() const
Return height of this rectangle in TWIPS.
Definition: SWFRect.h:109
gnash::TextField::TextField
TextField(as_object *object, DisplayObject *parent, const SWF::DefineEditTextTag &def)
Constructs a TextField as specified in a DefineEditText tag.
Definition: TextField.cpp:76
gnash::key::p
@ p
Definition: GnashKey.h:162
gnash::TextField::getBackgroundColor
rgba getBackgroundColor() const
Return color of the background.
Definition: TextField.cpp:2244
gnash::TextField::getVariableName
const std::string & getVariableName() const
Definition: TextField.h:144
gnash::as_environment::target
DisplayObject * target() const
Definition: as_environment.h:61
gnash::key::q
@ q
Definition: GnashKey.h:163
gnash::key::UP
@ UP
Definition: GnashKey.h:206
gnash::TextField::setTarget
void setTarget(std::string target)
Definition: TextField.cpp:2339
gnash::point
geometry::Point2d point
Definition: Point2d.h:143
gnash::key::HOME
@ HOME
Definition: GnashKey.h:211
gnash::TextField::getUnderlined
bool getUnderlined() const
Definition: TextField.h:498
gnash::key::_1
@ _1
Definition: GnashKey.h:95
gnash::TextField::setFontHeight
void setFontHeight(std::uint16_t h)
Definition: TextField.cpp:2402
gnash::TextField::getBottomScroll
size_t getBottomScroll() const
Definition: TextField.h:548
gnash::Renderer::draw_poly
virtual void draw_poly(const std::vector< point > &corners, const rgba &fill, const rgba &outline, const SWFMatrix &mat, bool masked)=0
Draw a simple, solid filled polygon with a thin (~1 pixel) outline.
GnashNumeric.h
Font.h
gnash::TextField::display
virtual void display(Renderer &renderer, const Transform &xform)
Draw the dynamic string.
Definition: TextField.cpp:289
gnash::TextFormat_as::leftMargin
const boost::optional< std::uint16_t > & leftMargin() const
Indicates the left margin of the paragraph, in points.
Definition: TextFormat_as.h:103
gnash::TextField::setAlignment
void setAlignment(TextAlignment h)
Definition: TextField.cpp:2357
gnash::DisplayObject::set_invalidated
void set_invalidated()
This function marks the DisplayObject as being modified in aspect and keeps track of current invalida...
Definition: DisplayObject.cpp:183
gnash::TextField::setSelectable
void setSelectable(bool v)
Set 'selectable' parameter.
Definition: TextField.h:416
gnash::TextField::setBullet
void setBullet(bool b)
Definition: TextField.cpp:2310
gnash::TextField::typeInvalid
@ typeInvalid
Invalid value.
Definition: TextField.h:99
gnash::event_id::PRESS
@ PRESS
Definition: event_id.h:62
gnash::SWFMatrix
Definition: SWFMatrix.h:54
gnash::MovieClip::METHOD_NONE
@ METHOD_NONE
Definition: MovieClip.h:420
gnash::geometry::Point2d
2D Point class
Definition: Point2d.h:39
gnash::TextField::AUTOSIZE_NONE
@ AUTOSIZE_NONE
Do not automatically resize TextField as text grow/shrink.
Definition: TextField.h:83
gnash::TextField::getTextBoundingBox
const SWFRect & getTextBoundingBox() const
Definition: TextField.h:587
gnash::TextField::getBullet
bool getBullet() const
Definition: TextField.h:508
gnash::TextField::getTabStops
const std::vector< int > & getTabStops() const
Definition: TextField.h:513
gnash::TextField::getDrawBorder
bool getDrawBorder() const
Return true if this TextField should have its border visible.
Definition: TextField.cpp:2199
gnash::TextField::getTextAlignment
TextAlignment getTextAlignment()
Return text TextAlignment.
Definition: TextField.cpp:2450
gnash::TextField::setTabStops
void setTabStops(const std::vector< int > &tabStops)
Definition: TextField.cpp:2318
gnash::TextField::getBlockIndent
std::uint16_t getBlockIndent() const
Definition: TextField.h:477
gnash::TextField::TypeValue
TypeValue
Possible type values.
Definition: TextField.h:96
gnash::log_aserror
void log_aserror(StringType msg, Args... args)
Definition: log.h:331
log.h
gnash::DisplayObject::clear_invalidated
void clear_invalidated()
Definition: DisplayObject.h:720
gnash::TextField::AutoSize
AutoSize
Possible autoSize values.
Definition: TextField.h:80
gnash::TextField::isReadOnly
bool isReadOnly() const
Return true if this TextField is read-only.
Definition: TextField.h:354
gnash::DisplayObject::parent
DisplayObject * parent() const
Return the parent of this DisplayObject, or NULL if the DisplayObject has no parent.
Definition: DisplayObject.h:252
gnash::TextField::setScroll
void setScroll(size_t scroll)
Definition: TextField.h:560
utf8.h
gnash::geometry::SnappingRanges2d::add
void add(const RangeType &range)
Add a Range to the set, merging when possible and appropriate.
Definition: snappingrange.h:250
gnash::TextFormat_as::leading
const boost::optional< std::uint16_t > & leading() const
Definition: TextFormat_as.h:100
gnash::TextField::setHeight
virtual void setHeight(double height)
Override of DisplayObject::setHeight.
Definition: TextField.cpp:2521
gnash::TextField::doWordWrap
bool doWordWrap() const
Return true if text should continue to next available line when hitting end of bounding box.
Definition: TextField.h:379
gnash::TextField::setIndent
void setIndent(std::uint16_t h)
Definition: TextField.cpp:2366
url
std::string url
Definition: gnash.cpp:59
gnash::Font::get_glyph_index
int get_glyph_index(std::uint16_t code, bool embedded) const
Return the glyph index for a given character code.
Definition: Font.cpp:201
as_environment.h
gnash::TextField::password
void password(bool b)
Set the current password setting of the TextField.
Definition: TextField.h:314
gnash::getObject
as_object * getObject(const DisplayObject *d)
Return the as_object associated with a DisplayObject if it exists.
Definition: DisplayObject.h:1160
gnash::key::f
@ f
Definition: GnashKey.h:152
gnash::utf8::encodeCanonicalString
std::string encodeCanonicalString(const std::wstring &wstr, int version)
Converts a std::wstring into canonical std::string.
Definition: utf8.cpp:67
gnash::TextField::maxChars
void maxChars(std::int32_t max)
Set the current maxChars setting of the TextField.
Definition: TextField.h:288
TextField.h
gnash::image::end
pixel_iterator< T > end(GnashImage &im)
Definition: ImageIterators.h:198
gnash::TextField::setWidth
virtual void setWidth(double width)
Override of DisplayObject::setWidth.
Definition: TextField.cpp:2511
gnash::TextField::AUTOSIZE_LEFT
@ AUTOSIZE_LEFT
Expand TextField, anchor the top-left side.
Definition: TextField.h:86
gnash::TextField
An instance of a DefineEditTextTag.
Definition: TextField.h:57
gnash::TextField::getMaxHScroll
size_t getMaxHScroll() const
Definition: TextField.h:543
gnash::movie_root
This class represents the 'Stage' and top-level movie.
Definition: movie_root.h:151
gnash::Font
A Font resource.
Definition: Font.h:90
DSOTEXPORT
#define DSOTEXPORT
Definition: dsodefs.h:63
namedStrings.h
gnash::as_object::set_member
virtual bool set_member(const ObjectURI &uri, const as_value &val, bool ifFound=false)
Set a member value.
Definition: as_object.cpp:583
gnash::getSWFVersion
int getSWFVersion(const as_environment &env)
Definition: as_environment.cpp:657
gnash::TextField::setHScroll
void setHScroll(size_t hScroll)
Definition: TextField.h:568
gnash::SWFRect::point_test
bool point_test(std::int32_t x, std::int32_t y) const
Return true if the given point is inside this SWFRect.
Definition: SWFRect.h:143
gnash::key::c
@ c
Definition: GnashKey.h:149
gnash::TextField::getScroll
size_t getScroll() const
Definition: TextField.h:528
gnash::SWF::DefineEditTextTag
SWF Tag DefineEditText (37).
Definition: DefineEditTextTag.h:57
gnash::TextField::getIndent
std::uint16_t getIndent() const
Definition: TextField.h:470
gnash::fontlib::get_default_font
boost::intrusive_ptr< Font > get_default_font()
Return a default device font.
Definition: fontlib.cpp:42
gnash::TextField::ALIGN_JUSTIFY
@ ALIGN_JUSTIFY
Definition: TextField.h:69
gnash::utf8::decodeCanonicalString
std::wstring decodeCanonicalString(const std::string &str, int version)
Converts a std::string with multibyte characters into a std::wstring.
Definition: utf8.cpp:39
gnash::SWFRect::width
std::int32_t width() const
Return width of this rectangle in TWIPS.
Definition: SWFRect.h:103
gnash::TextField::keyInput
void keyInput(key::code k)
Handle user input from a key press.
Definition: TextField.cpp:527
gnash::TextFormat_as::align
const boost::optional< TextField::TextAlignment > & align() const
Paragraph alignment.
Definition: TextFormat_as.h:82
gnash::getURI
ObjectURI getURI(const VM &vm, const std::string &str, bool lowerCaseHint=false)
Definition: VM.h:290
gnash::geometry::Point2d::y
std::int32_t y
The y coordinate.
Definition: Point2d.h:46
gnash::TextField::getEmbedFonts
bool getEmbedFonts() const
Return true if this TextField should use embedded font glyphs, false if it should use device font gly...
Definition: TextField.h:275
gnash::TextField::getRestrict
const std::string & getRestrict() const
Definition: TextField.h:523
gnash::DisplayObject
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:169
TextFormat_as.h
gnash::TextField::setRestrict
void setRestrict(const std::string &restrict)
Definition: TextField.cpp:394
gnash::TextField::getLeftMargin
std::uint16_t getLeftMargin() const
Definition: TextField.h:456
gnash::Font::get_advance
float get_advance(int glyph_index, bool embedded) const
Return the advance value for the given glyph index.
Definition: Font.cpp:221
gnash::TextField::setTextColor
void setTextColor(const rgba &col)
Set color of the text.
Definition: TextField.cpp:2259
gnash::DisplayObject::get_root
virtual Movie * get_root() const
Return the relative root of this DisplayObject.
Definition: DisplayObject.h:531
gnash::TextField::getLeading
std::int16_t getLeading() const
Definition: TextField.h:491
gnash::Transform
The Transform class expresses a stage in a cumulative transformation.
Definition: Transform.h:34
gnash::TextField::setAutoSize
void setAutoSize(AutoSize val)
Set autoSize value.
Definition: TextField.cpp:2440
gnash::TextField::isSelectableTextField
virtual bool isSelectableTextField() const
Return true if the TextField text is selectable.
Definition: TextField.h:423
width
@ width
Definition: klash_part.cpp:329
gnash::getMatrix
const SWFMatrix & getMatrix(const DisplayObject &o)
Get local transform SWFMatrix for this DisplayObject.
Definition: DisplayObject.h:1119
gnash::key::SWF
@ SWF
Definition: GnashKey.h:331
gnash::log_unimpl
void log_unimpl(StringType msg, Args... args)
Definition: log.h:289
gnash::key::u
@ u
Definition: GnashKey.h:167
gnash::DisplayObject::invalidated
bool invalidated() const
Return whether this DisplayObject has been invalidated or not.
Definition: DisplayObject.h:657
gnash::SWF::TextRecord
Store a TextRecord.
Definition: TextRecord.h:48
gnash::TextField::getTextColor
const rgba & getTextColor() const
Return color of the text.
Definition: TextField.h:261
x
std::int32_t x
Definition: BitmapData_as.cpp:434
gnash::TextField::setUnderlined
void setUnderlined(bool v)
Definition: TextField.cpp:2301
gnash::TextField::replaceSelection
void replaceSelection(const std::string &replace)
Replace the current selection with the new text.
Definition: TextField.cpp:481
gnash::TextField::setURL
void setURL(std::string url)
Definition: TextField.cpp:2330
gnash::findObject
as_object * findObject(const as_environment &ctx, const std::string &path, const as_environment::ScopeStack *scope)
Find the object referenced by the given path.
Definition: as_environment.cpp:116
snappingrange.h
gnash::key::b
@ b
Definition: GnashKey.h:148
test.v
v
Definition: test.py:11
gnash::SWF::TextRecord::getFont
const Font * getFont() const
Definition: TextRecord.h:133
gnash::TextField::getTextDefined
bool getTextDefined() const
Return true if text is defined.
Definition: TextField.h:172
InteractiveObject.h
gnash::key::e
@ e
Definition: GnashKey.h:151
gnash::DisplayObject::stage
movie_root & stage() const
Get the movie_root to which this DisplayObject belongs.
Definition: DisplayObject.h:981
gnash::setHeight
void setHeight(DisplayObject &o, const as_value &val)
Definition: DisplayObject.cpp:365
gnash::TextField::typeValueName
static const char * typeValueName(TypeValue val)
Return type value as a string.
Definition: TextField.cpp:2423
gnash::TextFormat_as::display
TextField::TextFormatDisplay display() const
The display type (block or inline).
Definition: TextFormat_as.h:70
gnash::readOnly
bool readOnly(const Property &prop)
is this a read-only member ?
Definition: Property.h:417
gnash::SWFRect::get_y_min
std::int32_t get_y_min() const
Get the y coordinate of the left-up corner.
Definition: SWFRect.h:129
gnash::TextField::getAutoSize
AutoSize getAutoSize() const
Get autoSize value.
Definition: TextField.h:325
gnash::TextField::getFontHeight
std::uint16_t getFontHeight() const
Definition: TextField.h:449
gnash::TextFormat_as::url
const boost::optional< std::string > & url() const
Definition: TextFormat_as.h:91
gnash::DisplayObject::visible
bool visible() const
Definition: DisplayObject.h:623
gnash::TextField::multiline
bool multiline() const
Get the current multiline setting of the TextField.
Definition: TextField.h:293
fontlib.h