diff options
Diffstat (limited to 'engines/titanic/gfx/slider_button.cpp')
-rw-r--r-- | engines/titanic/gfx/slider_button.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/engines/titanic/gfx/slider_button.cpp b/engines/titanic/gfx/slider_button.cpp index 0633158e97..b3dbbed08f 100644 --- a/engines/titanic/gfx/slider_button.cpp +++ b/engines/titanic/gfx/slider_button.cpp @@ -24,6 +24,14 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CSliderButton, CSTButton) + ON_MESSAGE(MouseButtonUpMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseDragMoveMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + CSliderButton::CSliderButton() : CSTButton(), _field114(0), _field118(0), _field11C(0) { } @@ -48,4 +56,39 @@ void CSliderButton::load(SimpleFile *file) { CSTButton::load(file); } +bool CSliderButton::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + _pos1 = msg->_mousePos; + CStatusChangeMsg changeMsg; + changeMsg.execute(this); + return true; +} + +bool CSliderButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + _pos1 = msg->_mousePos; + return true; +} + +bool CSliderButton::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { + _pos1 = msg->_mousePos; + if (_field118) { + CStatusChangeMsg changeMsg; + changeMsg.execute(this); + } + + return true; +} + +bool CSliderButton::StatusChangeMsg(CStatusChangeMsg *msg) { + CStatusChangeMsg changeMsg; + changeMsg._oldStatus = _currentStatus; + _currentStatus = (_pos1.y - _bounds.top) / _field11C; + changeMsg._newStatus = _currentStatus; + changeMsg.execute(_actionTarget); + return true; +} + +bool CSliderButton::EnterViewMsg(CEnterViewMsg *msg) { + return true; +} + } // End of namespace Titanic |