diff options
Diffstat (limited to 'dw/widget.hh')
-rw-r--r-- | dw/widget.hh | 70 |
1 files changed, 55 insertions, 15 deletions
diff --git a/dw/widget.hh b/dw/widget.hh index f9d1293c..a9a38087 100644 --- a/dw/widget.hh +++ b/dw/widget.hh @@ -180,19 +180,36 @@ protected: Allocation allocation; inline int getHeight () { return allocation.ascent + allocation.descent; } - inline int getContentWidth() { return allocation.width - - style->boxDiffWidth (); } - inline int getContentHeight() { return getHeight () - - style->boxDiffHeight (); } + inline int getContentWidth() { return allocation.width - boxDiffWidth (); } + inline int getContentHeight() { return getHeight () - boxDiffHeight (); } Layout *layout; /** * \brief Space around the margin box. Allocation is extraSpace + - * margin + border + padding + contents; + * 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. */ style::Box extraSpace; + /** + * \brief Set iff this widget constitutes a stacking context, as defined by + * CSS. + */ + StackingContextMgr *stackingContextMgr; + + /** + * \brief The bottom-most ancestor (or this) for which stackingContextMgr is + * set. + */ + Widget *stackingContextWidget; + + inline StackingContextMgr *getNextStackingContextMgr () + { return stackingContextWidget->stackingContextMgr; } + /*inline void printFlags () { DBG_IF_RTFL { char buf[10 * 3 - 1 + 1]; @@ -254,7 +271,6 @@ protected: inline void unsetFlags (Flags f) { flags = (Flags)(flags & ~f); printFlag (f); } - inline void queueDraw () { queueDrawArea (0, 0, allocation.width, getHeight()); } void queueDrawArea (int x, int y, int width, int height); @@ -264,13 +280,16 @@ protected: /** * \brief See \ref dw-widget-sizes. */ - virtual void sizeRequestImpl (Requisition *requisition) = 0; - + virtual void sizeRequestImpl (Requisition *requisition, bool posDefined, + int x, int y) = 0; + /** * \brief See \ref dw-widget-sizes. */ virtual void getExtremesImpl (Extremes *extremes) = 0; + virtual void calcExtraSpaceImpl (); + /** * \brief See \ref dw-widget-sizes. */ @@ -292,8 +311,6 @@ protected: */ virtual void markExtremesChange (int ref); - int getMinWidth (Extremes *extremes, bool forceValue); - virtual int getAvailWidthOfChild (Widget *child, bool forceValue); virtual int getAvailHeightOfChild (Widget *child, bool forceValue); virtual void correctRequisitionOfChild (Widget *child, @@ -410,6 +427,11 @@ public: inline style::Style *getStyle () { return style; } /** \todo I do not like this. */ inline Allocation *getAllocation () { return &allocation; } + inline bool inAllocation (int x, int y) { + return wasAllocated () && x >= allocation.x && y >= allocation.y && + x <= allocation.x + allocation.width && + y <= allocation.y + getHeight (); + } inline int boxOffsetX () { return extraSpace.left + getStyle()->boxOffsetX (); } @@ -422,10 +444,18 @@ public: { return extraSpace.bottom + getStyle()->boxRestHeight (); } inline int boxDiffHeight () { return boxOffsetY () + boxRestHeight (); } - void sizeRequest (Requisition *requisition); + /** + * \brief See \ref dw-widget-sizes (or \ref dw-size-request-pos). + */ + virtual Widget *sizeRequestReference (); + + void sizeRequest (Requisition *requisition, bool posDefined = false, + int x = 0, int y = 0); void getExtremes (Extremes *extremes); void sizeAllocate (Allocation *allocation); + void calcExtraSpace (); + int getAvailWidth (bool forceValue); int getAvailHeight (bool forceValue); virtual bool getAdjustMinWidth () { return Widget::adjustMinWidth; } @@ -442,15 +472,24 @@ public: virtual int applyPerWidth (int containerWidth, style::Length perWidth); virtual int applyPerHeight (int containerHeight, style::Length perHeight); + int getMinWidth (Extremes *extremes, bool forceValue); + virtual bool isBlockLevel (); virtual bool isPossibleContainer (); void containerSizeChanged (); - bool intersects (Rectangle *area, Rectangle *intersection); + bool intersects (Widget *refWidget, Rectangle *area, + Rectangle *intersection); /** Area is given in widget coordinates. */ - virtual void draw (View *view, Rectangle *area) = 0; + virtual void draw (View *view, Rectangle *area, DrawingContext *context) = 0; + void drawInterruption (View *view, Rectangle *area, DrawingContext *context); + + virtual Widget *getWidgetAtPoint (int x, int y, + GettingWidgetAtPointContext *context); + Widget *getWidgetAtPointInterrupted (int x, int y, + GettingWidgetAtPointContext *context); bool buttonPress (EventButton *event); bool buttonRelease (EventButton *event); @@ -481,11 +520,11 @@ public: inline Layout *getLayout () { return layout; } - virtual Widget *getWidgetAtPoint (int x, int y, int level); - 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); /** @@ -502,6 +541,7 @@ public: * dw::core::Iterator::prev in this case. */ virtual Iterator *iterator (Content::Type mask, bool atEnd) = 0; + virtual void removeChild (Widget *child); }; |