ScummVM API documentation
taskbar.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef COMMON_TASKBAR_MANAGER_H
23#define COMMON_TASKBAR_MANAGER_H
24
25#include "common/scummsys.h"
26
27#if defined(USE_TASKBAR)
28
29#include "common/str.h"
30#include "common/config-manager.h"
31#include "common/file.h"
32
33namespace Common {
34
64class TaskbarManager {
65public:
69 enum TaskbarProgressState {
70 kTaskbarNoProgress = 0,
71 kTaskbarIndeterminate = 1,
72 kTaskbarNormal = 2,
73 kTaskbarError = 4,
74 kTaskbarPaused = 8
75 };
76
77 TaskbarManager() {}
78 virtual ~TaskbarManager() {}
79
91 virtual void setOverlayIcon(const String &name, const String &description) {}
92
99 virtual void setProgressValue(int completed, int total) {}
100
113 virtual void setProgressState(TaskbarProgressState state) {}
114
122 virtual void setCount(int count) {}
123
134 virtual void addRecent(const String &name, const String &description) {}
135
142 virtual void notifyError() {}
143
147 virtual void clearError() {}
148
149protected:
157 Common::Path getIconPath(const Common::String &target, const Common::String &extension) {
158 // We first try to look for a iconspath configuration variable then
159 // fallback to the extra path
160 //
161 // Icons can be either in a subfolder named "icons" or directly in the path
162
163 Common::Path iconsPath = ConfMan.getPath("iconspath");
164 Common::Path extraPath = ConfMan.getPath("extrapath");
165
166 Common::String targetIcon = target + extension;
167 Common::String qualifiedIcon = ConfMan.get("engineid") + "-" + ConfMan.get("gameid") + extension;
168 Common::String gameIcon = ConfMan.get("gameid") + extension;
169 Common::String engineIcon = ConfMan.get("engineid") + extension;
170
171#define TRY_ICON_PATH(path) { \
172Common::FSNode node((path)); \
173if (node.exists()) \
174return (path); \
175}
176 if (!iconsPath.empty()) {
177 TRY_ICON_PATH(iconsPath.join(targetIcon));
178 TRY_ICON_PATH(iconsPath.join(qualifiedIcon));
179 TRY_ICON_PATH(iconsPath.join(gameIcon));
180 TRY_ICON_PATH(iconsPath.join(engineIcon));
181 TRY_ICON_PATH(iconsPath.join("icons/" + targetIcon));
182 TRY_ICON_PATH(iconsPath.join("icons/" + qualifiedIcon));
183 TRY_ICON_PATH(iconsPath.join("icons/" + gameIcon));
184 TRY_ICON_PATH(iconsPath.join("icons/" + engineIcon));
185 }
186
187 if (!extraPath.empty()) {
188 TRY_ICON_PATH(extraPath.join(targetIcon));
189 TRY_ICON_PATH(extraPath.join(qualifiedIcon));
190 TRY_ICON_PATH(extraPath.join(gameIcon));
191 TRY_ICON_PATH(extraPath.join(engineIcon));
192 TRY_ICON_PATH(extraPath.join("icons/" + targetIcon));
193 TRY_ICON_PATH(extraPath.join("icons/" + qualifiedIcon));
194 TRY_ICON_PATH(extraPath.join("icons/" + gameIcon));
195 TRY_ICON_PATH(extraPath.join("icons/" + engineIcon));
196 }
197#undef TRY_ICON_PATH
198
199 return Common::Path();
200 }
201};
202
205} // End of namespace Common
206
207#endif
208
209#endif // COMMON_TASKBAR_MANAGER_H
Definition: path.h:52
WARN_UNUSED_RESULT Path join(const Path &x) const
Definition: path.h:487
bool empty() const
Definition: path.h:353
Definition: str.h:59
Definition: algorithm.h:29