aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/alignedtablecell.cc5
-rw-r--r--dw/alignedtablecell.hh2
-rw-r--r--dw/ruler.cc6
-rw-r--r--dw/ruler.hh2
-rw-r--r--dw/simpletablecell.cc5
-rw-r--r--dw/simpletablecell.hh2
-rw-r--r--dw/table.cc6
-rw-r--r--dw/table.hh3
-rw-r--r--dw/textblock.cc6
-rw-r--r--dw/textblock.hh3
-rw-r--r--dw/textblock_linebreaking.cc4
-rw-r--r--dw/widget.cc6
-rw-r--r--dw/widget.hh15
13 files changed, 48 insertions, 17 deletions
diff --git a/dw/alignedtablecell.cc b/dw/alignedtablecell.cc
index 2b81645d..1fba7588 100644
--- a/dw/alignedtablecell.cc
+++ b/dw/alignedtablecell.cc
@@ -45,6 +45,11 @@ AlignedTableCell::~AlignedTableCell()
DBG_OBJ_DELETE ();
}
+bool AlignedTableCell::isBlockLevel ()
+{
+ return false;
+}
+
int AlignedTableCell::wordWrap(int wordIndex, bool wrapAll)
{
Textblock::Word *word;
diff --git a/dw/alignedtablecell.hh b/dw/alignedtablecell.hh
index 63e550e3..eafff468 100644
--- a/dw/alignedtablecell.hh
+++ b/dw/alignedtablecell.hh
@@ -22,6 +22,8 @@ public:
AlignedTableCell(AlignedTableCell *ref, bool limitTextWidth);
~AlignedTableCell();
+
+ bool isBlockLevel ();
};
} // namespace dw
diff --git a/dw/ruler.cc b/dw/ruler.cc
index 2b5288c2..cf4401ca 100644
--- a/dw/ruler.cc
+++ b/dw/ruler.cc
@@ -29,7 +29,6 @@ namespace dw {
Ruler::Ruler ()
{
setFlags (USES_HINTS);
- setFlags (BLOCK_LEVEL);
unsetFlags (HAS_CONTENTS);
availWidth = 0;
}
@@ -50,6 +49,11 @@ void Ruler::setWidth (int width)
}
}
+ bool Ruler::isBlockLevel ()
+{
+ return true;
+}
+
void Ruler::draw (core::View *view, core::Rectangle *area)
{
drawWidgetBox (view, area, false);
diff --git a/dw/ruler.hh b/dw/ruler.hh
index 863792dd..b5a26c2c 100644
--- a/dw/ruler.hh
+++ b/dw/ruler.hh
@@ -26,6 +26,8 @@ protected:
public:
Ruler ();
+ bool isBlockLevel ();
+
core::Iterator *iterator (core::Content::Type mask, bool atEnd);
};
diff --git a/dw/simpletablecell.cc b/dw/simpletablecell.cc
index 07f4f768..3a356cbc 100644
--- a/dw/simpletablecell.cc
+++ b/dw/simpletablecell.cc
@@ -38,4 +38,9 @@ SimpleTableCell::~SimpleTableCell()
DBG_OBJ_DELETE ();
}
+bool SimpleTableCell::isBlockLevel ()
+{
+ return false;
+}
+
} // namespace dw
diff --git a/dw/simpletablecell.hh b/dw/simpletablecell.hh
index 9eccbb00..a97464e4 100644
--- a/dw/simpletablecell.hh
+++ b/dw/simpletablecell.hh
@@ -12,6 +12,8 @@ public:
SimpleTableCell (bool limitTextWidth);
~SimpleTableCell ();
+
+ bool isBlockLevel ();
};
} // namespace dw
diff --git a/dw/table.cc b/dw/table.cc
index 794e588d..d565fc2c 100644
--- a/dw/table.cc
+++ b/dw/table.cc
@@ -34,7 +34,6 @@ Table::Table(bool limitTextWidth)
{
DBG_OBJ_CREATE ("dw::Table");
registerName ("dw::Table", &CLASS_ID);
- setFlags (BLOCK_LEVEL);
setFlags (USES_HINTS);
setButtonSensitive(false);
@@ -228,6 +227,11 @@ void Table::setDescent (int descent)
}
}
+bool Table::isBlockLevel ()
+{
+ return true;
+}
+
void Table::draw (core::View *view, core::Rectangle *area)
{
// Can be optimized, by iterating on the lines in area.
diff --git a/dw/table.hh b/dw/table.hh
index 295bdaad..715e2139 100644
--- a/dw/table.hh
+++ b/dw/table.hh
@@ -440,6 +440,9 @@ protected:
void setWidth (int width);
void setAscent (int ascent);
void setDescent (int descent);
+
+ bool isBlockLevel ();
+
void draw (core::View *view, core::Rectangle *area);
//bool buttonPressImpl (core::EventButton *event);
diff --git a/dw/textblock.cc b/dw/textblock.cc
index 590ffb60..44a3e50c 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -225,7 +225,6 @@ Textblock::Textblock (bool limitTextWidth)
{
DBG_OBJ_CREATE ("dw::Textblock");
registerName ("dw::Textblock", &CLASS_ID);
- setFlags (BLOCK_LEVEL);
setFlags (USES_HINTS);
setButtonSensitive(true);
@@ -822,6 +821,11 @@ void Textblock::setDescent (int descent)
}
}
+bool Textblock::isBlockLevel ()
+{
+ return true;
+}
+
bool Textblock::buttonPressImpl (core::EventButton *event)
{
return sendSelectionEvent (core::SelectionState::BUTTON_PRESS, event);
diff --git a/dw/textblock.hh b/dw/textblock.hh
index 3254b843..0eaf3907 100644
--- a/dw/textblock.hh
+++ b/dw/textblock.hh
@@ -753,6 +753,9 @@ protected:
void setWidth (int width);
void setAscent (int ascent);
void setDescent (int descent);
+
+ bool isBlockLevel ();
+
void draw (core::View *view, core::Rectangle *area);
bool buttonPressImpl (core::EventButton *event);
diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc
index a773f24c..a6fb75a4 100644
--- a/dw/textblock_linebreaking.cc
+++ b/dw/textblock_linebreaking.cc
@@ -1474,7 +1474,7 @@ void Textblock::accumulateWordForLine (int lineIndex, int wordIndex)
word->content.widget->getStyle()->margin.bottom);
if (lines->size () == 1 &&
- word->content.widget->blockLevel () &&
+ word->content.widget->isBlockLevel () &&
getStyle ()->borderWidth.top == 0 &&
getStyle ()->padding.top == 0) {
// collapse top margins of parent element and its first child
@@ -1645,7 +1645,7 @@ void Textblock::initLine1Offset (int wordIndex)
int indent = 0;
if (word->content.type == core::Content::WIDGET_IN_FLOW &&
- word->content.widget->blockLevel() == true) {
+ word->content.widget->isBlockLevel() == true) {
/* don't use text-indent when nesting blocks */
} else {
if (core::style::isPerLength(getStyle()->textIndent)) {
diff --git a/dw/widget.cc b/dw/widget.cc
index e6c2aa76..10312bf7 100644
--- a/dw/widget.cc
+++ b/dw/widget.cc
@@ -830,6 +830,12 @@ void Widget::setDescent (int descent)
{
}
+bool Widget::isBlockLevel ()
+{
+ // Most widgets are not block-level.
+ return false;
+}
+
bool Widget::buttonPressImpl (EventButton *event)
{
return false;
diff --git a/dw/widget.hh b/dw/widget.hh
index e3d9cbe1..6482c63a 100644
--- a/dw/widget.hh
+++ b/dw/widget.hh
@@ -90,11 +90,6 @@ protected:
* The dw::Image widget uses this flag, see dw::Image::setBuffer.
*/
WAS_ALLOCATED = 1 << 8,
-
- /**
- * \brief Set for block-level widgets (as opposed to inline widgets)
- */
- BLOCK_LEVEL = 1 << 9,
};
/**
@@ -255,12 +250,7 @@ protected:
case WAS_ALLOCATED:
DBG_OBJ_SET_SYM ("flags.WAS_ALLOCATED",
(flags & WAS_ALLOCATED) ? "true" : "false");
- break;
-
- case BLOCK_LEVEL:
- DBG_OBJ_SET_SYM ("flags.BLOCK_LEVEL",
- (flags & BLOCK_LEVEL) ? "true" : "false");
- break;
+ break;
}
}
}
@@ -396,7 +386,6 @@ public:
inline bool wasAllocated () { return flags & WAS_ALLOCATED; }
inline bool usesHints () { return flags & USES_HINTS; }
inline bool hasContents () { return flags & HAS_CONTENTS; }
- inline bool blockLevel () { return flags & BLOCK_LEVEL; }
void setParent (Widget *parent);
@@ -413,6 +402,8 @@ public:
virtual void setAscent (int ascent);
virtual void setDescent (int descent);
+ virtual bool isBlockLevel ();
+
bool intersects (Rectangle *area, Rectangle *intersection);
/** Area is given in widget coordinates. */