Dillo v3.1.1-98-g318d1f14
|
A stack of iterators, to iterate recursively through a widget tree. More...
#include <iterator.hh>
Classes | |
class | Stack |
Public Member Functions | |
DeepIterator (Iterator *it) | |
Create a new deep iterator from an existing dw::core::Iterator. | |
~DeepIterator () | |
lout::object::Object * | clone () |
Return an exact copy of the object. | |
DeepIterator * | createVariant (Iterator *it) |
Iterator * | getTopIterator () |
Content * | getContent () |
bool | isEmpty () |
bool | next () |
Move iterator forward and store content it. | |
bool | prev () |
Move iterator backward and store content it. | |
DeepIterator * | cloneDeepIterator () |
int | compareTo (lout::object::Comparable *other) |
Compare two objects, this and other. | |
void | highlight (int start, int end, HighlightLayer layer) |
Highlight a part of the current content. | |
void | getAllocation (int start, int end, Allocation *allocation) |
Return the shape, which a part of the item, the iterator points on, allocates. | |
void | unhighlight (int direction, HighlightLayer layer) |
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 bool | equals (Object *other) |
Returns, whether two objects are equal. | |
virtual int | hashValue () |
Return a hash value for the object. | |
virtual void | intoStringBuffer (misc::StringBuffer *sb) |
Store a textual representation of the object in a misc::StringBuffer. | |
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 (DeepIterator *it1, DeepIterator *it2, int start, int end, HPosition hpos, VPosition vpos) |
Private Member Functions | |
DeepIterator () | |
Widget * | getRespectiveParent (Widget *widget) |
int | getRespectiveLevel (Widget *widget) |
Static Private Member Functions | |
static Iterator * | searchDownward (Iterator *it, Content::Type mask, bool fromEnd) |
static Iterator * | searchSideward (Iterator *it, Content::Type mask, bool fromEnd) |
static Widget * | getRespectiveParent (Widget *widget, Content::Type mask) |
static int | getRespectiveLevel (Widget *widget, Content::Type mask) |
Private Attributes | |
Stack | stack |
Content::Type | mask |
Content | content |
bool | hasContents |
A stack of iterators, to iterate recursively through a widget tree.
This class is similar to dw::core::Iterator, but not created by a widget, but explicitly from another iterator. Deep iterators do not have the limitation, that iteration is only done within a widget, instead, child widgets are iterated through recursively.
Definition at line 146 of file iterator.hh.
|
inlineprivate |
Definition at line 170 of file iterator.hh.
Referenced by dw::core::CharIterator::CharIterator(), clone(), and createVariant().
dw::core::DeepIterator::DeepIterator | ( | Iterator * | it | ) |
Create a new deep iterator from an existing dw::core::Iterator.
The content of the return value will be the content of it. If within the widget tree, there is no non-widget content, the resulting deep iterator is empty (denoted by dw::core::DeepIterator::stack == NULL).
Notes:
Definition at line 497 of file iterator.cc.
References dw::core::Content::ANY_WIDGET, dw::core::Iterator::cloneIterator(), content, dw::core::Iterator::getContent(), dw::core::Iterator::getMask(), getRespectiveLevel(), getRespectiveParent(), dw::core::Iterator::getWidget(), dw::core::Content::getWidget(), hasContents, dw::core::Widget::iterator(), mask, dw::core::Iterator::next(), lout::container::typed::Vector< T >::put(), searchDownward(), searchSideward(), stack, dw::core::Content::type, dw::core::Iterator::unref(), dw::core::Content::WIDGET_OOF_CONT, and dw::core::Content::WIDGET_OOF_REF.
dw::core::DeepIterator::~DeepIterator | ( | ) |
Definition at line 591 of file iterator.cc.
|
virtual |
Return an exact copy of the object.
Reimplemented from lout::object::Object.
Definition at line 596 of file iterator.cc.
References content, DeepIterator(), lout::container::typed::Vector< T >::get(), hasContents, mask, lout::container::typed::Vector< T >::put(), lout::container::typed::Collection< T >::size(), and stack.
Referenced by cloneDeepIterator(), and dw::core::Iterator::scrollTo().
|
inline |
Definition at line 196 of file iterator.hh.
References clone().
Referenced by dw::core::SelectionState::buttonPress(), dw::core::CharIterator::clone(), dw::core::SelectionState::copy(), dw::core::CharIterator::highlight(), dw::core::SelectionState::highlight0(), dw::core::SelectionState::switchLinkToSelection(), and dw::core::CharIterator::unhighlight().
|
virtual |
Compare two objects, this and other.
Return a value < 0, when this is less than other, a value > 0, when this is greater than other, or 0, when this and other are equal.
If c1.equals(c2) (as defined in Object), c1.compareTo(c2) must be 0, but, unlike you may expect, the reversed is not necessarily true. This method returns 0, if, according to the rules for sorting, there is no difference, but there may still be differences (not relevant for sorting), which "equals" will care about.
Implements lout::object::Comparable.
Definition at line 610 of file iterator.cc.
References lout::container::typed::Vector< T >::get(), lout::container::typed::Collection< T >::size(), and stack.
Referenced by dw::core::SelectionState::adjustSelection(), dw::core::SelectionState::buttonRelease(), dw::core::SelectionState::copy(), dw::core::CharIterator::highlight(), dw::core::SelectionState::highlight0(), dw::core::Iterator::scrollTo(), and dw::core::CharIterator::unhighlight().
DeepIterator * dw::core::DeepIterator::createVariant | ( | Iterator * | it | ) |
Definition at line 656 of file iterator.cc.
References DeepIterator().
Referenced by dw::core::SelectionState::adjustSelection(), and dw::core::SelectionState::switchLinkToSelection().
|
inline |
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().
Definition at line 217 of file iterator.hh.
References dw::core::Iterator::getAllocation(), dw::core::DeepIterator::Stack::getTop(), and stack.
Referenced by dw::core::Iterator::scrollTo().
|
inline |
Definition at line 190 of file iterator.hh.
References content.
Referenced by dw::core::SelectionState::copy(), dw::core::CharIterator::highlight(), and dw::core::SelectionState::highlight0().
|
inlineprivate |
Definition at line 178 of file iterator.hh.
References getRespectiveLevel(), and mask.
|
staticprivate |
Definition at line 475 of file iterator.cc.
References dw::core::Widget::getGeneratorLevel(), dw::core::Widget::getLevel(), mask, and dw::core::Content::WIDGET_OOF_REF.
Referenced by DeepIterator(), and getRespectiveLevel().
Definition at line 173 of file iterator.hh.
References getRespectiveParent(), and mask.
|
staticprivate |
Definition at line 462 of file iterator.cc.
References dw::core::Widget::getGenerator(), dw::core::Widget::getParent(), mask, and dw::core::Content::WIDGET_OOF_REF.
Referenced by DeepIterator(), getRespectiveParent(), and searchSideward().
|
inline |
Definition at line 189 of file iterator.hh.
References dw::core::DeepIterator::Stack::getTop(), and stack.
Referenced by dw::core::SelectionState::copy(), and dw::core::SelectionState::correctCharPos().
|
inline |
Highlight a part of the current content.
Unhighlight the current content by passing -1 as start (see also (dw::core::Iterator::unhighlight). 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.
Definition at line 207 of file iterator.hh.
References dw::core::DeepIterator::Stack::getTop(), dw::core::Iterator::highlight(), and stack.
Referenced by dw::core::SelectionState::adjustSelection(), dw::core::CharIterator::highlight(), and dw::core::SelectionState::highlight0().
bool dw::core::DeepIterator::isEmpty | ( | ) |
Definition at line 662 of file iterator.cc.
References hasContents.
Referenced by dw::core::SelectionState::buttonPress().
bool dw::core::DeepIterator::next | ( | ) |
Move iterator forward and store content it.
Returns true on success.
Definition at line 671 of file iterator.cc.
References dw::core::Content::ANY_WIDGET, content, dw::core::Content::END, dw::core::Iterator::getContent(), dw::core::DeepIterator::Stack::getTop(), dw::core::Content::getWidget(), dw::core::Widget::iterator(), mask, next(), dw::core::Iterator::next(), dw::core::DeepIterator::Stack::pop(), dw::core::DeepIterator::Stack::push(), lout::container::typed::Collection< T >::size(), stack, and dw::core::Content::type.
Referenced by dw::core::SelectionState::copy(), dw::core::CharIterator::highlight(), dw::core::SelectionState::highlight0(), next(), dw::core::CharIterator::next(), dw::core::Iterator::scrollTo(), and dw::core::CharIterator::unhighlight().
bool dw::core::DeepIterator::prev | ( | ) |
Move iterator backward and store content it.
Returns true on success.
Definition at line 704 of file iterator.cc.
References dw::core::Content::ANY_WIDGET, content, dw::core::Iterator::getContent(), dw::core::DeepIterator::Stack::getTop(), dw::core::Content::getWidget(), dw::core::Widget::iterator(), mask, dw::core::DeepIterator::Stack::pop(), prev(), dw::core::Iterator::prev(), dw::core::DeepIterator::Stack::push(), lout::container::typed::Collection< T >::size(), stack, dw::core::Content::START, and dw::core::Content::type.
Referenced by prev(), and dw::core::CharIterator::prev().
|
inlinestatic |
Definition at line 223 of file iterator.hh.
References dw::core::DeepIterator::Stack::getTop(), dw::core::Iterator::scrollTo(), and stack.
Referenced by dw::core::CharIterator::scrollTo().
|
staticprivate |
Definition at line 356 of file iterator.cc.
References dw::core::Content::ANY_WIDGET, dw::core::Iterator::getContent(), dw::core::Content::getWidget(), dw::core::Widget::iterator(), mask, dw::core::Iterator::next(), dw::core::Iterator::prev(), searchDownward(), dw::core::Content::type, and dw::core::Iterator::unref().
Referenced by DeepIterator(), searchDownward(), and searchSideward().
|
staticprivate |
Definition at line 403 of file iterator.cc.
References dw::core::Content::ANY_WIDGET, lout::misc::assertNotReached(), dw::core::Iterator::cloneIterator(), dw::core::Iterator::getContent(), dw::core::Iterator::getMask(), getRespectiveParent(), dw::core::Iterator::getWidget(), dw::core::Content::getWidget(), dw::core::Widget::iterator(), mask, dw::core::Iterator::next(), dw::core::Iterator::prev(), searchDownward(), searchSideward(), dw::core::Content::type, and dw::core::Iterator::unref().
Referenced by DeepIterator(), and searchSideward().
|
inline |
Definition at line 220 of file iterator.hh.
References dw::core::DeepIterator::Stack::getTop(), stack, and dw::core::Iterator::unhighlight().
Referenced by dw::core::SelectionState::highlight0(), and dw::core::CharIterator::unhighlight().
|
private |
Definition at line 167 of file iterator.hh.
Referenced by clone(), DeepIterator(), getContent(), next(), and prev().
|
private |
Definition at line 168 of file iterator.hh.
Referenced by clone(), DeepIterator(), and isEmpty().
|
private |
Definition at line 166 of file iterator.hh.
Referenced by clone(), DeepIterator(), getRespectiveLevel(), getRespectiveLevel(), getRespectiveParent(), getRespectiveParent(), next(), prev(), searchDownward(), and searchSideward().
|
private |
Definition at line 159 of file iterator.hh.
Referenced by clone(), compareTo(), DeepIterator(), getAllocation(), getTopIterator(), highlight(), next(), prev(), scrollTo(), and unhighlight().