Dillo v3.1.1-95-g3af05307
|
Iterators are used to iterate through the contents of a widget. More...
#include <iterator.hh>
Public Member Functions | |
bool | equals (Object *other) |
Returns, whether two objects are equal. | |
void | intoStringBuffer (lout::misc::StringBuffer *sb) |
Store a textual representation of the object in a misc::StringBuffer. | |
Widget * | getWidget () |
Content * | getContent () |
Content::Type | getMask () |
virtual void | unref () |
Delete the iterator. | |
virtual bool | next ()=0 |
Move iterator forward and store content it. | |
virtual bool | prev ()=0 |
Move iterator backward and store content it. | |
virtual void | highlight (int start, int end, HighlightLayer layer)=0 |
Extend highlighted region to contain part of the current content. | |
virtual void | unhighlight (int direction, HighlightLayer layer)=0 |
Shrink highlighted region to no longer contain the current content. | |
virtual void | getAllocation (int start, int end, Allocation *allocation)=0 |
Return the shape, which a part of the item, the iterator points on, allocates. | |
Iterator * | cloneIterator () |
Public Member Functions inherited from lout::object::Comparable | |
virtual int | compareTo (Comparable *other)=0 |
Compare two objects, this and other. | |
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. | |
virtual int | hashValue () |
Return a hash value for the object. | |
virtual Object * | clone () |
Return an exact copy of the object. | |
const char * | toString () |
Use object::Object::intoStringBuffer to return a textual representation of the object. | |
virtual size_t | sizeOf () |
Return the number of bytes, this object totally uses. | |
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. | |
Protected Member Functions | |
Iterator (Widget *widget, Content::Type mask, bool atEnd) | |
Iterator (Iterator &it) | |
~Iterator () | |
Protected Attributes | |
Content | content |
Private Attributes | |
Widget * | widget |
Content::Type | mask |
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.
Definition at line 19 of file iterator.hh.
|
protected |
Definition at line 34 of file iterator.cc.
|
protected |
Definition at line 40 of file iterator.cc.
|
protected |
Definition at line 46 of file iterator.cc.
|
inline |
Definition at line 85 of file iterator.hh.
References lout::object::Object::clone().
Referenced by dw::core::DeepIterator::DeepIterator(), and dw::core::DeepIterator::searchSideward().
|
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().
|
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::core::EmptyIterator, dw::core::TextIterator, dw::Table::TableIterator, dw::Textblock::TextblockIterator, and dw::SimpleContainer::SimpleContainerIterator.
Referenced by dw::core::DeepIterator::getAllocation(), and scrollTo().
|
inline |
Definition at line 37 of file iterator.hh.
References content.
Referenced by dw::core::Widget::containerSizeChangedForChildren(), dw::core::SelectionState::copy(), dw::core::SelectionState::correctCharPos(), dw::core::DeepIterator::DeepIterator(), dw::core::Layout::detachWidget(), dw::core::DeepIterator::next(), dw::core::DeepIterator::prev(), dw::core::DeepIterator::searchDownward(), and dw::core::DeepIterator::searchSideward().
|
inline |
Definition at line 38 of file iterator.hh.
References mask.
Referenced by dw::core::DeepIterator::DeepIterator(), and dw::core::DeepIterator::searchSideward().
|
inline |
Definition at line 36 of file iterator.hh.
References widget.
Referenced by dw::core::SelectionState::buttonPress(), dw::core::SelectionState::buttonRelease(), dw::core::DeepIterator::DeepIterator(), equals(), dw::core::TextIterator::getAllocation(), scrollTo(), and dw::core::DeepIterator::searchSideward().
|
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::Table::TableIterator, dw::Textblock::TextblockIterator, dw::SimpleContainer::SimpleContainerIterator, and dw::core::EmptyIterator.
Referenced by dw::core::DeepIterator::highlight().
|
virtual |
Store a textual representation of the object in a misc::StringBuffer.
This is used by object::Object::toString.
Reimplemented from lout::object::Object.
Reimplemented in dw::oof::OOFAwareWidget::OOFAwareWidgetIterator.
Definition at line 58 of file iterator.cc.
References lout::misc::StringBuffer::append(), lout::misc::StringBuffer::appendPointer(), content, lout::identity::IdentifiableObject::getClassName(), dw::core::Content::intoStringBuffer(), mask, dw::core::Content::maskIntoStringBuffer(), and widget.
Referenced by dw::core::SelectionState::buttonPress(), dw::core::SelectionState::buttonRelease(), and dw::oof::OOFAwareWidget::OOFAwareWidgetIterator::intoStringBuffer().
|
pure virtual |
Move iterator forward and store content it.
Returns true on success.
Implemented in dw::core::EmptyIterator, dw::core::TextIterator, dw::oof::OOFAwareWidget::OOFAwareWidgetIterator, and dw::SimpleContainer::SimpleContainerIterator.
Referenced by dw::core::Widget::containerSizeChangedForChildren(), dw::core::DeepIterator::DeepIterator(), dw::core::Layout::detachWidget(), dw::core::DeepIterator::next(), dw::core::DeepIterator::searchDownward(), and dw::core::DeepIterator::searchSideward().
|
pure virtual |
Move iterator backward and store content it.
Returns true on success.
Implemented in dw::core::EmptyIterator, dw::core::TextIterator, dw::oof::OOFAwareWidget::OOFAwareWidgetIterator, and dw::SimpleContainer::SimpleContainerIterator.
Referenced by dw::core::DeepIterator::prev(), dw::core::DeepIterator::searchDownward(), and dw::core::DeepIterator::searchSideward().
|
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.
Definition at line 98 of file iterator.cc.
References dw::core::Allocation::ascent, dw::core::DeepIterator::clone(), dw::core::DeepIterator::compareTo(), dw::core::Allocation::descent, equals(), dw::core::DeepIterator::getAllocation(), 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().
|
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::Table::TableIterator, dw::Textblock::TextblockIterator, dw::SimpleContainer::SimpleContainerIterator, and dw::core::EmptyIterator.
Referenced by dw::core::DeepIterator::unhighlight().
|
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 82 of file iterator.cc.
Referenced by dw::core::CharIterator::CharIterator(), dw::core::Widget::containerSizeChangedForChildren(), dw::core::DeepIterator::DeepIterator(), dw::core::Layout::detachWidget(), dw::core::DeepIterator::Stack::pop(), dw::core::DeepIterator::searchDownward(), dw::core::DeepIterator::searchSideward(), and dw::Textblock::sendSelectionEvent().
|
protected |
Definition at line 26 of file iterator.hh.
Referenced by dw::SimpleContainer::SimpleContainerIterator::clone(), dw::core::EmptyIterator::compareTo(), dw::core::TextIterator::compareTo(), dw::core::EmptyIterator::EmptyIterator(), getContent(), intoStringBuffer(), Iterator(), dw::core::EmptyIterator::next(), dw::core::TextIterator::next(), dw::oof::OOFAwareWidget::OOFAwareWidgetIterator::OOFAwareWidgetIterator(), dw::core::EmptyIterator::prev(), dw::core::TextIterator::prev(), dw::SimpleContainer::SimpleContainerIterator::SimpleContainerIterator(), and dw::core::TextIterator::TextIterator().
|
private |
Definition at line 30 of file iterator.hh.
Referenced by getMask(), intoStringBuffer(), Iterator(), and dw::core::TextIterator::TextIterator().
|
private |
Definition at line 29 of file iterator.hh.
Referenced by getWidget(), intoStringBuffer(), Iterator(), and Iterator().