diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-08-31 03:05:27 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-08-31 03:05:27 +0000 |
| commit | 87bfe5dfced0fb7a4e9839fdafa898261a39c86c (patch) | |
| tree | e9cd842941df0e2fc679931f18701fbacf071c77 /lib/gui/ewidgetanimation.cpp | |
| parent | 58f644a3102613e874ecc0faf999da16c353f264 (diff) | |
| download | enigma2-87bfe5dfced0fb7a4e9839fdafa898261a39c86c.tar.gz enigma2-87bfe5dfced0fb7a4e9839fdafa898261a39c86c.zip | |
- fix serious problems in widget code. fixup buffered mode. add animation support.lib/gui
Diffstat (limited to 'lib/gui/ewidgetanimation.cpp')
| -rw-r--r-- | lib/gui/ewidgetanimation.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/gui/ewidgetanimation.cpp b/lib/gui/ewidgetanimation.cpp new file mode 100644 index 00000000..3912d592 --- /dev/null +++ b/lib/gui/ewidgetanimation.cpp @@ -0,0 +1,46 @@ +#include <lib/gui/ewidgetanimation.h> +#include <lib/gui/ewidget.h> + +eWidgetAnimation::eWidgetAnimation(eWidget *widget): m_widget(widget) +{ + m_active = 0; +} + +void eWidgetAnimation::tick(int inc) +{ + if (!m_active) + return; + + // move animation + if (m_move_length) + { + if (m_move_current_tick >= m_move_length) + { + m_active = 0; + m_move_current_tick = m_move_length; + } + int xdiff = m_move_end.x() - m_move_start.x(); + int ydiff = m_move_end.y() - m_move_start.y(); + + xdiff *= m_move_current_tick; + xdiff /= m_move_length; + + ydiff *= m_move_current_tick; + ydiff /= m_move_length; + + ePoint res(m_move_start.x() + xdiff, m_move_start.y() + ydiff); + + m_move_current_tick += inc; + + m_widget->move(res); + } +} + +void eWidgetAnimation::startMoveAnimation(ePoint start, ePoint end, int length) +{ + m_move_current_tick = 0; + m_move_length = length; + m_move_start = start; + m_move_end = end; + m_active = 1; +} |
