ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

cursorman.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef GRAPHICS_CURSORMAN_H
00024 #define GRAPHICS_CURSORMAN_H
00025 
00026 #include "common/scummsys.h"
00027 #include "common/stack.h"
00028 #include "common/singleton.h"
00029 #include "graphics/pixelformat.h"
00030 
00031 namespace Graphics {
00032 
00033 class CursorManager : public Common::Singleton<CursorManager> {
00034 public:
00036     bool isVisible();
00037 
00053     bool showMouse(bool visible);
00054 
00075     void pushCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
00076 
00081     void popCursor();
00082 
00100     void replaceCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
00101 
00108     void popAllCursors();
00109 
00119     bool supportsCursorPalettes();
00120 
00126     void disableCursorPalette(bool disable);
00127 
00142     void pushCursorPalette(const byte *colors, uint start, uint num);
00143 
00149     void popCursorPalette();
00150 
00162     void replaceCursorPalette(const byte *colors, uint start, uint num);
00163 
00164     void lock(bool locked);
00165 private:
00166     friend class Common::Singleton<SingletonBaseType>;
00167     // Even though this is basically the default constructor we implement it
00168     // ourselves, so it is private and thus there is no way to create this class
00169     // except from the Singleton code.
00170     CursorManager() {
00171         _locked = false;
00172     }
00173     ~CursorManager();
00174 
00175     struct Cursor {
00176         byte *_data;
00177         bool _visible;
00178         uint _width;
00179         uint _height;
00180         int _hotspotX;
00181         int _hotspotY;
00182         uint32 _keycolor;
00183         Graphics::PixelFormat _format;
00184         bool _dontScale;
00185 
00186         uint _size;
00187 
00188         Cursor(const void *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
00189         ~Cursor();
00190     };
00191 
00192     struct Palette {
00193         byte *_data;
00194         uint _start;
00195         uint _num;
00196         uint _size;
00197 
00198         bool _disabled;
00199 
00200         Palette(const byte *colors, uint start, uint num);
00201         ~Palette();
00202     };
00203     Common::Stack<Cursor *> _cursorStack;
00204     Common::Stack<Palette *> _cursorPaletteStack;
00205     bool _locked;
00206 };
00207 
00208 } // End of namespace Graphics
00209 
00210 #define CursorMan   (::Graphics::CursorManager::instance())
00211 
00212 #endif


Generated on Sat Nov 16 2019 05:00:45 for ResidualVM by doxygen 1.7.1
curved edge   curved edge