|
Dillo
|
The base class of all dillo widgets. More...
#include <widget.hh>
Public Member Functions | |
| 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::Style * | getStyle () |
| Allocation * | getAllocation () |
| 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. | |
| virtual void | setWidth (int width) |
| virtual void | setAscent (int ascent) |
| virtual void | setDescent (int descent) |
| bool | intersects (Rectangle *area, Rectangle *intersection) |
| Calculates the intersection of widget->allocation and area, returned in intersection (in widget coordinates!). | |
| virtual void | draw (View *view, Rectangle *area)=0 |
| 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::Color * | getBgColor () |
| 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 () |
| Widget * | getParent () |
| Widget * | getTopLevel () |
| 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. | |
| Widget * | getNearestCommonAncestor (Widget *otherWidget) |
| Get the widget with the highest level, which is a direct ancestor of widget1 and widget2. | |
| Layout * | getLayout () |
| virtual Widget * | getWidgetAtPoint (int x, int y, int level) |
| Search recursively through widget. | |
| void | scrollTo (HPosition hpos, VPosition vpos, int x, int y, int width, int height) |
| virtual Iterator * | iterator (Content::Type mask, bool atEnd)=0 |
| Return an iterator for this widget. | |
| 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 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. | |
Public Attributes | |
| int | parentRef |
| This value is defined by the parent widget, and used for incremential resizing. | |
Static Public Attributes | |
| static int | CLASS_ID = -1 |
Protected Types | |
| 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 | |
| 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. | |
| virtual void | sizeRequestImpl (Requisition *requisition)=0 |
| See Sizes of Dillo Widgets. | |
| virtual void | getExtremesImpl (Extremes *extremes) |
| See Sizes of Dillo Widgets. | |
| virtual void | sizeAllocateImpl (Allocation *allocation) |
| See Sizes of Dillo Widgets. | |
| virtual void | resizeDrawImpl () |
| Called after sizeAllocateImpl() to redraw necessary areas. By default the whole widget is redrawn. | |
| virtual void | markSizeChange (int ref) |
| See Sizes of Dillo Widgets. | |
| virtual void | markExtremesChange (int ref) |
| See Sizes of Dillo Widgets. | |
| virtual bool | buttonPressImpl (EventButton *event) |
| virtual bool | buttonReleaseImpl (EventButton *event) |
| virtual bool | motionNotifyImpl (EventMotion *event) |
| virtual void | enterNotifyImpl (EventCrossing *event) |
| virtual void | leaveNotifyImpl (EventCrossing *event) |
| 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 | |
| Allocation | allocation |
| The current allocation: size and position, always relative to the canvas. | |
| Layout * | layout |
Private Attributes | |
| Widget * | parent |
| The parent widget, NULL for top-level widgets. | |
| style::Style * | style |
| Flags | flags |
| Requisition | requisition |
| Size_request() stores the result of the last call of size_request_impl(). | |
| Extremes | extremes |
| Analogue to dw::core::Widget::requisition. | |
| style::Color * | bgColor |
| See dw::core::Widget::setBgColor(). | |
| bool | buttonSensitive |
| See dw::core::Widget::setButtonSensitive(). | |
| bool | buttonSensitiveSet |
| See dw::core::Widget::setButtonSensitive(). | |
| void * | deleteCallbackData |
| DW_Callback_t | deleteCallbackFunc |
Friends | |
| class | Layout |
The base class of all dillo widgets.
|
protected |
| NEEDS_RESIZE |
Set, when dw::core::Widget::requisition is not up to date anymore. |
| NEEDS_ALLOCATE |
Only used internally, set to enforce size allocation. (I've forgotten the case, for which this is necessary.) |
| EXTREMES_CHANGED |
Set, when dw::core::Widget::extremes is not up to date anymore. |
| USES_HINTS |
Set by the widget itself (in the constructor), when set... methods are implemented. Will hopefully be removed, after redesigning the size model. |
| HAS_CONTENTS |
Set by the widget itself (in the constructor), when it contains some contents, e.g. an image, as opposed to a horizontal ruler. Will hopefully be removed, after redesigning the size model. |
| WAS_ALLOCATED |
Set, when a widget was already once allocated,. The dw::Image widget uses this flag, see dw::Image::setBuffer. |
| BLOCK_LEVEL |
Set for block-level widgets (as opposed to inline widgets) |
| dw::core::Widget::Widget | ( | ) |
| dw::core::Widget::~Widget | ( | ) |
|
inlineprotected |
References dw::core::Layout::addAnchor(), and layout.
|
inlineprotected |
References dw::core::Layout::addAnchor(), and layout.
|
inline |
References BLOCK_LEVEL, and flags.
Referenced by dw::Textblock::accumulateWordForLine(), and dw::Textblock::initLine1Offset().
| bool dw::core::Widget::buttonPress | ( | EventButton * | event | ) |
Referenced by dw::core::Layout::processMouseEvent().
|
protectedvirtual |
Reimplemented in dw::Textblock, dw::core::ui::Embed, and dw::Image.
| bool dw::core::Widget::buttonRelease | ( | EventButton * | event | ) |
Referenced by dw::core::Layout::processMouseEvent().
|
protectedvirtual |
Reimplemented in dw::Textblock, and dw::Image.
|
inlineprotected |
References dw::core::Layout::changeAnchor(), and layout.
Area is given in widget coordinates.
Implemented in dw::Textblock, dw::Table, dw::core::ui::Embed, dw::Image, dw::Ruler, and dw::Bullet.
Referenced by dw::Textblock::drawLine().
| void dw::core::Widget::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).
area is given in widget coordinates.
References dw::core::style::StyleAttrs::backgroundColor, dw::core::style::drawBackground(), dw::core::style::drawBorder(), dw::core::Rectangle::height, dw::core::Rectangle::width, dw::core::Rectangle::x, and dw::core::Rectangle::y.
Draw borders and background of a widget.
area is given in widget coordinates.
References dw::core::style::drawBackground(), dw::core::style::drawBorder(), dw::core::Rectangle::height, dw::core::Rectangle::width, dw::core::Rectangle::x, and dw::core::Rectangle::y.
Referenced by dw::Ruler::draw().
| void dw::core::Widget::enterNotify | ( | EventCrossing * | event | ) |
Referenced by dw::core::Layout::enterNotify(), and dw::core::Layout::moveToWidget().
|
protectedvirtual |
Reimplemented in dw::Textblock, dw::core::ui::Embed, and dw::Image.
References dw::core::style::Tooltip::onEnter().
Referenced by dw::core::ui::Embed::enterNotifyImpl().
|
inline |
References EXTREMES_CHANGED, and flags.
|
inline |
References allocation.
Referenced by dw::core::TextIterator::getAllocation(), dw::core::Layout::processMouseEvent(), and dw::Textblock::sizeAllocateImpl().
| style::Color * dw::core::Widget::getBgColor | ( | ) |
Get the actual background of a widget.
References dw::core::style::StyleAttrs::backgroundColor, bgColor, getBgColor(), parent, and style.
Referenced by getBgColor().
|
inlineprotected |
References dw::core::style::StyleAttrs::boxDiffHeight(), getHeight(), and style.
|
inlineprotected |
References allocation, dw::core::style::StyleAttrs::boxDiffWidth(), style, and dw::core::Allocation::width.
| void dw::core::Widget::getExtremes | ( | Extremes * | extremes | ) |
Wrapper for Widget::getExtremesImpl().
References DBG_OBJ_SET_NUM, dw::core::Extremes::maxWidth, and dw::core::Extremes::minWidth.
Referenced by dw::Textblock::getWordExtremes().
|
protectedvirtual |
Reimplemented in dw::Textblock, dw::Table, and dw::core::ui::Embed.
References dw::core::Extremes::maxWidth, dw::core::Extremes::minWidth, and dw::core::Requisition::width.
|
inlineprotected |
References allocation, dw::core::Allocation::ascent, and dw::core::Allocation::descent.
Referenced by getContentHeight(), and queueDraw().
|
inline |
References layout.
Referenced by dw::core::Iterator::scrollTo().
| int dw::core::Widget::getLevel | ( | ) |
Get the level of the widget within the tree.
The root widget has the level 0.
References parent.
Referenced by dw::core::DeepIterator::DeepIterator(), and getNearestCommonAncestor().
Get the widget with the highest level, which is a direct ancestor of widget1 and widget2.
References getLevel(), and parent.
Referenced by dw::core::Layout::moveToWidget().
|
inline |
|
inline |
References style.
Referenced by dw::Textblock::accumulateWordForLine(), dw::Textblock::calcWidgetSize(), dw::Textblock::changeLinkColor(), dw::Bullet::draw(), dw::Textblock::getWordExtremes(), dw::Textblock::lineXOffsetWidget(), dw::Textblock::sizeAllocateImpl(), dw::Bullet::sizeRequestImpl(), and dw::Ruler::sizeRequestImpl().
| Widget * dw::core::Widget::getTopLevel | ( | ) |
Get the widget at the root of the tree, this widget is part from.
References parent.
Referenced by dw::core::Layout::moveToWidget().
|
virtual |
Search recursively through widget.
Used by dw::core::Layout:getWidgetAtPoint.
Reimplemented in dw::Textblock.
References dw::core::Iterator::getContent(), getWidgetAtPoint(), dw::core::Iterator::next(), dw::core::Iterator::unref(), and dw::core::Content::widget.
Referenced by getWidgetAtPoint(), and dw::Textblock::getWidgetAtPoint().
|
inline |
References flags, and HAS_CONTENTS.
Referenced by dw::Textblock::getWordExtremes().
Calculates the intersection of widget->allocation and area, returned in intersection (in widget coordinates!).
Typically used by containers when drawing their children. Returns whether intersection is not empty.
References dw::core::Rectangle::height, dw::core::Rectangle::intersectsWith(), dw::core::Rectangle::width, dw::core::Rectangle::x, and dw::core::Rectangle::y.
Referenced by dw::Textblock::drawLine().
|
inline |
References buttonSensitive.
Referenced by dw::core::Layout::processMouseEvent().
|
pure 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.
Implemented in dw::Textblock, dw::Table, dw::core::ui::Embed, dw::Image, dw::Ruler, and dw::Bullet.
Referenced by dw::core::CharIterator::CharIterator(), dw::core::DeepIterator::DeepIterator(), dw::core::DeepIterator::next(), dw::core::DeepIterator::prev(), dw::core::DeepIterator::searchDownward(), and dw::core::DeepIterator::searchSideward().
| void dw::core::Widget::leaveNotify | ( | EventCrossing * | event | ) |
Referenced by dw::core::Layout::leaveNotify(), and dw::core::Layout::moveToWidget().
|
protectedvirtual |
Reimplemented in dw::Textblock, dw::core::ui::Embed, and dw::Image.
References dw::core::style::Tooltip::onLeave().
Referenced by dw::core::ui::Embed::leaveNotifyImpl().
|
protectedvirtual |
Reimplemented in dw::Textblock.
|
protectedvirtual |
Reimplemented in dw::Textblock.
| bool dw::core::Widget::motionNotify | ( | EventMotion * | event | ) |
Referenced by dw::core::Layout::processMouseEvent().
|
protectedvirtual |
Reimplemented in dw::Textblock, and dw::Image.
|
inline |
References flags, and NEEDS_ALLOCATE.
|
inline |
References flags, and NEEDS_RESIZE.
|
inlineprotected |
References allocation, getHeight(), queueDrawArea(), and dw::core::Allocation::width.
Referenced by dw::Image::forceMapRedraw(), and resizeDrawImpl().
|
protected |
Referenced by queueDraw().
|
protected |
This method should be called, when a widget changes its size.
References parent, and parentRef.
Referenced by dw::Textblock::addParbreak(), dw::core::ui::Resource::queueResize(), dw::ListItem::setMaxValue(), and dw::TableCell::setMaxValue().
|
inlineprotected |
References layout, and dw::core::Layout::removeAnchor().
|
virtual |
References lout::misc::assertNotReached().
|
inlineprotectedvirtual |
Called after sizeAllocateImpl() to redraw necessary areas. By default the whole widget is redrawn.
Reimplemented in dw::Textblock, and dw::Table.
References queueDraw().
| void dw::core::Widget::scrollTo | ( | HPosition | hpos, |
| VPosition | vpos, | ||
| int | x, | ||
| int | y, | ||
| int | width, | ||
| int | height | ||
| ) |
References scrollTo().
Referenced by scrollTo().
|
inlineprotected |
References dw::core::SelectionState::buttonMotion(), layout, and dw::core::Layout::selectionState.
|
inlineprotected |
References dw::core::SelectionState::buttonPress(), layout, and dw::core::Layout::selectionState.
|
inlineprotected |
References dw::core::SelectionState::buttonRelease(), layout, and dw::core::Layout::selectionState.
|
inlineprotected |
References dw::core::SelectionState::handleEvent(), layout, and dw::core::Layout::selectionState.
|
virtual |
Reimplemented in dw::Textblock, dw::Table, and dw::core::ui::Embed.
Referenced by dw::Textblock::calcWidgetSize().
| void dw::core::Widget::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.
| void dw::core::Widget::setButtonSensitive | ( | bool | buttonSensitive | ) |
Referenced by dw::TableCell::TableCell().
|
inlineprotected |
References layout, and dw::core::Layout::setCursor().
|
inline |
References deleteCallbackData, and deleteCallbackFunc.
|
virtual |
Reimplemented in dw::Textblock, dw::Table, and dw::core::ui::Embed.
Referenced by dw::Textblock::calcWidgetSize().
|
inlineprotected |
References flags.
Referenced by dw::Ruler::Ruler(), and dw::core::ui::Embed::setUsesHints().
| void dw::core::Widget::setParent | ( | Widget * | parent | ) |
References buttonSensitive, and layout.
Referenced by dw::Textblock::addWidget().
|
virtual |
Change the style of a widget.
The old style is automatically unreferred, the new is referred. If this call causes the widget to change its size, dw::core::Widget::queueResize is called.
Reimplemented in dw::core::ui::Embed.
References dw::core::style::Style::ref(), dw::core::style::StyleAttrs::sizeDiffs(), and dw::core::style::Style::unref().
Referenced by dw::Textblock::addWidget(), dw::Textblock::changeLinkColor(), and dw::core::ui::Embed::setStyle().
|
virtual |
Reimplemented in dw::Textblock, dw::Table, and dw::core::ui::Embed.
Referenced by dw::Textblock::calcWidgetSize().
| void dw::core::Widget::sizeAllocate | ( | Allocation * | allocation | ) |
Wrapper for Widget::sizeAllocateImpl, calls the latter only when needed.
References dw::core::Allocation::ascent, DBG_OBJ_SET_NUM, dw::core::Allocation::descent, dw::core::Allocation::width, dw::core::Allocation::x, and dw::core::Allocation::y.
Referenced by dw::Textblock::sizeAllocateImpl().
|
protectedvirtual |
Reimplemented in dw::Textblock, dw::Table, dw::core::ui::Embed, and dw::Image.
| void dw::core::Widget::sizeRequest | ( | Requisition * | requisition | ) |
This method is a wrapper for Widget::sizeRequestImpl(); it calls the latter only when needed.
References dw::core::Requisition::ascent, DBG_OBJ_SET_NUM, dw::core::Requisition::descent, and dw::core::Requisition::width.
Referenced by dw::Textblock::calcWidgetSize().
|
protectedpure virtual |
Implemented in dw::Textblock, dw::Table, dw::core::ui::Embed, dw::Image, dw::Ruler, and dw::Bullet.
|
inlineprotected |
References flags.
Referenced by dw::Ruler::Ruler().
|
inline |
References flags, and USES_HINTS.
Referenced by dw::Textblock::calcWidgetSize(), and dw::Textblock::getWordExtremes().
|
inline |
References flags, and WAS_ALLOCATED.
Referenced by dw::Textblock::sizeAllocateImpl().
|
friend |
|
protected |
The current allocation: size and position, always relative to the canvas.
Referenced by dw::Bullet::draw(), getAllocation(), dw::Textblock::TextblockIterator::getAllocation(), getContentWidth(), getHeight(), dw::Textblock::lineYOffsetCanvas(), dw::Textblock::lineYOffsetWidget(), and queueDraw().
|
private |
See dw::core::Widget::setBgColor().
Referenced by getBgColor().
|
private |
See dw::core::Widget::setButtonSensitive().
Referenced by isButtonSensitive(), and setParent().
|
private |
|
static |
|
private |
Referenced by setDeleteCallback().
|
private |
Referenced by setDeleteCallback().
|
private |
Analogue to dw::core::Widget::requisition.
|
private |
Referenced by blockLevel(), extremesChanged(), hasContents(), needsAllocate(), needsResize(), setFlags(), unsetFlags(), usesHints(), and wasAllocated().
|
protected |
|
private |
The parent widget, NULL for top-level widgets.
Referenced by getBgColor(), getLevel(), getNearestCommonAncestor(), getParent(), getTopLevel(), and queueResize().
| int dw::core::Widget::parentRef |
This value is defined by the parent widget, and used for incremential resizing.
See documentation for an explanation.
Referenced by dw::Textblock::accumulateWordForLine(), dw::Textblock::addWidget(), queueResize(), and dw::Textblock::rewrap().
|
private |
Size_request() stores the result of the last call of size_request_impl().
Do not read this directly, but call size_request().
|
private |
Referenced by dw::Textblock::addBreakOption(), getBgColor(), getContentHeight(), getContentWidth(), and getStyle().
1.8.2