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 GLK_WINDOW_GRAPHICS_H 24 #define GLK_WINDOW_GRAPHICS_H 25 26 #include "glk/windows.h" 27 #include "glk/picture.h" 28 29 namespace Glk { 30 31 /** 32 * Graphics window 33 */ 34 class GraphicsWindow : public Window { 35 private: 36 void touch(); 37 38 void drawPicture(Picture *src, int x0, int y0, int width, int height, uint linkval); 39 public: 40 uint _bgnd; 41 bool _dirty; 42 uint _w, _h; 43 Graphics::ManagedSurface *_surface; 44 public: 45 /** 46 * Constructor 47 */ 48 GraphicsWindow(Windows *windows, uint rock); 49 50 /** 51 * Destructor 52 */ 53 ~GraphicsWindow() override; 54 55 bool drawPicture(const Common::String &image, int xpos, int ypos, bool scale, 56 uint imagewidth, uint imageheight); 57 void drawPicture(const Graphics::Surface &image, uint transColor, int x0, int y0, 58 int width, int height, uint linkval = 0); 59 60 /** 61 * Rearranges the window 62 */ 63 void rearrange(const Rect &box) override; 64 65 /** 66 * Get window split size within parent pair window 67 */ getSplit(uint size,bool vertical)68 uint getSplit(uint size, bool vertical) const override { 69 return size; 70 } 71 72 /** 73 * Click the window 74 */ 75 void click(const Point &newPos) override; 76 77 /** 78 * Cancel a mouse event 79 */ cancelMouseEvent()80 void cancelMouseEvent() override { 81 _mouseRequest = false; 82 } 83 84 /** 85 * Cancel a hyperlink event 86 */ cancelHyperlinkEvent()87 void cancelHyperlinkEvent() override { 88 _hyperRequest = false; 89 } 90 requestMouseEvent()91 void requestMouseEvent() override { 92 _mouseRequest = true; 93 } 94 requestHyperlinkEvent()95 void requestHyperlinkEvent() override { 96 _hyperRequest = true; 97 } 98 99 /** 100 * Redraw the window 101 */ 102 void redraw() override; 103 104 void eraseRect(bool whole, const Rect &box) override; 105 106 /** 107 * Fill an area of the window 108 */ 109 void fillRect(uint color, const Rect &box) override; 110 111 /** 112 * Clear the window 113 */ 114 virtual void clear() override; 115 116 /** 117 * Draw a rectangle in the given area 118 */ 119 void frameRect(uint color, const Rect &box); 120 121 /** 122 * Draws a line between two points 123 */ 124 void drawLine(uint color, const Point &from, const Point &to); 125 126 void getSize(uint *width, uint *height) const override; 127 128 void setBackgroundColor(uint color) override; 129 }; 130 131 } // End of namespace Glk 132 133 #endif 134