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

virtual-keyboard-gui.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 COMMON_VIRTUAL_KEYBOARD_GUI_H
00024 #define COMMON_VIRTUAL_KEYBOARD_GUI_H
00025 
00026 #include "common/scummsys.h"
00027 
00028 #ifdef ENABLE_VKEYBD
00029 
00030 #include "backends/vkeybd/virtual-keyboard.h"
00031 #include "common/rect.h"
00032 #include "common/system.h"
00033 #include "graphics/font.h"
00034 #include "graphics/surface.h"
00035 
00036 namespace Common {
00037 
00044 class VirtualKeyboardGUI {
00045 
00046 public:
00047 
00048     VirtualKeyboardGUI(VirtualKeyboard *kbd);
00049     ~VirtualKeyboardGUI();
00050 
00054     void initMode(VirtualKeyboard::Mode *mode);
00055 
00059     void run();
00060 
00064     void close();
00065 
00066     bool isDisplaying() { return _displaying; }
00067 
00071     void reset();
00072 
00077     void startDrag(int16 x, int16 y);
00078 
00082     void endDrag();
00083 
00088     void checkScreenChanged();
00089 
00093     void initSize(int16 w, int16 h);
00094 
00095 private:
00096 
00097     OSystem *_system;
00098 
00099     VirtualKeyboard *_kbd;
00100     Rect _kbdBound;
00101     Graphics::Surface *_kbdSurface;
00102     uint32 _kbdTransparentColor;
00103 
00104     Point _dragPoint;
00105     bool _drag;
00106     static const int SNAP_WIDTH = 10;
00107 
00108     Graphics::Surface _overlayBackup;
00109     Rect _dirtyRect;
00110 
00111     bool _displayEnabled;
00112     Graphics::Surface _dispSurface;
00113     const Graphics::Font *_dispFont;
00114     int16 _dispX, _dispY;
00115     uint _dispI;
00116     uint32 _dispForeColor, _dispBackColor;
00117 
00118     int _lastScreenChanged;
00119     int16 _screenW, _screenH;
00120 
00121     bool _displaying;
00122     bool _firstRun;
00123 
00124     void setupDisplayArea(Rect &r, uint32 forecolor);
00125     void move(int16 x, int16 y);
00126     void moveToDefaultPosition();
00127     void screenChanged();
00128     void mainLoop();
00129     void extendDirtyRect(const Rect &r);
00130     void resetDirtyRect();
00131     void redraw();
00132     void forceRedraw();
00133     void updateDisplay();
00134     bool fontIsSuitable(const Graphics::Font *font, const Rect &rect);
00135     uint calculateEndIndex(const String &str, uint startIndex);
00136 
00137     bool _drawCaret;
00138     int16 _caretX;
00139     static const int kCaretBlinkTime = 500;
00140     void animateCaret();
00141 
00142     static const int kCursorAnimateDelay = 250;
00143     int _cursorAnimateCounter;
00144     int _cursorAnimateTimer;
00145     byte _cursor[2048];
00146     void setupCursor();
00147     void removeCursor();
00148     void animateCursor();
00149 
00150 };
00151 
00152 } // End of namespace Common
00153 
00154 #endif // #ifdef ENABLE_VKEYBD
00155 
00156 #endif // #ifndef COMMON_VIRTUAL_KEYBOARD_GUI_H


Generated on Sat Mar 16 2019 05:02:01 for ResidualVM by doxygen 1.7.1
curved edge   curved edge