diff options
author | RichieSams | 2013-09-15 14:44:33 -0500 |
---|---|---|
committer | RichieSams | 2013-09-15 15:00:56 -0500 |
commit | 6ee253a4d8dce2f8c45f8d8256b49505db9eff4e (patch) | |
tree | b53648ca251ce4fa1f0002a01866c3f6e8104e49 /engines/zvision | |
parent | 0d78208562ad1709170734195587ac6e6a597dae (diff) | |
download | scummvm-rg350-6ee253a4d8dce2f8c45f8d8256b49505db9eff4e.tar.gz scummvm-rg350-6ee253a4d8dce2f8c45f8d8256b49505db9eff4e.tar.bz2 scummvm-rg350-6ee253a4d8dce2f8c45f8d8256b49505db9eff4e.zip |
ZVISION: Add focus support for the ScriptManager
Diffstat (limited to 'engines/zvision')
-rw-r--r-- | engines/zvision/script_manager.cpp | 17 | ||||
-rw-r--r-- | engines/zvision/script_manager.h | 4 |
2 files changed, 20 insertions, 1 deletions
diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 8dd944b1e9..3126aee8bb 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -38,7 +38,8 @@ namespace ZVision { ScriptManager::ScriptManager(ZVision *engine) - : _engine(engine) { + : _engine(engine), + _currentlyFocusedControl(0) { } ScriptManager::~ScriptManager() { @@ -254,6 +255,20 @@ void ScriptManager::disableControl(uint32 key) { } } +void ScriptManager::focusControl(uint32 key) { + for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { + uint32 controlKey = (*iter)->getKey(); + + if (controlKey == key) { + (*iter)->focus(); + } else if (controlKey == _currentlyFocusedControl) { + (*iter)->unfocus(); + } + } + + _currentlyFocusedControl = key; +} + void ScriptManager::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) { (*iter)->onMouseDown(screenSpacePos, backgroundImageSpacePos); diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 274905f88d..349f259198 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -74,6 +74,8 @@ private: Location _currentLocation; + uint32 _currentlyFocusedControl; + public: void initialize(); void update(uint deltaTimeMillis); @@ -88,6 +90,8 @@ public: void enableControl(uint32 key); void disableControl(uint32 key); + void focusControl(uint32 key); + /** * Called when LeftMouse is pushed. * |