1 #include <lib/gui/ewindow.h>
2 #include <lib/gui/ewidgetdesktop.h>
4 #include <lib/gui/ewindowstyle.h>
5 #include <lib/gui/ewindowstyleskinned.h>
7 #include <lib/gdi/epng.h>
9 eWindow::eWindow(eWidgetDesktop *desktop): eWidget(0)
12 /* ask style manager for current style */
13 ePtr<eWindowStyleManager> mgr;
14 eWindowStyleManager::getInstance(mgr);
16 ePtr<eWindowStyle> style;
20 /* when there is either no style manager or no style, revert to simple style. */
22 style = new eWindowStyleSimple();
26 /* we are the parent for the child window. */
27 /* as we are in the constructor, this is thread safe. */
29 m_child = new eWidget(this);
30 desktop->addRootWidget(this, 0);
35 getDesktop()->removeRootWidget(this);
38 void eWindow::setTitle(const std::string &string)
40 if (m_title == string)
43 event(evtTitleChanged);
46 void eWindow::setFlag(int flags)
51 void eWindow::clearFlag(int flags)
56 int eWindow::event(int event, void *data, void *data2)
60 case evtWillChangeSize:
62 eSize &new_size = *static_cast<eSize*>(data);
63 eSize &offset = *static_cast<eSize*>(data2);
64 if (!(m_flags & wfNoBorder))
66 ePtr<eWindowStyle> style;
69 // eDebug("eWindow::evtWillChangeSize to %d %d", new_size.width(), new_size.height());
70 style->handleNewSize(this, new_size, offset);
73 m_child->resize(new_size);
78 if (!(m_flags & wfNoBorder))
80 ePtr<eWindowStyle> style;
83 gPainter &painter = *static_cast<gPainter*>(data2);
84 style->paintWindowDecoration(this, painter, m_title);
92 return eWidget::event(event, data, data2);