ScummVM API documentation
itemdragger.h
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  * Additional copyright for this file:
8  * Copyright (C) 1995-1997 Presto Studios, Inc.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24 
25 #ifndef PEGASUS_ITEMS_ITEMDRAGGER_H
26 #define PEGASUS_ITEMS_ITEMDRAGGER_H
27 
28 #include "pegasus/elements.h"
29 #include "pegasus/input.h"
30 
31 namespace Pegasus {
32 
33 // TODO: Merge SpriteDragger and ItemDragger
34 
35 class Hotspot;
36 class Sprite;
37 
38 class SpriteDragger : public Tracker {
39 public:
40  SpriteDragger();
41  ~SpriteDragger() override {}
42 
43  void setDragSprite(Sprite *);
44  Sprite *getDragSprite() { return _draggingSprite; }
45 
46  void setDragConstraints(const Common::Rect &, const Common::Rect &);
47  void getDragConstraints(Common::Rect &, Common::Rect &) const;
48 
49  void startTracking(const Input &) override;
50  void continueTracking(const Input&) override;
51 
52  Hotspot *getLastHotspot() const { return _lastHotspot; }
53 
54 protected:
55  virtual void enterHotspot(Hotspot *) {}
56  virtual void exitHotspot(Hotspot *) {}
57 
58  Sprite *_draggingSprite;
59  Common::Point _startPoint, _lastPoint, _dragOffset;
60  Common::Point _startRawPoint, _lastRawPoint;
61  Common::Rect _rawLimitRect;
62  Common::Rect _limitRect;
63  Common::Rect _slopRect;
64  Hotspot *_lastHotspot;
65 
66  // This is a replica of QuickDraw's PinPointInRect function
67  void pinPointInRect(const Common::Rect &, Common::Point &);
68 };
69 
70 class PegasusEngine;
71 
72 class ItemDragger : public SpriteDragger {
73 public:
75  ~ItemDragger() override {}
76 
77  void setHighlightBounds();
78  void startTracking(const Input &) override;
79  void stopTracking(const Input &) override;
80  bool stopTrackingInput(const Input &) override;
81 
82 protected:
83  void enterHotspot(Hotspot *) override;
84  void exitHotspot(Hotspot *) override;
85 
86  PegasusEngine *_owner;
87  DropHighlight _inventoryHighlight;
88  Hotspot _inventoryDropSpot;
89  DropHighlight _biochipHighlight;
90  Hotspot _biochipDropSpot;
91 };
92 
93 } // End of namespace Pegasus
94 
95 #endif
Definition: rect.h:144
Definition: elements.h:168
Definition: hotspot.h:85
Definition: input.h:466
Definition: itemdragger.h:72
Definition: input.h:322
Definition: elements.h:90
Definition: rect.h:45
Definition: itemdragger.h:38
Definition: pegasus.h:70
Definition: ai_action.h:33