Dillo
Classes | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
dw::Textblock Class Reference

A Widget for rendering text blocks, i.e. paragraphs or sequences of paragraphs. More...

#include <textblock.hh>

Classes

struct  Anchor
 
class  BadnessAndPenalty
 
struct  Line
 
class  TextblockIterator
 
struct  Word
 

Public Member Functions

 Textblock (bool limitTextWidth)
 
 ~Textblock ()
 
core::Iteratoriterator (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 addBreakOption (core::style::Style *style)
 
void addHyphen ()
 
void addParbreak (int space, core::style::Style *style)
 
void addLinebreak (core::style::Style *style)
 
core::WidgetgetWidgetAtPoint (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)
 
- Public Member Functions inherited from dw::core::Widget
void setDeleteCallback (DW_Callback_t func, void *data)
 
 Widget ()
 
 ~Widget ()
 
bool needsResize ()
 
bool needsAllocate ()
 
bool extremesChanged ()
 
bool wasAllocated ()
 
bool usesHints ()
 
bool hasContents ()
 
bool blockLevel ()
 
void setParent (Widget *parent)
 
style::StylegetStyle ()
 
AllocationgetAllocation ()
 
void sizeRequest (Requisition *requisition)
 This method is a wrapper for Widget::sizeRequestImpl(); it calls the latter only when needed.
 
void getExtremes (Extremes *extremes)
 Wrapper for Widget::getExtremesImpl().
 
void sizeAllocate (Allocation *allocation)
 Wrapper for Widget::sizeAllocateImpl, calls the latter only when needed.
 
bool intersects (Rectangle *area, Rectangle *intersection)
 Calculates the intersection of widget->allocation and area, returned in intersection (in widget coordinates!).
 
bool buttonPress (EventButton *event)
 
bool buttonRelease (EventButton *event)
 
bool motionNotify (EventMotion *event)
 
void enterNotify (EventCrossing *event)
 
void leaveNotify (EventCrossing *event)
 
virtual void setStyle (style::Style *style)
 Change the style of a widget.
 
void setBgColor (style::Color *bgColor)
 Set the background "behind" the widget, if it is not the background of the parent widget, e.g. the background of a table row.
 
style::ColorgetBgColor ()
 Get the actual background of a widget.
 
void drawBox (View *view, style::Style *style, Rectangle *area, int x, int y, int width, int height, bool inverse)
 Draw borders and background of a widget part, which allocation is given by (x, y, width, height) (widget coordinates).
 
void drawWidgetBox (View *view, Rectangle *area, bool inverse)
 Draw borders and background of a widget.
 
void drawSelected (View *view, Rectangle *area)
 
void setButtonSensitive (bool buttonSensitive)
 
bool isButtonSensitive ()
 
WidgetgetParent ()
 
WidgetgetTopLevel ()
 Get the widget at the root of the tree, this widget is part from.
 
int getLevel ()
 Get the level of the widget within the tree.
 
WidgetgetNearestCommonAncestor (Widget *otherWidget)
 Get the widget with the highest level, which is a direct ancestor of widget1 and widget2.
 
LayoutgetLayout ()
 
void scrollTo (HPosition hpos, VPosition vpos, int x, int y, int width, int height)
 
virtual void removeChild (Widget *child)
 
- Public Member Functions inherited from lout::identity::IdentifiableObject
 IdentifiableObject ()
 
virtual void intoStringBuffer (misc::StringBuffer *sb)
 Store a textual representation of the object in a misc::StringBuffer.
 
int getClassId ()
 Returns the class identifier.
 
const char * getClassName ()
 Return the name, under which the class of this object was registered.
 
bool instanceOf (int otherClassId)
 Returns, whether this class is an instance of the class, given by otherClassId, or of a sub class of this class.
 
- 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 Objectclone ()
 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 Attributes

static int CLASS_ID = -1
 
- Static Public Attributes inherited from dw::core::Widget
static int CLASS_ID = -1
 

Protected Types

enum  { HYPHEN_BREAK = 100 }
 
- Protected Types inherited from dw::core::Widget
enum  Flags {
  NEEDS_RESIZE = 1 << 0, NEEDS_ALLOCATE = 1 << 1, EXTREMES_CHANGED = 1 << 2, USES_HINTS = 1 << 3,
  HAS_CONTENTS = 1 << 4, WAS_ALLOCATED = 1 << 5, BLOCK_LEVEL = 1 << 6
}
 

Protected Member Functions

void printWord (Word *word)
 
void queueDrawRange (int index1, int index2)
 
void getWordExtremes (Word *word, core::Extremes *extremes)
 
void markChange (int ref)
 
void justifyLine (Line *line, int diff)
 
LineaddLine (int firstWord, int lastWord, bool temporary)
 
void calcWidgetSize (core::Widget *widget, core::Requisition *size)
 
void rewrap ()
 
void showMissingLines ()
 
void removeTemporaryLines ()
 
void decorateText (core::View *view, core::style::Style *style, core::style::Color::Shading shading, int x, int yBase, int width)
 
void drawText (core::View *view, core::style::Style *style, core::style::Color::Shading shading, int x, int y, const char *text, int start, int len)
 
void drawWord (Line *line, int wordIndex1, int wordIndex2, core::View *view, core::Rectangle *area, int xWidget, int yWidgetBase)
 
void drawWord0 (int wordIndex1, int wordIndex2, const char *text, int totalWidth, core::style::Style *style, 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.
 
WordfindWord (int x, int y, bool *inSpace)
 Find the index of the word, or -1.
 
WordaddWord (int width, int ascent, int descent, bool canBeHyphenated, core::style::Style *style)
 
void fillWord (Word *word, int width, int ascent, int descent, bool canBeHyphenated, core::style::Style *style)
 
void fillSpace (Word *word, core::style::Style *style)
 
void setBreakOption (Word *word, core::style::Style *style)
 
int textWidth (const char *text, int start, int len, 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.
 
void accumulateWordExtremes (int firstWord, int lastWord, int *maxOfMinWidth, int *sumOfMaxWidth)
 
virtual void wordWrap (int wordIndex, bool wrapAll)
 
int hyphenateWord (int wordIndex)
 
void accumulateWordForLine (int lineIndex, int wordIndex)
 
void accumulateWordData (int wordIndex)
 
int calcAvailWidth (int lineIndex)
 
void initLine1Offset (int wordIndex)
 
void alignLine (int lineIndex)
 
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)
 
void addText0 (const char *text, size_t len, bool canBeHyphenated, core::style::Style *style, core::Requisition *size)
 
void calcTextSizes (const char *text, size_t textLen, core::style::Style *style, int numBreaks, int *breakPos, core::Requisition *wordSize)
 
- Protected Member Functions inherited from dw::core::Widget
int getHeight ()
 
int getContentWidth ()
 
int getContentHeight ()
 
void setFlags (Flags f)
 
void unsetFlags (Flags f)
 
void queueDraw ()
 
void queueDrawArea (int x, int y, int width, int height)
 
void queueResize (int ref, bool extremesChanged)
 This method should be called, when a widget changes its size.
 
char * addAnchor (const char *name)
 
char * addAnchor (const char *name, int y)
 
void changeAnchor (char *name, int y)
 
void removeAnchor (char *name)
 
void setCursor (style::Cursor cursor)
 
bool selectionButtonPress (Iterator *it, int charPos, int linkNo, EventButton *event, bool withinContent)
 
bool selectionButtonRelease (Iterator *it, int charPos, int linkNo, EventButton *event, bool withinContent)
 
bool selectionButtonMotion (Iterator *it, int charPos, int linkNo, EventMotion *event, bool withinContent)
 
bool selectionHandleEvent (SelectionState::EventType eventType, Iterator *it, int charPos, int linkNo, MousePositionEvent *event)
 
- Protected Member Functions inherited from lout::identity::IdentifiableObject
void registerName (const char *className, int *classId)
 This method must be called in the constructor for the sub class. See class comment for details.
 

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 wrapRef
 
lout::misc::SimpleVector< Line > * lines
 
int nonTemporaryLines
 
lout::misc::NotSoSimpleVector
< 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
 
- Protected Attributes inherited from dw::core::Widget
Allocation allocation
 The current allocation: size and position, always relative to the canvas.
 
Layoutlayout
 

Friends

class TextblockIterator
 

Additional Inherited Members

- Public Attributes inherited from dw::core::Widget
int parentRef
 This value is defined by the parent widget, and used for incremential resizing.
 

Detailed Description

A Widget for rendering text blocks, i.e. paragraphs or sequences of paragraphs.

Info: The recent changes (line breaking and hyphenation) have not yet been incorporated into this documentation. See Changes in Line-Breaking and Hyphenation.

Signals

dw::Textblock uses the signals defined in dw::core::Layout::LinkReceiver, related to links. The coordinates are always -1.

Collapsing Spaces

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:

  1. If a paragraph is following by another, the space between them is the maximum of both box spaces:

    dw-textblock-collapsing-spaces-1-1.png

    are combined like this:

    dw-textblock-collapsing-spaces-1-2.png

  2. a) If one paragraph is the first paragraph within another, the upper space of these paragraphs collapse. b) The analogue is the case for the last box:

    dw-textblock-collapsing-spaces-2-1.png

    If B and C are put into A, the result is:

    dw-textblock-collapsing-spaces-2-2.png

For achieving this, there are some features of dw::Textblock:

Collapsing Margins

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.)

Some Internals

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.

Incremental Resizing

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:

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.

Member Enumeration Documentation

anonymous enum
protected
Enumerator:
HYPHEN_BREAK 

The penalty for hyphens, multiplied by 100. So, 100 means 1.0. See dw::Textblock::BadnessAndPenalty::setPenalty for more details.

Constructor & Destructor Documentation

dw::Textblock::Textblock ( bool  limitTextWidth)
dw::Textblock::~Textblock ( )

Member Function Documentation

void dw::Textblock::accumulateWordData ( int  wordIndex)
protected
void dw::Textblock::accumulateWordExtremes ( int  firstWord,
int  lastWord,
int *  maxOfMinWidth,
int *  sumOfMaxWidth 
)
protected
void dw::Textblock::accumulateWordForLine ( int  lineIndex,
int  wordIndex 
)
protected
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.

Todo:
It may be necessary for future uses to save the anchor in some way, e.g. when parts of the widget tree change.

References dw::Textblock::Anchor::name, and dw::Textblock::Anchor::wordIndex.

void dw::Textblock::addBreakOption ( core::style::Style style)
inline

Add a break option (see setBreakOption() for details). Used instead of addStyle for ideographic characters.

References lout::misc::NotSoSimpleVector< T >::getRef(), setBreakOption(), lout::misc::NotSoSimpleVector< T >::size(), dw::core::Widget::style, and words.

void dw::Textblock::addHyphen ( )
Textblock::Line * dw::Textblock::addLine ( int  firstWord,
int  lastWord,
bool  temporary 
)
protected
void dw::Textblock::addLinebreak ( core::style::Style style)
void dw::Textblock::addParbreak ( int  space,
core::style::Style style 
)
void dw::Textblock::addSpace ( core::style::Style style)
void dw::Textblock::addText ( const char *  text,
size_t  len,
core::style::Style style 
)

Add a word to the page structure. If it contains soft hyphens, it is divided.

References PRINTF, and PUTCHAR.

Referenced by addText(), and dw::ListItem::initWithText().

void dw::Textblock::addText ( const char *  text,
core::style::Style style 
)
inline

References addText().

void dw::Textblock::addText0 ( const char *  text,
size_t  len,
bool  canBeHyphenated,
core::style::Style style,
core::Requisition size 
)
protected
void dw::Textblock::addWidget ( core::Widget widget,
core::style::Style style 
)
Textblock::Word * dw::Textblock::addWord ( int  width,
int  ascent,
int  descent,
bool  canBeHyphenated,
core::style::Style style 
)
protected

Add a new word (text, widget etc.) to a page.

void dw::Textblock::alignLine ( int  lineIndex)
protected
bool dw::Textblock::buttonPressImpl ( core::EventButton event)
protectedvirtual

Reimplemented from dw::core::Widget.

bool dw::Textblock::buttonReleaseImpl ( core::EventButton event)
protectedvirtual

Reimplemented from dw::core::Widget.

int dw::Textblock::calcAvailWidth ( int  lineIndex)
protected
void dw::Textblock::calcTextSize ( const char *  text,
size_t  len,
core::style::Style style,
core::Requisition size 
)
protected
void dw::Textblock::calcTextSizes ( const char *  text,
size_t  textLen,
core::style::Style style,
int  numBreaks,
int *  breakPos,
core::Requisition wordSize 
)
protected
void dw::Textblock::calcWidgetSize ( core::Widget widget,
core::Requisition size 
)
protected
void dw::Textblock::changeLinkColor ( int  link,
int  newColor 
)
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
void dw::Textblock::draw ( core::View view,
core::Rectangle area 
)
protectedvirtual
void dw::Textblock::drawLine ( Line line,
core::View view,
core::Rectangle area 
)
protected
void dw::Textblock::drawSpace ( int  wordIndex,
core::View view,
core::Rectangle area,
int  xWidget,
int  yWidgetBase 
)
protected
void dw::Textblock::drawText ( core::View view,
core::style::Style style,
core::style::Color::Shading  shading,
int  x,
int  y,
const char *  text,
int  start,
int  len 
)
protected
void dw::Textblock::drawWord ( Line line,
int  wordIndex1,
int  wordIndex2,
core::View view,
core::Rectangle area,
int  xWidget,
int  yWidgetBase 
)
protected

Draw a word of text.

Since hyphenated words consist of multiple instance of dw::Textblock::Word, which should be drawn as a whole (to preserve kerning etc.; see Changes in Line-Breaking and Hyphenation), two indices are passed. See also drawLine(), where drawWord() is called.

References dw::Textblock::Line::boxAscent, dw::Textblock::Line::boxDescent, dw::Textblock::Word::content, dw::core::style::StyleAttrs::hasBackground(), dw::Textblock::Line::lastWord, dw::Textblock::Word::size, dw::core::Content::text, and dw::core::Requisition::width.

void dw::Textblock::drawWord0 ( int  wordIndex1,
int  wordIndex2,
const char *  text,
int  totalWidth,
core::style::Style style,
core::View view,
core::Rectangle area,
int  xWidget,
int  yWidgetBase 
)
protected
void dw::Textblock::enterNotifyImpl ( core::EventCrossing event)
protectedvirtual

Reimplemented from dw::core::Widget.

void dw::Textblock::fillSpace ( Word word,
core::style::Style style 
)
protected
void dw::Textblock::fillWord ( Word word,
int  width,
int  ascent,
int  descent,
bool  canBeHyphenated,
core::style::Style style 
)
protected
int dw::Textblock::findLineIndex ( int  y)
protected

Find the first line index that includes y, relative to top of widget.

int dw::Textblock::findLineOfWord ( int  wordIndex)
protected

Find the line of word wordIndex.

Referenced by dw::Textblock::TextblockIterator::getAllocation().

Textblock::Word * dw::Textblock::findWord ( int  x,
int  y,
bool *  inSpace 
)
protected
void dw::Textblock::flush ( )

References PRINTF.

void dw::Textblock::getExtremesImpl ( core::Extremes extremes)
protectedvirtual
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::Textblock::Word::content, dw::Textblock::Line::firstWord, dw::core::Widget::getWidgetAtPoint(), dw::core::Content::type, and dw::core::Content::widget.

void dw::Textblock::getWordExtremes ( Word word,
core::Extremes extremes 
)
protected
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(), and dw::Textblock::Line::breakSpace.

int dw::Textblock::hyphenateWord ( int  wordIndex)
protected
void dw::Textblock::initLine1Offset ( int  wordIndex)
protected
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.

void dw::Textblock::justifyLine ( Line line,
int  diff 
)
protected
void dw::Textblock::leaveNotifyImpl ( core::EventCrossing event)
protectedvirtual

Reimplemented from dw::core::Widget.

References dw::core::style::Tooltip::onLeave().

int dw::Textblock::lineXOffsetContents ( Line line)
inlineprotected

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 >::getFirstRef(), innerPadding, dw::Textblock::Line::leftOffset, line1OffsetEff, and lines.

Referenced by lineXOffsetWidget().

int dw::Textblock::lineXOffsetWidget ( Line line)
inlineprotected

Like lineXOffset, but relative to the allocation (i.e. including border etc.).

References dw::core::style::StyleAttrs::boxOffsetX(), dw::core::Widget::getStyle(), and lineXOffsetContents().

Referenced by dw::Textblock::TextblockIterator::getAllocation().

int dw::Textblock::lineYOffsetCanvas ( Line line)
inlineprotected

Returns the y offset (within the canvas) of a line.

References dw::core::Widget::allocation, and lineYOffsetCanvasAllocation().

Referenced by dw::Textblock::TextblockIterator::getAllocation(), and lineYOffsetCanvasI().

int dw::Textblock::lineYOffsetCanvasAllocation ( Line line,
core::Allocation allocation 
)
inlineprotected

Like lineYOffsetCanvas, but with the allocation as parameter.

References lineYOffsetWidgetAllocation(), and dw::core::Allocation::y.

Referenced by lineYOffsetCanvas().

int dw::Textblock::lineYOffsetCanvasI ( int  lineIndex)
inlineprotected
int dw::Textblock::lineYOffsetWidget ( Line line)
inlineprotected
int dw::Textblock::lineYOffsetWidgetAllocation ( Line line,
core::Allocation allocation 
)
inlineprotected
int dw::Textblock::lineYOffsetWidgetI ( int  lineIndex)
inlineprotected
void dw::Textblock::markChange ( int  ref)
protected

References lout::misc::min(), and PRINTF.

void dw::Textblock::markExtremesChange ( int  ref)
protectedvirtual

See Sizes of Dillo Widgets.

Reimplemented from dw::core::Widget.

void dw::Textblock::markSizeChange ( int  ref)
protectedvirtual

See Sizes of Dillo Widgets.

Reimplemented from dw::core::Widget.

bool dw::Textblock::motionNotifyImpl ( core::EventMotion event)
protectedvirtual
void dw::Textblock::printWord ( Word word)
protected
void dw::Textblock::queueDrawRange ( int  index1,
int  index2 
)
protected
void dw::Textblock::removeChild ( Widget child)
protected
Bug:
Not implemented.
void dw::Textblock::removeTemporaryLines ( )
protected
void dw::Textblock::resizeDrawImpl ( )
protectedvirtual

Called after sizeAllocateImpl() to redraw necessary areas. By default the whole widget is redrawn.

Reimplemented from dw::core::Widget.

References dw::Textblock::Line::lastWord.

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 dw::Textblock::Word::content, lout::misc::min(), dw::core::Widget::parentRef, PRINTF, dw::Textblock::Word::size, dw::core::Content::type, and dw::core::Content::widget.

bool dw::Textblock::sendSelectionEvent ( core::SelectionState::EventType  eventType,
core::MousePositionEvent event 
)
protected
void dw::Textblock::setAscent ( int  ascent)
protectedvirtual

Reimplemented from dw::core::Widget.

void dw::Textblock::setBreakOption ( Word word,
core::style::Style style 
)
protected
void dw::Textblock::setDescent ( int  descent)
protectedvirtual

Reimplemented from dw::core::Widget.

void dw::Textblock::setWidth ( int  width)
protectedvirtual

Reimplemented from dw::core::Widget.

void dw::Textblock::showMissingLines ( )
protected

References PRINTF.

void dw::Textblock::sizeAllocateImpl ( core::Allocation allocation)
protectedvirtual
void dw::Textblock::sizeRequestImpl ( core::Requisition requisition)
protectedvirtual

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, dw::Textblock::Line::boxAscent, dw::Textblock::Line::boxDescent, dw::core::Requisition::descent, dw::Textblock::Line::maxLineWidth, PRINTF, dw::Textblock::Line::top, and dw::core::Requisition::width.

int dw::Textblock::textWidth ( const char *  text,
int  start,
int  len,
core::style::Style style 
)
protected
void dw::Textblock::wordWrap ( int  wordIndex,
bool  wrapAll 
)
protectedvirtual

Friends And Related Function Documentation

friend class TextblockIterator
friend

Member Data Documentation

lout::misc::SimpleVector<Anchor>* dw::Textblock::anchors
protected
int dw::Textblock::availAscent
protected
int dw::Textblock::availDescent
protected
int dw::Textblock::availWidth
protected
int dw::Textblock::CLASS_ID = -1
static
bool dw::Textblock::hasListitemValue
protected
struct { ... } dw::Textblock::hlEnd[core::HIGHLIGHT_NUM_LAYERS]
struct { ... } dw::Textblock::hlStart[core::HIGHLIGHT_NUM_LAYERS]
int dw::Textblock::hoverLink
protected
bool dw::Textblock::ignoreLine1OffsetSometimes
protected
int dw::Textblock::index
int dw::Textblock::innerPadding
protected
int dw::Textblock::lastWordDrawn
protected
bool dw::Textblock::limitTextWidth
protected
int dw::Textblock::line1Offset
protected
int dw::Textblock::line1OffsetEff
protected

Referenced by lineXOffsetContents().

lout::misc::SimpleVector<Line>* dw::Textblock::lines
protected
bool dw::Textblock::mustQueueResize
protected

Referenced by addParbreak().

int dw::Textblock::nChar
int dw::Textblock::nonTemporaryLines
protected
int dw::Textblock::redrawY
protected
lout::misc::NotSoSimpleVector<Word>* dw::Textblock::words
protected
int dw::Textblock::wrapRef
protected

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