aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/modular-backend.cpp3
-rw-r--r--backends/modular-backend.h10
-rw-r--r--backends/platform/sdl/sdl.cpp17
-rw-r--r--backends/platform/sdl/sdl.h6
-rw-r--r--common/taskbar.h98
5 files changed, 128 insertions, 6 deletions
diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp
index 525170d685..70c352303c 100644
--- a/backends/modular-backend.cpp
+++ b/backends/modular-backend.cpp
@@ -33,6 +33,7 @@
ModularBackend::ModularBackend()
:
_mutexManager(0),
+ _taskbarManager(0),
_graphicsManager(0),
_mixer(0) {
@@ -43,6 +44,8 @@ ModularBackend::~ModularBackend() {
_graphicsManager = 0;
delete _mixer;
_mixer = 0;
+ delete _taskbarManager;
+ _taskbarManager = 0;
delete _mutexManager;
_mutexManager = 0;
}
diff --git a/backends/modular-backend.h b/backends/modular-backend.h
index 3593130bf5..124a6ad807 100644
--- a/backends/modular-backend.h
+++ b/backends/modular-backend.h
@@ -27,20 +27,21 @@
class GraphicsManager;
class MutexManager;
+class TaskbarManager;
/**
* Base class for modular backends.
- *
+ *
* It wraps most functions to their manager equivalent, but not
* all OSystem functions are implemented here.
- *
+ *
* A backend derivated from this class, will need to implement
* these functions on its own:
* OSystem::pollEvent()
* OSystem::getMillis()
* OSystem::delayMillis()
* OSystem::getTimeAndDate()
- *
+ *
* And, it should also initialize all the managers variables
* declared in this class, or override their related functions.
*/
@@ -111,7 +112,7 @@ public:
virtual Common::HardwareKeySet *getHardwareKeySet() { return 0; }
//@}
-
+
/** @name Mutex handling */
//@{
@@ -141,6 +142,7 @@ protected:
/** @name Managers variables */
//@{
+ TaskbarManager *_taskbarManager;
MutexManager *_mutexManager;
GraphicsManager *_graphicsManager;
Audio::Mixer *_mixer;
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index fd27c82797..4520b74861 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -31,6 +31,7 @@
#include "backends/platform/sdl/sdl.h"
#include "common/config-manager.h"
#include "common/EventRecorder.h"
+#include "common/taskbar.h"
#include "common/textconsole.h"
#include "backends/saves/default/default-saves.h"
@@ -125,6 +126,9 @@ void OSystem_SDL::init() {
if (_timerManager == 0)
_timerManager = new SdlTimerManager();
+ if (_taskbarManager == 0)
+ _taskbarManager = new Common::TaskbarManager();
+
#ifdef USE_OPENGL
// Setup a list with both SDL and OpenGL graphics modes
setupGraphicsModes();
@@ -209,6 +213,19 @@ void OSystem_SDL::initBackend() {
ModularBackend::initBackend();
}
+void OSystem_SDL::engineInit() {
+ // Add the started engine to the list of recent tasks
+ _taskbarManager->addRecent(ConfMan.getActiveDomainName(), ConfMan.get("description"));
+
+ // Set the overlay icon the current running engine
+ _taskbarManager->setOverlayIcon(ConfMan.getActiveDomainName(), ConfMan.get("description"));
+}
+
+void OSystem_SDL::engineDone() {
+ // Remove overlay icon
+ _taskbarManager->setOverlayIcon("", "");
+}
+
void OSystem_SDL::initSDL() {
// Check if SDL has not been initialized
if (!_initedSDL) {
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 9c08752054..19f913ef45 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -30,7 +30,7 @@
#include "backends/events/sdl/sdl-events.h"
#include "backends/log/log.h"
-/**
+/**
* Base OSystem class for all SDL ports.
*/
class OSystem_SDL : public ModularBackend {
@@ -38,7 +38,7 @@ public:
OSystem_SDL();
virtual ~OSystem_SDL();
- /**
+ /**
* Pre-initialize backend. It should be called after
* instantiating the backend. Early needed managers are
* created here.
@@ -54,6 +54,8 @@ public:
// Override functions from ModularBackend and OSystem
virtual void initBackend();
+ virtual void engineInit();
+ virtual void engineDone();
virtual Common::HardwareKeySet *getHardwareKeySet();
virtual void quit();
virtual void fatalError();
diff --git a/common/taskbar.h b/common/taskbar.h
new file mode 100644
index 0000000000..e29fcdcb36
--- /dev/null
+++ b/common/taskbar.h
@@ -0,0 +1,98 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#ifndef COMMON_TASKBAR_MANAGER_H
+#define COMMON_TASKBAR_MANAGER_H
+
+#include "common/str.h"
+
+namespace Common {
+
+class TaskbarManager {
+public:
+ /**
+ * Values representing the taskbar progress state
+ */
+ enum TaskbarProgressState {
+ NoProgress = 0,
+ Indeterminate = 1,
+ Normal = 2,
+ Error = 4,
+ Paused = 8
+ };
+
+ TaskbarManager() {}
+ virtual ~TaskbarManager() {}
+
+ /**
+ * Sets an overlay icon on the taskbar icon.
+ *
+ * When an empty name is given, no icon is shown
+ * and the current overlay icon (if any) is removed
+ *
+ * @param name Path to the icon
+ * @param description The description
+ *
+ * @note on Windows, the icon should be an ICO file
+ */
+ virtual void setOverlayIcon(const String &name, const String &description) {}
+
+ /**
+ * Sets a progress value on the taskbar icon
+ *
+ * @param val The current progress value
+ * @param max The maximum progress value
+ */
+ virtual void setProgressValue(int val, int max) {}
+
+ /**
+ * Sets the progress state on the taskbar icon
+ *
+ * State can be any of the following:
+ * - NoProgress: disable display of progress state
+ * - Indeterminate
+ * - Normal
+ * - Error
+ * - Paused
+ *
+ * @param state The progress state
+ */
+ virtual void setProgressState(TaskbarProgressState state) {}
+
+ /**
+ * Adds an engine to the recent items list
+ *
+ * Path is automatically set to the current executable path,
+ * an icon name is generated (with fallback to default icon)
+ * and the command line is set to start the engine on click.
+ *
+ * @param name The target name.
+ * @param description The description.
+ */
+ virtual void addRecent(const String &name, const String &description) {}
+};
+
+} // End of namespace Common
+
+#endif // COMMON_TASKBAR_MANAGER_H