diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-01-23 23:14:14 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-01-23 23:14:14 +0000 |
| commit | 4c9d04cb33fb06dfa075b431e36e7ea938a5f963 (patch) | |
| tree | c2c74af99bbece5f62c4577beca11f27c2539ec3 /lib | |
| parent | 9202d4248dd7df2f6e5eb53b4154c8297ec9b1d1 (diff) | |
| download | enigma2-4c9d04cb33fb06dfa075b431e36e7ea938a5f963.tar.gz enigma2-4c9d04cb33fb06dfa075b431e36e7ea938a5f963.zip | |
- allow close of dialog
- some eWidget fixes
- background for eWidgetDesktop
- introduce "session" object
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Makefile.am | 2 | ||||
| -rw-r--r-- | lib/gui/ewidget.cpp | 16 | ||||
| -rw-r--r-- | lib/gui/ewidgetdesktop.cpp | 26 | ||||
| -rw-r--r-- | lib/gui/ewidgetdesktop.h | 4 |
4 files changed, 43 insertions, 5 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index f33133b8..a09b9bc1 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1 +1 @@ -SUBDIRS = base dvb dvb_si gdi network service driver nav content gui python +SUBDIRS = base dvb dvb_si gdi network service driver nav gui python diff --git a/lib/gui/ewidget.cpp b/lib/gui/ewidget.cpp index 3ebac357..7f089361 100644 --- a/lib/gui/ewidget.cpp +++ b/lib/gui/ewidget.cpp @@ -10,7 +10,7 @@ eWidget::eWidget(eWidget *parent): m_parent(parent ? parent->child() : 0) if (m_parent) m_vis = wVisShow; - + if (m_parent) { m_parent->m_childs.push_back(this); @@ -109,7 +109,17 @@ void eWidget::show() void eWidget::hide() { + /* TODO: when hiding an upper level widget, widgets get hidden but keep the */ + /* wVisShow flag (because when the widget is shown again, the widgets must */ + /* become visible again. */ + if (!(m_vis & wVisShow)) + return; m_vis &= ~wVisShow; + + /* this is a workaround to the above problem. when we are in the delete phase, + don't hide childs. */ + if (!(m_parent || m_desktop)) + return; /* TODO: optimize here to only recalc what's required. possibly merge with show. */ eWidget *root = this; @@ -137,9 +147,13 @@ void eWidget::destruct() eWidget::~eWidget() { + hide(); + if (m_parent) m_parent->m_childs.remove(this); + m_parent = 0; + /* destroy all childs */ ePtrList<eWidget>::iterator i(m_childs.begin()); while (i != m_childs.end()) diff --git a/lib/gui/ewidgetdesktop.cpp b/lib/gui/ewidgetdesktop.cpp index bb6c7c39..1b5cf9b2 100644 --- a/lib/gui/ewidgetdesktop.cpp +++ b/lib/gui/ewidgetdesktop.cpp @@ -42,11 +42,10 @@ void eWidgetDesktop::calcWidgetClipRegion(eWidget *widget, gRegion &parent_visib void eWidgetDesktop::recalcClipRegions() { - gRegion screen = gRegion(eRect(ePoint(0, 0), m_screen_size)); + m_background_region = gRegion(eRect(ePoint(0, 0), m_screen_size)); for (ePtrList<eWidget>::iterator i(m_root.begin()); i != m_root.end(); ++i) - calcWidgetClipRegion(*i, screen); -// dumpRegion(screen); + calcWidgetClipRegion(*i, m_background_region); } void eWidgetDesktop::invalidate(const gRegion ®ion) @@ -56,12 +55,33 @@ void eWidgetDesktop::invalidate(const gRegion ®ion) m_dirty_region |= region; } +void eWidgetDesktop::setBackgroundColor(gColor col) +{ + m_background_color = col; + + /* if there's something visible from the background, redraw it with the new color. */ + if (m_dc && m_background_region.valid() && !m_background_region.empty()) + { + /* todo: split out "setBackgroundColor / clear"... maybe? */ + gPainter painter(m_dc); + painter.resetClip(m_background_region); + painter.setBackgroundColor(m_background_color); + painter.clear(); + } +} + void eWidgetDesktop::paint() { gPainter painter(m_dc); /* walk all root windows. */ for (ePtrList<eWidget>::iterator i(m_root.begin()); i != m_root.end(); ++i) i->doPaint(painter, m_dirty_region); + m_dirty_region &= m_background_region; + + painter.resetClip(m_dirty_region); + painter.setBackgroundColor(m_background_color); + painter.clear(); + m_dirty_region = gRegion(); } diff --git a/lib/gui/ewidgetdesktop.h b/lib/gui/ewidgetdesktop.h index 1354a86b..f76baf60 100644 --- a/lib/gui/ewidgetdesktop.h +++ b/lib/gui/ewidgetdesktop.h @@ -13,7 +13,9 @@ class eWidgetDesktop: public Object public: // weil debug eSize m_screen_size; gRegion m_dirty_region; + gRegion m_background_region; ePtr<gDC> m_dc; + gColor m_background_color; public: eWidgetDesktop(eSize screen); ~eWidgetDesktop(); @@ -25,6 +27,8 @@ public: void paint(); void setDC(gDC *dc); + void setBackgroundColor(gColor col); + void setRedrawTask(eMainloop &ml); private: ePtrList<eWidget> m_root; |
