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)  

fltkviewbase.cc
Go to the documentation of this file.
1 /*
2  * Dillo Widget
3  *
4  * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
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, see <http://www.gnu.org/licenses/>.
18  */
19 
20 
21 
22 #include "fltkviewport.hh"
23 
24 #include <FL/Fl.H>
25 #include <FL/fl_draw.H>
26 
27 #include <stdio.h>
28 #include "../lout/msg.h"
29 
30 using namespace lout::object;
31 using namespace lout::container::typed;
32 
33 namespace dw {
34 namespace fltk {
35 
36 FltkViewBase::BackBuffer::BackBuffer ()
37 {
38  w = 0;
39  h = 0;
40  created = false;
41 }
42 
43 FltkViewBase::BackBuffer::~BackBuffer ()
44 {
45  if (created)
46  fl_delete_offscreen (offscreen);
47 }
48 
49 void FltkViewBase::BackBuffer::setSize (int w, int h)
50 {
51  if (!created || w > this->w || h > this->h) {
52  this->w = w;
53  this->h = h;
54  if (created)
55  fl_delete_offscreen (offscreen);
56  offscreen = fl_create_offscreen (w, h);
57  created = true;
58  }
59 }
60 
61 FltkViewBase::BackBuffer *FltkViewBase::backBuffer;
62 bool FltkViewBase::backBufferInUse;
63 
64 FltkViewBase::FltkViewBase (int x, int y, int w, int h, const char *label):
65  Fl_Group (x, y, w, h, label)
66 {
67  Fl_Group::current(0);
68  canvasWidth = 1;
69  canvasHeight = 1;
70  bgColor = FL_WHITE;
71  mouse_x = mouse_y = 0;
72  focused_child = NULL;
73  exposeArea = NULL;
74  if (backBuffer == NULL) {
75  backBuffer = new BackBuffer ();
76  }
77  box(FL_NO_BOX);
78  resizable(NULL);
79 }
80 
82 {
83  cancelQueueDraw ();
84 }
85 
87  if (b && backBuffer == NULL) {
88  backBuffer = new BackBuffer ();
89  } else if (!b && backBuffer != NULL) {
90  delete backBuffer;
91  backBuffer = NULL;
92  }
93 }
94 
96 {
97  int d = damage ();
98 
99  if ((d & FL_DAMAGE_USER1) && !(d & FL_DAMAGE_EXPOSE)) {
101 
102  for (it = drawRegion.rectangles (); it.hasNext (); ) {
103  draw (it.getNext (), DRAW_BUFFERED);
104  }
105 
106  drawRegion.clear ();
107  d &= ~FL_DAMAGE_USER1;
108  }
109 
110  if (d & FL_DAMAGE_CHILD) {
111  drawChildWidgets ();
112  d &= ~FL_DAMAGE_CHILD;
113  }
114 
115  if (d) {
116  dw::core::Rectangle rect (
119  w (),
120  h ());
121 
122  if (d == FL_DAMAGE_SCROLL) {
123  // a clipping rectangle has already been set by fltk::scrollrect ()
124  draw (&rect, DRAW_PLAIN);
125  } else {
126  draw (&rect, DRAW_CLIPPED);
127  drawRegion.clear ();
128  }
129  }
130 }
131 
133  DrawType type)
134 {
135  int X = translateCanvasXToViewX (rect->x);
136  int Y = translateCanvasYToViewY (rect->y);
137  int W, H;
138 
139  // fl_clip_box() can't handle values greater than SHRT_MAX!
140  if (X > x () + w () || Y > y () + h ())
141  return;
142 
143  W = X + rect->width > x () + w () ? x () + w () - X : rect->width;
144  H = Y + rect->height > y () + h () ? y () + h () - Y : rect->height;
145 
146  fl_clip_box(X, Y, W, H, X, Y, W, H);
147 
149  translateViewYToCanvasY (Y), W, H);
150 
151  if (r.isEmpty ())
152  return;
153 
154  exposeArea = &r;
155 
156  if (type == DRAW_BUFFERED && backBuffer && !backBufferInUse) {
157  backBufferInUse = true;
158  backBuffer->setSize (X + W, Y + H); // would be nicer to use (W, H)...
159  fl_begin_offscreen (backBuffer->offscreen);
160  fl_push_matrix ();
161  fl_color (bgColor);
162  fl_rectf (X, Y, W, H);
163  theLayout->expose (this, &r);
164  fl_pop_matrix ();
165  fl_end_offscreen ();
166  fl_copy_offscreen (X, Y, W, H, backBuffer->offscreen, X, Y);
167  backBufferInUse = false;
168  } else if (type == DRAW_BUFFERED || type == DRAW_CLIPPED) {
169  // if type == DRAW_BUFFERED but we do not have backBuffer available
170  // we fall back to clipped drawing
171  fl_push_clip (X, Y, W, H);
172  fl_color (bgColor);
173  fl_rectf (X, Y, W, H);
174  theLayout->expose (this, &r);
175  fl_pop_clip ();
176  } else {
177  fl_color (bgColor);
178  fl_rectf (X, Y, W, H);
179  theLayout->expose (this, &r);
180  }
181  // DEBUG:
182  //fl_color(FL_RED);
183  //fl_rect(X, Y, W, H);
184 
185  exposeArea = NULL;
186 }
187 
189  for (int i = children () - 1; i >= 0; i--) {
190  Fl_Widget& w = *child(i);
191 #if 0
192 PORT1.3
193  if (w.damage() & DAMAGE_CHILD_LABEL) {
194  draw_outside_label(w);
195  w.set_damage(w.damage() & ~DAMAGE_CHILD_LABEL);
196  }
197 #endif
198  update_child(w);
199  }
200 }
201 
203 {
204  int s1 = Fl::event_state ();
205  int s2 = (core::ButtonState)0;
206 
207  if (s1 & FL_SHIFT) s2 |= core::SHIFT_MASK;
208  if (s1 & FL_CTRL) s2 |= core::CONTROL_MASK;
209  if (s1 & FL_ALT) s2 |= core::META_MASK;
210  if (s1 & FL_BUTTON1) s2 |= core::BUTTON1_MASK;
211  if (s1 & FL_BUTTON2) s2 |= core::BUTTON2_MASK;
212  if (s1 & FL_BUTTON3) s2 |= core::BUTTON3_MASK;
213 
214  return (core::ButtonState)s2;
215 }
216 
217 /*
218  * We handle Tab to determine which FLTK widget should get focus.
219  *
220  * Presumably a proper solution that allows focusing links, etc., would live
221  * in Textblock and use iterators.
222  */
224 {
225  int i, ret = 0;
226  Fl_Widget *old_child = NULL;
227 
228  if (this == Fl::focus()) {
229  // if we have focus, give it to a child. Go forward typically,
230  // or backward with Shift pressed.
231  if (!(Fl::event_state() & FL_SHIFT)) {
232  for (i = 0; i < children(); i++) {
233  if (child(i)->take_focus()) {
234  ret = 1;
235  break;
236  }
237  }
238  } else {
239  for (i = children() - 1; i >= 0; i--) {
240  if (child(i)->take_focus()) {
241  ret = 1;
242  break;
243  }
244  }
245  }
246  } else {
247  // tabbing between children
248  old_child = Fl::focus();
249 
250  if (!(ret = Fl_Group::handle (FL_KEYBOARD))) {
251  // group didn't have any more children to focus.
252  Fl::focus(this);
253  return 1;
254  } else {
255  // which one did it focus? (Note i == children() if not found)
256  i = find(Fl::focus());
257  }
258  }
259  if (ret) {
260  if (i >= 0 && i < children()) {
261  Fl_Widget *c = child(i);
262  int canvasX = translateViewXToCanvasX(c->x()),
263  canvasY = translateViewYToCanvasY(c->y());
264 
266  canvasX, canvasY, c->w(), c->h());
267 
268  // Draw the children who gained and lost focus. Otherwise a
269  // widget that had been only partly visible still shows its old
270  // appearance in the previously-visible portion.
271  core::Rectangle r(canvasX, canvasY, c->w(), c->h());
272 
273  queueDraw(&r);
274 
275  if (old_child) {
276  r.x = translateViewXToCanvasX(old_child->x());
277  r.y = translateViewYToCanvasY(old_child->y());
278  r.width = old_child->w();
279  r.height = old_child->h();
280  queueDraw(&r);
281  }
282  }
283  }
284  return ret;
285 }
286 
287 int FltkViewBase::handle (int event)
288 {
289  bool processed;
290 
296  switch(event) {
297  case FL_PUSH:
298  /* Hide the tooltip */
300 
301  processed =
302  theLayout->buttonPress (this, Fl::event_clicks () + 1,
303  translateViewXToCanvasX (Fl::event_x ()),
304  translateViewYToCanvasY (Fl::event_y ()),
305  getDwButtonState (), Fl::event_button ());
306  _MSG("PUSH => %s\n", processed ? "true" : "false");
307  if (processed) {
308  /* pressed dw content; give focus to the view */
309  if (Fl::event_button() != FL_RIGHT_MOUSE)
310  Fl::focus(this);
311  return true;
312  }
313  break;
314  case FL_RELEASE:
315  processed =
316  theLayout->buttonRelease (this, Fl::event_clicks () + 1,
317  translateViewXToCanvasX (Fl::event_x ()),
318  translateViewYToCanvasY (Fl::event_y ()),
319  getDwButtonState (), Fl::event_button ());
320  _MSG("RELEASE => %s\n", processed ? "true" : "false");
321  if (processed)
322  return true;
323  break;
324  case FL_MOVE:
325  mouse_x = Fl::event_x();
326  mouse_y = Fl::event_y();
327  processed =
328  theLayout->motionNotify (this,
331  getDwButtonState ());
332  _MSG("MOVE => %s\n", processed ? "true" : "false");
333  if (processed)
334  return true;
335  break;
336  case FL_DRAG:
337  processed =
338  theLayout->motionNotify (this,
339  translateViewXToCanvasX (Fl::event_x ()),
340  translateViewYToCanvasY (Fl::event_y ()),
341  getDwButtonState ());
342  _MSG("DRAG => %s\n", processed ? "true" : "false");
343  if (processed)
344  return true;
345  break;
346  case FL_ENTER:
347  theLayout->enterNotify (this,
348  translateViewXToCanvasX (Fl::event_x ()),
349  translateViewYToCanvasY (Fl::event_y ()),
350  getDwButtonState ());
351  break;
352  case FL_HIDE:
353  /* WORKAROUND: strangely, the tooltip window is not automatically hidden
354  * with its parent. Here we fake a LEAVE to achieve it. */
355  case FL_LEAVE:
357  break;
358  case FL_FOCUS:
359  if (focused_child && find(focused_child) < children()) {
360  /* strangely, find() == children() if the child is not found */
361  focused_child->take_focus();
362  }
363  return 1;
364  case FL_UNFOCUS:
365  // FLTK delivers UNFOCUS to the previously focused widget
366  if (find(Fl::focus()) < children())
367  focused_child = Fl::focus(); // remember the focused child!
368  else if (Fl::focus() == this)
369  focused_child = NULL; // no focused child this time
370  return 0;
371  case FL_KEYBOARD:
372  if (Fl::event_key() == FL_Tab)
373  return manageTabToFocus();
374  break;
375  default:
376  break;
377  }
378  return Fl_Group::handle (event);
379 }
380 
381 // ----------------------------------------------------------------------
382 
384 {
385  theLayout = layout;
386  if (usesViewport())
387  theLayout->viewportSizeChanged(this, w(), h());
388 }
389 
390 void FltkViewBase::setCanvasSize (int width, int ascent, int descent)
391 {
392  canvasWidth = width;
393  canvasHeight = ascent + descent;
394 }
395 
397 {
398  static Fl_Cursor mapDwToFltk[] = {
399  FL_CURSOR_CROSS,
400  FL_CURSOR_DEFAULT,
401  FL_CURSOR_HAND,
402  FL_CURSOR_MOVE,
403  FL_CURSOR_WE,
404  FL_CURSOR_NESW,
405  FL_CURSOR_NWSE,
406  FL_CURSOR_NS,
407  FL_CURSOR_NWSE,
408  FL_CURSOR_NESW,
409  FL_CURSOR_NS,
410  FL_CURSOR_WE,
411  FL_CURSOR_INSERT,
412  FL_CURSOR_WAIT,
413  FL_CURSOR_HELP
414  };
415 
416  fl_cursor (mapDwToFltk[cursor]);
417 }
418 
420 {
421  bgColor = color ?
423  FL_WHITE;
424 }
425 
427 {
428 }
429 
431 {
432 }
433 
435 {
436  drawRegion.addRectangle (area);
437  damage (FL_DAMAGE_USER1);
438 }
439 
441 {
442  damage (FL_DAMAGE_EXPOSE);
443 }
444 
446 {
447 }
448 
451  int x, int y)
452 {
453 }
454 
457  int x1, int y1, int x2, int y2)
458 {
459  fl_color(((FltkColor*)color)->colors[shading]);
460  // we clip with a large border (5000px), as clipping causes artefacts
461  // with non-solid line styles.
462  // However it's still better than no clipping at all.
463  clipPoint (&x1, &y1, 5000);
464  clipPoint (&x2, &y2, 5000);
465  fl_line (translateCanvasXToViewX (x1),
469 }
470 
473  core::style::LineType type, int width,
474  int x1, int y1, int x2, int y2)
475 {
476  char dashes[3], w, ng, d, gap, len;
477  const int f = 2;
478 
479  w = (width == 1) ? 0 : width;
480  if (type == core::style::LINE_DOTTED) {
481  /* customized drawing for dotted lines */
482  len = (x2 == x1) ? y2 - y1 + 1 : (y2 == y1) ? x2 - x1 + 1 : 0;
483  ng = len / f*width;
484  d = len % f*width;
485  gap = ng ? d/ng + (w > 3 ? 2 : 0) : 0;
486  dashes[0] = 1; dashes[1] = f*width-gap; dashes[2] = 0;
487  fl_line_style(FL_DASH + FL_CAP_ROUND, w, dashes);
488 
489  /* These formulas also work, but ain't pretty ;)
490  * fl_line_style(FL_DOT + FL_CAP_ROUND, w);
491  * dashes[0] = 1; dashes[1] = 3*width-2; dashes[2] = 0;
492  */
493  } else if (type == core::style::LINE_DASHED) {
494  fl_line_style(FL_DASH + FL_CAP_ROUND, w);
495  }
496 
497  fl_color(((FltkColor*)color)->colors[shading]);
498  drawLine (color, shading, x1, y1, x2, y2);
499 
500  if (type != core::style::LINE_NORMAL)
501  fl_line_style(FL_SOLID);
502 }
503 
506  bool filled,
507  int X, int Y, int width, int height)
508 {
509  fl_color(((FltkColor*)color)->colors[shading]);
510  if (width < 0) {
511  X += width;
512  width = -width;
513  }
514  if (height < 0) {
515  Y += height;
516  height = -height;
517  }
518 
519  int x1 = X;
520  int y1 = Y;
521  int x2 = X + width;
522  int y2 = Y + height;
523 
524  // We only support rectangles with line width 1px, so we clip with
525  // a rectangle 1px wider and higher than what we actually expose.
526  // This is only really necessary for non-filled rectangles.
527  clipPoint (&x1, &y1, 1);
528  clipPoint (&x2, &y2, 1);
529 
530  x1 = translateCanvasXToViewX (x1);
531  y1 = translateCanvasYToViewY (y1);
532  x2 = translateCanvasXToViewX (x2);
533  y2 = translateCanvasYToViewY (y2);
534 
535  if (filled)
536  fl_rectf (x1, y1, x2 - x1, y2 - y1);
537  else
538  fl_rect (x1, y1, x2 - x1, y2 - y1);
539 }
540 
542  core::style::Color::Shading shading, bool filled,
543  int centerX, int centerY, int width, int height,
544  int angle1, int angle2)
545 {
546  fl_color(((FltkColor*)color)->colors[shading]);
547  int x = translateCanvasXToViewX (centerX) - width / 2;
548  int y = translateCanvasYToViewY (centerY) - height / 2;
549 
550  fl_arc(x, y, width, height, angle1, angle2);
551  if (filled) {
552  // WORKAROUND: We call both fl_arc and fl_pie due to a FLTK bug
553  // (STR #2703) that was present in 1.3.0.
554  fl_pie(x, y, width, height, angle1, angle2);
555  }
556 }
557 
560  bool filled, bool convex, core::Point *points,
561  int npoints)
562 {
563  if (npoints > 0) {
564  fl_color(((FltkColor*)color)->colors[shading]);
565 
566  if (filled) {
567  if (convex)
568  fl_begin_polygon();
569  else
570  fl_begin_complex_polygon();
571  } else
572  fl_begin_loop();
573 
574  for (int i = 0; i < npoints; i++) {
575  fl_vertex(translateCanvasXToViewX(points[i].x),
576  translateCanvasYToViewY(points[i].y));
577  }
578  if (filled) {
579  if (convex)
580  fl_end_polygon();
581  else
582  fl_end_complex_polygon();
583  } else
584  fl_end_loop();
585  }
586 }
587 
588 core::View *FltkViewBase::getClippingView (int x, int y, int width, int height)
589 {
590  fl_push_clip (translateCanvasXToViewX (x), translateCanvasYToViewY (y),
591  width, height);
592  return this;
593 }
594 
596 {
597  fl_pop_clip ();
598 }
599 
600 // ----------------------------------------------------------------------
601 
602 FltkWidgetView::FltkWidgetView (int x, int y, int w, int h,
603  const char *label):
604  FltkViewBase (x, y, w, h, label)
605 {
606 }
607 
609 {
610 }
611 
613  core::style::Color *color,
615  int X, int Y, const char *text, int len)
616 {
617  //printf ("drawText (..., %d, %d, '", X, Y);
618  //for (int i = 0; i < len; i++)
619  // putchar (text[i]);
620  //printf ("'\n");
621 
622  FltkFont *ff = (FltkFont*)font;
623  fl_font(ff->font, ff->size);
624  fl_color(((FltkColor*)color)->colors[shading]);
625 
626  if (!font->letterSpacing && !font->fontVariant) {
627  fl_draw(text, len,
629  } else {
630  /* Nonzero letter spacing adjustment, draw each glyph individually */
631  int viewX = translateCanvasXToViewX (X),
632  viewY = translateCanvasYToViewY (Y);
633  int curr = 0, next = 0, nb;
634  char chbuf[4];
635  int c, cu, width;
636 
638  int sc_fontsize = lout::misc::roundInt(ff->size * 0.78);
639  for (curr = 0; next < len; curr = next) {
640  next = theLayout->nextGlyph(text, curr);
641  c = fl_utf8decode(text + curr, text + next, &nb);
642  if ((cu = fl_toupper(c)) == c) {
643  /* already uppercase, just draw the character */
644  fl_font(ff->font, ff->size);
645  width = (int)fl_width(text + curr, next - curr);
646  if (curr && width)
647  viewX += font->letterSpacing;
648  fl_draw(text + curr, next - curr, viewX, viewY);
649  viewX += width;
650  } else {
651  /* make utf8 string for converted char */
652  nb = fl_utf8encode(cu, chbuf);
653  fl_font(ff->font, sc_fontsize);
654  width = (int)fl_width(chbuf, nb);
655  if (curr && width)
656  viewX += font->letterSpacing;
657  fl_draw(chbuf, nb, viewX, viewY);
658  viewX += width;
659  }
660  }
661  } else {
662  while (next < len) {
663  next = theLayout->nextGlyph(text, curr);
664  width = (int)fl_width(text + curr, next - curr);
665  if (curr && width)
666  viewX += font->letterSpacing;
667  fl_draw(text + curr, next - curr, viewX, viewY);
668  viewX += width;
669  curr = next;
670  }
671  }
672  }
673 }
674 
675 /*
676  * "simple" in that it ignores letter-spacing, etc. This was added for image
677  * alt text where none of that matters.
678  */
680  core::style::Color *color,
682  int X, int Y, int W, int H,
683  const char *text)
684 {
685  FltkFont *ff = (FltkFont*)font;
686  fl_font(ff->font, ff->size);
687  fl_color(((FltkColor*)color)->colors[shading]);
688  fl_draw(text,
690  W, H, FL_ALIGN_TOP|FL_ALIGN_LEFT|FL_ALIGN_WRAP, NULL, 0);
691 }
692 
693 void FltkWidgetView::drawImage (core::Imgbuf *imgbuf, int xRoot, int yRoot,
694  int X, int Y, int width, int height)
695 {
696  ((FltkImgbuf*)imgbuf)->draw (this,
697  translateCanvasXToViewX (xRoot),
698  translateCanvasYToViewY (yRoot),
699  X, Y, width, height);
700 }
701 
703 {
704  return true;
705 }
706 
707 void FltkWidgetView::addFltkWidget (Fl_Widget *widget,
708  core::Allocation *allocation)
709 {
710  allocateFltkWidget (widget, allocation);
711  add (widget);
712 }
713 
714 void FltkWidgetView::removeFltkWidget (Fl_Widget *widget)
715 {
716  remove (widget);
717 }
718 
719 void FltkWidgetView::allocateFltkWidget (Fl_Widget *widget,
720  core::Allocation *allocation)
721 {
722  widget->resize (translateCanvasXToViewX (allocation->x),
723  translateCanvasYToViewY (allocation->y),
724  allocation->width,
725  allocation->ascent + allocation->descent);
726 }
727 
728 void FltkWidgetView::drawFltkWidget (Fl_Widget *widget,
729  core::Rectangle *area)
730 {
731  draw_child (*widget);
732  draw_outside_label(*widget);
733 }
734 
735 } // namespace fltk
736 } // namespace dw
dw::fltk::FltkViewBase::handle
int handle(int event)
Definition: fltkviewbase.cc:287
dw::core::Layout::leaveNotify
void leaveNotify(View *view, ButtonState state)
This function is called by a view, to delegate a leave notify event.
Definition: layout.cc:954
dw::fltk::FltkViewBase::drawLine
void drawLine(core::style::Color *color, core::style::Color::Shading shading, int x1, int y1, int x2, int y2)
Definition: fltkviewbase.cc:455
dw::fltk::FltkViewBase::drawRegion
core::Region drawRegion
Definition: fltkviewbase.hh:35
dw::core::Point
Definition: types.hh:49
dw::core::style::Cursor
Cursor
Definition: style.hh:198
dw::fltk::FltkViewBase::mouse_y
int mouse_y
Definition: fltkviewbase.hh:58
dw::core::Allocation::y
int y
Definition: types.hh:166
dw::fltk::FltkViewBase::DRAW_BUFFERED
Definition: fltkviewbase.hh:32
dw::core::Layout::scrollTo
void scrollTo(HPosition hpos, VPosition vpos, int x, int y, int width, int height)
Scrolls all viewports, so that the region [x, y, width, height] is seen, according to hpos and vpos.
Definition: layout.cc:452
dw::core::Allocation::x
int x
Definition: types.hh:165
dw::core::BUTTON2_MASK
Definition: events.hh:21
dw::fltk::FltkViewBase::canvasHeight
int canvasHeight
Definition: fltkviewbase.hh:57
lout::object
Here, some common classes (or interfaces) are defined, to standardize the access to other classes.
Definition: object.cc:29
dw::fltk::FltkViewBase::translateCanvasYToViewY
virtual int translateCanvasYToViewY(int y)=0
dw::fltk::FltkWidgetView::addFltkWidget
void addFltkWidget(Fl_Widget *widget, core::Allocation *allocation)
Definition: fltkviewbase.cc:707
dw::core::style::LINE_DASHED
Definition: style.hh:292
dw::fltk::FltkWidgetView::FltkWidgetView
FltkWidgetView(int x, int y, int w, int h, const char *label=0)
Definition: fltkviewbase.cc:602
dw::fltk::FltkViewBase::manageTabToFocus
int manageTabToFocus()
Definition: fltkviewbase.cc:223
dw::fltk::FltkViewBase::DRAW_CLIPPED
Definition: fltkviewbase.hh:32
dw::fltk::FltkViewBase::setBgColor
void setBgColor(core::style::Color *color)
Set the background of the view.
Definition: fltkviewbase.cc:419
dw::core::Layout::nextGlyph
int nextGlyph(const char *text, int idx)
Definition: layout.hh:342
dw::core::style::Color
Definition: style.hh:709
dw::core::Layout::enterNotify
void enterNotify(View *view, int x, int y, ButtonState state)
This function is called by a view, to delegate a enter notify event.
Definition: layout.cc:933
dw::fltk::FltkViewBase::focused_child
Fl_Widget * focused_child
Definition: fltkviewbase.hh:59
dw::fltk::FltkViewBase::setCanvasSize
void setCanvasSize(int width, int ascent, int descent)
Set the canvas size.
Definition: fltkviewbase.cc:390
lout::container::typed::Iterator::hasNext
bool hasNext()
Definition: container.hh:369
dw::fltk::FltkViewBase::getClippingView
core::View * getClippingView(int x, int y, int width, int height)
Definition: fltkviewbase.cc:588
dw::fltk::FltkViewBase::draw
void draw()
Definition: fltkviewbase.cc:95
dw::fltk::FltkWidgetView::drawFltkWidget
void drawFltkWidget(Fl_Widget *widget, core::Rectangle *area)
Definition: fltkviewbase.cc:728
dw::core::HPOS_INTO_VIEW
Definition: types.hh:20
dw::fltk::FltkViewBase::drawTypedLine
void drawTypedLine(core::style::Color *color, core::style::Color::Shading shading, core::style::LineType type, int width, int x1, int y1, int x2, int y2)
Definition: fltkviewbase.cc:471
dw::fltk::FltkViewBase::mouse_x
int mouse_x
Definition: fltkviewbase.hh:58
dw::core::style::LineType
LineType
Definition: style.hh:289
dw::core::Rectangle::x
int x
Definition: types.hh:72
H
#define H(x, y, z)
dw::core::Layout::expose
void expose(View *view, Rectangle *area)
Definition: layout.hh:284
dw::fltk::FltkViewBase::BackBuffer
Definition: fltkviewbase.hh:18
dw::core::Allocation
Represents the allocation, i.e. actual position and size of a dw::core::Widget.
Definition: types.hh:163
dw::core::Layout::motionNotify
bool motionNotify(View *view, int x, int y, ButtonState state)
This function is called by a view, to delegate a motion notify event.
Definition: layout.cc:915
dw::core::style::FontAttrs::letterSpacing
int letterSpacing
Definition: style.hh:644
dw::core::CONTROL_MASK
Definition: events.hh:18
dw::fltk::FltkViewBase::theLayout
core::Layout * theLayout
Definition: fltkviewbase.hh:56
dw::fltk::FltkImgbuf
Definition: fltkimgbuf.hh:11
dw::core::BUTTON3_MASK
Definition: events.hh:22
dw::core::style::LINE_DOTTED
Definition: style.hh:291
dw::core::Region::rectangles
lout::container::typed::Iterator< Rectangle > rectangles()
Definition: types.hh:153
dw::core::Layout::buttonRelease
bool buttonRelease(View *view, int numPressed, int x, int y, ButtonState state, int button)
This function is called by a view, to delegate a button press event.
Definition: layout.hh:306
dw::core::SHIFT_MASK
Definition: events.hh:17
dw::core::style::Color::Shading
Shading
Definition: style.hh:725
dw::core::View::usesViewport
virtual bool usesViewport()=0
Return, whether this view uses a viewport.
lout::container::typed::Iterator
Typed version of container::untyped::Iterator.
Definition: container.hh:352
dw::fltk::FltkViewBase::setCursor
void setCursor(core::style::Cursor cursor)
Set the cursor appearance.
Definition: fltkviewbase.cc:396
dw::core::META_MASK
Definition: events.hh:19
dw::fltk::FltkViewBase::drawArc
void drawArc(core::style::Color *color, core::style::Color::Shading shading, bool filled, int centerX, int centerY, int width, int height, int angle1, int angle2)
Definition: fltkviewbase.cc:541
dw::fltk::getDwButtonState
core::ButtonState getDwButtonState()
Definition: fltkviewbase.cc:202
dw::core::Allocation::descent
int descent
Definition: types.hh:169
dw::core::style::Color::SHADING_NORMAL
Definition: style.hh:725
dw::fltk::FltkViewBase::DrawType
DrawType
Definition: fltkviewbase.hh:32
dw::fltk::FltkViewBase::translateViewXToCanvasX
virtual int translateViewXToCanvasX(int x)=0
dw::fltk::FltkViewBase::startDrawing
void startDrawing(core::Rectangle *area)
Called before drawing.
Definition: fltkviewbase.cc:426
dw::fltk::FltkViewBase::bgColor
int bgColor
Definition: fltkviewbase.hh:34
dw::core::style::Font
Definition: style.hh:656
dw::core::Rectangle::height
int height
Definition: types.hh:75
dw::fltk::FltkWidgetView::drawSimpleWrappedText
void drawSimpleWrappedText(core::style::Font *font, core::style::Color *color, core::style::Color::Shading shading, int x, int y, int w, int h, const char *text)
Definition: fltkviewbase.cc:679
dw::fltk::FltkViewBase::queueDraw
void queueDraw(core::Rectangle *area)
Queue a region, which is given in canvas coordinates, for drawing.
Definition: fltkviewbase.cc:434
dw::fltk::FltkViewBase::translateViewYToCanvasY
virtual int translateViewYToCanvasY(int y)=0
dw::fltk::FltkViewBase::drawRectangle
void drawRectangle(core::style::Color *color, core::style::Color::Shading shading, bool filled, int x, int y, int width, int height)
Definition: fltkviewbase.cc:504
dw::core::Layout
The central class for managing and drawing a widget tree.
Definition: layout.hh:16
dw::core::Rectangle::isEmpty
bool isEmpty()
Definition: types.hh:84
dw::fltk::FltkViewBase::BackBuffer::offscreen
Fl_Offscreen offscreen
Definition: fltkviewbase.hh:25
dw::fltk::FltkViewBase
Definition: fltkviewbase.hh:15
dw::fltk::FltkViewBase::canvasWidth
int canvasWidth
Definition: fltkviewbase.hh:57
dw::fltk::FltkFont
Definition: fltkplatform.hh:15
dw::core::Imgbuf
The platform independent interface for image buffers.
Definition: imgbuf.hh:161
dw::fltk::FltkFont::font
Fl_Font font
Definition: fltkplatform.hh:39
dw::fltk::FltkWidgetView::allocateFltkWidget
void allocateFltkWidget(Fl_Widget *widget, core::Allocation *allocation)
Definition: fltkviewbase.cc:719
dw::core::style::FONT_VARIANT_SMALL_CAPS
Definition: style.hh:332
dw::fltk::FltkViewBase::drawPoint
void drawPoint(core::style::Color *color, core::style::Color::Shading shading, int x, int y)
Definition: fltkviewbase.cc:449
dw::core::Rectangle
dw::core::Shape implemtation for simple rectangles.
Definition: types.hh:69
dw::fltk::FltkViewBase::backBuffer
static BackBuffer * backBuffer
Definition: fltkviewbase.hh:37
dw::fltk::FltkViewBase::queueDrawTotal
void queueDrawTotal()
Queue the total viewport for drawing.
Definition: fltkviewbase.cc:440
dw::fltk::FltkViewBase::setLayout
void setLayout(core::Layout *layout)
This methods notifies the view, that it has been attached to a layout.
Definition: fltkviewbase.cc:383
dw::core::Layout::cancelTooltip
void cancelTooltip()
Definition: layout.hh:382
dw::core::View
An interface to encapsulate platform dependent drawing.
Definition: view.hh:16
dw::core::style::LINE_NORMAL
Definition: style.hh:290
dw::fltk::FltkViewBase::mergeClippingView
void mergeClippingView(core::View *clippingView)
Definition: fltkviewbase.cc:595
lout::container::typed::Iterator::getNext
T * getNext()
Definition: container.hh:370
fltkviewport.hh
dw::fltk::FltkWidgetView::removeFltkWidget
void removeFltkWidget(Fl_Widget *widget)
Definition: fltkviewbase.cc:714
dw::fltk::FltkWidgetView::usesFltkWidgets
bool usesFltkWidgets()
Definition: fltkviewbase.cc:702
dw::fltk::FltkViewBase::clipPoint
void clipPoint(int *x, int *y, int border)
Definition: fltkviewbase.hh:43
dw::fltk::FltkViewBase::drawChildWidgets
void drawChildWidgets()
Definition: fltkviewbase.cc:188
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
_MSG
#define _MSG(...)
Definition: bookmarks.c:44
dw::fltk::FltkViewBase::setBufferedDrawing
void setBufferedDrawing(bool b)
Definition: fltkviewbase.cc:86
dw::fltk::FltkViewBase::finishDrawing
void finishDrawing(core::Rectangle *area)
Called after drawing.
Definition: fltkviewbase.cc:430
dw::core::Layout::buttonPress
bool buttonPress(View *view, int numPressed, int x, int y, ButtonState state, int button)
This function is called by a view, to delegate a button press event.
Definition: layout.hh:294
dw::fltk::FltkColor
Definition: fltkplatform.hh:47
dw::core::style::FontAttrs::size
int size
Definition: style.hh:642
dw::core::ButtonState
ButtonState
Platform independent representation.
Definition: events.hh:14
lout::misc::roundInt
int roundInt(double d)
Definition: misc.hh:41
dw::fltk::FltkViewBase::DRAW_PLAIN
Definition: fltkviewbase.hh:32
dw::core::Region::clear
void clear()
Definition: types.hh:149
dw::fltk::FltkWidgetView::drawImage
void drawImage(core::Imgbuf *imgbuf, int xRoot, int yRoot, int x, int y, int width, int height)
Definition: fltkviewbase.cc:693
dw
Dw is in this namespace, or sub namespaces of this one.
Definition: alignedtextblock.cc:26
dw::fltk::FltkWidgetView::drawText
void drawText(core::style::Font *font, core::style::Color *color, core::style::Color::Shading shading, int x, int y, const char *text, int len)
Definition: fltkviewbase.cc:612
dw::fltk::FltkViewBase::translateCanvasXToViewX
virtual int translateCanvasXToViewX(int x)=0
dw::fltk::FltkViewBase::~FltkViewBase
~FltkViewBase()
Definition: fltkviewbase.cc:81
lout::container::typed
This namespace provides thin wrappers, implemented as C++ templates, to gain type-safety.
Definition: container.hh:345
dw::core::BUTTON1_MASK
Definition: events.hh:20
dw::core::Layout::viewportSizeChanged
void viewportSizeChanged(View *view, int width, int height)
Definition: layout.cc:1155
dw::fltk::FltkViewBase::backBufferInUse
static bool backBufferInUse
Definition: fltkviewbase.hh:38
dw::fltk::FltkWidgetView::~FltkWidgetView
~FltkWidgetView()
Definition: fltkviewbase.cc:608
dw::core::VPOS_INTO_VIEW
Definition: types.hh:30
dw::core::Rectangle::width
int width
Definition: types.hh:74
dw::fltk::FltkViewBase::BackBuffer::setSize
void setSize(int w, int h)
Definition: fltkviewbase.cc:49
dw::core::style::FontAttrs::fontVariant
FontVariant fontVariant
Definition: style.hh:645
dw::core::Rectangle::y
int y
Definition: types.hh:73
dw::fltk::FltkViewBase::exposeArea
core::Rectangle * exposeArea
Definition: fltkviewbase.hh:36
dw::fltk::FltkViewBase::cancelQueueDraw
void cancelQueueDraw()
Cancel a draw queue request.
Definition: fltkviewbase.cc:445
dw::core::Allocation::width
int width
Definition: types.hh:167
dw::fltk::FltkViewBase::drawPolygon
void drawPolygon(core::style::Color *color, core::style::Color::Shading shading, bool filled, bool convex, core::Point *points, int npoints)
Definition: fltkviewbase.cc:558