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)  

iterator.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 "core.hh"
23 #include <limits.h>
24 
25 using namespace lout;
26 
27 namespace dw {
28 namespace core {
29 
30 // --------------
31 // Iterator
32 // --------------
33 
34 Iterator::Iterator(Widget *widget, Content::Type mask, bool atEnd)
35 {
36  this->widget = widget;
37  this->mask = mask;
38 }
39 
40 Iterator::Iterator(Iterator &it): object::Comparable ()
41 {
42  widget = it.widget;
43  content = it.content;
44 }
45 
47 {
48 }
49 
50 bool Iterator::equals (Object *other)
51 {
52  Iterator *otherIt = (Iterator*)other;
53  return
54  this == otherIt ||
55  (getWidget() == otherIt->getWidget() && compareTo(otherIt) == 0);
56 }
57 
65 {
66  delete this;
67 }
68 
80 void Iterator::scrollTo (Iterator *it1, Iterator *it2, int start, int end,
81  HPosition hpos, VPosition vpos)
82 {
83  Allocation alloc1, alloc2, alloc;
84  int x1, x2, y1, y2;
85  DeepIterator *eit1, *eit2, *eit3;
86  int curStart, curEnd, cmp;
87  bool atStart;
88 
89  if (it1->equals(it2)) {
90  it1->getAllocation (start, end, &alloc);
91  it1->getWidget()->getLayout()->scrollTo (hpos, vpos, alloc.x, alloc.y,
92  alloc.width,
93  alloc.ascent + alloc.descent);
94  } else {
95  // First, determine the rectangle all iterators from it1 and it2
96  // allocate, i.e. the smallest rectangle containing all allocations of
97  // these iterators.
98  eit1 = new DeepIterator (it1);
99  eit2 = new DeepIterator (it2);
100 
101  x1 = INT_MAX;
102  x2 = INT_MIN;
103  y1 = INT_MAX;
104  y2 = INT_MIN;
105 
106  for (eit3 = (DeepIterator*)eit1->clone (), atStart = true;
107  (cmp = eit3->compareTo (eit2)) <= 0;
108  eit3->next (), atStart = false) {
109  if (atStart)
110  curStart = start;
111  else
112  curStart = 0;
113 
114  if (cmp == 0)
115  curEnd = end;
116  else
117  curEnd = INT_MAX;
118 
119  eit3->getAllocation (curStart, curEnd, &alloc);
120  x1 = misc::min (x1, alloc.x);
121  x2 = misc::max (x2, alloc.x + alloc.width);
122  y1 = misc::min (y1, alloc.y);
123  y2 = misc::max (y2, alloc.y + alloc.ascent + alloc.descent);
124  }
125 
126  delete eit3;
127  delete eit2;
128  delete eit1;
129 
130  it1->getAllocation (start, INT_MAX, &alloc1);
131  it2->getAllocation (0, end, &alloc2);
132 
133  if (alloc1.x > alloc2.x) {
134  //
135  // This is due to a line break within the region. When the line is
136  // longer than the viewport, and the region is actually quite short,
137  // the user would not see anything of the region, as in this figure
138  // (with region marked as "#"):
139  //
140  // +----------+ ,-- alloc1
141  // | | V
142  // | | ### ###
143  // ### ### | |
144  // ^ | | <-- viewport
145  // | +----------+
146  // `-- alloc2
147  // |----------------------------|
148  // width
149  //
150  // Therefore, we make the region smaller, so that the region will be
151  // displayed like this:
152  //
153  // ,-- alloc1
154  // +----|-----+
155  // | V |
156  // | ### ###|
157  // ### ### | |
158  // ^ | | <-- viewport
159  // `-- alloc2 +----------+
160  // |----------|
161  // width
162  //
163 
167  if (it1->getWidget()->getLayout()->getUsesViewport() &&
168  x2 - x1 > it1->getWidget()->getLayout()->getWidthViewport()) {
169  x1 = x2 - it1->getWidget()->getLayout()->getWidthViewport();
170  x2 = x1 + it1->getWidget()->getLayout()->getWidthViewport();
171  }
172  }
173 
174  if (alloc1.y > alloc2.y) {
175  // This is similar to the case above, e.g. if the region ends in
176  // another table column.
177  if (it1->getWidget()->getLayout()->getUsesViewport() &&
178  y2 - y1 > it1->getWidget()->getLayout()->getHeightViewport()) {
179  y1 = y2 - it1->getWidget()->getLayout()->getHeightViewport();
180  y2 = y1 + it1->getWidget()->getLayout()->getHeightViewport();
181  }
182  }
183 
184  it1->getWidget()->getLayout()->scrollTo (hpos, vpos,
185  x1, y1, x2 - x1, y2 - y1);
186  }
187 }
188 
189 // -------------------
190 // EmptyIterator
191 // -------------------
192 
194  Iterator (widget, mask, atEnd)
195 {
196  this->content.type = (atEnd ? Content::END : Content::START);
197 }
198 
200 {
201 }
202 
204 {
205  return new EmptyIterator (*this);
206 }
207 
209 {
210  EmptyIterator *otherIt = (EmptyIterator*)other;
211 
212  if (content.type == otherIt->content.type)
213  return 0;
214  else if (content.type == Content::START)
215  return -1;
216  else
217  return +1;
218 }
219 
221 {
223  return false;
224 }
225 
227 {
229  return false;
230 }
231 
232 void EmptyIterator::highlight (int start, int end, HighlightLayer layer)
233 {
234 }
235 
236 void EmptyIterator::unhighlight (int direction, HighlightLayer layer)
237 {
238 }
239 
240 void EmptyIterator::getAllocation (int start, int end, Allocation *allocation)
241 {
242 }
243 
244 // ------------------
245 // TextIterator
246 // ------------------
247 
249  const char *text): Iterator (widget, mask, atEnd)
250 {
251  this->content.type = (atEnd ? Content::END : Content::START);
252  this->text = (mask & Content::TEXT) ? text : NULL;
253 }
254 
256 {
257  text = it.text;
258 }
259 
261 {
262  TextIterator *otherIt = (TextIterator*)other;
263 
264  if (content.type == otherIt->content.type)
265  return 0;
266 
267  switch (content.type) {
268  case Content::START:
269  return -1;
270 
271  case Content::TEXT:
272  if (otherIt->content.type == Content::START)
273  return +1;
274  else
275  return -1;
276 
277  case Content::END:
278  return +1;
279 
280  default:
282  return 0;
283  }
284 }
285 
287 {
288  if (content.type == Content::START && text != NULL) {
290  content.text = text;
291  return true;
292  } else {
294  return false;
295  }
296 }
297 
299 {
300  if (content.type == Content::END && text != NULL) {
302  content.text = text;
303  return true;
304  } else {
306  return false;
307  }
308 }
309 
310 void TextIterator::getAllocation (int start, int end, Allocation *allocation)
311 {
312  // Return the allocation of the widget.
313  *allocation = *(getWidget()->getAllocation ());
314 }
315 
316 // ------------------
317 // DeepIterator
318 // ------------------
319 
321 {
322  for (int i = 0; i < size (); i++)
323  get(i)->unref ();
324 }
325 
326 /*
327  * The following two methods are used by dw::core::DeepIterator::DeepIterator,
328  * when the passed dw::core::Iterator points to a widget. Since a
329  * dw::core::DeepIterator never returns a widget, the dw::core::Iterator has
330  * to be corrected, by searching for the next content downwards (within the
331  * widget pointed to), forwards, and backwards (in the traversed tree).
332  */
333 
334 /*
335  * Search downwards. If fromEnd is true, start search at the end,
336  * otherwise at the beginning.
337  */
339  bool fromEnd)
340 {
341  Iterator *it2, *it3;
342 
343  //DEBUG_MSG (1, "%*smoving down (%swards) from %s\n",
344  // indent, "", from_end ? "back" : "for", a_Dw_iterator_text (it));
345 
346  assert (it->getContent()->type == Content::WIDGET);
347  it2 = it->getContent()->widget->iterator (mask, fromEnd);
348 
349  if (it2 == NULL) {
350  // Moving downwards failed.
351  //DEBUG_MSG (1, "%*smoving down failed\n", indent, "");
352  return NULL;
353  }
354 
355  while (fromEnd ? it2->prev () : it2->next ()) {
356  //DEBUG_MSG (1, "%*sexamining %s\n",
357  // indent, "", a_Dw_iterator_text (it2));
358 
359  if (it2->getContent()->type == Content::WIDGET) {
360  // Another widget. Search in it downwards.
361  it3 = searchDownward (it2, mask, fromEnd);
362  if (it3 != NULL) {
363  it2->unref ();
364  return it3;
365  }
366  // Else continue in this widget.
367  } else {
368  // Success!
369  //DEBUG_MSG (1, "%*smoving down succeeded: %s\n",
370  // indent, "", a_Dw_iterator_text (it2));
371  return it2;
372  }
373  }
374 
375  // Nothing found.
376  it2->unref ();
377  //DEBUG_MSG (1, "%*smoving down failed (nothing found)\n", indent, "");
378  return NULL;
379 }
380 
381 /*
382  * Search sidewards. fromEnd specifies the direction, false means forwards,
383  * true means backwards.
384  */
386  bool fromEnd)
387 {
388  Iterator *it2, *it3;
389 
390  //DEBUG_MSG (1, "%*smoving %swards from %s\n",
391  // indent, "", from_end ? "back" : "for", a_Dw_iterator_text (it));
392 
393  assert (it->getContent()->type == Content::WIDGET);
394  it2 = it->cloneIterator ();
395 
396  while (fromEnd ? it2->prev () : it2->next ()) {
397  if (it2->getContent()->type == Content::WIDGET) {
398  // Search downwards in this widget.
399  it3 = searchDownward (it2, mask, fromEnd);
400  if (it3 != NULL) {
401  it2->unref ();
402  //DEBUG_MSG (1, "%*smoving %swards succeeded: %s\n",
403  // indent, "", from_end ? "back" : "for",
404  // a_Dw_iterator_text (it3));
405  return it3;
406  }
407  // Else continue in this widget.
408  } else {
409  // Success!
410  // DEBUG_MSG (1, "%*smoving %swards succeeded: %s\n",
411  // indent, "", from_end ? "back" : "for",
412  // a_Dw_iterator_text (it2));
413  return it2;
414  }
415  }
416 
417  /* Nothing found, go upwards in the tree (if possible). */
418  it2->unref ();
419  if (it->getWidget()->getParent ()) {
420  it2 = it->getWidget()->getParent()->iterator (mask, false);
421  while (true) {
422  if (!it2->next ())
424 
425  if (it2->getContent()->type == Content::WIDGET &&
426  it2->getContent()->widget == it->getWidget ()) {
427  it3 = searchSideward (it2, mask, fromEnd);
428  it2->unref ();
429  //DEBUG_MSG (1, "%*smoving %swards succeeded: %s\n",
430  // indent, "", from_end ? "back" : "for",
431  // a_Dw_iterator_text (it3));
432  return it3;
433  }
434  }
435  }
436 
437  // Nothing found at all.
438  // DEBUG_MSG (1, "%*smoving %swards failed (nothing found)\n",
439  // indent, "", from_end ? "back" : "for");
440  return NULL;
441 }
442 
458 {
459  //DEBUG_MSG (1, "a_Dw_ext_iterator_new: %s\n", a_Dw_iterator_text (it));
460 
461  // Clone input iterator, so the iterator passed as parameter
462  // remains untouched.
463  it = it->cloneIterator ();
464  this->mask = it->getMask ();
465 
466  hasContents = true;
467 
468  // If it points to a widget, find a near non-widget content,
469  // since an DeepIterator should never return widgets.
470  if (it->getContent()->type == Content::WIDGET) {
471  Iterator *it2;
472 
473  // The second argument of searchDownward is actually a matter of
474  // taste :-)
475  if ((it2 = searchDownward (it, mask, false)) ||
476  (it2 = searchSideward (it, mask, false)) ||
477  (it2 = searchSideward (it, mask, true))) {
478  it->unref ();
479  it = it2;
480  } else {
481  // This may happen, when a page does not contain any non-widget
482  // content.
483  //DEBUG_MSG (1, "a_Dw_ext_iterator_new got totally helpless!\n");
484  it->unref ();
485  hasContents = false;
486  }
487  }
488 
489  //DEBUG_MSG (1, " => %s\n", a_Dw_iterator_text (it));
490 
491  if (hasContents) {
492  // If this widget has parents, we must construct appropriate iterators.
493  //
494  // \todo There may be a faster way instead of iterating through the
495  // parent widgets.
496 
497  // Construct the iterators.
498  int thisLevel = it->getWidget()->getLevel (), level;
499  Widget *w;
500  for (w = it->getWidget (), level = thisLevel; w->getParent() != NULL;
501  w = w->getParent (), level--) {
502  Iterator *it = w->getParent()->iterator (mask, false);
503  stack.put (it, level - 1);
504  while (true) {
505  bool hasNext = it->next();
506  assert (hasNext);
507 
508  if (it->getContent()->type == Content::WIDGET &&
509  it->getContent()->widget == w)
510  break;
511  }
512  }
513 
514  stack.put (it, thisLevel);
515  content = *(it->getContent());
516  }
517 }
518 
519 
521 {
522 }
523 
525 {
526  DeepIterator *it = new DeepIterator ();
527 
528  for (int i = 0; i < stack.size (); i++)
529  it->stack.put (stack.get(i)->cloneIterator (), i);
530 
531  it->mask = mask;
532  it->content = content;
533  it->hasContents = hasContents;
534 
535  return it;
536 }
537 
539 {
540  DeepIterator *otherDeepIterator = (DeepIterator*)other;
541 
542  // Search the highest level, where the widgets are the same.
543  int level = 0;
544 
545  while (stack.get(level)->getWidget ()
546  == otherDeepIterator->stack.get(level)->getWidget ()) {
547  if (level == stack.size() - 1 ||
548  level == otherDeepIterator->stack.size() - 1)
549  break;
550  level++;
551  }
552 
553  while (stack.get(level)->getWidget ()
554  != otherDeepIterator->stack.get(level)->getWidget ())
555  level--;
556 
557  return stack.get(level)->compareTo (otherDeepIterator->stack.get(level));
558 }
559 
561 {
563  return new DeepIterator (it);
564 }
565 
567  return !hasContents;
568 }
569 
576 {
577  Iterator *it = stack.getTop ();
578 
579  if (it->next ()) {
580  if (it->getContent()->type == Content::WIDGET) {
581  // Widget: new iterator on stack, to search in this widget.
582  stack.push (it->getContent()->widget->iterator (mask, false));
583  return next ();
584  } else {
585  // Simply return the content of the iterartor.
586  content = *(it->getContent ());
587  return true;
588  }
589  } else {
590  // No more data in the top-most widget.
591  if (stack.size () > 1) {
592  // Pop iterator from stack, and move to next item in the old one.
593  stack.pop ();
594  return next ();
595  } else {
596  // Stack is empty.
598  return false;
599  }
600  }
601 }
602 
609 {
610  Iterator *it = stack.getTop ();
611 
612  if (it->prev ()) {
613  if (it->getContent()->type == Content::WIDGET) {
614  // Widget: new iterator on stack, to search in this widget.
615  stack.push (it->getContent()->widget->iterator (mask, true));
616  return prev ();
617  } else {
618  // Simply return the content of the iterartor.
619  content = *(it->getContent ());
620  return true;
621  }
622  } else {
623  // No more data in the top-most widget.
624  if (stack.size () > 1) {
625  // Pop iterator from stack, and move to next item in the old one.
626  stack.pop ();
627  return prev ();
628  } else {
629  // Stack is empty.
631  return false;
632  }
633  }
634 }
635 
636 // -----------------
637 // CharIterator
638 // -----------------
639 
641 {
642  it = NULL;
643 }
644 
646 {
647  Iterator *i = widget->iterator (Content::SELECTION_CONTENT, false);
648  it = new DeepIterator (i);
649  i->unref ();
650  ch = START;
651 }
652 
654 {
655  if (it)
656  delete it;
657 }
658 
660 {
661  CharIterator *cloned = new CharIterator ();
662  cloned->it = it->cloneDeepIterator ();
663  cloned->ch = ch;
664  cloned->pos = pos;
665  return cloned;
666 }
667 
669 {
670  CharIterator *otherIt = (CharIterator*)other;
671  int c = it->compareTo(otherIt->it);
672  if (c != 0)
673  return c;
674  else
675  return pos - otherIt->pos;
676 }
677 
679 {
680  if (ch == START || it->getContent()->type == Content::BREAK ||
681  (it->getContent()->type == Content::TEXT &&
682  it->getContent()->text[pos] == 0)) {
683  if (it->next()) {
684  if (it->getContent()->type == Content::BREAK)
685  ch = '\n';
686  else { // if (it->getContent()->type == Content::TEXT)
687  pos = 0;
688  ch = it->getContent()->text[pos];
689  if (ch == 0)
690  // should not happen, actually
691  return next ();
692  }
693  return true;
694  }
695  else {
696  ch = END;
697  return false;
698  }
699  } else if (ch == END)
700  return false;
701  else {
702  // at this point, it->getContent()->type == Content::TEXT
703  pos++;
704  ch = it->getContent()->text[pos];
705  if (ch == 0) {
706  if (it->getContent()->space) {
707  ch = ' ';
708  } else {
709  return next ();
710  }
711  }
712 
713  return true;
714  }
715 }
716 
718 {
719  if (ch == END || it->getContent()->type == Content::BREAK ||
720  (it->getContent()->type == Content::TEXT && pos == 0)) {
721  if (it->prev()) {
722  if (it->getContent()->type == Content::BREAK)
723  ch = '\n';
724  else { // if (it->getContent()->type == Content::TEXT)
725  if (it->getContent()->text[0] == 0)
726  return prev ();
727  else {
728  pos = strlen (it->getContent()->text);
729  if (it->getContent()->space) {
730  ch = ' ';
731  } else {
732  pos--;
733  ch = it->getContent()->text[pos];
734  }
735  }
736  }
737  return true;
738  }
739  else {
740  ch = START;
741  return false;
742  }
743  } else if (ch == START)
744  return false;
745  else {
746  // at this point, it->getContent()->type == Content::TEXT
747  pos--;
748  ch = it->getContent()->text[pos];
749  return true;
750  }
751 }
752 
754  HighlightLayer layer)
755 {
756  if (it2->getChar () == CharIterator::END)
757  it2->prev ();
758 
759  if (it1->it->compareTo (it2->it) == 0)
760  // Only one content => highlight part of it.
761  it1->it->highlight (it1->pos, it2->pos, layer);
762  else {
763  DeepIterator *it = it1->it->cloneDeepIterator ();
764  int c;
765  bool start;
766  for (start = true;
767  (c = it->compareTo (it2->it)) <= 0;
768  it->next (), start = false) {
769  int endOfWord =
770  it->getContent()->type == Content::TEXT ?
771  strlen (it->getContent()->text) : 1;
772  if (start) // first iteration
773  it->highlight (it1->pos, endOfWord, layer);
774  else if (c == 0) // last iteration
775  it->highlight (0, it2->pos, layer);
776  else
777  it->highlight (0, endOfWord, layer);
778  }
779  delete it;
780  }
781 }
782 
784  HighlightLayer layer)
785 {
786  if (it1->it->compareTo (it2->it) == 0)
787  // Only one content => unhighlight it (only for efficiency).
788  it1->it->unhighlight (0, layer);
789  else {
790  DeepIterator *it = it1->it->cloneDeepIterator ();
791  for (; it->compareTo (it2->it) <= 0; it->next ())
792  it->unhighlight (-1, layer);
793  delete it;
794  }
795 }
796 
797 } // namespace core
798 } // namespace dw
dw::core::DeepIterator::Stack::getTop
Iterator * getTop()
Definition: iterator.hh:153
dw::core::HPosition
HPosition
Definition: types.hh:15
dw::core::Iterator::next
virtual bool next()=0
Move iterator forward and store content it.
dw::core::Allocation::y
int y
Definition: types.hh:166
dw::core::TextIterator::compareTo
int compareTo(lout::object::Comparable *other)
Compare two objects c1 and c2.
Definition: iterator.cc:260
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::DeepIterator::isEmpty
bool isEmpty()
Definition: iterator.cc:566
dw::core::DeepIterator::getContent
Content * getContent()
Definition: iterator.hh:179
dw::core::HighlightLayer
HighlightLayer
Definition: types.hh:42
dw::core::TextIterator::prev
bool prev()
Move iterator backward and store content it.
Definition: iterator.cc:298
dw::core::CharIterator::ch
int ch
Definition: iterator.hh:228
dw::core::DeepIterator::prev
bool prev()
Move iterator backward and store content it.
Definition: iterator.cc:608
dw::core::CharIterator::END
Definition: iterator.hh:224
dw::core::Layout::getWidthViewport
int getWidthViewport()
Definition: layout.hh:270
dw::core::Layout::getHeightViewport
int getHeightViewport()
Definition: layout.hh:271
dw::core::DeepIterator::mask
Content::Type mask
Definition: iterator.hh:165
dw::core::DeepIterator::searchDownward
static Iterator * searchDownward(Iterator *it, Content::Type mask, bool fromEnd)
Definition: iterator.cc:338
dw::core::Content::BREAK
Definition: types.hh:192
dw::core::CharIterator::unhighlight
static void unhighlight(CharIterator *it1, CharIterator *it2, HighlightLayer layer)
Definition: iterator.cc:783
dw::core::Content::Type
Type
Definition: types.hh:187
dw::core::CharIterator::compareTo
int compareTo(lout::object::Comparable *other)
Compare two objects c1 and c2.
Definition: iterator.cc:668
dw::core::Widget::getLevel
int getLevel()
Get the level of the widget within the tree.
Definition: widget.cc:499
dw::core::Iterator::getAllocation
virtual void getAllocation(int start, int end, Allocation *allocation)=0
Return the shape, which a part of the item, the iterator points on, allocates.
dw::core::CharIterator::it
DeepIterator * it
Definition: iterator.hh:227
dw::core::DeepIterator
A stack of iterators, to iterate recursively through a widget tree.
Definition: iterator.hh:145
dw::core::DeepIterator::Stack::~Stack
~Stack()
Definition: iterator.cc:320
dw::core::Iterator
Iterators are used to iterate through the contents of a widget.
Definition: iterator.hh:19
dw::core::EmptyIterator::clone
lout::object::Object * clone()
Return an exact copy of the object.
Definition: iterator.cc:203
dw::core::CharIterator::next
bool next()
Definition: iterator.cc:678
lout::misc::assertNotReached
void assertNotReached()
Definition: misc.hh:35
dw::core::EmptyIterator
This implementation of dw::core::Iterator can be used by widgets with no contents.
Definition: iterator.hh:95
dw::core::DeepIterator::cloneDeepIterator
DeepIterator * cloneDeepIterator()
Definition: iterator.hh:185
dw::core::CharIterator::getChar
int getChar()
Definition: iterator.hh:241
dw::core::TextIterator
This implementation of dw::core::Iterator can be used by widgets having one text word as contents.
Definition: iterator.hh:117
dw::core::DeepIterator::DeepIterator
DeepIterator()
Definition: iterator.hh:169
dw::core::Layout::getUsesViewport
bool getUsesViewport()
Definition: layout.hh:269
dw::core::Allocation
Represents the allocation, i.e. actual position and size of a dw::core::Widget.
Definition: types.hh:163
dw::core::EmptyIterator::next
bool next()
Move iterator forward and store content it.
Definition: iterator.cc:220
dw::core::Content::text
const char * text
Definition: types.hh:204
dw::core::Widget::getParent
Widget * getParent()
Definition: widget.hh:302
dw::core::Widget::iterator
virtual Iterator * iterator(Content::Type mask, bool atEnd)=0
Return an iterator for this widget.
dw::core::CharIterator::CharIterator
CharIterator()
Definition: iterator.cc:640
dw::core::Content::SELECTION_CONTENT
Definition: types.hh:195
dw::core::CharIterator::pos
int pos
Definition: iterator.hh:228
dw::core::TextIterator::getAllocation
void getAllocation(int start, int end, Allocation *allocation)
Return the shape, which a part of the item, the iterator points on, allocates.
Definition: iterator.cc:310
dw::core::DeepIterator::stack
Stack stack
Definition: iterator.hh:158
dw::core::Iterator::getWidget
Widget * getWidget()
Definition: iterator.hh:35
dw::core::Widget::getLayout
Layout * getLayout()
Definition: widget.hh:307
lout::misc::max
T max(T a, T b)
Definition: misc.hh:20
lout::misc::min
T min(T a, T b)
Definition: misc.hh:19
dw::core::Iterator::widget
Widget * widget
Definition: iterator.hh:29
dw::core::EmptyIterator::unhighlight
void unhighlight(int direction, HighlightLayer layer)
Shrink highlighted region to no longer contain the current content.
Definition: iterator.cc:236
dw::core::Allocation::descent
int descent
Definition: types.hh:169
dw::core::DeepIterator::Stack::pop
void pop()
Definition: iterator.hh:155
dw::core::DeepIterator::hasContents
bool hasContents
Definition: iterator.hh:167
lout::container::typed::Vector< Iterator >::get
Iterator * get(int pos) const
Definition: container.hh:412
lout::object::Object
This is the base class for many other classes, which defines very common virtual methods.
Definition: object.hh:24
dw::core::CharIterator
Definition: iterator.hh:219
dw::core::CharIterator::~CharIterator
~CharIterator()
Definition: iterator.cc:653
dw::core::TextIterator::next
bool next()
Move iterator forward and store content it.
Definition: iterator.cc:286
dw::core::EmptyIterator::highlight
void highlight(int start, int end, HighlightLayer layer)
Extend highlighted region to contain part of the current content.
Definition: iterator.cc:232
dw::core::Iterator::getContent
Content * getContent()
Definition: iterator.hh:36
dw::core::Iterator::mask
Content::Type mask
Definition: iterator.hh:30
lout
Definition: container.cc:26
dw::core::Iterator::prev
virtual bool prev()=0
Move iterator backward and store content it.
dw::core::Iterator::~Iterator
~Iterator()
Definition: iterator.cc:46
dw::core::Iterator::getMask
Content::Type getMask()
Definition: iterator.hh:37
dw::core::Iterator::equals
bool equals(Object *other)
Returns, whether two objects are equal.
Definition: iterator.cc:50
dw::core::EmptyIterator::EmptyIterator
EmptyIterator(EmptyIterator &it)
Definition: iterator.cc:199
dw::core::EmptyIterator::compareTo
int compareTo(lout::object::Comparable *other)
Compare two objects c1 and c2.
Definition: iterator.cc:208
lout::object::Comparable::compareTo
virtual int compareTo(Comparable *other)=0
Compare two objects c1 and c2.
dw::core::Content::WIDGET
Definition: types.hh:191
dw::core::Widget::getAllocation
Allocation * getAllocation()
Definition: widget.hh:270
dw::core::Iterator::content
Content content
Definition: iterator.hh:26
dw::core::EmptyIterator::getAllocation
void getAllocation(int start, int end, Allocation *allocation)
Return the shape, which a part of the item, the iterator points on, allocates.
Definition: iterator.cc:240
dw::core::Content::widget
Widget * widget
Definition: types.hh:205
dw::core::DeepIterator::createVariant
DeepIterator * createVariant(Iterator *it)
Definition: iterator.cc:560
dw::core::DeepIterator::~DeepIterator
~DeepIterator()
Definition: iterator.cc:520
dw::core::DeepIterator::content
Content content
Definition: iterator.hh:166
dw::core::DeepIterator::searchSideward
static Iterator * searchSideward(Iterator *it, Content::Type mask, bool fromEnd)
Definition: iterator.cc:385
dw::core::DeepIterator::clone
lout::object::Object * clone()
Return an exact copy of the object.
Definition: iterator.cc:524
dw::core::Content::END
Definition: types.hh:189
dw::core::Content::TEXT
Definition: types.hh:190
dw::core::CharIterator::clone
lout::object::Object * clone()
Return an exact copy of the object.
Definition: iterator.cc:659
dw::core::Allocation::ascent
int ascent
Definition: types.hh:168
lout::object::Comparable
Instances of a sub class of may be compared (less, greater).
Definition: object.hh:41
core.hh
dw::core::VPosition
VPosition
Definition: types.hh:25
dw::core::DeepIterator::compareTo
int compareTo(lout::object::Comparable *other)
Compare two objects c1 and c2.
Definition: iterator.cc:538
lout::container::typed::Vector::put
void put(T *newElement, int newPos=-1)
Definition: container.hh:405
dw::core::EmptyIterator::prev
bool prev()
Move iterator backward and store content it.
Definition: iterator.cc:226
dw::core::DeepIterator::next
bool next()
Move iterator forward and store content it.
Definition: iterator.cc:575
dw::core::Iterator::cloneIterator
Iterator * cloneIterator()
Definition: iterator.hh:84
dw::core::DeepIterator::unhighlight
void unhighlight(int direction, HighlightLayer layer)
Definition: iterator.hh:209
dw::core::Iterator::unref
virtual void unref()
Delete the iterator.
Definition: iterator.cc:64
dw::core::CharIterator::highlight
static void highlight(CharIterator *it1, CharIterator *it2, HighlightLayer layer)
Definition: iterator.cc:753
dw::core::Widget
The base class of all dillo widgets.
Definition: widget.hh:23
dw
Dw is in this namespace, or sub namespaces of this one.
Definition: alignedtextblock.cc:26
dw::core::DeepIterator::getAllocation
void getAllocation(int start, int end, Allocation *allocation)
Return the shape, which a part of the item, the iterator points on, allocates.
Definition: iterator.hh:206
dw::core::Content::type
short type
Definition: types.hh:201
dw::core::CharIterator::prev
bool prev()
Definition: iterator.cc:717
dw::core::DeepIterator::highlight
void highlight(int start, int end, HighlightLayer layer)
Highlight a part of the current content.
Definition: iterator.hh:196
lout::container::typed::Vector< Iterator >::size
int size() const
Definition: container.hh:414
dw::core::Iterator::scrollTo
static void scrollTo(Iterator *it1, Iterator *it2, int start, int end, HPosition hpos, VPosition vpos)
Scrolls the viewport, so that the region between it1 and it2 is seen, according to hpos and vpos.
Definition: iterator.cc:80
dw::core::TextIterator::TextIterator
TextIterator(TextIterator &it)
Definition: iterator.cc:255
dw::core::TextIterator::text
const char * text
Definition: iterator.hh:121
dw::core::Allocation::width
int width
Definition: types.hh:167
dw::core::Content::START
Definition: types.hh:188
dw::core::DeepIterator::Stack::push
void push(Iterator *it)
Definition: iterator.hh:154