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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef SCI_GRAPHICS_CONTROLS16_H 24 #define SCI_GRAPHICS_CONTROLS16_H 25 26 namespace Sci { 27 28 enum controlStateFlags { 29 SCI_CONTROLS_STYLE_ENABLED = 0x0001, ///< 0001 - enabled buttons 30 SCI_CONTROLS_STYLE_DISABLED = 0x0004, ///< 0010 - grayed out buttons 31 SCI_CONTROLS_STYLE_SELECTED = 0x0008 ///< 1000 - widgets surrounded by a frame 32 }; 33 34 // Control types and flags 35 enum { 36 SCI_CONTROLS_TYPE_BUTTON = 1, 37 SCI_CONTROLS_TYPE_TEXT = 2, 38 SCI_CONTROLS_TYPE_TEXTEDIT = 3, 39 SCI_CONTROLS_TYPE_ICON = 4, 40 SCI_CONTROLS_TYPE_LIST = 6, 41 SCI_CONTROLS_TYPE_LIST_ALIAS = 7, 42 SCI_CONTROLS_TYPE_DUMMY = 10 43 }; 44 45 class GfxPorts; 46 class GfxPaint16; 47 class Font; 48 class GfxText16; 49 class GfxScreen; 50 /** 51 * Controls class, handles drawing of controls in SCI16 (SCI0-SCI1.1) games 52 */ 53 class GfxControls16 { 54 public: 55 GfxControls16(SegManager *segMan, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen); 56 ~GfxControls16(); 57 58 void kernelDrawButton(Common::Rect rect, reg_t obj, const char *text, uint16 languageSplitter, int16 fontId, int16 style, bool hilite); 59 void kernelDrawText(Common::Rect rect, reg_t obj, const char *text, uint16 languageSplitter, int16 fontId, int16 alignment, int16 style, bool hilite); 60 void kernelDrawTextEdit(Common::Rect rect, reg_t obj, const char *text, uint16 languageSplitter, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite); 61 void kernelDrawIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, int16 loopNo, int16 celNo, int16 priority, int16 style, bool hilite); 62 void kernelDrawList(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const Common::String *entries, GuiResourceId fontId, int16 style, int16 upperPos, int16 cursorPos, bool isAlias, bool hilite); 63 void kernelTexteditChange(reg_t controlObject, reg_t eventObject); 64 65 private: 66 void texteditSetBlinkTime(); 67 68 void drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const Common::String *entries, GuiResourceId fontId, int16 upperPos, int16 cursorPos, bool isAlias); 69 void texteditCursorDraw(Common::Rect rect, const char *text, uint16 curPos); 70 void texteditCursorErase(); 71 int getPicNotValid(); 72 73 SegManager *_segMan; 74 GfxPorts *_ports; 75 GfxPaint16 *_paint16; 76 GfxText16 *_text16; 77 GfxScreen *_screen; 78 79 // Textedit-Control related 80 Common::Rect _texteditCursorRect; 81 bool _texteditCursorVisible; 82 uint32 _texteditBlinkTime; 83 }; 84 85 } // End of namespace Sci 86 87 #endif 88