| 1 | /* |
| 2 | * LegacyClonk |
| 3 | * |
| 4 | * Copyright (c) 1998-2000, Matthes Bender (RedWolf Design) |
| 5 | * Copyright (c) 2017-2019, The LegacyClonk Team and contributors |
| 6 | * |
| 7 | * Distributed under the terms of the ISC license; see accompanying file |
| 8 | * "COPYING" for details. |
| 9 | * |
| 10 | * "Clonk" is a registered trademark of Matthes Bender, used with permission. |
| 11 | * See accompanying file "TRADEMARK" for details. |
| 12 | * |
| 13 | * To redistribute this file separately, substitute the full license texts |
| 14 | * for the above references. |
| 15 | */ |
| 16 | |
| 17 | /* Screen area marked for mouse interaction */ |
| 18 | |
| 19 | #pragma once |
| 20 | |
| 21 | #include "C4Constants.h" |
| 22 | #include "C4ForwardDeclarations.h" |
| 23 | #include <C4Id.h> |
| 24 | |
| 25 | const int C4RGN_MaxCaption = 256; |
| 26 | |
| 27 | class C4Region |
| 28 | { |
| 29 | friend class C4RegionList; |
| 30 | |
| 31 | public: |
| 32 | C4Region(); |
| 33 | ~C4Region(); |
| 34 | |
| 35 | public: |
| 36 | int X, Y, Wdt, Hgt; |
| 37 | char Caption[C4RGN_MaxCaption + 1]; |
| 38 | int Com, RightCom, MoveOverCom, HoldCom; |
| 39 | int Data; |
| 40 | C4ID id; |
| 41 | C4Object *Target; |
| 42 | |
| 43 | protected: |
| 44 | C4Region *Next; |
| 45 | |
| 46 | public: |
| 47 | void Set(C4Facet &fctArea, const char *szCaption = nullptr, C4Object *pTarget = nullptr); |
| 48 | void Clear(); |
| 49 | void Default(); |
| 50 | void Set(int iX, int iY, int iWdt, int iHgt, const char *szCaption, int iCom, int iMoveOverCom, int iHoldCom, int iData, C4Object *pTarget); |
| 51 | |
| 52 | protected: |
| 53 | void ClearPointers(C4Object *pObj); |
| 54 | }; |
| 55 | |
| 56 | class C4RegionList |
| 57 | { |
| 58 | public: |
| 59 | C4RegionList(); |
| 60 | ~C4RegionList(); |
| 61 | |
| 62 | protected: |
| 63 | int AdjustX, AdjustY; |
| 64 | C4Region *First; |
| 65 | |
| 66 | public: |
| 67 | void ClearPointers(C4Object *pObj); |
| 68 | void SetAdjust(int iX, int iY); |
| 69 | void Clear(); |
| 70 | void Default(); |
| 71 | C4Region *Find(int iX, int iY); |
| 72 | bool Add(int iX, int iY, int iWdt, int iHgt, const char *szCaption = nullptr, int iCom = COM_None, C4Object *pTarget = nullptr, int iMoveOverCom = COM_None, int iHoldCom = COM_None, int iData = 0); |
| 73 | bool Add(C4Region &rRegion); |
| 74 | }; |
| 75 | |