Gnash  0.8.11dev
StaticText.h
Go to the documentation of this file.
1 // StaticText.h: StaticText DisplayObject implementation for Gnash.
2 //
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 #ifndef GNASH_STATIC_TEXT_H
21 #define GNASH_STATIC_TEXT_H
22 
23 #include "DisplayObject.h" // for inheritance
24 #include "swf/DefineTextTag.h"
25 
26 #include <vector>
27 #include <boost/dynamic_bitset.hpp>
28 #include <boost/intrusive_ptr.hpp>
29 #include <cassert>
30 
31 // Forward declarations
32 namespace gnash {
33  namespace SWF {
34  class TextRecord;
35  }
36 }
37 
38 namespace gnash {
39 
41 //
43 class StaticText : public DisplayObject
44 {
45 public:
46 
48  DisplayObject* parent)
49  :
50  DisplayObject(mr, object, parent),
51  _def(def),
52  _selectionColor(0, 255, 255, 255)
53  {
54  assert(_def);
55  }
56 
58  //
61  //
67  virtual StaticText* getStaticText(std::vector<const SWF::TextRecord*>& to,
68  size_t& numChars);
69 
70  virtual void display(Renderer& renderer, const Transform& xform);
71 
72  void setSelected(size_t pos, bool selected) {
73  _selectedText.set(pos, selected);
74  }
75 
77  //
84  const boost::dynamic_bitset<>& getSelected() const {
85  return _selectedText;
86  }
87 
88  void setSelectionColor(std::uint32_t color);
89 
90  virtual SWFRect getBounds() const {
91  return _def->bounds();
92  }
93 
94  virtual bool pointInShape(std::int32_t x, std::int32_t y) const;
95 
96  const rgba& selectionColor() const {
97  return _selectionColor;
98  }
99 
100 private:
101 
102  const boost::intrusive_ptr<const SWF::DefineTextTag> _def;
103 
105  //
108  boost::dynamic_bitset<> _selectedText;
109 
111  //
113  rgba _selectionColor;
114 
115 };
116 
117 
118 } // end namespace gnash
119 
120 
121 #endif
122 
123 
124 // Local Variables:
125 // mode: C++
126 // indent-tabs-mode: t
127 // End:
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:168
const boost::dynamic_bitset & getSelected() const
Return a bitset showing which DisplayObjects (by index) are selected.
Definition: StaticText.h:84
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
StaticText(movie_root &mr, as_object *object, const SWF::DefineTextTag *def, DisplayObject *parent)
Definition: StaticText.h:47
The base class for all ActionScript objects.
Definition: as_object.h:161
Base class for render handlers.
Definition: Renderer.h:188
const VGfloat color[4]
Definition: testr_gtk.cpp:82
void setSelected(size_t pos, bool selected)
Definition: StaticText.h:72
virtual SWFRect getBounds() const
Definition: StaticText.h:90
std::int32_t x
Definition: BitmapData_as.cpp:434
std::int32_t y
Definition: BitmapData_as.cpp:435
Static text fields, SWF-defined with read-only text.
Definition: StaticText.h:43
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:44
Definition: GnashKey.h:331
const rgba & selectionColor() const
Definition: StaticText.h:96
The Transform class expresses a stage in a cumulative transformation.
Definition: Transform.h:33
Static text definition tag.
Definition: DefineTextTag.h:42
This class represents the &#39;Stage&#39; and top-level movie.
Definition: movie_root.h:150
A basic RGBA type.
Definition: RGBA.h:35