1 /*
2  * Copyright (C) 2008 Emweb bv, Herent, Belgium.
3  *
4  * See the LICENSE file for terms of use.
5  */
6 #include <cassert>
7 
8 #include "DomElement.h"
9 #include "FlexItemImpl.h"
10 #include "ResizeSensor.h"
11 
12 #include "Wt/WApplication.h"
13 #include "Wt/WContainerWidget.h"
14 #include "Wt/WEnvironment.h"
15 #include "Wt/WLogger.h"
16 #include "Wt/WWidgetItem.h"
17 
18 namespace Wt {
19 
20 LOGGER("WWidgetItem");
21 
FlexItemImpl(WWidgetItem * item)22 FlexItemImpl::FlexItemImpl(WWidgetItem *item)
23   : item_(item)
24 { }
25 
~FlexItemImpl()26 FlexItemImpl::~FlexItemImpl()
27 { }
28 
minimumWidth()29 int FlexItemImpl::minimumWidth() const
30 {
31   if (item_->widget()->isHidden())
32     return 0;
33   else
34     return static_cast<int>(item_->widget()->minimumWidth().toPixels());
35 }
36 
minimumHeight()37 int FlexItemImpl::minimumHeight() const
38 {
39   if (item_->widget()->isHidden())
40     return 0;
41   else
42     return static_cast<int>(item_->widget()->minimumHeight().toPixels());
43 }
44 
createDomElement(DomElement * parent,bool fitWidth,bool fitHeight,WApplication * app)45 DomElement *FlexItemImpl::createDomElement(DomElement *parent,
46 					   bool fitWidth, bool fitHeight,
47 					   WApplication *app)
48 {
49   WWidget *w = item_->widget();
50 
51   DomElement *result = w->createSDomElement(app);
52   ResizeSensor::applyIfNeeded(w);
53   return result;
54 }
55 
layoutItem()56 WLayoutItem *FlexItemImpl::layoutItem() const
57 {
58   return item_;
59 }
60 
61 }
62