aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/layout.cc21
-rw-r--r--dw/outofflowmgr.cc6
-rw-r--r--dw/ruler.cc13
-rw-r--r--dw/ruler.hh4
-rw-r--r--dw/table.cc36
-rw-r--r--dw/table.hh10
-rw-r--r--dw/textblock.cc21
-rw-r--r--dw/textblock.hh1
-rw-r--r--dw/ui.cc72
-rw-r--r--dw/ui.hh9
-rw-r--r--dw/widget.cc20
-rw-r--r--dw/widget.hh4
12 files changed, 21 insertions, 196 deletions
diff --git a/dw/layout.cc b/dw/layout.cc
index 998878ca..c89b2868 100644
--- a/dw/layout.cc
+++ b/dw/layout.cc
@@ -378,7 +378,6 @@ void Layout::addWidget (Widget *widget)
findtextState.setWidget (widget);
canvasHeightGreater = false;
- setSizeHints ();
// Do not directly call Layout::queueResize(), but
// Widget::queueResize(), so that all flags are set properly,
@@ -909,12 +908,10 @@ void Layout::resizeIdle ()
int currVThickness = currVScrollbarThickness();
if (!canvasHeightGreater &&
- canvasAscent + canvasDescent
- > viewportHeight - currHThickness) {
+ canvasAscent + canvasDescent > viewportHeight - currHThickness) {
canvasHeightGreater = true;
- setSizeHints ();
- /* May queue a new resize. */
- }
+ // TODO tell widget about change.
+ }
// Set viewport sizes.
view->setViewportSize (viewportWidth, viewportHeight,
@@ -933,16 +930,6 @@ void Layout::resizeIdle ()
leaveResizeIdle ();
}
-void Layout::setSizeHints ()
-{
- if (topLevel) {
- topLevel->setWidth (viewportWidth
- - (canvasHeightGreater ? vScrollbarThickness : 0));
- topLevel->setAscent (viewportHeight - hScrollbarThickness);
- topLevel->setDescent (0);
- }
-}
-
void Layout::queueDraw (int x, int y, int width, int height)
{
Rectangle area;
@@ -1286,7 +1273,7 @@ void Layout::viewportSizeChanged (View *view, int width, int height)
viewportWidth = width;
viewportHeight = height;
- setSizeHints ();
+ // TODO tell widget about change.
}
} // namespace core
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc
index ea089cdb..9526764f 100644
--- a/dw/outofflowmgr.cc
+++ b/dw/outofflowmgr.cc
@@ -2097,7 +2097,7 @@ void OutOfFlowMgr::ensureFloatSize (Float *vloat)
DBG_OBJ_MSGF ("resize.oofm", 1, "about to set absolute width: %d",
width);
width = adjustFloatWidth (width, &extremes);
- vloat->getWidget()->setWidth (width);
+ //vloat->getWidget()->setWidth (width);
} else if (cssWidth == LENGTH_AUTO || isPerLength (cssWidth)) {
// It is important that the width of the *CB* is not
// larger than its minimal width, when the latter is set
@@ -2136,7 +2136,7 @@ void OutOfFlowMgr::ensureFloatSize (Float *vloat)
width = adjustFloatWidth (width, &extremes);
}
- vloat->getWidget()->setWidth (width);
+ //vloat->getWidget()->setWidth (width);
} else
DBG_OBJ_MSG ("resize.oofm", 1,
"setting width: <b>relative length? may be a bug</b>");
@@ -2170,7 +2170,7 @@ void OutOfFlowMgr::ensureFloatSize (Float *vloat)
int width = vloat->size.width;
DBG_OBJ_MSGF ("resize.oofm", 1, "new width: %d", width);
width = adjustFloatWidth (width, &extremes);
- vloat->getWidget()->setWidth (width);
+ //vloat->getWidget()->setWidth (width);
vloat->getWidget()->sizeRequest (&vloat->size);
DBG_OBJ_MSGF ("resize.oofm", 1, "sizeRequest (2) => %d * (%d + %d)",
vloat->size.width, vloat->size.ascent, vloat->size.descent);
diff --git a/dw/ruler.cc b/dw/ruler.cc
index 7969e3c0..3599c32a 100644
--- a/dw/ruler.cc
+++ b/dw/ruler.cc
@@ -30,25 +30,16 @@ Ruler::Ruler ()
{
setFlags (USES_HINTS);
unsetFlags (HAS_CONTENTS);
- availWidth = 0;
}
void Ruler::sizeRequestImpl (core::Requisition *requisition)
{
- requisition->width =
- lout::misc::max (availWidth, getStyle()->boxDiffWidth ());
+ requisition->width = lout::misc::max (getAvailWidth (),
+ getStyle()->boxDiffWidth ());
requisition->ascent = getStyle()->boxOffsetY ();
requisition->descent = getStyle()->boxRestHeight ();
}
-void Ruler::setWidth (int width)
-{
- if (availWidth != width) {
- availWidth = width;
- queueResize (0, false);
- }
-}
-
bool Ruler::isBlockLevel ()
{
return true;
diff --git a/dw/ruler.hh b/dw/ruler.hh
index b5a26c2c..0a0cd2b2 100644
--- a/dw/ruler.hh
+++ b/dw/ruler.hh
@@ -15,12 +15,8 @@ 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:
diff --git a/dw/table.cc b/dw/table.cc
index d565fc2c..d15100b7 100644
--- a/dw/table.cc
+++ b/dw/table.cc
@@ -41,11 +41,6 @@ Table::Table(bool limitTextWidth)
rowClosed = false;
- // random values
- availWidth = 100;
- availAscent = 100;
- availDescent = 0;
-
numRows = 0;
numCols = 0;
curRow = -1;
@@ -201,32 +196,6 @@ void Table::resizeDrawImpl ()
redrawY = getHeight ();
}
-void Table::setWidth (int width)
-{
- // If limitTextWidth is set, a queueResize may also be necessary.
- if (availWidth != width || limitTextWidth) {
- _MSG(" Table::setWidth %d\n", width);
- availWidth = width;
- queueResize (0, false);
- }
-}
-
-void Table::setAscent (int ascent)
-{
- if (availAscent != ascent) {
- availAscent = ascent;
- queueResize (0, false);
- }
-}
-
-void Table::setDescent (int descent)
-{
- if (availDescent != descent) {
- availDescent = descent;
- queueResize (0, false);
- }
-}
-
bool Table::isBlockLevel ()
{
return true;
@@ -508,12 +477,13 @@ void Table::forceCalcCellSizes ()
* rendering is implemented, to handle fixed positions etc.,
* as defined by CSS2.)
*/
+ int availWidth = getAvailWidth ();
totalWidth =
misc::min (core::style::multiplyWithPerLength (availWidth,
getStyle()->width),
availWidth);
} else if (getStyle()->width == core::style::LENGTH_AUTO) {
- totalWidth = availWidth;
+ totalWidth = getAvailWidth ();
forceTotalWidth = 0;
}
@@ -559,7 +529,7 @@ void Table::forceCalcCellSizes ()
width += colWidths->get (col + i);
core::Requisition childRequisition;
- children->get(n)->cell.widget->setWidth (width);
+ //children->get(n)->cell.widget->setWidth (width);
children->get(n)->cell.widget->sizeRequest (&childRequisition);
childHeight = childRequisition.ascent + childRequisition.descent;
if (children->get(n)->cell.rowspan == 1) {
diff --git a/dw/table.hh b/dw/table.hh
index 715e2139..f49d3014 100644
--- a/dw/table.hh
+++ b/dw/table.hh
@@ -191,8 +191,9 @@ namespace dw {
*
* <ul>
* <li> the specified absolute width of the table, when given, or
- * <li> the available width (set by dw::Table::setWidth) times the specified
- * percentage width of t(at max 100%), if the latter is given, or
+ * <li> the available width (set by dw::Table::setWidth [TODO outdated]) times
+ * the specified percentage width of t(at max 100%), if the latter is
+ * given, or
* <li> otherwise the available width.
* </ul>
*
@@ -356,7 +357,6 @@ private:
friend class TableIterator;
bool limitTextWidth, rowClosed;
- int availWidth, availAscent, availDescent; // set by set...
int numRows, numCols, curRow, curCol;
lout::misc::SimpleVector<Child*> *children;
@@ -437,10 +437,6 @@ protected:
void sizeAllocateImpl (core::Allocation *allocation);
void resizeDrawImpl ();
- void setWidth (int width);
- void setAscent (int ascent);
- void setDescent (int descent);
-
bool isBlockLevel ();
void draw (core::View *view, core::Rectangle *area);
diff --git a/dw/textblock.cc b/dw/textblock.cc
index 7a379a08..93fd64a7 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -769,25 +769,6 @@ void Textblock::notifySetParent ()
assert (containingBlock != NULL);
}
-void Textblock::setWidth (int width)
-{
- /* If limitTextWidth is set to YES, a queueResize() may also be
- * necessary. */
- if (lineBreakWidth != width || limitTextWidth) {
- DBG_OBJ_MSGF ("resize", 0, "<b>setWidth</b> (%d)", width);
- DBG_OBJ_MSG_START ();
-
- lineBreakWidth = width;
- DBG_OBJ_SET_NUM ("lineBreakWidth", lineBreakWidth);
- queueResize (OutOfFlowMgr::createRefNormalFlow (0), false);
- mustQueueResize = false;
- redrawY = 0;
- DBG_OBJ_SET_NUM ("redrawY", redrawY);
-
- DBG_OBJ_MSG_END ();
- }
-}
-
bool Textblock::isBlockLevel ()
{
return true;
@@ -1077,7 +1058,7 @@ void Textblock::calcWidgetSize (core::Widget *widget, core::Requisition *size)
0);
DBG_OBJ_MSGF ("resize", 1, "setting hint: %d", corrLineBreakWidth);
- widget->setWidth (corrLineBreakWidth);
+ //widget->setWidth (corrLineBreakWidth);
widget->sizeRequest (size);
DBG_OBJ_MSGF ("resize", 1, "sizeRequest => %d * (%d + %d)",
size->width, size->ascent, size->descent);
diff --git a/dw/textblock.hh b/dw/textblock.hh
index 80590c96..2f35acb5 100644
--- a/dw/textblock.hh
+++ b/dw/textblock.hh
@@ -753,7 +753,6 @@ protected:
void notifySetAsTopLevel();
void notifySetParent();
- void setWidth (int width);
bool isBlockLevel ();
diff --git a/dw/ui.cc b/dw/ui.cc
index 8fb34c96..2560ebc1 100644
--- a/dw/ui.cc
+++ b/dw/ui.cc
@@ -88,36 +88,6 @@ bool Embed::buttonPressImpl (core::EventButton *event)
return handled;
}
-void Embed::setWidth (int width)
-{
- DBG_OBJ_MSGF ("resize", 0, "<b>setWidth</b> (%d)", width);
- DBG_OBJ_MSG_START ();
-
- resource->setWidth (width);
-
- DBG_OBJ_MSG_END ();
-}
-
-void Embed::setAscent (int ascent)
-{
- DBG_OBJ_MSGF ("resize", 0, "<b>setAscent</b> (%d)", ascent);
- DBG_OBJ_MSG_START ();
-
- resource->setAscent (ascent);
-
- DBG_OBJ_MSG_END ();
-}
-
-void Embed::setDescent (int descent)
-{
- DBG_OBJ_MSGF ("resize", 0, "<b>setDescent</b> (%d)", descent);
- DBG_OBJ_MSG_START ();
-
- resource->setDescent (descent);
-
- DBG_OBJ_MSG_END ();
-}
-
void Embed::setDisplayed (bool displayed)
{
resource->setDisplayed (displayed);
@@ -223,18 +193,6 @@ void Resource::sizeAllocate (Allocation *allocation)
{
}
-void Resource::setWidth (int width)
-{
-}
-
-void Resource::setAscent (int ascent)
-{
-}
-
-void Resource::setDescent (int descent)
-{
-}
-
void Resource::setDisplayed (bool displayed)
{
}
@@ -368,36 +326,6 @@ void ComplexButtonResource::sizeAllocate (Allocation *allocation)
{
}
-void ComplexButtonResource::setWidth (int width)
-{
- DBG_OBJ_MSGF ("resize", 0, "<b>setWidth</b> (%d)", width);
- DBG_OBJ_MSG_START ();
-
- childWidget->setWidth (width - 2 * reliefXThickness ());
-
- DBG_OBJ_MSG_END ();
-}
-
-void ComplexButtonResource::setAscent (int ascent)
-{
- DBG_OBJ_MSGF ("resize", 0, "<b>setAscent</b> (%d)", ascent);
- DBG_OBJ_MSG_START ();
-
- childWidget->setAscent (ascent - reliefYThickness ());
-
- DBG_OBJ_MSG_END ();
-}
-
-void ComplexButtonResource::setDescent (int descent)
-{
- DBG_OBJ_MSGF ("resize", 0, "<b>setDescent</b> (%d)", descent);
- DBG_OBJ_MSG_START ();
-
- childWidget->setDescent (descent - reliefYThickness ());
-
- DBG_OBJ_MSG_END ();
-}
-
Iterator *ComplexButtonResource::iterator (Content::Type mask, bool atEnd)
{
/**
diff --git a/dw/ui.hh b/dw/ui.hh
index cab67e17..6fc3d28a 100644
--- a/dw/ui.hh
+++ b/dw/ui.hh
@@ -241,9 +241,6 @@ public:
Embed(Resource *resource);
~Embed();
- void setWidth (int width);
- void setAscent (int ascent);
- void setDescent (int descent);
void setDisplayed (bool displayed);
void setEnabled (bool enabled);
void draw (View *view, Rectangle *area);
@@ -337,9 +334,6 @@ public:
virtual void sizeRequest (Requisition *requisition) = 0;
virtual void getExtremes (Extremes *extremes);
virtual void sizeAllocate (Allocation *allocation);
- virtual void setWidth (int width);
- virtual void setAscent (int ascent);
- virtual void setDescent (int descent);
virtual void setDisplayed (bool displayed);
virtual void draw (View *view, Rectangle *area);
virtual Iterator *iterator (Content::Type mask, bool atEnd) = 0;
@@ -407,9 +401,6 @@ public:
void sizeRequest (Requisition *requisition);
void getExtremes (Extremes *extremes);
void sizeAllocate (Allocation *allocation);
- void setWidth (int width);
- void setAscent (int ascent);
- void setDescent (int descent);
Iterator *iterator (Content::Type mask, bool atEnd);
int getClickX () {return click_x;};
int getClickY () {return click_y;};
diff --git a/dw/widget.cc b/dw/widget.cc
index cb283aca..e7562875 100644
--- a/dw/widget.cc
+++ b/dw/widget.cc
@@ -342,13 +342,15 @@ int Widget::getAvailWidth ()
if (container == NULL) {
// TODO Consider nested layouts (e. g. <button>).
+ int viewportWidth =
+ layout->viewportWidth - (layout->canvasHeightGreater ?
+ layout->vScrollbarThickness : 0);
if (style::isAbsLength (getStyle()->width))
return style::absLengthVal (getStyle()->width);
else if (style::isPerLength (getStyle()->width))
- return style::multiplyWithPerLength (layout->viewportWidth,
- getStyle()->width);
+ return style::multiplyWithPerLength (viewportWidth, getStyle()->width);
else
- return layout->viewportWidth;
+ return viewportWidth;
} else
return container->getAvailWidthOfChild (this);
}
@@ -856,18 +858,6 @@ void Widget::notifySetParent()
{
}
-void Widget::setWidth (int width)
-{
-}
-
-void Widget::setAscent (int ascent)
-{
-}
-
-void Widget::setDescent (int descent)
-{
-}
-
bool Widget::isBlockLevel ()
{
// Most widgets are not block-level.
diff --git a/dw/widget.hh b/dw/widget.hh
index 792b1082..5abbf89a 100644
--- a/dw/widget.hh
+++ b/dw/widget.hh
@@ -409,10 +409,6 @@ public:
void sizeAllocate (Allocation *allocation);
int getAvailWidth ();
- virtual void setWidth (int width);
- virtual void setAscent (int ascent);
- virtual void setDescent (int descent);
-
virtual bool isBlockLevel ();
virtual bool isPossibleContainer ();