Gnash  0.8.11dev
InteractiveObject.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_INTERACTIVE_DISPLAY_OBJECT_H
20 #define GNASH_INTERACTIVE_DISPLAY_OBJECT_H
21 
22 #include "DisplayObject.h" // for inheritance
23 #include "log.h"
24 #include "as_object.h" // for getRoot()
25 
26 #include <vector>
27 #include <cassert>
28 
29 namespace gnash {
30  class StaticText;
31  namespace SWF {
32  class TextRecord;
33  }
34 }
35 
36 namespace gnash {
37 
39 //
42 //
45 {
46 
47 public:
48 
50  :
51  DisplayObject(getRoot(*object), object, parent)
52  {
53  // It's a bit too late for this assertion as we've already
54  // deferenced it. All InteractiveObjects are AS-referenceable,
55  // so they must have an object.
56  assert(object);
57  }
58 
59  virtual ~InteractiveObject() {}
60 
62  virtual void display(Renderer& renderer, const Transform& xform) = 0;
63 
65  //
68  virtual bool mouseEnabled() const = 0;
69 
71  virtual bool trackAsMenu() {
72  return false;
73  }
74 
76  //
79  virtual StaticText* getStaticText(std::vector<const SWF::TextRecord*>&,
80  size_t&) {
81  return 0;
82  }
83 
85  //
89  virtual SWFRect getBounds() const = 0;
90 
94  //
115  virtual InteractiveObject* topmostMouseEntity(boost::int32_t /*x*/,
116  boost::int32_t /*y*/) = 0;
117 
119  //
122  virtual void mouseEvent(const event_id& id) = 0;
123 
125  //
132  virtual bool pointInShape(boost::int32_t x, boost::int32_t y) const
133  {
134  log_error("Character %s did not override pointInShape() - "
135  "using pointInBounds() instead", typeid(*this).name());
136  return pointInBounds(x, y);
137  }
138 
139  void add_invalidated_bounds(InvalidatedRanges& ranges, bool force) = 0;
140 
141 };
142 
143 
144 } // namespace gnash
145 
146 
147 #endif
148 
149 
150 // Local Variables:
151 // mode: C++
152 // indent-tabs-mode: t
153 // End: