aboutsummaryrefslogtreecommitdiff
path: root/test/dw_simple_container.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2014-10-19 00:29:52 +0200
committerSebastian Geerken <devnull@localhost>2014-10-19 00:29:52 +0200
commit356751ca1ee7df3819dfcfcece24cfbdb37fba7c (patch)
tree8cffd8d8235aab30ef267695b8b6bf2bfa191e53 /test/dw_simple_container.cc
parent021d425fea3bdc727328ccbe24f508453a4ada36 (diff)
Changes in drawing process: is now interruptable. (Some errors left.)
Diffstat (limited to 'test/dw_simple_container.cc')
-rw-r--r--test/dw_simple_container.cc283
1 files changed, 144 insertions, 139 deletions
diff --git a/test/dw_simple_container.cc b/test/dw_simple_container.cc
index e19511a6..cdc7df5f 100644
--- a/test/dw_simple_container.cc
+++ b/test/dw_simple_container.cc
@@ -27,190 +27,195 @@ using namespace lout::misc;
namespace dw {
-int SimpleContainer::CLASS_ID = -1;
+ int SimpleContainer::CLASS_ID = -1;
-// ----------------------------------------------------------------------
+ // ----------------------------------------------------------------------
-SimpleContainer::SimpleContainerIterator::SimpleContainerIterator
+ SimpleContainer::SimpleContainerIterator::SimpleContainerIterator
(SimpleContainer *simpleContainer, Content::Type mask, bool atEnd) :
- Iterator (simpleContainer, mask, atEnd)
-{
- content.type = atEnd ? Content::END : Content::START;
-}
+ Iterator (simpleContainer, mask, atEnd)
+ {
+ content.type = atEnd ? Content::END : Content::START;
+ }
-lout::object::Object *SimpleContainer::SimpleContainerIterator::clone ()
-{
- SimpleContainerIterator *sci =
- new SimpleContainerIterator ((SimpleContainer*)getWidget(),
- getMask(), false);
- sci->content = content;
- return sci;
-}
+ lout::object::Object *SimpleContainer::SimpleContainerIterator::clone ()
+ {
+ SimpleContainerIterator *sci =
+ new SimpleContainerIterator ((SimpleContainer*)getWidget(),
+ getMask(), false);
+ sci->content = content;
+ return sci;
+ }
-int SimpleContainer::SimpleContainerIterator::index ()
-{
- switch (content.type) {
- case Content::START:
- return 0;
- case Content::WIDGET_IN_FLOW:
- return 1;
- case Content::END:
- return 2;
- default:
- assertNotReached ();
- return 0;
+ int SimpleContainer::SimpleContainerIterator::index ()
+ {
+ switch (content.type) {
+ case Content::START:
+ return 0;
+ case Content::WIDGET_IN_FLOW:
+ return 1;
+ case Content::END:
+ return 2;
+ default:
+ assertNotReached ();
+ return 0;
+ }
}
-}
-int SimpleContainer::SimpleContainerIterator::compareTo
+ int SimpleContainer::SimpleContainerIterator::compareTo
(lout::object::Comparable *other)
-{
- return index () - ((SimpleContainerIterator*)other)->index ();
-}
+ {
+ return index () - ((SimpleContainerIterator*)other)->index ();
+ }
-bool SimpleContainer::SimpleContainerIterator::next ()
-{
- SimpleContainer *simpleContainer = (SimpleContainer*)getWidget();
+ bool SimpleContainer::SimpleContainerIterator::next ()
+ {
+ SimpleContainer *simpleContainer = (SimpleContainer*)getWidget();
- if (content.type == Content::END)
- return false;
+ if (content.type == Content::END)
+ return false;
- // simple containers only contain widgets:
- if ((getMask() & Content::WIDGET_IN_FLOW) == 0) {
- content.type = Content::END;
- return false;
- }
+ // simple containers only contain widgets:
+ if ((getMask() & Content::WIDGET_IN_FLOW) == 0) {
+ content.type = Content::END;
+ return false;
+ }
- if (content.type == Content::START) {
- if (simpleContainer->child != NULL) {
- content.type = Content::WIDGET_IN_FLOW;
- content.widget = simpleContainer->child;
- return true;
- } else {
+ if (content.type == Content::START) {
+ if (simpleContainer->child != NULL) {
+ content.type = Content::WIDGET_IN_FLOW;
+ content.widget = simpleContainer->child;
+ return true;
+ } else {
+ content.type = Content::END;
+ return false;
+ }
+ } else /* if (content.type == Content::WIDGET) */ {
content.type = Content::END;
return false;
}
- } else /* if (content.type == Content::WIDGET) */ {
- content.type = Content::END;
- return false;
}
-}
-bool SimpleContainer::SimpleContainerIterator::prev ()
-{
- SimpleContainer *simpleContainer = (SimpleContainer*)getWidget();
+ bool SimpleContainer::SimpleContainerIterator::prev ()
+ {
+ SimpleContainer *simpleContainer = (SimpleContainer*)getWidget();
- if (content.type == Content::START)
- return false;
+ if (content.type == Content::START)
+ return false;
- // simple containers only contain widgets:
- if ((getMask() & Content::WIDGET_IN_FLOW) == 0) {
- content.type = Content::START;
- return false;
- }
+ // simple containers only contain widgets:
+ if ((getMask() & Content::WIDGET_IN_FLOW) == 0) {
+ content.type = Content::START;
+ return false;
+ }
- if (content.type == Content::END) {
- if (simpleContainer->child != NULL) {
- content.type = Content::WIDGET_IN_FLOW;
- content.widget = simpleContainer->child;
- return true;
- } else {
+ if (content.type == Content::END) {
+ if (simpleContainer->child != NULL) {
+ content.type = Content::WIDGET_IN_FLOW;
+ content.widget = simpleContainer->child;
+ return true;
+ } else {
+ content.type = Content::START;
+ return false;
+ }
+ } else /* if (content.type == Content::WIDGET) */ {
content.type = Content::START;
return false;
}
- } else /* if (content.type == Content::WIDGET) */ {
- content.type = Content::START;
- return false;
}
-}
-void SimpleContainer::SimpleContainerIterator::highlight (int start,
- int end,
- HighlightLayer layer)
-{
- /** todo Needs this an implementation? */
-}
+ void SimpleContainer::SimpleContainerIterator::highlight (int start,
+ int end,
+ HighlightLayer layer)
+ {
+ /** todo Needs this an implementation? */
+ }
-void SimpleContainer::SimpleContainerIterator::unhighlight (int direction,
- HighlightLayer
- layer)
-{
- /** todo Needs this an implementation? */
-}
+ void SimpleContainer::SimpleContainerIterator::unhighlight (int direction,
+ HighlightLayer
+ layer)
+ {
+ /** todo Needs this an implementation? */
+ }
-void SimpleContainer::SimpleContainerIterator::getAllocation (int start,
- int end,
- Allocation
- *allocation)
-{
- /** \bug Not implemented. */
-}
+ void SimpleContainer::SimpleContainerIterator::getAllocation (int start,
+ int end,
+ Allocation
+ *allocation)
+ {
+ /** \bug Not implemented. */
+ }
-// ----------------------------------------------------------------------
+ // ----------------------------------------------------------------------
-SimpleContainer::SimpleContainer ()
-{
- registerName ("dw::SimpleContainer", &CLASS_ID);
- child = NULL;
-}
+ SimpleContainer::SimpleContainer ()
+ {
+ registerName ("dw::SimpleContainer", &CLASS_ID);
+ child = NULL;
+ }
-SimpleContainer::~SimpleContainer ()
-{
- if (child)
- delete child;
-}
+ SimpleContainer::~SimpleContainer ()
+ {
+ if (child)
+ delete child;
+ }
-void SimpleContainer::sizeRequestImpl (Requisition *requisition)
-{
- Requisition childReq;
- if (child)
- child->sizeRequest (&childReq);
- else
- childReq.width = childReq.ascent = childReq.descent = 0;
+ void SimpleContainer::sizeRequestImpl (Requisition *requisition)
+ {
+ Requisition childReq;
+ if (child)
+ child->sizeRequest (&childReq);
+ else
+ childReq.width = childReq.ascent = childReq.descent = 0;
- requisition->width = childReq.width + boxDiffWidth ();
- requisition->ascent = childReq.ascent + boxOffsetY ();
- requisition->descent = childReq.descent + boxRestHeight ();
+ requisition->width = childReq.width + boxDiffWidth ();
+ requisition->ascent = childReq.ascent + boxOffsetY ();
+ requisition->descent = childReq.descent + boxRestHeight ();
- correctRequisition (requisition, splitHeightPreserveAscent);
-}
+ correctRequisition (requisition, splitHeightPreserveAscent);
+ }
-void SimpleContainer::getExtremesImpl (Extremes *extremes)
-{
- Extremes childExtr;
- if (child)
- child->getExtremes (&childExtr);
- else
- childExtr.minWidth = childExtr.maxWidth = 0;
+ void SimpleContainer::getExtremesImpl (Extremes *extremes)
+ {
+ Extremes childExtr;
+ if (child)
+ child->getExtremes (&childExtr);
+ else
+ childExtr.minWidth = childExtr.maxWidth = 0;
- extremes->minWidth = childExtr.minWidth + boxDiffWidth ();
- extremes->maxWidth = childExtr.maxWidth + boxDiffWidth ();
+ extremes->minWidth = childExtr.minWidth + boxDiffWidth ();
+ extremes->maxWidth = childExtr.maxWidth + boxDiffWidth ();
- correctExtremes (extremes);
-}
+ correctExtremes (extremes);
+ }
-void SimpleContainer::sizeAllocateImpl (Allocation *allocation)
-{
- Allocation childAlloc;
-
- if (child) {
- childAlloc.x = allocation->x + boxOffsetX ();
- childAlloc.y = allocation->y + boxOffsetY ();
- childAlloc.width = allocation->width - boxDiffWidth ();
- childAlloc.ascent = allocation->ascent - boxOffsetY ();
- childAlloc.descent = allocation->descent - boxRestHeight ();
- child->sizeAllocate (&childAlloc);
+ void SimpleContainer::sizeAllocateImpl (Allocation *allocation)
+ {
+ Allocation childAlloc;
+
+ if (child) {
+ childAlloc.x = allocation->x + boxOffsetX ();
+ childAlloc.y = allocation->y + boxOffsetY ();
+ childAlloc.width = allocation->width - boxDiffWidth ();
+ childAlloc.ascent = allocation->ascent - boxOffsetY ();
+ childAlloc.descent = allocation->descent - boxRestHeight ();
+ child->sizeAllocate (&childAlloc);
+ }
}
-}
-void SimpleContainer::draw (View *view, Rectangle *area)
+core::Widget *SimpleContainer::draw (View *view, Rectangle *area,
+ lout::container::untyped::Stack *iterator)
{
+ Widget *retWidget = NULL;
+
drawWidgetBox (view, area, false);
Rectangle childArea;
if (child && child->intersects (area, &childArea))
- child->draw (view, &childArea);
+ retWidget = child->drawTotal (view, &childArea, iterator);
+
+ return retWidget;
}
Iterator *SimpleContainer::iterator (Content::Type mask, bool atEnd)