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/cursor.h"
00030 #include "graphics/pixelformat.h"
00031 
00032 namespace Graphics {
00033 
00034 class CursorManager : public Common::Singleton<CursorManager> {
00035 public:
00037     bool isVisible();
00038 
00054     bool showMouse(bool visible);
00055 
00076     void pushCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
00077 
00082     void popCursor();
00083 
00101     void replaceCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
00102 
00110     void replaceCursor(const Graphics::Cursor *cursor);
00111 
00118     void popAllCursors();
00119 
00129     bool supportsCursorPalettes();
00130 
00136     void disableCursorPalette(bool disable);
00137 
00152     void pushCursorPalette(const byte *colors, uint start, uint num);
00153 
00159     void popCursorPalette();
00160 
00172     void replaceCursorPalette(const byte *colors, uint start, uint num);
00173 
00174     void lock(bool locked);
00175 private:
00176     friend class Common::Singleton<SingletonBaseType>;
00177     // Even though this is basically the default constructor we implement it
00178     // ourselves, so it is private and thus there is no way to create this class
00179     // except from the Singleton code.
00180     CursorManager() {
00181         _locked = false;
00182     }
00183     ~CursorManager();
00184 
00185     struct Cursor {
00186         byte *_data;
00187         bool _visible;
00188         uint _width;
00189         uint _height;
00190         int _hotspotX;
00191         int _hotspotY;
00192         uint32 _keycolor;
00193         Graphics::PixelFormat _format;
00194         bool _dontScale;
00195 
00196         uint _size;
00197 
00198         // _format set to default by Graphics::PixelFormat default constructor
00199         Cursor() : _data(0), _visible(false), _width(0), _height(0), _hotspotX(0), _hotspotY(0), _keycolor(0), _dontScale(false), _size(0) {}
00200 
00201         Cursor(const void *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
00202         ~Cursor();
00203     };
00204 
00205     struct Palette {
00206         byte *_data;
00207         uint _start;
00208         uint _num;
00209         uint _size;
00210 
00211         bool _disabled;
00212 
00213         Palette() : _data(0), _start(0), _num(0), _size(0), _disabled(false) {}
00214 
00215         Palette(const byte *colors, uint start, uint num);
00216         ~Palette();
00217     };
00218     Common::Stack<Cursor *> _cursorStack;
00219     Common::Stack<Palette *> _cursorPaletteStack;
00220     bool _locked;
00221 };
00222 
00223 } // End of namespace Graphics
00224 
00225 #define CursorMan   (::Graphics::CursorManager::instance())
00226 
00227 #endif


Generated on Sat Apr 4 2020 05:00:34 for ResidualVM by doxygen 1.7.1
curved edge   curved edge