diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2001-02-15 22:56:41 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2001-02-15 22:56:41 (GMT) |
commit | c982ef2df6af4c89151ba4d8f624a479f7ff0775 (patch) | |
tree | a2dbb3b48a84a9cbc8d392e14a1d54e23a85881b /Mac/Wastemods/WEObjectHandlers.c | |
parent | 0de65807e6bdc5254f5a7e99b2f39adeea6b883b (diff) | |
download | cpython-c982ef2df6af4c89151ba4d8f624a479f7ff0775.zip cpython-c982ef2df6af4c89151ba4d8f624a479f7ff0775.tar.gz cpython-c982ef2df6af4c89151ba4d8f624a479f7ff0775.tar.bz2 |
Waste 1.3 extra's modified for waste 2.0 (and missing from MW's distribution of 2.0).
Diffstat (limited to 'Mac/Wastemods/WEObjectHandlers.c')
-rw-r--r-- | Mac/Wastemods/WEObjectHandlers.c | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/Mac/Wastemods/WEObjectHandlers.c b/Mac/Wastemods/WEObjectHandlers.c new file mode 100644 index 0000000..f1dd5af --- /dev/null +++ b/Mac/Wastemods/WEObjectHandlers.c @@ -0,0 +1,111 @@ +/* + WASTE Demo Project: + Sample WASTE Object Handlers + + Copyright © 1993-1998 Marco Piovanelli + All Rights Reserved +*/ + +#include "WEObjectHandlers.h" + +#ifndef __ICONS__ +#include <Icons.h> +#endif + +#ifndef __SOUND__ +#include <Sound.h> +#endif + +/* PICTURES */ + +pascal OSErr HandleNewPicture(Point *defaultObjectSize, WEObjectReference objectRef) +{ + PicHandle thePicture; + Rect frame; + + /* get handle to object data (in this case, a picture handle) */ + thePicture = (PicHandle) WEGetObjectDataHandle(objectRef); + + /* figure out the default object size by looking at the picFrame record */ + frame = (*thePicture)->picFrame; + OffsetRect(&frame, -frame.left, -frame.top); + defaultObjectSize->v = frame.bottom; + defaultObjectSize->h = frame.right; + + return noErr; +} + +pascal OSErr HandleDisposePicture(WEObjectReference objectRef) +{ + PicHandle thePicture; + + /* get handle to object data (in this case, a picture handle) */ + thePicture = (PicHandle) WEGetObjectDataHandle(objectRef); + + /* kill the picture */ + KillPicture(thePicture); + + return MemError(); +} + +pascal OSErr HandleDrawPicture(const Rect *destRect, WEObjectReference objectRef) +{ + PicHandle thePicture; + + /* get handle to object data (in this case, a picture handle) */ + thePicture = (PicHandle) WEGetObjectDataHandle(objectRef); + + /* draw the picture */ + DrawPicture(thePicture, destRect); + + return noErr; +} + + +/* SOUND */ + +pascal OSErr HandleNewSound(Point *defaultObjectSize, WEObjectReference objectRef) +{ +#pragma unused(objectRef) + + /* sounds are drawn as standard 32x32 icons */ + defaultObjectSize->v = 32; + defaultObjectSize->h = 32; + + return noErr; +} + +pascal OSErr HandleDrawSound(const Rect *destRect, WEObjectReference objectRef) +{ +#pragma unused(objectRef) + + /* draw the sound icon */ + return PlotIconID(destRect, kAlignNone, kTransformNone, kSoundIconID); +} + +pascal Boolean HandleClickSound(Point hitPt, EventModifiers modifiers, + UInt32 clickTime, WEObjectReference objectRef) +{ +#pragma unused(hitPt, clickTime) + + SndListHandle theSound; + + /* WASTE sets the low bit of modifiers on double (multiple) clicks */ + if (modifiers & 0x0001) + { + + /* get a handle to the object data (in this case, a sound handle) */ + theSound = (SndListHandle) WEGetObjectDataHandle(objectRef); + + /* play the sound */ + SndPlay(nil, theSound, false); + + /* return TRUE so WASTE knows we handled the click */ + return true; + } + else + { + /* not a double click: let WASTE handle the mouse-down */ + return false; + } +} |