aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/zvision/script_manager.cpp17
-rw-r--r--engines/zvision/script_manager.h4
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.
*