diff options
author | Sebastian Geerken <devnull@localhost> | 2014-07-03 20:25:18 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-07-03 20:25:18 +0200 |
commit | c92be107921cc075131c73946028c4a51af67759 (patch) | |
tree | ceb8c86af7644957afd66f3a3b788efbf32ec4c9 /dw | |
parent | 732d5e480bec103be3faf4d351b652d156a0de23 (diff) |
Widget::getExtremesImpl is now abstract; this way, getExtremes can avoid to call sizeRequest.
Diffstat (limited to 'dw')
-rw-r--r-- | dw/bullet.cc | 6 | ||||
-rw-r--r-- | dw/bullet.hh | 1 | ||||
-rw-r--r-- | dw/image.cc | 7 | ||||
-rw-r--r-- | dw/image.hh | 1 | ||||
-rw-r--r-- | dw/widget.cc | 9 | ||||
-rw-r--r-- | dw/widget.hh | 2 |
6 files changed, 16 insertions, 10 deletions
diff --git a/dw/bullet.cc b/dw/bullet.cc index b74f836c..54fd136e 100644 --- a/dw/bullet.cc +++ b/dw/bullet.cc @@ -42,6 +42,12 @@ void Bullet::sizeRequestImpl (core::Requisition *requisition) requisition->descent = 0; } +void Bullet::getExtremesImpl (core::Extremes *extremes) +{ + extremes->minWidth = extremes->maxWidth = + lout::misc::max (getStyle()->font->xHeight * 4 / 5, 1); +} + void Bullet::containerSizeChangedForChildren () { // Nothing to do. diff --git a/dw/bullet.hh b/dw/bullet.hh index 97a4909d..004187cd 100644 --- a/dw/bullet.hh +++ b/dw/bullet.hh @@ -15,6 +15,7 @@ class Bullet: public core::Widget { protected: void sizeRequestImpl (core::Requisition *requisition); + void getExtremesImpl (core::Extremes *extremes); void containerSizeChangedForChildren (); void draw (core::View *view, core::Rectangle *area); core::Iterator *iterator (core::Content::Type mask, bool atEnd); diff --git a/dw/image.cc b/dw/image.cc index ae48961f..65ebcdf3 100644 --- a/dw/image.cc +++ b/dw/image.cc @@ -216,6 +216,13 @@ void Image::sizeRequestImpl (core::Requisition *requisition) DBG_OBJ_MSG_END (); } +void Image::getExtremesImpl (core::Extremes *extremes) +{ + extremes->minWidth = extremes->maxWidth = + (buffer ? buffer->getRootWidth () : 0) + boxDiffWidth (); + correctExtremes (extremes); +} + void Image::sizeAllocateImpl (core::Allocation *allocation) { core::Imgbuf *oldBuffer; diff --git a/dw/image.hh b/dw/image.hh index 2d3cafd6..71ed85b9 100644 --- a/dw/image.hh +++ b/dw/image.hh @@ -130,6 +130,7 @@ private: protected: void sizeRequestImpl (core::Requisition *requisition); + void getExtremesImpl (core::Extremes *extremes); void sizeAllocateImpl (core::Allocation *allocation); void containerSizeChangedForChildren (); diff --git a/dw/widget.cc b/dw/widget.cc index 2271ee1e..6aec2358 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -1149,15 +1149,6 @@ void Widget::getPaddingArea (int *xPad, int *yPad, int *widthPad, - style->margin.bottom - style->borderWidth.bottom; } -void Widget::getExtremesImpl (Extremes *extremes) -{ - /* Simply return the requisition width */ - Requisition requisition; - sizeRequest (&requisition); - extremes->minWidth = extremes->maxWidth = requisition.width; - correctExtremes (extremes); -} - void Widget::sizeAllocateImpl (Allocation *allocation) { } diff --git a/dw/widget.hh b/dw/widget.hh index 00fc2aa5..bb41b3e3 100644 --- a/dw/widget.hh +++ b/dw/widget.hh @@ -291,7 +291,7 @@ protected: /** * \brief See \ref dw-widget-sizes. */ - virtual void getExtremesImpl (Extremes *extremes); + virtual void getExtremesImpl (Extremes *extremes) = 0; /** * \brief See \ref dw-widget-sizes. |