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)  

dw::core::Iterator Class Referenceabstract

Iterators are used to iterate through the contents of a widget. More...

#include <iterator.hh>

Inheritance diagram for dw::core::Iterator:
[legend]
Collaboration diagram for dw::core::Iterator:
[legend]

Public Member Functions

bool equals (Object *other)
 Returns, whether two objects are equal. More...
 
WidgetgetWidget ()
 
ContentgetContent ()
 
Content::Type getMask ()
 
virtual void unref ()
 Delete the iterator. More...
 
virtual bool next ()=0
 Move iterator forward and store content it. More...
 
virtual bool prev ()=0
 Move iterator backward and store content it. More...
 
virtual void highlight (int start, int end, HighlightLayer layer)=0
 Extend highlighted region to contain part of the current content. More...
 
virtual void unhighlight (int direction, HighlightLayer layer)=0
 Shrink highlighted region to no longer contain the current content. More...
 
virtual void getAllocation (int start, int end, Allocation *allocation)=0
 Return the shape, which a part of the item, the iterator points on, allocates. More...
 
IteratorcloneIterator ()
 
- Public Member Functions inherited from lout::object::Comparable
virtual int compareTo (Comparable *other)=0
 Compare two objects c1 and c2. More...
 
- Public Member Functions inherited from lout::object::Object
virtual ~Object ()
 The destructor is defined as virtual (but not abstract), so that destruction of Object's works properly. More...
 
virtual int hashValue ()
 Return a hash value for the object. More...
 
virtual Objectclone ()
 Return an exact copy of the object. More...
 
virtual void intoStringBuffer (misc::StringBuffer *sb)
 Store a textual representation of the object in a misc::StringBuffer. More...
 
const char * toString ()
 Use object::Object::intoStringBuffer to return a textual representation of the object. More...
 
virtual size_t sizeOf ()
 Return the number of bytes, this object totally uses. More...
 

Static Public Member Functions

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. More...
 
- Static Public Member Functions inherited from lout::object::Comparable
static int compareFun (const void *p1, const void *p2)
 This static method may be used as compare function for qsort(3) and bsearch(3), for an array of Object* (Object*[] or Object**). More...
 

Protected Member Functions

 Iterator (Widget *widget, Content::Type mask, bool atEnd)
 
 Iterator (Iterator &it)
 
 ~Iterator ()
 

Protected Attributes

Content content
 

Private Attributes

Widgetwidget
 
Content::Type mask
 

Detailed Description

Iterators are used to iterate through the contents of a widget.

When using iterators, you should care about the results of dw::core::Widget::hasContents.

See also
dw::core::Widget::iterator

Definition at line 19 of file iterator.hh.

Constructor & Destructor Documentation

◆ Iterator() [1/2]

dw::core::Iterator::Iterator ( Widget widget,
Content::Type  mask,
bool  atEnd 
)
protected

Definition at line 34 of file iterator.cc.

◆ Iterator() [2/2]

dw::core::Iterator::Iterator ( Iterator it)
protected

Definition at line 40 of file iterator.cc.

References content, and widget.

◆ ~Iterator()

dw::core::Iterator::~Iterator ( )
protected

Definition at line 46 of file iterator.cc.

Member Function Documentation

◆ cloneIterator()

Iterator* dw::core::Iterator::cloneIterator ( )
inline

◆ equals()

bool dw::core::Iterator::equals ( Object other)
virtual

Returns, whether two objects are equal.

The caller should ensure, that this and the object have the same class; this makes casting of "other" safe. Typically, an implementation should check this == other first, the caller can assume a fast implementation.

Reimplemented from lout::object::Object.

Definition at line 50 of file iterator.cc.

References lout::object::Comparable::compareTo(), and getWidget().

Referenced by scrollTo().

◆ getAllocation()

virtual void dw::core::Iterator::getAllocation ( int  start,
int  end,
Allocation allocation 
)
pure virtual

Return the shape, which a part of the item, the iterator points on, allocates.

The parameters start and end have the same meaning as in DwIterator::highlight().

Implemented in dw::Textblock::TextblockIterator, dw::Table::TableIterator, dw::core::TextIterator, and dw::core::EmptyIterator.

Referenced by dw::core::DeepIterator::getAllocation(), and scrollTo().

◆ getContent()

◆ getMask()

Content::Type dw::core::Iterator::getMask ( )
inline

Definition at line 37 of file iterator.hh.

References mask.

Referenced by dw::Table::TableIterator::clone(), and dw::core::DeepIterator::DeepIterator().

◆ getWidget()

◆ highlight()

virtual void dw::core::Iterator::highlight ( int  start,
int  end,
HighlightLayer  layer 
)
pure virtual

Extend highlighted region to contain part of the current content.

For text, start and end define the characters, otherwise, the shape is defined as [0, 1], i.e. for highlighting a whole dw::core::Content, pass 0 and >= 1. To unhighlight see also dw::core::Iterator::unhighlight.

Implemented in dw::core::EmptyIterator, dw::Textblock::TextblockIterator, and dw::Table::TableIterator.

Referenced by dw::core::DeepIterator::highlight().

◆ next()

virtual bool dw::core::Iterator::next ( )
pure virtual

◆ prev()

virtual bool dw::core::Iterator::prev ( )
pure virtual

Move iterator backward and store content it.

Returns true on success.

Implemented in dw::Textblock::TextblockIterator, dw::Table::TableIterator, dw::core::TextIterator, and dw::core::EmptyIterator.

Referenced by dw::core::DeepIterator::prev().

◆ scrollTo()

void dw::core::Iterator::scrollTo ( Iterator it1,
Iterator it2,
int  start,
int  end,
HPosition  hpos,
VPosition  vpos 
)
static

Scrolls the viewport, so that the region between it1 and it2 is seen, according to hpos and vpos.

The parameters start and end have the same meaning as in dw::core::Iterator::getAllocation, start refers to it1, while end rerers to it2.

If it1 and it2 point to the same location (see code), only it1 is regarded, and both belowstart and belowend refer to it.

Todo:
Changes in the viewport size, until the idle function is called, are not regarded.

Definition at line 80 of file iterator.cc.

References dw::core::Allocation::ascent, dw::core::DeepIterator::clone(), dw::core::DeepIterator::compareTo(), dw::core::Allocation::descent, equals(), getAllocation(), dw::core::DeepIterator::getAllocation(), dw::core::Layout::getHeightViewport(), dw::core::Widget::getLayout(), dw::core::Layout::getUsesViewport(), getWidget(), dw::core::Layout::getWidthViewport(), lout::misc::max(), lout::misc::min(), dw::core::DeepIterator::next(), dw::core::Layout::scrollTo(), dw::core::Allocation::width, dw::core::Allocation::x, and dw::core::Allocation::y.

Referenced by dw::core::DeepIterator::scrollTo().

◆ unhighlight()

virtual void dw::core::Iterator::unhighlight ( int  direction,
HighlightLayer  layer 
)
pure virtual

Shrink highlighted region to no longer contain the current content.

The direction parameter indicates whether the highlighted region should be reduced from the start (direction > 0) or from the end (direction < 0). If direction is 0 all content is unhighlighted.

Implemented in dw::core::EmptyIterator, dw::Textblock::TextblockIterator, and dw::Table::TableIterator.

Referenced by dw::core::DeepIterator::unhighlight().

◆ unref()

void dw::core::Iterator::unref ( )
virtual

Delete the iterator.

The destructor is hidden, implementations may use optimizations for the allocation. (Will soon be the case for dw::core::EmptyIteratorFactory.)

Definition at line 64 of file iterator.cc.

Referenced by dw::core::CharIterator::CharIterator(), dw::core::DeepIterator::DeepIterator(), dw::core::Widget::getWidgetAtPoint(), dw::core::DeepIterator::Stack::pop(), dw::core::DeepIterator::searchDownward(), dw::core::DeepIterator::searchSideward(), and dw::Textblock::sendSelectionEvent().

Member Data Documentation

◆ content

◆ mask

Content::Type dw::core::Iterator::mask
private

Definition at line 30 of file iterator.hh.

Referenced by getMask(), and dw::core::TextIterator::TextIterator().

◆ widget

Widget* dw::core::Iterator::widget
private

Definition at line 29 of file iterator.hh.

Referenced by getWidget(), and Iterator().


The documentation for this class was generated from the following files: