1 /* GemRB - Infinity Engine Emulator 2 * Copyright (C) 2003 The GemRB Project 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 * 18 * 19 */ 20 21 /** 22 * @file WorldMapControl.h 23 * Declares WorldMapControl, widget for displaying world map 24 */ 25 26 27 #ifndef WORLDMAPCONTROL_H 28 #define WORLDMAPCONTROL_H 29 30 #include "GUI/Control.h" 31 #include "GUI/GUIAnimation.h" 32 33 #include "exports.h" 34 35 namespace GemRB { 36 37 class Font; 38 class WMPAreaEntry; 39 class WorldMapControl; 40 41 /** 42 * @class WorldMapControl 43 * Widget displaying "world" map, with particular locations and possibly 44 * allowing travelling between areas. 45 */ 46 47 class GEM_EXPORT WorldMapControl : public Control, public View::Scrollable { 48 private: 49 /** Draws the Control on the Output Display */ 50 void WillDraw(const Region& /*drawFrame*/, const Region& /*clip*/) override; 51 void DrawSelf(Region drawFrame, const Region&) override; 52 53 public: 54 WorldMapControl(const Region& frame, Font *font); 55 WorldMapControl(const Region& frame, Font *font, const Color &normal, const Color &selected, const Color ¬visited); 56 57 /** Allows modification of the scrolling factor from outside */ 58 void ScrollDelta(const Point& delta) override; 59 void ScrollTo(const Point& pos) override; 60 /** Sets the exit direction (we need this to calculate distances) */ 61 void SetDirection(int direction); 62 63 Point Pos; 64 /** pointer to last pointed area */ 65 WMPAreaEntry *Area = nullptr; 66 ColorAnimation hoverAnim; 67 68 protected: 69 /** Mouse Over Event */ 70 bool OnMouseOver(const MouseEvent& /*me*/) override; 71 bool OnMouseDrag(const MouseEvent& /*me*/) override; 72 /** Mouse Leave Event */ 73 void OnMouseLeave(const MouseEvent& /*me*/, const DragOp*) override; 74 /** Mouse Button Down */ 75 bool OnMouseDown(const MouseEvent& /*me*/, unsigned short Mod) override; 76 /** Mouse Button Up */ 77 bool OnMouseUp(const MouseEvent& /*me*/, unsigned short Mod) override; 78 /** Mouse Wheel Event */ 79 bool OnMouseWheelScroll(const Point& delta) override; 80 81 bool OnKeyPress(const KeyboardEvent& /*Key*/, unsigned short /*Mod*/) override; 82 83 private: 84 //font for printing area names 85 Font* ftext; 86 //current area 87 ieResRef currentArea; 88 89 /** Label color of a visited area */ 90 91 Color color_normal; 92 /** Label color of a currently selected area */ 93 Color color_selected; 94 /** Label color of a not yet visited area */ 95 Color color_notvisited; 96 97 }; 98 99 } 100 101 #endif 102