dillo  3.0.5
About: dillo is a small, fast, extensible Web browser particularly suitable for older or smaller computers and embedded systems (but only limited or no support for frames, CSS, JavaScript, Java).
  Fossies Dox: dillo-3.0.5.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

types.hh
Go to the documentation of this file.
1 #ifndef __DW_TYPES_HH__
2 #define __DW_TYPES_HH__
3 
4 #ifndef __INCLUDED_FROM_DW_CORE_HH__
5 # error Do not include this file directly, use "core.hh" instead.
6 #endif
7 
8 namespace dw {
9 namespace core {
10 
11 namespace style {
12  class Style;
13 }
14 
16 {
20  HPOS_INTO_VIEW, /* scroll only, until the content in question comes
21  * into view */
23 };
24 
26 {
30  VPOS_INTO_VIEW, /* scroll only, until the content in question comes
31  * into view */
33 };
34 
38 
39 /*
40  * Different "layers" may be highlighted in a widget.
41  */
43 {
47 };
48 
49 struct Point
50 {
51  int x;
52  int y;
53 };
54 
59 {
60 public:
61  virtual bool isPointWithin (int x, int y) = 0;
62  virtual void draw (core::View *view, core::style::Style *style, int x,
63  int y) = 0;
64 };
65 
69 class Rectangle: public Shape
70 {
71 public:
72  int x;
73  int y;
74  int width;
75  int height;
76 
77  inline Rectangle () { }
78  Rectangle (int x, int y, int width, int height);
79 
80  void draw (core::View *view, core::style::Style *style, int x, int y);
81  bool intersectsWith (Rectangle *otherRect, Rectangle *dest);
82  bool isSubsetOf (Rectangle *otherRect);
83  bool isPointWithin (int x, int y);
84  bool isEmpty () { return width <= 0 || height <= 0; };
85 };
86 
90 class Circle: public Shape
91 {
92 public:
93  int x, y, radius;
94 
95  Circle (int x, int y, int radius);
96 
97  void draw (core::View *view, core::style::Style *style, int x, int y);
98  bool isPointWithin (int x, int y);
99 };
100 
104 class Polygon: public Shape
105 {
106 private:
108  int minx, miny, maxx, maxy;
109 
115  inline int zOfVectorProduct(int x1, int y1, int x2, int y2) {
116  return x1 * y2 - x2 * y1;
117  }
118 
119  bool linesCross0(int ax1, int ay1, int ax2, int ay2,
120  int bx1, int by1, int bx2, int by2);
121  bool linesCross(int ax1, int ay1, int ax2, int ay2,
122  int bx1, int by1, int bx2, int by2);
123 
124 public:
125  Polygon ();
126  ~Polygon ();
127 
128  void draw (core::View *view, core::style::Style *style, int x, int y);
129  void addPoint (int x, int y);
130  bool isPointWithin (int x, int y);
131 };
132 
140 class Region
141 {
142 private:
144 
145 public:
146  Region ();
147  ~Region ();
148 
149  void clear () { rectangleList->clear (); };
150 
151  void addRectangle (Rectangle *r);
152 
154  {
155  return rectangleList->iterator ();
156  };
157 };
158 
164 {
165  int x;
166  int y;
167  int width;
168  int ascent;
169  int descent;
170 };
171 
173 {
174  int width;
175  int ascent;
176  int descent;
177 };
178 
179 struct Extremes
180 {
181  int minWidth;
182  int maxWidth;
183 };
184 
185 struct Content
186 {
187  enum Type {
188  START = 1 << 0,
189  END = 1 << 1,
190  TEXT = 1 << 2,
191  WIDGET = 1 << 3,
192  BREAK = 1 << 4,
193  ALL = 0xff,
194  REAL_CONTENT = 0xff ^ (START | END),
196  };
197 
198  /* Content is embedded in struct Word therefore we
199  * try to be space efficient.
200  */
201  short type;
202  bool space;
203  union {
204  const char *text;
207  };
208 };
209 
210 } // namespace core
211 } // namespace dw
212 
213 #endif // __DW_TYPES_HH__
dw::core::Point
Definition: types.hh:49
dw::core::Rectangle::Rectangle
Rectangle()
Definition: types.hh:77
dw::core::HPosition
HPosition
Definition: types.hh:15
dw::core::Allocation::y
int y
Definition: types.hh:166
dw::core::HPOS_RIGHT
Definition: types.hh:19
dw::core::Polygon::minx
int minx
Definition: types.hh:108
dw::core::Allocation::x
int x
Definition: types.hh:165
dw::core::Region::rectangleList
lout::container::typed::List< Rectangle > * rectangleList
Definition: types.hh:143
dw::core::Extremes::maxWidth
int maxWidth
Definition: types.hh:182
dw::core::Polygon::addPoint
void addPoint(int x, int y)
Definition: types.cc:156
dw::core::HighlightLayer
HighlightLayer
Definition: types.hh:42
dw::core::Requisition
Definition: types.hh:172
dw::core::Circle::x
int x
Definition: types.hh:93
dw::core::VPOS_CENTER
Definition: types.hh:28
dw::core::Requisition::descent
int descent
Definition: types.hh:176
dw::core::Polygon
dw::core::Shape implemtation for polygons.
Definition: types.hh:104
dw::core::Rectangle::draw
void draw(core::View *view, core::style::Style *style, int x, int y)
Definition: types.cc:41
dw::core::Extremes::minWidth
int minWidth
Definition: types.hh:181
dw::core::RIGHT_CMD
Definition: types.hh:37
dw::core::Content::BREAK
Definition: types.hh:192
dw::core::Region::Region
Region()
Definition: types.cc:223
dw::core::Content::Type
Type
Definition: types.hh:187
dw::core::Polygon::linesCross
bool linesCross(int ax1, int ay1, int ax2, int ay2, int bx1, int by1, int bx2, int by2)
Return, whether the line, limited by (ax1, ay1) and (ax2, ay2), crosses the line, limited by (bx1,...
Definition: types.cc:189
dw::core::Circle::y
int y
Definition: types.hh:93
dw::core::Polygon::maxx
int maxx
Definition: types.hh:108
dw::core::Rectangle::intersectsWith
bool intersectsWith(Rectangle *otherRect, Rectangle *dest)
Definition: types.cc:53
dw::core::HPOS_INTO_VIEW
Definition: types.hh:20
dw::core::Circle::isPointWithin
bool isPointWithin(int x, int y)
Definition: types.cc:115
dw::core::LINE_DOWN_CMD
Definition: types.hh:36
dw::core::Rectangle::x
int x
Definition: types.hh:72
dw::core::Content::space
bool space
Definition: types.hh:202
dw::core::HIGHLIGHT_FINDTEXT
Definition: types.hh:45
dw::core::Allocation
Represents the allocation, i.e. actual position and size of a dw::core::Widget.
Definition: types.hh:163
dw::core::SCREEN_RIGHT_CMD
Definition: types.hh:36
dw::core::Content::text
const char * text
Definition: types.hh:204
dw::core::Content::SELECTION_CONTENT
Definition: types.hh:195
dw::core::HPOS_NO_CHANGE
Definition: types.hh:22
dw::core::Circle::draw
void draw(core::View *view, core::style::Style *style, int x, int y)
Definition: types.cc:106
dw::core::Region::rectangles
lout::container::typed::Iterator< Rectangle > rectangles()
Definition: types.hh:153
dw::core::VPOS_TOP
Definition: types.hh:27
dw::core::Polygon::~Polygon
~Polygon()
Definition: types.cc:131
lout::container::typed::Iterator
Typed version of container::untyped::Iterator.
Definition: container.hh:352
dw::core::Polygon::maxy
int maxy
Definition: types.hh:108
dw::core::Allocation::descent
int descent
Definition: types.hh:169
dw::core::Region::~Region
~Region()
Definition: types.cc:228
dw::core::Point::y
int y
Definition: types.hh:52
dw::core::Rectangle::isSubsetOf
bool isSubsetOf(Rectangle *otherRect)
Definition: types.cc:78
lout::object::Object
This is the base class for many other classes, which defines very common virtual methods.
Definition: object.hh:24
dw::core::Polygon::draw
void draw(core::View *view, core::style::Style *style, int x, int y)
Definition: types.cc:139
dw::core::Polygon::linesCross0
bool linesCross0(int ax1, int ay1, int ax2, int ay2, int bx1, int by1, int bx2, int by2)
Return, whether the line, limited by (ax1, ay1) and (ax2, ay2), crosses the unlimited line,...
Definition: types.cc:173
dw::core::Rectangle::isPointWithin
bool isPointWithin(int x, int y)
Definition: types.cc:87
dw::core::Content::ALL
Definition: types.hh:193
dw::core::Rectangle::height
int height
Definition: types.hh:75
dw::core::SCREEN_DOWN_CMD
Definition: types.hh:35
dw::core::Circle::radius
int radius
Definition: types.hh:93
dw::core::Requisition::ascent
int ascent
Definition: types.hh:175
dw::core::Shape::draw
virtual void draw(core::View *view, core::style::Style *style, int x, int y)=0
dw::core::Rectangle::isEmpty
bool isEmpty()
Definition: types.hh:84
dw::core::ScrollCommand
ScrollCommand
Definition: types.hh:35
dw::core::Requisition::width
int width
Definition: types.hh:174
dw::core::Shape
Abstract interface for different shapes.
Definition: types.hh:58
dw::core::Content::WIDGET
Definition: types.hh:191
dw::core::Rectangle
dw::core::Shape implemtation for simple rectangles.
Definition: types.hh:69
dw::core::Point::x
int x
Definition: types.hh:51
lout::container::typed::List
Typed version of container::untyped::List.
Definition: container.hh:425
dw::core::Extremes
Definition: types.hh:179
dw::core::HIGHLIGHT_NUM_LAYERS
Definition: types.hh:46
dw::core::View
An interface to encapsulate platform dependent drawing.
Definition: view.hh:16
dw::core::BOTTOM_CMD
Definition: types.hh:37
dw::core::Content::breakSpace
int breakSpace
Definition: types.hh:206
dw::core::Content::widget
Widget * widget
Definition: types.hh:205
dw::core::HPOS_LEFT
Definition: types.hh:17
dw::core::Content::END
Definition: types.hh:189
dw::core::HIGHLIGHT_SELECTION
Definition: types.hh:44
dw::core::Content::TEXT
Definition: types.hh:190
dw::core::VPOS_BOTTOM
Definition: types.hh:29
dw::core::Shape::isPointWithin
virtual bool isPointWithin(int x, int y)=0
dw::core::Allocation::ascent
int ascent
Definition: types.hh:168
dw::core::Region::addRectangle
void addRectangle(Rectangle *r)
Add a rectangle to the region and combine it with existing rectangles if possible....
Definition: types.cc:239
dw::core::VPosition
VPosition
Definition: types.hh:25
dw::core::Content
Definition: types.hh:185
dw::core::Circle
dw::core::Shape implemtation for simple circles.
Definition: types.hh:90
dw::core::Polygon::zOfVectorProduct
int zOfVectorProduct(int x1, int y1, int x2, int y2)
Return the z-coordinate of the vector product of two vectors, whose z-coordinate is 0 (so that x and ...
Definition: types.hh:115
dw::core::Polygon::points
lout::misc::SimpleVector< Point > * points
Definition: types.hh:107
dw::core::SCREEN_UP_CMD
Definition: types.hh:35
dw::core::Polygon::isPointWithin
bool isPointWithin(int x, int y)
Definition: types.cc:200
dw::core::Polygon::Polygon
Polygon()
Definition: types.cc:124
dw::core::Content::REAL_CONTENT
Definition: types.hh:194
dw::core::Widget
The base class of all dillo widgets.
Definition: widget.hh:23
dw::core::Region::clear
void clear()
Definition: types.hh:149
dw::core::VPOS_NO_CHANGE
Definition: types.hh:32
dw
Dw is in this namespace, or sub namespaces of this one.
Definition: alignedtextblock.cc:26
dw::core::LEFT_CMD
Definition: types.hh:37
dw::core::Content::type
short type
Definition: types.hh:201
dw::core::SCREEN_LEFT_CMD
Definition: types.hh:35
dw::core::HPOS_CENTER
Definition: types.hh:18
dw::core::Polygon::miny
int miny
Definition: types.hh:108
dw::core::TOP_CMD
Definition: types.hh:37
dw::core::Circle::Circle
Circle(int x, int y, int radius)
Definition: types.cc:96
dw::core::VPOS_INTO_VIEW
Definition: types.hh:30
dw::core::Region
Definition: types.hh:140
dw::core::Rectangle::width
int width
Definition: types.hh:74
lout::misc::SimpleVector
Simple (simpler than container::untyped::Vector and container::typed::Vector) template based vector.
Definition: misc.hh:71
dw::core::style::Style
Definition: style.hh:571
dw::core::Rectangle::y
int y
Definition: types.hh:73
dw::core::LINE_UP_CMD
Definition: types.hh:36
dw::core::Allocation::width
int width
Definition: types.hh:167
dw::core::Content::START
Definition: types.hh:188