Remove stray | in comment
[python.git] / Mac / Wastemods / WEObjectHandlers.c
blobf1dd5af21cef98eed7809c3f87d5854a1bca7c5c
1 /*
2 WASTE Demo Project:
3 Sample WASTE Object Handlers
5 Copyright © 1993-1998 Marco Piovanelli
6 All Rights Reserved
7 */
9 #include "WEObjectHandlers.h"
11 #ifndef __ICONS__
12 #include <Icons.h>
13 #endif
15 #ifndef __SOUND__
16 #include <Sound.h>
17 #endif
19 /* PICTURES */
21 pascal OSErr HandleNewPicture(Point *defaultObjectSize, WEObjectReference objectRef)
23 PicHandle thePicture;
24 Rect frame;
26 /* get handle to object data (in this case, a picture handle) */
27 thePicture = (PicHandle) WEGetObjectDataHandle(objectRef);
29 /* figure out the default object size by looking at the picFrame record */
30 frame = (*thePicture)->picFrame;
31 OffsetRect(&frame, -frame.left, -frame.top);
32 defaultObjectSize->v = frame.bottom;
33 defaultObjectSize->h = frame.right;
35 return noErr;
38 pascal OSErr HandleDisposePicture(WEObjectReference objectRef)
40 PicHandle thePicture;
42 /* get handle to object data (in this case, a picture handle) */
43 thePicture = (PicHandle) WEGetObjectDataHandle(objectRef);
45 /* kill the picture */
46 KillPicture(thePicture);
48 return MemError();
51 pascal OSErr HandleDrawPicture(const Rect *destRect, WEObjectReference objectRef)
53 PicHandle thePicture;
55 /* get handle to object data (in this case, a picture handle) */
56 thePicture = (PicHandle) WEGetObjectDataHandle(objectRef);
58 /* draw the picture */
59 DrawPicture(thePicture, destRect);
61 return noErr;
65 /* SOUND */
67 pascal OSErr HandleNewSound(Point *defaultObjectSize, WEObjectReference objectRef)
69 #pragma unused(objectRef)
71 /* sounds are drawn as standard 32x32 icons */
72 defaultObjectSize->v = 32;
73 defaultObjectSize->h = 32;
75 return noErr;
78 pascal OSErr HandleDrawSound(const Rect *destRect, WEObjectReference objectRef)
80 #pragma unused(objectRef)
82 /* draw the sound icon */
83 return PlotIconID(destRect, kAlignNone, kTransformNone, kSoundIconID);
86 pascal Boolean HandleClickSound(Point hitPt, EventModifiers modifiers,
87 UInt32 clickTime, WEObjectReference objectRef)
89 #pragma unused(hitPt, clickTime)
91 SndListHandle theSound;
93 /* WASTE sets the low bit of modifiers on double (multiple) clicks */
94 if (modifiers & 0x0001)
97 /* get a handle to the object data (in this case, a sound handle) */
98 theSound = (SndListHandle) WEGetObjectDataHandle(objectRef);
100 /* play the sound */
101 SndPlay(nil, theSound, false);
103 /* return TRUE so WASTE knows we handled the click */
104 return true;
106 else
108 /* not a double click: let WASTE handle the mouse-down */
109 return false;