diff options
Diffstat (limited to 'dw')
-rw-r--r-- | dw/textblock.cc | 10 | ||||
-rw-r--r-- | dw/widget.cc | 47 | ||||
-rw-r--r-- | dw/widget.hh | 2 |
3 files changed, 29 insertions, 30 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc index 035bb4d0..6cb02726 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -82,15 +82,7 @@ void Textblock::WordImgRenderer::getArea (int *x, int *y, int *width, void Textblock::WordImgRenderer::getRefArea (int *xRef, int *yRef, int *widthRef, int *heightRef) { - /** - * \todo Reference should be the containing block (which will be - * introduced later), not the widget allocation. (And also, - * there should be one single method for this.) - */ - *xRef = textblock->allocation.x; - *yRef = textblock->allocation.y; - *widthRef = textblock->allocation.width; - *heightRef = textblock->getHeight (); + textblock->getBgRefArea (xRef, yRef, widthRef, heightRef); } core::style::Style *Textblock::WordImgRenderer::getStyle () diff --git a/dw/widget.cc b/dw/widget.cc index 317d5eeb..719f1263 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -49,14 +49,7 @@ void Widget::WidgetImgRenderer::getArea (int *x, int *y, int *width, void Widget::WidgetImgRenderer::getRefArea (int *xRef, int *yRef, int *widthRef, int *heightRef) { - /** - * \todo Reference should be the containing block (which will be - * introduced later), not the widget allocation. - */ - *xRef = widget->allocation.x; - *yRef = widget->allocation.y; - *widthRef = widget->allocation.width; - *heightRef = widget->getHeight (); + widget->getBgRefArea (xRef, yRef, widthRef, heightRef); } style::Style *Widget::WidgetImgRenderer::getStyle () @@ -411,14 +404,12 @@ void Widget::drawBox (View *view, style::Style *style, Rectangle *area, allocation.x + x, allocation.y + y, width, height, style, inverse); - /** - * \todo Reference should be the containing block (which will be - * introduced later), not the widget allocation. - */ + int xRef, yRef, widthRef, heightRef; + getBgRefArea (&xRef, &yRef, &widthRef, &heightRef); style::drawBackground (view, layout, &canvasArea, allocation.x + x, allocation.y + y, width, height, - allocation.x, allocation.y, allocation.width, - getHeight (), style, inverse, false); + xRef, yRef, widthRef, heightRef, style, inverse, + false); } /** @@ -438,14 +429,11 @@ void Widget::drawWidgetBox (View *view, Rectangle *area, bool inverse) style::drawBorder (view, layout, &canvasArea, allocation.x, allocation.y, allocation.width, getHeight (), style, inverse); - /** - * \todo Reference should be the containing block (which will be - * introduced later), not the widget allocation. - */ + int xRef, yRef, widthRef, heightRef; + getBgRefArea (&xRef, &yRef, &widthRef, &heightRef); style::drawBackground (view, layout, &canvasArea, allocation.x, allocation.y, - allocation.width, getHeight (), allocation.x, - allocation.y, allocation.width, getHeight (), - style, inverse, parent == NULL); + allocation.width, getHeight (), xRef, yRef, widthRef, + heightRef, style, inverse, parent == NULL); } /* @@ -589,6 +577,23 @@ void Widget::scrollTo (HPosition hpos, VPosition vpos, x + allocation.x, y + allocation.y, width, height); } +/** + * \brief Return the "reference area" for backgrounds. + * + * See comment of "style::drawBackground". + */ +void Widget::getBgRefArea (int *xRef, int *yRef, int *widthRef, int *heightRef) +{ + /** + * \todo Reference should be the containing block (which will be + * introduced later), not the widget allocation. + */ + *xRef = allocation.x; + *yRef = allocation.y; + *widthRef = allocation.width; + *heightRef = getHeight (); +} + void Widget::getExtremesImpl (Extremes *extremes) { /* Simply return the requisition width */ diff --git a/dw/widget.hh b/dw/widget.hh index c836d117..fb16bf90 100644 --- a/dw/widget.hh +++ b/dw/widget.hh @@ -311,6 +311,8 @@ public: void scrollTo (HPosition hpos, VPosition vpos, int x, int y, int width, int height); + void getBgRefArea (int *xRef, int *yRef, int *widthRef, int *heightRef); + /** * \brief Return an iterator for this widget. * |