-
Notifications
You must be signed in to change notification settings - Fork 0
/
CGWorldView.h
executable file
·98 lines (68 loc) · 2.61 KB
/
CGWorldView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// ===========================================================================
// CGWorldView.h
// ===========================================================================
/* This class implements a view that mirrors the contents of a GWorld. */
#pragma once
#include <LView.h>
#include <UGWorld.h>
#include "DragAndDrop.h"
#include <LClipboard.h>
const PaneIDT kGWPaneID = 'Gwld'; // PaneID in Example Window
const PaneIDT kGWorldWindowTimed = 20023;
const PaneIDT kGWorldWindowListener = 20024;
class CImage;
class CGWorldView : public LView, public LDragAndDrop, public LCommander
{
public:
CGWorldView();
CGWorldView(LStream *inStream);
~CGWorldView(void);
void SetMyGWorld(LGWorld *inGW);
void SetImage(CImage *inImage);
virtual void Click( SMouseDownEvent &inMouseDown);
protected:
virtual void ClickSelf (const SMouseDownEvent &inMouseDown);
virtual Boolean ItemIsAcceptable (DragReference inDragRef,
ItemReference inItemRef);
virtual void EnterDropArea (DragReference inDragRef,
Boolean inDragHasLeftSender);
virtual void LeaveDropArea (DragReference inDragRef);
virtual void InsideDropArea (DragReference inDragRef);
virtual void ReceiveDragItem (DragReference inDragRef,
DragAttributes inDragAttrs,
ItemReference inItemRef,
Rect &inItemBounds);
void HiliteDropArea(DragReference inDragRef);
void DrawSelf();
LGWorld *mGWorld;
private:
void CreateDragEvent (const SMouseDownEvent &inMouseDown);
Boolean CheckForOptionKey (DragReference inDragRef);
Boolean CheckIfViewIsAlsoSender (DragReference inDragRef);
void PasteItem ();
CImage *_image;
};
class CGWorldViewTimed : public CGWorldView, public LPeriodical {
public:
enum { class_ID = 'CGwT' };
CGWorldViewTimed();
CGWorldViewTimed(LStream *inStream);
~CGWorldViewTimed(void);
void SetMyGWorld(LGWorld *inGW);
void SpendTime(const EventRecord &inMacEvent);
void SetDrawInterval(short inSeconds) {mDrawInterval = inSeconds*60;};
protected:
UInt32 mLastDraw;
UInt32 mDrawInterval; // in Ticks
};
const MessageT msg_JustChanged = 'JtCh'; // this is the Message to send in order to get the Pane to draw a new copy of the GWorld
class CGWorldViewListener : public CGWorldView, public LListener {
public:
enum { class_ID = 'CGwL' };
CGWorldViewListener();
CGWorldViewListener(LStream *inStream);
~CGWorldViewListener(void);
void ListenToMessage(
MessageT inMessage,
void *ioParam);
};