19 #ifndef GNASH_TEXTFIELD_H
20 #define GNASH_TEXTFIELD_H
22 #include <boost/intrusive_ptr.hpp>
36 class DefineEditTextTag;
47 ,std::char_traits<wchar_t>
48 ,std::allocator<wchar_t> >
136 virtual int getDefinitionVersion()
const;
139 void mouseEvent(
const event_id&
id);
146 return _variable_name;
155 void set_variable_name(
const std::string& newname);
163 void updateText(
const std::string&
s);
166 std::string get_text_value()
const;
169 std::string get_htmltext_value()
const;
189 void replaceSelection(
const std::string& replace);
198 void setSelection(
int start,
int end);
203 virtual void setWidth(
double width);
222 bool pointInShape(boost::int32_t
x, boost::int32_t
y)
const;
225 bool getDrawBackground()
const;
230 void setDrawBackground(
bool draw);
233 rgba getBackgroundColor()
const;
240 void setBackgroundColor(
const rgba& col);
243 bool getDrawBorder()
const;
248 void setDrawBorder(
bool draw);
251 rgba getBorderColor()
const;
258 void setBorderColor(
const rgba& col);
270 void setTextColor(
const rgba& col);
322 void setEmbedFonts(
bool use);
331 TextAlignment getTextAlignment();
338 void setAutoSize(AutoSize val);
363 static TypeValue parseTypeValue(
const std::string& val);
373 static const char* typeValueName(TypeValue val);
391 void setWordWrap(
bool on);
425 return isSelectable();
436 void removeTextField();
443 boost::intrusive_ptr<const Font> setFont(
444 boost::intrusive_ptr<const Font> newfont);
454 void setFontHeight(boost::uint16_t
h);
461 void setLeftMargin(boost::uint16_t
h);
468 void setRightMargin(boost::uint16_t
h);
475 void setIndent(boost::uint16_t
h);
482 void setBlockIndent(boost::uint16_t
h);
489 void setAlignment(TextAlignment
h);
496 void setLeading(boost::int16_t
h);
520 return _restrictDefined;
550 return _bottomScroll;
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);
565 _maxScroll = maxScroll;
573 _maxHScroll = maxHScroll;
577 _bottomScroll = bottomScroll;
583 size_t cursorRecord();
588 return m_text_bounding_box;
595 void setTextValue(
const std::wstring& wstr);
607 void updateText(
const std::wstring&
s);
609 void updateHtmlText(
const std::wstring&
s);
617 virtual bool handleFocus();
620 virtual void killFocus();
626 void reset_bounding_box(boost::int32_t
x, boost::int32_t
y)
628 m_text_bounding_box.set_to_point(x, y);
640 void newLine(boost::int32_t& x, boost::int32_t& y,
641 SWF::TextRecord& rec,
int& last_space_glyph,
642 LineStarts::value_type& last_line_start_record,
float div);
645 void handleChar(std::wstring::const_iterator& it,
646 const std::wstring::const_iterator&
e, boost::int32_t& x,
647 boost::int32_t& y, SWF::TextRecord& rec,
int& last_code,
648 int& last_space_glyph,
649 LineStarts::value_type& last_line_start_record);
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;
671 float align_line(TextAlignment align,
int last_line_start_record,
float x);
690 void registerTextVariable();
692 typedef std::pair<as_object*, ObjectURI> VariableRef;
698 VariableRef parseTextVariableRef(
const std::string& variableName)
const;
704 void show_cursor(Renderer& renderer,
const SWFMatrix& mat);
709 boost::intrusive_ptr<const SWF::DefineEditTextTag> _tag;
721 std::wstring _htmlText;
724 SWFRect m_text_bounding_box;
726 typedef std::vector<SWF::TextRecord> TextRecords;
727 TextRecords _textRecords;
729 std::vector<size_t> _recordStarts;
731 TextRecords _displayRecords;
735 std::string _restrict;
736 std::set<wchar_t> _restrictedchars;
737 TextFormatDisplay _display;
738 std::vector<int> _tabStops;
739 LineStarts _line_starts;
746 std::string _variable_name;
748 rgba _backgroundColor;
754 TextAlignment _alignment;
756 boost::intrusive_ptr<const Font> _font;
763 size_t _bottomScroll;
764 size_t _linesindisplay;
783 std::pair<size_t, size_t> _selection;
785 boost::int16_t _leading;
786 boost::uint16_t _indent;
790 boost::uint16_t _blockIndent;
792 boost::uint16_t _leftMargin;
794 boost::uint16_t _rightMargin;
796 boost::uint16_t _fontHeight;
804 bool _restrictDefined;
822 bool _text_variable_registered;
824 bool _drawBackground;