#include <textblock.hh>
Classes | |
| struct | Anchor |
| struct | Line |
| class | TextblockIterator |
| struct | Word |
Public Member Functions | |
| Textblock (bool limitTextWidth) | |
| ~Textblock () | |
| core::Iterator * | iterator (core::Content::Type mask, bool atEnd) |
| Return an iterator for this widget. | |
| void | flush () |
| void | addText (const char *text, size_t len, core::style::Style *style) |
| void | addText (const char *text, core::style::Style *style) |
| void | addWidget (core::Widget *widget, core::style::Style *style) |
| bool | addAnchor (const char *name, core::style::Style *style) |
| void | addSpace (core::style::Style *style) |
| void | addParbreak (int space, core::style::Style *style) |
| void | addLinebreak (core::style::Style *style) |
| core::Widget * | getWidgetAtPoint (int x, int y, int level) |
| Search recursively through widget. | |
| void | handOverBreak (core::style::Style *style) |
| void | changeLinkColor (int link, int newColor) |
| void | changeWordStyle (int from, int to, core::style::Style *style, bool includeFirstSpace, bool includeLastSpace) |
Static Public Attributes | |
| static int | CLASS_ID = -1 |
Protected Member Functions | |
| void | queueDrawRange (int index1, int index2) |
| void | getWordExtremes (Word *word, core::Extremes *extremes) |
| void | markChange (int ref) |
| void | justifyLine (Line *line, int availWidth) |
| Line * | addLine (int wordInd, bool newPar) |
| void | calcWidgetSize (core::Widget *widget, core::Requisition *size) |
| void | rewrap () |
| void | decorateText (core::View *view, core::style::Style *style, core::style::Color::Shading shading, int x, int yBase, int width) |
| void | drawText (int wordIndex, core::View *view, core::Rectangle *area, int xWidget, int yWidgetBase) |
| void | drawSpace (int wordIndex, core::View *view, core::Rectangle *area, int xWidget, int yWidgetBase) |
| void | drawLine (Line *line, core::View *view, core::Rectangle *area) |
| int | findLineIndex (int y) |
| int | findLineOfWord (int wordIndex) |
| Find the line of word wordIndex. | |
| Word * | findWord (int x, int y, bool *inSpace) |
| Find the index of the word, or -1. | |
| Word * | addWord (int width, int ascent, int descent, core::style::Style *style) |
| void | calcTextSize (const char *text, size_t len, core::style::Style *style, core::Requisition *size) |
| int | lineXOffsetContents (Line *line) |
| Returns the x offset (the indentation plus any offset needed for centering or right justification) for the line. | |
| int | lineXOffsetWidget (Line *line) |
| Like lineXOffset, but relative to the allocation (i.e. including border etc.). | |
| int | lineYOffsetWidgetAllocation (Line *line, core::Allocation *allocation) |
| int | lineYOffsetWidget (Line *line) |
| int | lineYOffsetCanvasAllocation (Line *line, core::Allocation *allocation) |
| int | lineYOffsetCanvas (Line *line) |
| int | lineYOffsetWidgetI (int lineIndex) |
| int | lineYOffsetCanvasI (int lineIndex) |
| bool | sendSelectionEvent (core::SelectionState::EventType eventType, core::MousePositionEvent *event) |
| Send event to selection. | |
| virtual void | wordWrap (int wordIndex) |
| void | sizeRequestImpl (core::Requisition *requisition) |
| void | getExtremesImpl (core::Extremes *extremes) |
| See Sizes of Dillo Widgets. | |
| void | sizeAllocateImpl (core::Allocation *allocation) |
| See Sizes of Dillo Widgets. | |
| void | resizeDrawImpl () |
| Called after sizeAllocateImpl() to redraw necessary areas. By default the whole widget is redrawn. | |
| void | markSizeChange (int ref) |
| See Sizes of Dillo Widgets. | |
| void | markExtremesChange (int ref) |
| See Sizes of Dillo Widgets. | |
| void | setWidth (int width) |
| void | setAscent (int ascent) |
| void | setDescent (int descent) |
| void | draw (core::View *view, core::Rectangle *area) |
| bool | buttonPressImpl (core::EventButton *event) |
| bool | buttonReleaseImpl (core::EventButton *event) |
| bool | motionNotifyImpl (core::EventMotion *event) |
| void | enterNotifyImpl (core::EventCrossing *event) |
| void | leaveNotifyImpl (core::EventCrossing *event) |
| void | removeChild (Widget *child) |
Protected Attributes | |
| bool | hasListitemValue |
| int | innerPadding |
| int | line1Offset |
| int | line1OffsetEff |
| bool | ignoreLine1OffsetSometimes |
| bool | mustQueueResize |
| bool | limitTextWidth |
| int | redrawY |
| int | lastWordDrawn |
| int | availWidth |
| int | availAscent |
| int | availDescent |
| int | lastLineWidth |
| int | lastLineParMin |
| int | lastLineParMax |
| int | wrapRef |
| lout::misc::SimpleVector< Line > * | lines |
| lout::misc::SimpleVector< Word > * | words |
| lout::misc::SimpleVector < Anchor > * | anchors |
| struct { | |
| int index | |
| int nChar | |
| } | hlStart [core::HIGHLIGHT_NUM_LAYERS] |
| struct { | |
| int index | |
| int nChar | |
| } | hlEnd [core::HIGHLIGHT_NUM_LAYERS] |
| int | hoverLink |
Friends | |
| class | TextblockIterator |
dw::Textblock uses the signals defined in dw::core::Layout::LinkReceiver, related to links. The coordinates are always -1.
The idea behind this is that every paragraph has a specific vertical space around and that they are combined to one space, according to rules stated below. A paragraph consists either of the lines between two paragraph breaks within a dw::Textblock, or of a dw::Textblock within a dw::Textblock, in a single line; the latter is used for indented boxes and list items.
The rules:
are combined like this:
If B and C are put into A, the result is:
For achieving this, there are some features of dw::Textblock:
Collapsing margins, as defined in the CSS2 specification, are, supported in addition to collapsing spaces. Also, spaces and margins collapse themselves. I.e., the space between two paragraphs is the maximum of the space calculated as described in "Collapsing Spaces" and the space calculated according to the rules for collapsing margins.
(This is an intermediate hybrid state, collapsing spaces are used in the current version of dillo, while I implemented collapsing margins for the CSS prototype and integrated it already into the main trunk. For a pure CSS-based dillo, collapsing spaces will not be needed anymore, and may be removed for simplicity.)
There are 3 lists, dw::Textblock::words, dw::Textblock::lines, and dw::Textblock::anchors. The word list is quite static; only new words may be added. A word is either text, a widget, or a break.
Lines refer to the word list (first and last). They are completely redundant, i.e., they can be rebuilt from the words. Lines can be rewrapped either completely or partially (see "Incremental Resizing" below). For the latter purpose, several values are accumulated in the lines. See dw::Textblock::Line for details.
Anchors associate the anchor name with the index of the next word at the point of the anchor.
dw::Textblock makes use of incremental resizing as described in Sizes of Dillo Widgets. The parentRef is, for children of a dw::Textblock, simply the number of the line.
Generally, there are three cases which may change the size of the widget:
(This case is very important for tables. Tables are quite at the bottom, so that a partial rewrap is relevant. Otherwise, tables change their size quite often, so that this is necessary for a fast, non-blocking rendering)
The state of the size calculation is stored in wrapRef within dw::Textblock, which has the value -1 if no rewrapping of lines necessary, or otherwise the line from which a rewrap is necessary.
| dw::Textblock::Textblock | ( | bool | limitTextWidth | ) |
References anchors, availAscent, availDescent, availWidth, dw::core::Widget::BLOCK_LEVEL, CLASS_ID, hasListitemValue, dw::core::HIGHLIGHT_NUM_LAYERS, hlEnd, hlStart, hoverLink, ignoreLine1OffsetSometimes, innerPadding, lastLineParMax, lastLineParMin, lastLineWidth, lastWordDrawn, line1Offset, line1OffsetEff, lines, mustQueueResize, redrawY, lout::identity::IdentifiableObject::registerName(), dw::core::Widget::setButtonSensitive(), dw::core::Widget::setFlags(), dw::core::Widget::USES_HINTS, words, and wrapRef.
| dw::Textblock::~Textblock | ( | ) |
References anchors, dw::Textblock::Word::content, lout::misc::SimpleVector< T >::getRef(), lines, dw::Textblock::Anchor::name, dw::core::Widget::removeAnchor(), lout::misc::SimpleVector< T >::size(), dw::Textblock::Word::spaceStyle, dw::Textblock::Word::style, dw::core::Content::type, dw::core::style::Style::unref(), dw::core::Content::widget, dw::core::Content::WIDGET, and words.
| bool dw::Textblock::addAnchor | ( | const char * | name, | |
| core::style::Style * | style | |||
| ) |
Add an anchor to the page. "name" is copied, so no strdup is necessary for the caller.
Return true on success, and false, when this anchor had already been added to the widget tree.
References dw::core::Widget::allocation, anchors, lout::misc::SimpleVector< T >::getRef(), lout::misc::SimpleVector< T >::increase(), lines, lineYOffsetWidgetI(), dw::Textblock::Anchor::name, lout::misc::SimpleVector< T >::size(), dw::core::Widget::wasAllocated(), dw::Textblock::Anchor::wordIndex, and words.
| Textblock::Line * dw::Textblock::addLine | ( | int | wordInd, | |
| bool | newPar | |||
| ) | [protected] |
References dw::Textblock::Line::boxAscent, dw::Textblock::Line::boxDescent, dw::Textblock::Line::breakSpace, dw::Textblock::Line::contentAscent, dw::Textblock::Line::contentDescent, dw::Textblock::Line::firstWord, lout::misc::SimpleVector< T >::getRef(), lout::misc::SimpleVector< T >::increase(), lastLineParMax, lastLineParMin, lastLineWidth, dw::Textblock::Line::leftOffset, line1OffsetEff, lines, dw::Textblock::Line::marginDescent, lout::misc::max(), dw::Textblock::Line::maxLineWidth, dw::Textblock::Line::maxParMax, dw::Textblock::Line::maxWordMin, dw::Textblock::Line::parMax, dw::Textblock::Line::parMin, lout::misc::SimpleVector< T >::size(), and dw::Textblock::Line::top.
Referenced by wordWrap().
| void dw::Textblock::addLinebreak | ( | core::style::Style * | style | ) |
| void dw::Textblock::addParbreak | ( | int | space, | |
| core::style::Style * | style | |||
| ) |
Cause a paragraph break
References addWord(), dw::Textblock::Line::boxDescent, dw::core::Content::BREAK, dw::Textblock::Line::breakSpace, dw::core::Content::breakSpace, CLASS_ID, dw::Textblock::Word::content, dw::Textblock::Line::firstWord, lout::misc::SimpleVector< T >::getRef(), hasListitemValue, index, lines, dw::Textblock::Line::marginDescent, lout::misc::max(), mustQueueResize, dw::core::Widget::queueResize(), lout::misc::SimpleVector< T >::size(), dw::core::Content::type, dw::core::Content::widget, dw::core::Content::WIDGET, dw::core::Widget::Widget(), words, and wordWrap().
Referenced by handOverBreak().
| void dw::Textblock::addSpace | ( | core::style::Style * | style | ) |
?
References dw::Textblock::Word::content, dw::Textblock::Word::effSpace, dw::core::style::StyleAttrs::font, lout::misc::SimpleVector< T >::getRef(), dw::Textblock::Word::origSpace, dw::core::style::Style::ref(), lout::misc::SimpleVector< T >::size(), dw::core::Content::space, dw::Textblock::Word::spaceStyle, dw::core::style::Style::unref(), words, and dw::core::style::StyleAttrs::wordSpacing.
Referenced by dw::ListItem::initWithText(), and dw::ListItem::initWithWidget().
| void dw::Textblock::addText | ( | const char * | text, | |
| core::style::Style * | style | |||
| ) | [inline] |
References addText().
| void dw::Textblock::addText | ( | const char * | text, | |
| size_t | len, | |||
| core::style::Style * | style | |||
| ) |
Add a word to the page structure.
References addWord(), dw::core::Requisition::ascent, calcTextSize(), dw::Textblock::Word::content, dw::core::Requisition::descent, dw::core::Widget::layout, lout::misc::SimpleVector< T >::size(), dw::core::Content::text, dw::core::Content::TEXT, dw::core::Content::type, dw::core::Requisition::width, words, and wordWrap().
Referenced by addText(), and dw::ListItem::initWithText().
| void dw::Textblock::addWidget | ( | core::Widget * | widget, | |
| core::style::Style * | style | |||
| ) |
Add a widget (word type) to the page.
References addWord(), dw::core::Requisition::ascent, calcWidgetSize(), dw::Textblock::Word::content, dw::core::Requisition::descent, lines, dw::core::Widget::parentRef, dw::core::Widget::setParent(), dw::core::Widget::setStyle(), lout::misc::SimpleVector< T >::size(), dw::core::Content::type, dw::core::Content::widget, dw::core::Content::WIDGET, dw::core::Requisition::width, words, and wordWrap().
Referenced by dw::ListItem::initWithWidget().
| Textblock::Word * dw::Textblock::addWord | ( | int | width, | |
| int | ascent, | |||
| int | descent, | |||
| core::style::Style * | style | |||
| ) | [protected] |
Add a new word (text, widget etc.) to a page.
References dw::core::Requisition::ascent, dw::Textblock::Word::content, dw::core::Requisition::descent, dw::Textblock::Word::effSpace, lout::misc::SimpleVector< T >::getRef(), lout::misc::SimpleVector< T >::increase(), dw::Textblock::Word::origSpace, dw::core::style::Style::ref(), dw::Textblock::Word::size, lout::misc::SimpleVector< T >::size(), dw::core::Content::space, dw::Textblock::Word::spaceStyle, dw::Textblock::Word::style, dw::core::Requisition::width, and words.
Referenced by addLinebreak(), addParbreak(), addText(), and addWidget().
| bool dw::Textblock::buttonPressImpl | ( | core::EventButton * | event | ) | [protected, virtual] |
Reimplemented from dw::core::Widget.
References dw::core::SelectionState::BUTTON_PRESS, and sendSelectionEvent().
| bool dw::Textblock::buttonReleaseImpl | ( | core::EventButton * | event | ) | [protected, virtual] |
Reimplemented from dw::core::Widget.
References dw::core::SelectionState::BUTTON_RELEASE, and sendSelectionEvent().
| void dw::Textblock::calcTextSize | ( | const char * | text, | |
| size_t | len, | |||
| core::style::Style * | style, | |||
| core::Requisition * | size | |||
| ) | [protected] |
Calculate the size of a text word.
References dw::core::style::absLengthVal(), dw::core::Requisition::ascent, dw::core::Requisition::descent, dw::core::style::StyleAttrs::font, dw::core::style::isAbsLength(), dw::core::Widget::layout, dw::core::style::LENGTH_AUTO, dw::core::style::StyleAttrs::lineHeight, dw::core::style::perLengthVal(), lout::misc::roundInt(), dw::core::style::StyleAttrs::valign, dw::core::style::VALIGN_SUB, dw::core::style::VALIGN_SUPER, and dw::core::Requisition::width.
Referenced by addText().
| void dw::Textblock::calcWidgetSize | ( | core::Widget * | widget, | |
| core::Requisition * | size | |||
| ) | [protected] |
Calculate the size of a widget within the page. (Subject of change in the near future!)
References dw::core::style::absLengthVal(), dw::core::Requisition::ascent, availAscent, availDescent, availWidth, dw::core::style::StyleAttrs::boxDiffHeight(), dw::core::style::StyleAttrs::boxDiffWidth(), dw::core::Requisition::descent, dw::core::Widget::getStyle(), dw::core::style::StyleAttrs::height, innerPadding, dw::core::style::isAbsLength(), dw::core::style::LENGTH_AUTO, dw::core::style::StyleAttrs::margin, dw::core::style::perLengthVal(), dw::core::Widget::requisition, dw::core::Widget::setAscent(), dw::core::Widget::setDescent(), dw::core::Widget::setWidth(), dw::core::Widget::sizeRequest(), dw::core::Widget::usesHints(), dw::core::Requisition::width, and dw::core::style::StyleAttrs::width.
Referenced by addWidget(), and rewrap().
| void dw::Textblock::changeLinkColor | ( | int | link, | |
| int | newColor | |||
| ) |
References dw::core::Widget::allocation, dw::Textblock::Line::boxAscent, dw::Textblock::Line::boxDescent, dw::core::style::StyleAttrs::color, dw::Textblock::Word::content, dw::core::style::Style::create(), dw::core::style::Color::create(), dw::Textblock::Line::firstWord, lout::misc::SimpleVector< T >::getRef(), dw::core::Widget::getStyle(), dw::core::Widget::layout, lines, lineYOffsetWidget(), dw::core::Widget::queueDrawArea(), dw::core::style::StyleAttrs::setBorderColor(), dw::core::Widget::setStyle(), lout::misc::SimpleVector< T >::size(), dw::Textblock::Word::spaceStyle, dw::Textblock::Word::style, dw::core::Content::TEXT, dw::core::Content::type, dw::core::style::Style::unref(), dw::core::Content::widget, dw::core::Content::WIDGET, words, and dw::core::style::StyleAttrs::x_link.
| void dw::Textblock::changeWordStyle | ( | int | from, | |
| int | to, | |||
| core::style::Style * | style, | |||
| bool | includeFirstSpace, | |||
| bool | includeLastSpace | |||
| ) |
| void dw::Textblock::decorateText | ( | core::View * | view, | |
| core::style::Style * | style, | |||
| core::style::Color::Shading | shading, | |||
| int | x, | |||
| int | yBase, | |||
| int | width | |||
| ) | [protected] |
References dw::core::style::StyleAttrs::color, dw::core::View::drawRectangle(), dw::core::style::StyleAttrs::font, dw::core::style::TEXT_DECORATION_LINE_THROUGH, dw::core::style::TEXT_DECORATION_OVERLINE, dw::core::style::TEXT_DECORATION_UNDERLINE, and dw::core::style::StyleAttrs::textDecoration.
Referenced by drawSpace(), and drawText().
| void dw::Textblock::draw | ( | core::View * | view, | |
| core::Rectangle * | area | |||
| ) | [protected, virtual] |
Area is given in widget coordinates.
Implements dw::core::Widget.
References drawLine(), dw::core::Widget::drawWidgetBox(), findLineIndex(), lout::misc::SimpleVector< T >::getRef(), dw::core::Rectangle::height, lines, lineYOffsetWidget(), lout::misc::SimpleVector< T >::size(), and dw::core::Rectangle::y.
| void dw::Textblock::drawLine | ( | Line * | line, | |
| core::View * | view, | |||
| core::Rectangle * | area | |||
| ) | [protected] |
References dw::Textblock::Line::boxAscent, dw::Textblock::Line::boxDescent, dw::core::Content::BREAK, dw::Textblock::Word::content, dw::core::Widget::draw(), dw::core::Widget::drawBox(), drawSpace(), drawText(), dw::Textblock::Word::effSpace, dw::Textblock::Line::firstWord, lout::misc::SimpleVector< T >::getRef(), dw::core::style::StyleAttrs::hasBackground(), dw::core::Widget::intersects(), lineXOffsetWidget(), lineYOffsetWidget(), dw::Textblock::Word::size, dw::Textblock::Word::spaceStyle, dw::Textblock::Word::style, dw::core::Content::TEXT, dw::core::Content::type, dw::core::Content::widget, dw::core::Content::WIDGET, dw::core::Requisition::width, dw::core::Rectangle::width, words, and dw::core::Rectangle::x.
Referenced by draw().
| void dw::Textblock::drawSpace | ( | int | wordIndex, | |
| core::View * | view, | |||
| core::Rectangle * | area, | |||
| int | xWidget, | |||
| int | yWidgetBase | |||
| ) | [protected] |
References dw::core::Widget::allocation, dw::core::style::StyleAttrs::backgroundColor, decorateText(), dw::core::View::drawRectangle(), dw::Textblock::Word::effSpace, dw::core::style::StyleAttrs::font, dw::core::Widget::getBgColor(), lout::misc::SimpleVector< T >::getRef(), dw::core::HIGHLIGHT_NUM_LAYERS, hlEnd, hlStart, index, dw::core::style::Color::SHADING_INVERSE, dw::core::style::Color::SHADING_NORMAL, dw::Textblock::Word::spaceStyle, dw::core::Widget::style, dw::core::style::StyleAttrs::textDecoration, dw::core::style::StyleAttrs::valign, dw::core::style::VALIGN_SUB, dw::core::style::VALIGN_SUPER, and words.
Referenced by drawLine().
| void dw::Textblock::drawText | ( | int | wordIndex, | |
| core::View * | view, | |||
| core::Rectangle * | area, | |||
| int | xWidget, | |||
| int | yWidgetBase | |||
| ) | [protected] |
References dw::core::Widget::allocation, dw::core::style::StyleAttrs::backgroundColor, dw::core::style::StyleAttrs::color, dw::Textblock::Word::content, decorateText(), dw::core::View::drawRectangle(), dw::core::View::drawText(), dw::core::style::StyleAttrs::font, dw::core::Widget::getBgColor(), lout::misc::SimpleVector< T >::getRef(), dw::core::HIGHLIGHT_NUM_LAYERS, hlEnd, hlStart, index, dw::core::Widget::layout, lout::misc::min(), nChar, dw::core::style::Color::SHADING_INVERSE, dw::core::style::Color::SHADING_NORMAL, dw::Textblock::Word::size, dw::Textblock::Word::style, dw::core::Widget::style, dw::core::Content::text, dw::core::style::StyleAttrs::textDecoration, dw::core::style::StyleAttrs::valign, dw::core::style::VALIGN_SUB, dw::core::style::VALIGN_SUPER, dw::core::Requisition::width, and words.
Referenced by drawLine().
| void dw::Textblock::enterNotifyImpl | ( | core::EventCrossing * | event | ) | [protected, virtual] |
| int dw::Textblock::findLineIndex | ( | int | y | ) | [protected] |
Find the first line index that includes y, relative to top of widget.
References index, lines, lineYOffsetWidgetI(), and lout::misc::SimpleVector< T >::size().
Referenced by draw(), findWord(), getWidgetAtPoint(), and sendSelectionEvent().
| int dw::Textblock::findLineOfWord | ( | int | wordIndex | ) | [protected] |
Find the line of word wordIndex.
References dw::Textblock::Line::firstWord, lout::misc::SimpleVector< T >::getRef(), index, lines, lout::misc::SimpleVector< T >::size(), and words.
Referenced by dw::Textblock::TextblockIterator::getAllocation(), queueDrawRange(), and sizeAllocateImpl().
| Textblock::Word * dw::Textblock::findWord | ( | int | x, | |
| int | y, | |||
| bool * | inSpace | |||
| ) | [protected] |
Find the index of the word, or -1.
References dw::core::Requisition::ascent, dw::Textblock::Line::boxAscent, dw::Textblock::Line::boxDescent, dw::Textblock::Word::effSpace, findLineIndex(), dw::Textblock::Line::firstWord, lout::misc::SimpleVector< T >::getRef(), lines, lineXOffsetWidget(), lineYOffsetWidget(), dw::Textblock::Word::size, lout::misc::SimpleVector< T >::size(), dw::core::Requisition::width, and words.
Referenced by motionNotifyImpl().
| void dw::Textblock::flush | ( | ) |
References mustQueueResize, and dw::core::Widget::queueResize().
| void dw::Textblock::getExtremesImpl | ( | core::Extremes * | extremes | ) | [protected, virtual] |
Reimplemented from dw::core::Widget.
References dw::core::Content::BREAK, dw::Textblock::Word::content, dw::Textblock::Line::firstWord, lout::misc::SimpleVector< T >::getRef(), dw::core::Widget::getStyle(), getWordExtremes(), innerPadding, lastLineParMax, dw::Textblock::Line::lastWord, line1OffsetEff, lines, lout::misc::max(), dw::Textblock::Line::maxParMax, dw::core::Extremes::maxWidth, dw::Textblock::Line::maxWordMin, dw::core::Extremes::minWidth, dw::Textblock::Word::origSpace, dw::Textblock::Line::parMax, dw::Textblock::Line::parMin, lout::misc::SimpleVector< T >::size(), dw::Textblock::Word::style, dw::core::Content::type, dw::core::style::WHITE_SPACE_NOWRAP, dw::core::style::WHITE_SPACE_PRE, dw::core::style::StyleAttrs::whiteSpace, words, and wrapRef.
| core::Widget * dw::Textblock::getWidgetAtPoint | ( | int | x, | |
| int | y, | |||
| int | level | |||
| ) | [virtual] |
Search recursively through widget.
This is an optimized version of the general dw::core::Widget::getWidgetAtPoint method.
Reimplemented from dw::core::Widget.
References dw::core::Widget::allocation, dw::Textblock::Word::content, findLineIndex(), dw::Textblock::Line::firstWord, dw::core::Widget::getHeight(), lout::misc::SimpleVector< T >::getRef(), lines, lout::misc::SimpleVector< T >::size(), dw::core::Content::type, dw::core::Content::widget, dw::core::Content::WIDGET, and words.
| void dw::Textblock::getWordExtremes | ( | Word * | word, | |
| core::Extremes * | extremes | |||
| ) | [protected] |
Get the extremes of a word within a textblock.
References dw::core::style::absLengthVal(), dw::core::style::StyleAttrs::boxDiffWidth(), dw::Textblock::Word::content, dw::core::style::isAbsLength(), dw::core::style::isPerLength(), dw::core::Extremes::maxWidth, dw::core::Extremes::minWidth, dw::Textblock::Word::size, dw::Textblock::Word::style, dw::core::Content::type, dw::core::Content::widget, dw::core::Content::WIDGET, and dw::core::Requisition::width.
Referenced by getExtremesImpl(), and wordWrap().
| void dw::Textblock::handOverBreak | ( | core::style::Style * | style | ) |
This function "hands" the last break of a page "over" to a parent page. This is used for "collapsing spaces".
References addParbreak(), dw::Textblock::Line::breakSpace, CLASS_ID, dw::core::Widget::getParent(), lout::misc::SimpleVector< T >::getRef(), lines, dw::core::Widget::parent, lout::misc::SimpleVector< T >::size(), and dw::core::Widget::Widget().
| core::Iterator * dw::Textblock::iterator | ( | core::Content::Type | mask, | |
| bool | atEnd | |||
| ) | [virtual] |
Return an iterator for this widget.
mask can narrow the types returned by the iterator, this can enhance performance quite much, e.g. when only searching for child widgets.
With atEnd == false, the iterator starts before the beginning, i.e. the first call of dw::core::Iterator::next will let the iterator point on the first piece of contents. Likewise, With atEnd == true, the iterator starts after the last piece of contents, call dw::core::Iterator::prev in this case.
Implements dw::core::Widget.
References TextblockIterator.
| void dw::Textblock::justifyLine | ( | Line * | line, | |
| int | availWidth | |||
| ) | [protected] |
References dw::Textblock::Word::effSpace, dw::Textblock::Line::firstWord, lout::misc::SimpleVector< T >::getRef(), lastLineWidth, dw::Textblock::Word::origSpace, and words.
Referenced by wordWrap().
| void dw::Textblock::leaveNotifyImpl | ( | core::EventCrossing * | event | ) | [protected, virtual] |
Reimplemented from dw::core::Widget.
References hoverLink, dw::core::Widget::layout, and dw::core::style::Tooltip::onLeave().
| int dw::Textblock::lineXOffsetContents | ( | Line * | line | ) | [inline, protected] |
Returns the x offset (the indentation plus any offset needed for centering or right justification) for the line.
The offset returned is relative to the page *content* (i.e. without border etc.).
References lout::misc::SimpleVector< T >::getRef(), innerPadding, dw::Textblock::Line::leftOffset, line1OffsetEff, and lines.
Referenced by lineXOffsetWidget().
| int dw::Textblock::lineXOffsetWidget | ( | Line * | line | ) | [inline, protected] |
Like lineXOffset, but relative to the allocation (i.e. including border etc.).
References dw::core::Widget::getStyle(), and lineXOffsetContents().
Referenced by drawLine(), findWord(), dw::Textblock::TextblockIterator::getAllocation(), sendSelectionEvent(), and sizeAllocateImpl().
| int dw::Textblock::lineYOffsetCanvas | ( | Line * | line | ) | [inline, protected] |
Returns the y offset (within the canvas) of a line.
References dw::core::Widget::allocation, and lineYOffsetCanvasAllocation().
Referenced by dw::Textblock::TextblockIterator::getAllocation(), lineYOffsetCanvasI(), and sendSelectionEvent().
| int dw::Textblock::lineYOffsetCanvasAllocation | ( | Line * | line, | |
| core::Allocation * | allocation | |||
| ) | [inline, protected] |
Like lineYOffsetCanvas, but with the allocation as parameter.
References lineYOffsetWidgetAllocation(), and dw::core::Allocation::y.
Referenced by lineYOffsetCanvas(), and sizeAllocateImpl().
| int dw::Textblock::lineYOffsetCanvasI | ( | int | lineIndex | ) | [inline, protected] |
References lout::misc::SimpleVector< T >::getRef(), lines, and lineYOffsetCanvas().
Referenced by sendSelectionEvent().
| int dw::Textblock::lineYOffsetWidget | ( | Line * | line | ) | [inline, protected] |
References dw::core::Widget::allocation, and lineYOffsetWidgetAllocation().
Referenced by changeLinkColor(), draw(), drawLine(), findWord(), lineYOffsetWidgetI(), queueDrawRange(), sendSelectionEvent(), and sizeAllocateImpl().
| int dw::Textblock::lineYOffsetWidgetAllocation | ( | Line * | line, | |
| core::Allocation * | allocation | |||
| ) | [inline, protected] |
References dw::core::Allocation::ascent, dw::Textblock::Line::boxAscent, lout::misc::SimpleVector< T >::getRef(), lines, and dw::Textblock::Line::top.
Referenced by lineYOffsetCanvasAllocation(), and lineYOffsetWidget().
| int dw::Textblock::lineYOffsetWidgetI | ( | int | lineIndex | ) | [inline, protected] |
References lout::misc::SimpleVector< T >::getRef(), lines, and lineYOffsetWidget().
Referenced by addAnchor(), and findLineIndex().
| void dw::Textblock::markChange | ( | int | ref | ) | [protected] |
References lout::misc::min(), and wrapRef.
Referenced by markExtremesChange(), and markSizeChange().
| void dw::Textblock::markExtremesChange | ( | int | ref | ) | [protected, virtual] |
| void dw::Textblock::markSizeChange | ( | int | ref | ) | [protected, virtual] |
| bool dw::Textblock::motionNotifyImpl | ( | core::EventMotion * | event | ) | [protected, virtual] |
Reimplemented from dw::core::Widget.
References dw::core::BUTTON1_MASK, dw::core::SelectionState::BUTTON_MOTION, dw::core::style::StyleAttrs::cursor, findWord(), dw::core::Widget::getStyle(), hoverLink, dw::core::Widget::layout, dw::core::style::Tooltip::onEnter(), dw::core::style::Tooltip::onLeave(), dw::core::style::Tooltip::onMotion(), sendSelectionEvent(), dw::core::Widget::setCursor(), dw::Textblock::Word::spaceStyle, dw::core::MouseEvent::state, dw::Textblock::Word::style, dw::core::Widget::style, dw::core::style::StyleAttrs::x_link, dw::core::style::StyleAttrs::x_tooltip, dw::core::MousePositionEvent::xWidget, and dw::core::MousePositionEvent::yWidget.
| void dw::Textblock::queueDrawRange | ( | int | index1, | |
| int | index2 | |||
| ) | [protected] |
References dw::core::Widget::allocation, dw::Textblock::Line::boxAscent, dw::Textblock::Line::contentAscent, findLineOfWord(), lout::misc::SimpleVector< T >::getRef(), lines, lineYOffsetWidget(), lout::misc::max(), lout::misc::min(), dw::core::Widget::queueDrawArea(), lout::misc::SimpleVector< T >::size(), and words.
Referenced by dw::Textblock::TextblockIterator::highlight(), and dw::Textblock::TextblockIterator::unhighlight().
| void dw::Textblock::removeChild | ( | Widget * | child | ) | [protected] |
| void dw::Textblock::resizeDrawImpl | ( | ) | [protected, virtual] |
Called after sizeAllocateImpl() to redraw necessary areas. By default the whole widget is redrawn.
Reimplemented from dw::core::Widget.
References dw::core::Widget::allocation, dw::core::Widget::getHeight(), lout::misc::SimpleVector< T >::getRef(), dw::Textblock::Line::lastWord, lastWordDrawn, lines, dw::core::Widget::queueDrawArea(), redrawY, and lout::misc::SimpleVector< T >::size().
| void dw::Textblock::rewrap | ( | ) | [protected] |
Rewrap the page from the line from which this is necessary. There are basically two times we'll want to do this: either when the viewport is resized, or when the size changes on one of the child widgets.
References calcWidgetSize(), dw::Textblock::Word::content, dw::Textblock::Line::firstWord, lout::misc::SimpleVector< T >::getRef(), lastLineParMax, lastLineParMin, lastLineWidth, dw::Textblock::Line::lastWord, lines, dw::Textblock::Word::origSpace, dw::Textblock::Line::parMax, dw::Textblock::Line::parMin, lout::misc::SimpleVector< T >::setSize(), dw::Textblock::Word::size, lout::misc::SimpleVector< T >::size(), dw::core::Content::type, dw::core::Content::widget, dw::core::Content::WIDGET, dw::core::Requisition::width, words, wordWrap(), and wrapRef.
Referenced by sizeRequestImpl().
| bool dw::Textblock::sendSelectionEvent | ( | core::SelectionState::EventType | eventType, | |
| core::MousePositionEvent * | event | |||
| ) | [protected] |
Send event to selection.
References dw::Textblock::Line::boxAscent, dw::Textblock::Line::boxDescent, dw::Textblock::Word::content, dw::Textblock::Word::effSpace, dw::core::SelectionState::END_OF_WORD, findLineIndex(), dw::Textblock::Line::firstWord, dw::core::style::StyleAttrs::font, lout::misc::SimpleVector< T >::getRef(), dw::Textblock::Line::lastWord, dw::core::Widget::layout, lines, lineXOffsetWidget(), lineYOffsetCanvas(), lineYOffsetCanvasI(), lineYOffsetWidget(), dw::core::Content::SELECTION_CONTENT, dw::core::Widget::selectionHandleEvent(), dw::Textblock::Word::size, lout::misc::SimpleVector< T >::size(), dw::Textblock::Word::style, dw::core::Content::text, dw::core::Content::TEXT, TextblockIterator, dw::core::Content::type, dw::core::Iterator::unref(), dw::core::Requisition::width, words, dw::core::style::StyleAttrs::x_link, dw::core::MousePositionEvent::xWidget, dw::core::MousePositionEvent::yCanvas, and dw::core::MousePositionEvent::yWidget.
Referenced by buttonPressImpl(), buttonReleaseImpl(), and motionNotifyImpl().
| void dw::Textblock::setAscent | ( | int | ascent | ) | [protected, virtual] |
Reimplemented from dw::core::Widget.
References availAscent, mustQueueResize, and dw::core::Widget::queueResize().
| void dw::Textblock::setDescent | ( | int | descent | ) | [protected, virtual] |
Reimplemented from dw::core::Widget.
References availDescent, mustQueueResize, and dw::core::Widget::queueResize().
| void dw::Textblock::setWidth | ( | int | width | ) | [protected, virtual] |
Reimplemented from dw::core::Widget.
References availWidth, limitTextWidth, mustQueueResize, dw::core::Widget::queueResize(), and redrawY.
| void dw::Textblock::sizeAllocateImpl | ( | core::Allocation * | allocation | ) | [protected, virtual] |
Reimplemented from dw::core::Widget.
References anchors, dw::core::Allocation::ascent, dw::core::Requisition::ascent, dw::Textblock::Line::boxAscent, dw::core::Content::BREAK, dw::core::Widget::changeAnchor(), dw::Textblock::Word::content, dw::core::Requisition::descent, dw::core::Allocation::descent, dw::Textblock::Word::effSpace, findLineOfWord(), dw::Textblock::Line::firstWord, lout::misc::SimpleVector< T >::getRef(), dw::Textblock::Line::lastWord, lastWordDrawn, lines, lineXOffsetWidget(), lineYOffsetCanvasAllocation(), lineYOffsetWidget(), lout::misc::min(), dw::Textblock::Anchor::name, redrawY, dw::Textblock::Word::size, lout::misc::SimpleVector< T >::size(), dw::core::Content::type, dw::core::Content::widget, dw::core::Content::WIDGET, dw::core::Requisition::width, dw::core::Allocation::width, dw::Textblock::Anchor::wordIndex, words, dw::core::Allocation::x, and dw::core::Allocation::y.
| void dw::Textblock::sizeRequestImpl | ( | core::Requisition * | requisition | ) | [protected, virtual] |
The ascent of a textblock is the ascent of the first line, plus padding/border/margin. This can be used to align the first lines of several textblocks in a horizontal line.
Implements dw::core::Widget.
References dw::core::Requisition::ascent, availWidth, dw::Textblock::Line::boxAscent, dw::Textblock::Line::boxDescent, dw::core::Requisition::descent, lout::misc::SimpleVector< T >::getRef(), dw::core::Widget::getStyle(), innerPadding, lastLineWidth, lines, lout::misc::max(), dw::Textblock::Line::maxLineWidth, rewrap(), lout::misc::SimpleVector< T >::size(), dw::Textblock::Line::top, and dw::core::Requisition::width.
| void dw::Textblock::wordWrap | ( | int | wordIndex | ) | [protected, virtual] |
Reimplemented in dw::TableCell.
References dw::core::style::absLengthVal(), addLine(), dw::core::Requisition::ascent, availWidth, dw::Textblock::Line::boxAscent, dw::Textblock::Line::boxDescent, dw::core::Content::BREAK, dw::core::Content::breakSpace, dw::Textblock::Line::breakSpace, dw::Textblock::Word::content, dw::Textblock::Line::contentAscent, dw::Textblock::Line::contentDescent, dw::core::Requisition::descent, dw::Textblock::Word::effSpace, dw::Textblock::Line::firstWord, dw::core::style::StyleAttrs::font, lout::misc::SimpleVector< T >::getRef(), dw::core::Widget::getStyle(), getWordExtremes(), hasListitemValue, ignoreLine1OffsetSometimes, innerPadding, dw::core::style::isPerLength(), justifyLine(), lastLineParMax, lastLineParMin, lastLineWidth, dw::Textblock::Line::lastWord, dw::core::Widget::layout, dw::Textblock::Line::leftOffset, limitTextWidth, line1Offset, line1OffsetEff, lines, dw::Textblock::Line::marginDescent, lout::misc::max(), dw::core::Extremes::maxWidth, dw::Textblock::Line::maxWordMin, dw::core::Extremes::minWidth, mustQueueResize, dw::Textblock::Word::origSpace, dw::Textblock::Line::parMin, dw::core::style::perLengthVal(), lout::misc::roundInt(), lout::misc::SimpleVector< T >::size(), dw::Textblock::Word::size, dw::Textblock::Word::style, dw::core::style::TEXT_ALIGN_CENTER, dw::core::style::TEXT_ALIGN_JUSTIFY, dw::core::style::TEXT_ALIGN_LEFT, dw::core::style::TEXT_ALIGN_RIGHT, dw::core::style::TEXT_ALIGN_STRING, dw::core::style::StyleAttrs::textAlign, dw::core::Content::type, dw::core::style::StyleAttrs::valign, dw::core::style::VALIGN_SUB, dw::core::style::VALIGN_SUPER, dw::core::style::WHITE_SPACE_NOWRAP, dw::core::style::WHITE_SPACE_PRE, dw::core::style::StyleAttrs::whiteSpace, dw::core::Content::widget, dw::core::Content::WIDGET, dw::core::Requisition::width, and words.
Referenced by addLinebreak(), addParbreak(), addText(), addWidget(), and rewrap().
friend class TextblockIterator [friend] |
Referenced by iterator(), and sendSelectionEvent().
lout::misc::SimpleVector<Anchor>* dw::Textblock::anchors [protected] |
Referenced by addAnchor(), sizeAllocateImpl(), Textblock(), and ~Textblock().
int dw::Textblock::availAscent [protected] |
Referenced by calcWidgetSize(), setAscent(), and Textblock().
int dw::Textblock::availDescent [protected] |
Referenced by calcWidgetSize(), setDescent(), and Textblock().
int dw::Textblock::availWidth [protected] |
Referenced by calcWidgetSize(), setWidth(), sizeRequestImpl(), Textblock(), and wordWrap().
int dw::Textblock::CLASS_ID = -1 [static] |
Reimplemented from dw::core::Widget.
Reimplemented in dw::AlignedTextblock, dw::ListItem, and dw::TableCell.
Referenced by addParbreak(), handOverBreak(), and Textblock().
bool dw::Textblock::hasListitemValue [protected] |
Referenced by addParbreak(), dw::ListItem::initWithText(), dw::ListItem::initWithWidget(), Textblock(), and wordWrap().
struct { ... } dw::Textblock::hlEnd[core::HIGHLIGHT_NUM_LAYERS] [protected] |
struct { ... }
dw::Textblock::hlStart[core::HIGHLIGHT_NUM_LAYERS] [protected] |
int dw::Textblock::hoverLink [protected] |
Referenced by enterNotifyImpl(), leaveNotifyImpl(), motionNotifyImpl(), and Textblock().
bool dw::Textblock::ignoreLine1OffsetSometimes [protected] |
Referenced by Textblock(), and wordWrap().
int dw::Textblock::innerPadding [protected] |
Referenced by calcWidgetSize(), getExtremesImpl(), lineXOffsetContents(), dw::ListItem::setMaxValue(), sizeRequestImpl(), Textblock(), and wordWrap().
int dw::Textblock::lastLineParMax [protected] |
Referenced by addLine(), getExtremesImpl(), rewrap(), Textblock(), and wordWrap().
int dw::Textblock::lastLineParMin [protected] |
Referenced by addLine(), rewrap(), Textblock(), and wordWrap().
int dw::Textblock::lastLineWidth [protected] |
Referenced by addLine(), justifyLine(), rewrap(), sizeRequestImpl(), Textblock(), and wordWrap().
int dw::Textblock::lastWordDrawn [protected] |
Referenced by resizeDrawImpl(), sizeAllocateImpl(), and Textblock().
bool dw::Textblock::limitTextWidth [protected] |
Referenced by setWidth(), and wordWrap().
int dw::Textblock::line1Offset [protected] |
Referenced by dw::TableCell::setMaxValue(), dw::ListItem::setMaxValue(), Textblock(), and wordWrap().
int dw::Textblock::line1OffsetEff [protected] |
Referenced by addLine(), getExtremesImpl(), lineXOffsetContents(), Textblock(), and wordWrap().
lout::misc::SimpleVector<Line>* dw::Textblock::lines [protected] |
Referenced by addAnchor(), addLine(), addParbreak(), addWidget(), changeLinkColor(), draw(), findLineIndex(), findLineOfWord(), findWord(), dw::Textblock::TextblockIterator::getAllocation(), getExtremesImpl(), getWidgetAtPoint(), handOverBreak(), lineXOffsetContents(), lineYOffsetCanvasI(), lineYOffsetWidgetAllocation(), lineYOffsetWidgetI(), queueDrawRange(), resizeDrawImpl(), rewrap(), sendSelectionEvent(), sizeAllocateImpl(), sizeRequestImpl(), Textblock(), wordWrap(), and ~Textblock().
bool dw::Textblock::mustQueueResize [protected] |
Referenced by addParbreak(), flush(), setAscent(), setDescent(), setWidth(), Textblock(), and wordWrap().
int dw::Textblock::redrawY [protected] |
Referenced by resizeDrawImpl(), dw::ListItem::setMaxValue(), setWidth(), sizeAllocateImpl(), and Textblock().
lout::misc::SimpleVector<Word>* dw::Textblock::words [protected] |
Referenced by addAnchor(), addLinebreak(), addParbreak(), addSpace(), addText(), addWidget(), addWord(), changeLinkColor(), drawLine(), drawSpace(), drawText(), findLineOfWord(), findWord(), dw::Textblock::TextblockIterator::getAllocation(), getExtremesImpl(), dw::TableCell::getValue(), dw::ListItem::getValue(), getWidgetAtPoint(), justifyLine(), dw::Textblock::TextblockIterator::next(), dw::Textblock::TextblockIterator::prev(), queueDrawRange(), rewrap(), sendSelectionEvent(), sizeAllocateImpl(), Textblock(), dw::Textblock::TextblockIterator::TextblockIterator(), wordWrap(), dw::TableCell::wordWrap(), and ~Textblock().
int dw::Textblock::wrapRef [protected] |
Referenced by getExtremesImpl(), markChange(), rewrap(), and Textblock().
1.5.9