Dillo
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
dw::core::Widget Class Referenceabstract

The base class of all dillo widgets. More...

#include <widget.hh>

Classes

class  WidgetImgRenderer
 Implementation which represents the whole widget. More...
 

Public Member Functions

void setDeleteCallback (DW_Callback_t func, void *data)
 
 Widget ()
 
 ~Widget ()
 
bool resizeQueued ()
 
bool extremesQueued ()
 
bool needsResize ()
 
bool needsAllocate ()
 
bool allocateQueued ()
 
bool extremesChanged ()
 
bool wasAllocated ()
 
void setParent (Widget *parent)
 
void setQuasiParent (Widget *quasiParent)
 
void setGenerator (Widget *generator)
 
style::StylegetStyle ()
 
AllocationgetAllocation ()
 
bool inAllocation (int x, int y)
 
int boxOffsetX ()
 
int boxRestWidth ()
 
int boxDiffWidth ()
 
int boxOffsetY ()
 
int boxRestHeight ()
 
int boxDiffHeight ()
 
virtual int numSizeRequestReferences ()
 See Sizes of Dillo Widgets (or Size requisitions depending on positions). More...
 
virtual WidgetsizeRequestReference (int index)
 See Sizes of Dillo Widgets (or Size requisitions depending on positions). More...
 
virtual int numGetExtremesReferences ()
 See Sizes of Dillo Widgets (or Size requisitions depending on positions). More...
 
virtual WidgetgetExtremesReference (int index)
 See Sizes of Dillo Widgets (or Size requisitions depending on positions). More...
 
void sizeRequest (Requisition *requisition, int numPos=0, Widget **references=NULL, int *x=NULL, int *y=NULL)
 This method is a wrapper for Widget::sizeRequestImpl(); it calls the latter only when needed. More...
 
void getExtremes (Extremes *extremes, int numPos=0, Widget **references=NULL, int *x=NULL, int *y=NULL)
 Wrapper for Widget::getExtremesImpl(). More...
 
void sizeAllocate (Allocation *allocation)
 Wrapper for Widget::sizeAllocateImpl, calls the latter only when needed. More...
 
void calcExtraSpace (int numPos, Widget **references, int *x, int *y)
 Calculates dw::core::Widget::extraSpace. More...
 
int getAvailWidth (bool forceValue)
 
int getAvailHeight (bool forceValue)
 
virtual bool getAdjustMinWidth ()
 
void correctRequisition (Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseWidth, bool allowDecreaseHeight)
 
void correctExtremes (Extremes *extremes, bool useAdjustmentWidth)
 
int calcWidth (style::Length cssValue, int refWidth, Widget *refWidget, int limitMinWidth, bool forceValue)
 
void calcFinalWidth (style::Style *style, int refWidth, Widget *refWidget, int limitMinWidth, bool forceValue, int *finalWidth)
 
int calcHeight (style::Length cssValue, bool usePercentage, int refHeight, Widget *refWidget, bool forceValue)
 
virtual int applyPerWidth (int containerWidth, style::Length perWidth)
 
virtual int applyPerHeight (int containerHeight, style::Length perHeight)
 
int getMinWidth (Extremes *extremes, bool forceValue)
 Used to evaluate Widget::adjustMinWidth. More...
 
virtual bool isBlockLevel ()
 
virtual bool isPossibleContainer ()
 
void containerSizeChanged ()
 
bool intersects (Widget *refWidget, Rectangle *area, Rectangle *intersection)
 Calculates the intersection of the visible allocation (i. e. the intersection with the visible parent allocation) and "area" (in widget coordinates referring to "refWidget"), returned in intersection (in widget coordinates). More...
 
virtual void draw (View *view, Rectangle *area, DrawingContext *context)=0
 
void drawInterruption (View *view, Rectangle *area, DrawingContext *context)
 
virtual WidgetgetWidgetAtPoint (int x, int y, GettingWidgetAtPointContext *context)
 
WidgetgetWidgetAtPointInterrupted (int x, int y, GettingWidgetAtPointContext *context)
 
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. More...
 
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. More...
 
style::ColorgetBgColor ()
 Get the actual background of a widget. More...
 
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). More...
 
void drawWidgetBox (View *view, Rectangle *area, bool inverse)
 Draw borders and background of a widget. More...
 
void drawSelected (View *view, Rectangle *area)
 
void setButtonSensitive (bool buttonSensitive)
 
bool isButtonSensitive ()
 
WidgetgetParent ()
 
WidgetgetContainer ()
 
WidgetgetTopLevel ()
 Get the widget at the root of the tree, this widget is part from. More...
 
int getLevel ()
 Get the level of the widget within the tree. More...
 
int getGeneratorLevel ()
 Get the level of the widget within the tree, regarting the generators, not the parents. More...
 
WidgetgetNearestCommonAncestor (Widget *otherWidget)
 Get the widget with the highest level, which is a direct ancestor of widget1 and widget2. More...
 
WidgetReferencegetWidgetReference ()
 
void setWidgetReference (WidgetReference *widgetReference)
 
WidgetgetGenerator ()
 
LayoutgetLayout ()
 
void scrollTo (HPosition hpos, VPosition vpos, int x, int y, int width, int height)
 
void getMarginArea (int *xMar, int *yMar, int *widthMar, int *heightMar)
 
void getBorderArea (int *xBor, int *yBor, int *widthBor, int *heightBor)
 
void getPaddingArea (int *xPad, int *yPad, int *widthPad, int *heightPad)
 Return the padding area (content plus padding). More...
 
virtual Iteratoriterator (Content::Type mask, bool atEnd)=0
 Return an iterator for this widget. More...
 
virtual void removeChild (Widget *child)
 
- Public Member Functions inherited from lout::identity::IdentifiableObject
 IdentifiableObject ()
 
void intoStringBuffer (misc::StringBuffer *sb)
 Store a textual representation of the object in a misc::StringBuffer. More...
 
int getClassId ()
 Returns the class identifier. More...
 
const char * getClassName ()
 Return the name, under which the class of this object was registered. More...
 
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. More...
 
- 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. More...
 
virtual bool equals (Object *other)
 Returns, whether two objects are equal. More...
 
virtual int hashValue ()
 Return a hash value for the object. More...
 
virtual Objectclone ()
 Return an exact copy of the object. More...
 
const char * toString ()
 Use object::Object::intoStringBuffer to return a textual representation of the object. More...
 
virtual size_t sizeOf ()
 Return the number of bytes, this object totally uses. More...
 

Static Public Member Functions

static void setAdjustMinWidth (bool adjustMinWidth)
 
static void adjustHeight (int *height, bool allowDecreaseHeight, int ascent, int descent)
 

Public Attributes

int parentRef
 This value is defined by the parent widget, and used for incremential resizing. More...
 

Static Public Attributes

static int CLASS_ID = -1
 

Protected Types

enum  Flags {
  RESIZE_QUEUED = 1 << 0, EXTREMES_QUEUED = 1 << 1, NEEDS_RESIZE = 1 << 2, NEEDS_ALLOCATE = 1 << 3,
  ALLOCATE_QUEUED = 1 << 4, EXTREMES_CHANGED = 1 << 5, WAS_ALLOCATED = 1 << 6
}
 

Protected Member Functions

int getHeight ()
 
int getContentWidth ()
 
int getContentHeight ()
 
StackingContextMgrgetNextStackingContextMgr ()
 
void printFlag (Flags f)
 
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)
 
virtual void sizeRequestImpl (Requisition *requisition, int numPos, Widget **references, int *x, int *y)
 See Sizes of Dillo Widgets. More...
 
virtual void sizeRequestSimpl (Requisition *requisition)
 Simple variant, to be implemented by widgets with sizes not depending on positions. More...
 
virtual void getExtremesImpl (Extremes *extremes, int numPos, Widget **references, int *x, int *y)
 See Sizes of Dillo Widgets. More...
 
virtual void getExtremesSimpl (Extremes *extremes)
 Simple variant, to be implemented by widgets with extremes not depending on positions. More...
 
virtual void calcExtraSpaceImpl (int numPos, Widget **references, int *x, int *y)
 The actual implementation for calculating dw::core::Widget::extraSpace. More...
 
virtual void sizeAllocateImpl (Allocation *allocation)
 See Sizes of Dillo Widgets. More...
 
virtual void resizeDrawImpl ()
 Called after sizeAllocateImpl() to redraw necessary areas. By default the whole widget is redrawn. More...
 
virtual void markSizeChange (int ref)
 See Sizes of Dillo Widgets. More...
 
virtual void markExtremesChange (int ref)
 See Sizes of Dillo Widgets. More...
 
virtual int getAvailWidthOfChild (Widget *child, bool forceValue)
 
virtual int getAvailHeightOfChild (Widget *child, bool forceValue)
 
virtual void correctRequisitionOfChild (Widget *child, Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseWidth, bool allowDecreaseHeight)
 
void correctReqWidthOfChild (Widget *child, Requisition *requisition, bool allowDecreaseWidth)
 
void correctReqHeightOfChild (Widget *child, Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseHeight)
 
virtual void correctExtremesOfChild (Widget *child, Extremes *extremes, bool useAdjustmentWidth)
 
virtual void containerSizeChangedForChildren ()
 
virtual bool affectedByContainerSizeChange ()
 
virtual bool affectsSizeChangeContainerChild (Widget *child)
 
virtual bool usesAvailWidth ()
 Must be implemengted by a method returning true, when getAvailWidth() is called. More...
 
virtual bool usesAvailHeight ()
 Must be implemengted by a method returning true, when getAvailHeight() is called. More...
 
virtual void notifySetAsTopLevel ()
 This method is called after a widget has been set as the top of a widget tree. More...
 
virtual void notifySetParent ()
 This method is called after a widget has been added to a parent. More...
 
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 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. More...
 

Protected Attributes

WidgetImgRendererwidgetImgRenderer
 
Allocation allocation
 The current allocation: size and position, always relative to the canvas. More...
 
Layoutlayout
 
style::Box extraSpace
 Space around the margin box. Allocation is extraSpace + margin + border + padding + contents. More...
 
StackingContextMgrstackingContextMgr
 Set iff this widget constitutes a stacking context, as defined by CSS. More...
 
WidgetstackingContextWidget
 The bottom-most ancestor (or this) for which stackingContextMgr is set. More...
 

Private Member Functions

void queueResize (int ref, bool extremesChanged, bool fast)
 This method should be called, when a widget changes its size. More...
 
void queueResizeFast (int ref, bool extremesChanged)
 
bool resizeIdleEntered ()
 
void enterQueueResize ()
 
void leaveQueueResize ()
 
bool queueResizeEntered ()
 
void enterSizeAllocate ()
 
void leaveSizeAllocate ()
 
bool sizeAllocateEntered ()
 
void enterSizeRequest ()
 
void leaveSizeRequest ()
 
bool sizeRequestEntered ()
 
void enterGetExtremes ()
 
void leaveGetExtremes ()
 
bool getExtremesEntered ()
 

Private Attributes

Widgetparent
 The parent widget, NULL for top-level widgets. More...
 
WidgetquasiParent
 ... More...
 
Widgetgenerator
 The generating widget, NULL for top-level widgets, or if not set; in the latter case, the effective generator (see getGenerator) is the parent. More...
 
Widgetcontainer
 The containing widget, equivalent to the "containing block" defined by CSS. May be NULL, in this case the viewport is used. More...
 
WidgetReferencewidgetReference
 
style::Stylestyle
 
Flags flags
 
Requisition requisition
 Size_request() stores the result of the last call of size_request_impl(). More...
 
SizeParams requisitionParams
 
Extremes extremes
 Analogue to dw::core::Widget::requisition. More...
 
SizeParams extremesParams
 
style::ColorbgColor
 See dw::core::Widget::setBgColor(). More...
 
bool buttonSensitive
 See dw::core::Widget::setButtonSensitive(). More...
 
bool buttonSensitiveSet
 See dw::core::Widget::setButtonSensitive(). More...
 
void * deleteCallbackData
 
DW_Callback_t deleteCallbackFunc
 

Static Private Attributes

static bool adjustMinWidth = true
 

Friends

class Layout
 

Detailed Description

The base class of all dillo widgets.

See also
Dillo Widget Overview, Layout and Widgets

Member Enumeration Documentation

enum dw::core::Widget::Flags
protected
Enumerator
RESIZE_QUEUED 
Todo:
Comment this.
EXTREMES_QUEUED 
Todo:
Comment this.
NEEDS_RESIZE 

Set, when dw::core::Widget::requisition is not up to date anymore.

Todo:
Update, see RESIZE_QUEUED.
NEEDS_ALLOCATE 

Only used internally, set to enforce size allocation.

In some cases, the size of a widget remains the same, but the children are allocated at different positions and in different sizes, so that a simple comparison of old and new allocation is insufficient. Therefore, this flag is set (indirectly, as ALLOCATE_QUEUED) in queueResize.

ALLOCATE_QUEUED 
Todo:
Comment this.
EXTREMES_CHANGED 

Set, when dw::core::Widget::extremes is not up to date anymore.

Todo:
Update, see RESIZE_QUEUED.
WAS_ALLOCATED 

Set, when a widget was already once allocated,.

The dw::Image widget uses this flag, see dw::Image::setBuffer.

Constructor & Destructor Documentation

dw::core::Widget::Widget ( )
dw::core::Widget::~Widget ( )

References DBG_OBJ_DELETE, and layout.

Member Function Documentation

char* dw::core::Widget::addAnchor ( const char *  name)
inlineprotected
char* dw::core::Widget::addAnchor ( const char *  name,
int  y 
)
inlineprotected
void dw::core::Widget::adjustHeight ( int *  height,
bool  allowDecreaseHeight,
int  ascent,
int  descent 
)
static
bool dw::core::Widget::affectedByContainerSizeChange ( )
protectedvirtual
bool dw::core::Widget::affectsSizeChangeContainerChild ( Widget child)
protectedvirtual
bool dw::core::Widget::allocateQueued ( )
inline

References ALLOCATE_QUEUED.

Referenced by dw::core::Layout::resizeIdle().

int dw::core::Widget::applyPerHeight ( int  containerHeight,
style::Length  perHeight 
)
virtual
int dw::core::Widget::applyPerWidth ( int  containerWidth,
style::Length  perWidth 
)
virtual
int dw::core::Widget::boxDiffHeight ( )
inline
int dw::core::Widget::boxDiffWidth ( )
inline
int dw::core::Widget::boxOffsetX ( )
inline
int dw::core::Widget::boxOffsetY ( )
inline
int dw::core::Widget::boxRestHeight ( )
inline
int dw::core::Widget::boxRestWidth ( )
inline
bool dw::core::Widget::buttonPress ( EventButton event)
bool dw::core::Widget::buttonPressImpl ( EventButton event)
protectedvirtual

Reimplemented in dw::Textblock, dw::core::ui::Embed, and dw::Image.

bool dw::core::Widget::buttonRelease ( EventButton event)
bool dw::core::Widget::buttonReleaseImpl ( EventButton event)
protectedvirtual

Reimplemented in dw::Textblock, and dw::Image.

void dw::core::Widget::calcExtraSpace ( int  numPos,
Widget **  references,
int *  x,
int *  y 
)
void dw::core::Widget::calcExtraSpaceImpl ( int  numPos,
Widget **  references,
int *  x,
int *  y 
)
protectedvirtual

The actual implementation for calculating dw::core::Widget::extraSpace.

The implementation gets a clean value of dw::core::Widget::extraSpace, which is only corrected. To make sure all possible influences are considered, the implementation of the base class should be called, too.

void dw::core::Widget::calcFinalWidth ( style::Style style,
int  refWidth,
Widget refWidget,
int  limitMinWidth,
bool  forceValue,
int *  finalWidth 
)
int dw::core::Widget::calcHeight ( style::Length  cssValue,
bool  usePercentage,
int  refHeight,
Widget refWidget,
bool  forceValue 
)
int dw::core::Widget::calcWidth ( style::Length  cssValue,
int  refWidth,
Widget refWidget,
int  limitMinWidth,
bool  forceValue 
)
void dw::core::Widget::changeAnchor ( char *  name,
int  y 
)
inlineprotected
void dw::core::Widget::containerSizeChanged ( )
void dw::core::Widget::containerSizeChangedForChildren ( )
protectedvirtual
void dw::core::Widget::correctExtremes ( Extremes extremes,
bool  useAdjustmentWidth 
)
void dw::core::Widget::correctExtremesOfChild ( Widget child,
Extremes extremes,
bool  useAdjustmentWidth 
)
protectedvirtual
void dw::core::Widget::correctReqHeightOfChild ( Widget child,
Requisition requisition,
void(*)(int, int *, int *)  splitHeightFun,
bool  allowDecreaseHeight 
)
protected
void dw::core::Widget::correctRequisition ( Requisition requisition,
void(*)(int, int *, int *)  splitHeightFun,
bool  allowDecreaseWidth,
bool  allowDecreaseHeight 
)
void dw::core::Widget::correctRequisitionOfChild ( Widget child,
Requisition requisition,
void(*)(int, int *, int *)  splitHeightFun,
bool  allowDecreaseWidth,
bool  allowDecreaseHeight 
)
protectedvirtual
void dw::core::Widget::correctReqWidthOfChild ( Widget child,
Requisition requisition,
bool  allowDecreaseWidth 
)
protected
virtual void dw::core::Widget::draw ( View view,
Rectangle area,
DrawingContext context 
)
pure virtual
void dw::core::Widget::drawBox ( View view,
style::Style style,
Rectangle area,
int  x,
int  y,
int  width,
int  height,
bool  inverse 
)
void dw::core::Widget::drawInterruption ( View view,
Rectangle area,
DrawingContext context 
)
void dw::core::Widget::drawSelected ( View view,
Rectangle area 
)
void dw::core::Widget::drawWidgetBox ( View view,
Rectangle area,
bool  inverse 
)
void dw::core::Widget::enterGetExtremes ( )
inlineprivate
void dw::core::Widget::enterNotify ( EventCrossing event)
void dw::core::Widget::enterNotifyImpl ( EventCrossing event)
protectedvirtual
void dw::core::Widget::enterQueueResize ( )
inlineprivate
void dw::core::Widget::enterSizeAllocate ( )
inlineprivate
void dw::core::Widget::enterSizeRequest ( )
inlineprivate
bool dw::core::Widget::extremesChanged ( )
inline

References EXTREMES_CHANGED.

bool dw::core::Widget::extremesQueued ( )
inline

References EXTREMES_QUEUED.

Referenced by dw::core::Layout::resizeIdle().

virtual bool dw::core::Widget::getAdjustMinWidth ( )
inlinevirtual
Allocation* dw::core::Widget::getAllocation ( )
inline
int dw::core::Widget::getAvailHeight ( bool  forceValue)
int dw::core::Widget::getAvailHeightOfChild ( Widget child,
bool  forceValue 
)
protectedvirtual
int dw::core::Widget::getAvailWidth ( bool  forceValue)
int dw::core::Widget::getAvailWidthOfChild ( Widget child,
bool  forceValue 
)
protectedvirtual
style::Color * dw::core::Widget::getBgColor ( )

Get the actual background of a widget.

References dw::core::style::StyleAttrs::backgroundColor, bgColor, layout, parent, and style.

void dw::core::Widget::getBorderArea ( int *  xBor,
int *  yBor,
int *  widthBor,
int *  heightBor 
)
Widget* dw::core::Widget::getContainer ( )
inline

References container.

int dw::core::Widget::getContentHeight ( )
inlineprotected

References boxDiffHeight(), and getHeight().

int dw::core::Widget::getContentWidth ( )
inlineprotected
void dw::core::Widget::getExtremes ( Extremes extremes,
int  numPos = 0,
Widget **  references = NULL,
int *  x = NULL,
int *  y = NULL 
)
bool dw::core::Widget::getExtremesEntered ( )
inlineprivate
void dw::core::Widget::getExtremesImpl ( Extremes extremes,
int  numPos,
Widget **  references,
int *  x,
int *  y 
)
protectedvirtual
Widget * dw::core::Widget::getExtremesReference ( int  index)
virtual
void dw::core::Widget::getExtremesSimpl ( Extremes extremes)
protectedvirtual

Simple variant, to be implemented by widgets with extremes not depending on positions.

Reimplemented in dw::Textblock, dw::Table, dw::core::ui::Embed, dw::Image, dw::SimpleContainer, dw::Ruler, and dw::Bullet.

References lout::misc::notImplemented().

Widget* dw::core::Widget::getGenerator ( )
inline
int dw::core::Widget::getGeneratorLevel ( )

Get the level of the widget within the tree, regarting the generators, not the parents.

The root widget has the level 0.

References getGenerator().

Referenced by dw::core::DeepIterator::getRespectiveLevel().

int dw::core::Widget::getHeight ( )
inlineprotected
Layout* dw::core::Widget::getLayout ( )
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 getNearestCommonAncestor(), and dw::core::DeepIterator::getRespectiveLevel().

void dw::core::Widget::getMarginArea ( int *  xMar,
int *  yMar,
int *  widthMar,
int *  heightMar 
)
int dw::core::Widget::getMinWidth ( Extremes extremes,
bool  forceValue 
)

Used to evaluate Widget::adjustMinWidth.

If extremes == NULL, getExtremes is called. ForceValue is the same value passed to getAvailWidth etc.; if false, getExtremes is not called. A value of "false" is passed for "useCorrected" in the context of correctExtemes etc., to avoid cyclic dependencies.

References dw::core::Extremes::adjustmentWidth, DBG_IF_RTFL, DBG_OBJ_ENTER, DBG_OBJ_LEAVE_VAL, dw::tablecell::getAdjustMinWidth(), dw::core::Extremes::maxWidth, dw::core::Extremes::maxWidthIntrinsic, dw::core::Extremes::minWidth, and dw::core::Extremes::minWidthIntrinsic.

Referenced by correctExtremesOfChild(), correctReqWidthOfChild(), and dw::oof::OOFPosAbsLikeMgr::getAvailWidthOfChild().

Widget * dw::core::Widget::getNearestCommonAncestor ( Widget otherWidget)

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

StackingContextMgr* dw::core::Widget::getNextStackingContextMgr ( )
inlineprotected

References stackingContextMgr.

void dw::core::Widget::getPaddingArea ( int *  xPad,
int *  yPad,
int *  widthPad,
int *  heightPad 
)

Return the padding area (content plus padding).

Used as "reference area" (ee comment of "style::drawBackground") for backgrounds.

Widget* dw::core::Widget::getParent ( )
inline
style::Style* dw::core::Widget::getStyle ( )
inline

References style.

Referenced by dw::Textblock::accumulateWordForLine(), dw::core::StackingContextMgr::addChildSCWidget(), dw::oof::OOFFloatsMgr::addWidgetOOF(), dw::oof::OOFFloatsMgr::affectsLeftBorder(), dw::oof::OOFFloatsMgr::affectsRightBorder(), affectsSizeChangeContainerChild(), boxOffsetX(), boxOffsetY(), boxRestHeight(), boxRestWidth(), dw::oof::OOFFloatsMgr::calcFloatX(), dw::oof::OOFPosAbsLikeMgr::calcHPosAndSizeChildOfChild(), dw::oof::OOFPosAbsLikeMgr::calcVPosAndSizeChildOfChild(), dw::Textblock::changeLinkColor(), dw::oof::OOFFloatsMgr::collidesH(), dw::oof::OOFPosAbsMgr::containerBoxOffsetX(), dw::oof::OOFPosAbsMgr::containerBoxOffsetY(), dw::oof::OOFPosAbsMgr::containerBoxRestHeight(), dw::oof::OOFPosAbsMgr::containerBoxRestWidth(), correctExtremesOfChild(), dw::core::ui::ComplexButtonResource::correctExtremesOfChild(), correctReqHeightOfChild(), dw::core::ui::ComplexButtonResource::correctRequisitionOfChild(), correctReqWidthOfChild(), dw::Bullet::draw(), dw::core::StackingContextMgr::draw(), dw::Textblock::TextblockIterator::getAllocation(), dw::oof::OOFPosAbsLikeMgr::getAvailHeightOfChild(), getAvailHeightOfChild(), dw::oof::OOFPosAbsLikeMgr::getAvailWidthOfChild(), getAvailWidthOfChild(), dw::oof::OOFFloatsMgr::getBorder(), dw::oof::OOFPosRelMgr::getChildPosX(), dw::oof::OOFPosRelMgr::getChildPosY(), dw::oof::OOFFloatsMgr::getClearPosition(), dw::Bullet::getExtremesSimpl(), dw::oof::OOFFloatsMgr::getFloatsExtremes(), dw::oof::OOFFloatsMgr::getFloatsListsAndSide(), dw::oof::OOFAwareWidget::getOOFMIndex(), dw::oof::OOFPositionedMgr::getPosBottom(), dw::oof::OOFPositionedMgr::getPosLeft(), dw::oof::OOFPositionedMgr::getPosRight(), dw::oof::OOFPositionedMgr::getPosTop(), dw::core::StackingContextMgr::getWidgetAtPoint(), dw::core::StackingContextMgr::isEstablishingStackingContext(), dw::oof::OOFPosAbsLikeMgr::posXAbsolute(), dw::oof::OOFPosAbsLikeMgr::posYAbsolute(), and dw::Bullet::sizeRequestSimpl().

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

Widget * dw::core::Widget::getWidgetAtPoint ( int  x,
int  y,
GettingWidgetAtPointContext context 
)
virtual
Widget * dw::core::Widget::getWidgetAtPointInterrupted ( int  x,
int  y,
GettingWidgetAtPointContext context 
)
WidgetReference* dw::core::Widget::getWidgetReference ( )
inline
bool dw::core::Widget::inAllocation ( int  x,
int  y 
)
inline
bool dw::core::Widget::intersects ( Widget refWidget,
Rectangle area,
Rectangle intersection 
)

Calculates the intersection of the visible allocation (i. e. the intersection with the visible parent allocation) and "area" (in widget coordinates referring to "refWidget"), returned in intersection (in widget coordinates).

Typically used by containers when drawing their children (passing "this" as "refWidget"). Returns whether intersection is not empty.

References allocation, DBG_OBJ_ENTER, DBG_OBJ_LEAVE_VAL, DBG_OBJ_LEAVE_VAL0, DBG_OBJ_MSG, DBG_OBJ_MSGF, dw::core::Rectangle::height, dw::core::Rectangle::intersectsWith(), parent, dw::core::Rectangle::width, dw::core::Rectangle::x, dw::core::Allocation::x, dw::core::Rectangle::y, and dw::core::Allocation::y.

Referenced by dw::core::StackingContextMgr::draw(), dw::oof::OOFPositionedMgr::draw(), dw::oof::OOFFloatsMgr::drawFloats(), and dw::Textblock::drawLine().

bool dw::core::Widget::isBlockLevel ( )
virtual
bool dw::core::Widget::isButtonSensitive ( )
inline
bool dw::core::Widget::isPossibleContainer ( )
virtual
virtual Iterator* dw::core::Widget::iterator ( Content::Type  mask,
bool  atEnd 
)
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::SimpleContainer, dw::Ruler, and dw::Bullet.

Referenced by dw::core::CharIterator::CharIterator(), dw::core::DeepIterator::DeepIterator(), dw::core::Layout::detachWidget(), dw::core::DeepIterator::next(), dw::core::DeepIterator::prev(), dw::core::DeepIterator::searchDownward(), and dw::core::DeepIterator::searchSideward().

void dw::core::Widget::leaveGetExtremes ( )
inlineprivate
void dw::core::Widget::leaveNotify ( EventCrossing event)
void dw::core::Widget::leaveNotifyImpl ( EventCrossing event)
protectedvirtual
void dw::core::Widget::leaveQueueResize ( )
inlineprivate
void dw::core::Widget::leaveSizeAllocate ( )
inlineprivate
void dw::core::Widget::leaveSizeRequest ( )
inlineprivate
void dw::core::Widget::markExtremesChange ( int  ref)
protectedvirtual

See Sizes of Dillo Widgets.

Reimplemented in dw::Textblock.

void dw::core::Widget::markSizeChange ( int  ref)
protectedvirtual

See Sizes of Dillo Widgets.

Reimplemented in dw::Textblock.

bool dw::core::Widget::motionNotify ( EventMotion event)
bool dw::core::Widget::motionNotifyImpl ( EventMotion event)
protectedvirtual

Reimplemented in dw::Textblock, and dw::Image.

bool dw::core::Widget::needsAllocate ( )
inline

References NEEDS_ALLOCATE.

bool dw::core::Widget::needsResize ( )
inline

References NEEDS_RESIZE.

void dw::core::Widget::notifySetAsTopLevel ( )
protectedvirtual

This method is called after a widget has been set as the top of a widget tree.

A widget may override this method when it is necessary to be notified.

Reimplemented in dw::Textblock, and dw::oof::OOFAwareWidget.

Referenced by dw::core::Layout::addWidget().

void dw::core::Widget::notifySetParent ( )
protectedvirtual

This method is called after a widget has been added to a parent.

A widget may override this method when it is necessary to be notified.

Reimplemented in dw::Textblock, and dw::oof::OOFAwareWidget.

int dw::core::Widget::numGetExtremesReferences ( )
virtual
int dw::core::Widget::numSizeRequestReferences ( )
virtual
void dw::core::Widget::printFlag ( Flags  f)
inlineprotected
void dw::core::Widget::queueDraw ( )
inlineprotected
void dw::core::Widget::queueDrawArea ( int  x,
int  y,
int  width,
int  height 
)
protected
Todo:
Maybe only the intersection?

References DBG_OBJ_ENTER, DBG_OBJ_LEAVE, and layout.

Referenced by queueDraw().

void dw::core::Widget::queueResize ( int  ref,
bool  extremesChanged,
bool  fast 
)
private

This method should be called, when a widget changes its size.

A "fast" queueResize will ignore the anchestors, and furthermore not trigger the idle function. Used only within viewportSizeChanged, and not available outside Layout and Widget.

References DBG_OBJ_ENTER, DBG_OBJ_LEAVE, DBG_OBJ_MSGF, layout, parent, and parentRef.

Referenced by queueResize(), queueResizeFast(), dw::ListItem::setMaxValue(), and dw::AlignedTableCell::setMaxValue().

void dw::core::Widget::queueResize ( int  ref,
bool  extremesChanged 
)
inlineprotected
bool dw::core::Widget::queueResizeEntered ( )
inlineprivate
void dw::core::Widget::queueResizeFast ( int  ref,
bool  extremesChanged 
)
inlineprivate

References queueResize().

void dw::core::Widget::removeAnchor ( char *  name)
inlineprotected
void dw::core::Widget::removeChild ( Widget child)
virtual
virtual void dw::core::Widget::resizeDrawImpl ( )
inlineprotectedvirtual

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

Reimplemented in dw::Textblock, and dw::Table.

References queueDraw().

bool dw::core::Widget::resizeIdleEntered ( )
inlineprivate
bool dw::core::Widget::resizeQueued ( )
inline

References RESIZE_QUEUED.

Referenced by dw::core::Layout::resizeIdle().

void dw::core::Widget::scrollTo ( HPosition  hpos,
VPosition  vpos,
int  x,
int  y,
int  width,
int  height 
)

References layout.

bool dw::core::Widget::selectionHandleEvent ( SelectionState::EventType  eventType,
Iterator it,
int  charPos,
int  linkNo,
MousePositionEvent event 
)
inlineprotected
static void dw::core::Widget::setAdjustMinWidth ( bool  adjustMinWidth)
inlinestatic

References adjustMinWidth.

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)
void dw::core::Widget::setCursor ( style::Cursor  cursor)
inlineprotected
void dw::core::Widget::setDeleteCallback ( DW_Callback_t  func,
void *  data 
)
inline
void dw::core::Widget::setFlags ( Flags  f)
inlineprotected

References printFlag().

Referenced by dw::core::Layout::resizeIdle().

void dw::core::Widget::setGenerator ( Widget generator)
inline

References generator.

Referenced by dw::Textblock::addWidget().

void dw::core::Widget::setParent ( Widget parent)
void dw::core::Widget::setQuasiParent ( Widget quasiParent)

References DBG_OBJ_SET_PTR.

void dw::core::Widget::setStyle ( style::Style style)
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::StyleAttrs::backgroundColor, dw::core::style::StyleAttrs::backgroundImage, dw::core::style::StyleAttrs::borderWidth, dw::core::style::Box::bottom, DBG_OBJ_ASSOC_CHILD, DBG_OBJ_SET_COL, DBG_OBJ_SET_NUM, DBG_OBJ_SET_SYM, dw::core::style::StyleAttrs::display, dw::core::style::DISPLAY_BLOCK, dw::core::style::DISPLAY_INLINE, dw::core::style::DISPLAY_INLINE_BLOCK, dw::core::style::DISPLAY_LIST_ITEM, dw::core::style::DISPLAY_NONE, dw::core::style::DISPLAY_TABLE, dw::core::style::DISPLAY_TABLE_CELL, dw::core::style::DISPLAY_TABLE_FOOTER_GROUP, dw::core::style::DISPLAY_TABLE_HEADER_GROUP, dw::core::style::DISPLAY_TABLE_ROW, dw::core::style::DISPLAY_TABLE_ROW_GROUP, dw::core::style::ColorAttrs::getColor(), dw::core::style::StyleAttrs::hBorderSpacing, dw::core::style::StyleAttrs::height, layout, dw::core::style::Box::left, dw::core::style::StyleAttrs::margin, dw::core::style::StyleAttrs::maxHeight, dw::core::style::StyleAttrs::maxWidth, dw::core::style::StyleAttrs::minHeight, dw::core::style::StyleAttrs::minWidth, dw::core::style::StyleAttrs::padding, dw::core::style::StyleImage::putExternalImgRenderer(), dw::core::style::Style::ref(), dw::core::style::StyleImage::removeExternalImgRenderer(), dw::core::style::Box::right, dw::core::style::StyleAttrs::sizeDiffs(), dw::core::style::Box::top, dw::core::style::Style::unref(), dw::core::style::StyleAttrs::vBorderSpacing, and dw::core::style::StyleAttrs::width.

Referenced by dw::Textblock::addWidget(), dw::Textblock::changeLinkColor(), main(), dw::core::ui::Embed::setStyle(), and textTimeout().

void dw::core::Widget::setWidgetReference ( WidgetReference widgetReference)
inline
void dw::core::Widget::sizeAllocate ( Allocation allocation)
bool dw::core::Widget::sizeAllocateEntered ( )
inlineprivate
void dw::core::Widget::sizeAllocateImpl ( Allocation allocation)
protectedvirtual
void dw::core::Widget::sizeRequest ( Requisition requisition,
int  numPos = 0,
Widget **  references = NULL,
int *  x = NULL,
int *  y = NULL 
)
bool dw::core::Widget::sizeRequestEntered ( )
inlineprivate
void dw::core::Widget::sizeRequestImpl ( Requisition requisition,
int  numPos,
Widget **  references,
int *  x,
int *  y 
)
protectedvirtual
Widget * dw::core::Widget::sizeRequestReference ( int  index)
virtual
void dw::core::Widget::sizeRequestSimpl ( Requisition requisition)
protectedvirtual

Simple variant, to be implemented by widgets with sizes not depending on positions.

Reimplemented in dw::Table, dw::core::ui::Embed, dw::Image, dw::SimpleContainer, dw::Ruler, and dw::Bullet.

References lout::misc::notImplemented().

void dw::core::Widget::unsetFlags ( Flags  f)
inlineprotected

References printFlag().

Referenced by dw::core::Layout::resizeIdle().

bool dw::core::Widget::usesAvailHeight ( )
protectedvirtual

Must be implemengted by a method returning true, when getAvailHeight() is called.

Referenced by affectsSizeChangeContainerChild().

bool dw::core::Widget::usesAvailWidth ( )
protectedvirtual

Must be implemengted by a method returning true, when getAvailWidth() is called.

Reimplemented in dw::Textblock, dw::Table, and dw::Ruler.

Referenced by affectsSizeChangeContainerChild().

bool dw::core::Widget::wasAllocated ( )
inline

Friends And Related Function Documentation

friend class Layout
friend

Member Data Documentation

bool dw::core::Widget::adjustMinWidth = true
staticprivate
Allocation dw::core::Widget::allocation
protected
style::Color* dw::core::Widget::bgColor
private
bool dw::core::Widget::buttonSensitive
private
bool dw::core::Widget::buttonSensitiveSet
private
int dw::core::Widget::CLASS_ID = -1
static
Widget* dw::core::Widget::container
private

The containing widget, equivalent to the "containing block" defined by CSS. May be NULL, in this case the viewport is used.

Referenced by dw::core::Layout::addWidget(), correctExtremesOfChild(), correctReqHeightOfChild(), correctRequisitionOfChild(), correctReqWidthOfChild(), getAvailHeightOfChild(), getAvailWidthOfChild(), and getContainer().

void* dw::core::Widget::deleteCallbackData
private
DW_Callback_t dw::core::Widget::deleteCallbackFunc
private
style::Box dw::core::Widget::extraSpace
protected

Space around the margin box. Allocation is extraSpace + margin + border + padding + contents.

See also dw::core::Widget::calcExtraSpace and dw::core::Widget::calcExtraSpaceImpl. Also, it is feasible to correct this value within dw::core::Widget::sizeRequestImpl.

Extremes dw::core::Widget::extremes
private
SizeParams dw::core::Widget::extremesParams
private
Flags dw::core::Widget::flags
private
Widget* dw::core::Widget::generator
private

The generating widget, NULL for top-level widgets, or if not set; in the latter case, the effective generator (see getGenerator) is the parent.

Referenced by setGenerator().

Layout* dw::core::Widget::layout
protected
Widget* dw::core::Widget::parent
private
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::wrapWordInFlow().

Widget* dw::core::Widget::quasiParent
private
Requisition dw::core::Widget::requisition
private

Size_request() stores the result of the last call of size_request_impl().

Do not read this directly, but call size_request().

SizeParams dw::core::Widget::requisitionParams
private
StackingContextMgr* dw::core::Widget::stackingContextMgr
protected

Set iff this widget constitutes a stacking context, as defined by CSS.

Referenced by dw::core::Layout::addWidget(), getNextStackingContextMgr(), and setParent().

Widget* dw::core::Widget::stackingContextWidget
protected

The bottom-most ancestor (or this) for which stackingContextMgr is set.

Referenced by dw::core::Layout::addWidget(), and setParent().

style::Style* dw::core::Widget::style
private

Referenced by drawWidgetBox(), getBgColor(), and getStyle().

WidgetImgRenderer* dw::core::Widget::widgetImgRenderer
protected
WidgetReference* dw::core::Widget::widgetReference
private

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