aboutsummaryrefslogtreecommitdiff
path: root/dw
diff options
context:
space:
mode:
Diffstat (limited to 'dw')
-rw-r--r--dw/ruler.cc13
-rw-r--r--dw/ruler.hh4
2 files changed, 16 insertions, 1 deletions
diff --git a/dw/ruler.cc b/dw/ruler.cc
index 115dfaa5..2b5288c2 100644
--- a/dw/ruler.cc
+++ b/dw/ruler.cc
@@ -28,17 +28,28 @@ namespace dw {
Ruler::Ruler ()
{
+ setFlags (USES_HINTS);
setFlags (BLOCK_LEVEL);
unsetFlags (HAS_CONTENTS);
+ availWidth = 0;
}
void Ruler::sizeRequestImpl (core::Requisition *requisition)
{
- requisition->width = getStyle()->boxDiffWidth ();
+ requisition->width =
+ lout::misc::max (availWidth, getStyle()->boxDiffWidth ());
requisition->ascent = getStyle()->boxOffsetY ();
requisition->descent = getStyle()->boxRestHeight ();
}
+void Ruler::setWidth (int width)
+{
+ if (availWidth != width) {
+ availWidth = width;
+ queueResize (0, false);
+ }
+}
+
void Ruler::draw (core::View *view, core::Rectangle *area)
{
drawWidgetBox (view, area, false);
diff --git a/dw/ruler.hh b/dw/ruler.hh
index 32e859a1..863792dd 100644
--- a/dw/ruler.hh
+++ b/dw/ruler.hh
@@ -15,8 +15,12 @@ namespace dw {
*/
class Ruler: public core::Widget
{
+private:
+ int availWidth;
+
protected:
void sizeRequestImpl (core::Requisition *requisition);
+ void setWidth (int width);
void draw (core::View *view, core::Rectangle *area);
public: