home *** CD-ROM | disk | FTP | other *** search
- /*
- Copyright © 1991-1995 by TopSoft Inc. All rights reserved.
-
- You may distribute this file under the terms of the TopSoft
- Artistic License, accompanying this package.
-
- This file was developed by George (ty) Tempel in connection with TopSoft, Inc..
- See the Modification History for more details.
-
- Product
- About Box
-
- FILE
- ABPict.c
-
- NAME
- ABPict.c, part of the ABox project source code,
- responsible for handling the AboutBox PICT class stuff.
-
- DESCRIPTION
- This file contains defines for the about box modules.
-
- DEVELOPED BY
- George (ty) Tempel netromancr@aol.com
- All code in this file, and its associated header file was
- Created by George (ty) Tempel in connection with the TopSoft, Inc.
- "FilterTop" application development, except where noted.
-
- CARETAKER - George (ty) Tempel <netromancr@aol.com>
- Please consult this person for any changes or suggestions to this file.
-
- MODIFICATION HISTORY
-
- dd mmm yy - xxx - patchxx: description of patch
- 9 June 94 - ty - Initial Version Created
- 20-july-94 - ty - initial version released
- 28-july-94 - ty - 1.0.6--additions to support settable drag mgr usage
- via the ABox Get/SetProperty methods
- 1-aug-94 - ty - 1.0.7--removed the LocalSendProc since it's not used here
- 23-may-95 - ty - changes for compatibility with the CodeWarrior CW6
- release and the associated Universal Headers from Apple:
- most methods that returned references now have "Ref" at
- the end of their methods names to prevent possible collisions
- with datatypes and classes of the same name (older versions
- of the compiler didn't have a problem with this).
-
- */
-
- /*===========================================================================*/
-
- /*======= Segmentation directives ========*/
-
- #ifdef USE_MANUAL_SEGMENTATION
- #pragma segment ty
- #endif
-
- /*============ Header files ==============*/
-
- #include "ABPict.h"
- #include "ABox.h"
-
- /*=============== Globals ================*/
-
- /*================ CODE ==================*/
-
-
- /*=============================== ABPict::ABPict ================================*/
- ABPict::ABPict(void)
- {
- mResType = kABPictResource;
- } // end ABPict
-
-
-
- /*=============================== ABPict::~ABPict ================================*/
- ABPict::~ABPict(void)
- {
- } // end ~ABPict
-
-
-
-
- /*=============================== ABPict::Draw ================================*/
- OSErr ABPict::Draw(WindowPtr window)
- {
- OSErr error = noErr;
- Rect box;
-
- // begin here...
-
- error = ABObject::Draw(window);
- if (error == noErr)
- {
-
- // get the display area...
- //
- box = this->ObjectRect();
-
- // now get the picture information
-
- error = this->InitializeResource();
-
- if (!error)
- {
- // now do the drawing...
- //
- ::DrawPicture ((PicHandle)this->ResourceHandleRef(), &box);
- error = ::QDError();
- } // end if block
-
- }
-
- return error;
-
- } // end Draw
-
-
-
- /*=============================== ABPict::Event ================================*/
- Boolean ABPict::Event(EventRecord *event)
- {
- Boolean handled = false;
- Point where;
- OSErr error = noErr;
- Rect box = this->ObjectRect();
-
- // begin here...
- //
- if (!event)
- return handled;
-
- switch (event->what)
- {
- case mouseDown:
- // 1.0.6 ty--check to see if we're allowed to use the DragMgr
- //
- ABox *theABox = (ABox *)GetWRefCon (this->OurWindowRef());
- Boolean useDrag = false;
-
- if (theABox)
- error = theABox->GetProperty(kABoxUseDragMgr, &useDrag, NULL);
-
- where = event->where;
- ::GlobalToLocal(&where);
- if (::PtInRect (where, &box) &&
- (::FrontWindow() == this->OurWindowRef()) &&
- ABUEnvDragMgr::IsPresent() &&
- useDrag)
- {
- // DragMgr stuff here!!!
-
- if (::WaitMouseMoved(event->where))
- {
- // the user is trying to Drag
- // from the field to someplace
- this->DragMgrEventRef() = event;
- error = Begin();
- error = End();
- } // end if block
- } // end if block
- break;
- default:
- break;
- } // end switch block
-
- return handled;
- } // end Event
-
-
-
-
-
-
- /*=============================== ABPict::Initialize ================================*/
- OSErr ABPict::Initialize(void)
- {
- OSErr error = noErr;
- Ptr ptr = NULL;
- Size ptrSize = 0;
-
- // OVERRIDE of the ABUEnvDragMgr method!
- if (this->IsDragInitialized())
- return noErr;
-
- this->DragRectRef() = this->ObjectRect();
- error = ABUEnvDragMgr::Initialize();
- if (error)
- return error;
-
- error = ::SetDragSendProc (this->DragRef(),
- this->DragUPPRef(),
- this);
- if (error)
- return error;
-
- // now create the Send information
- ::HLock (this->ResourceHandleRef());
- ptr = *(this->ResourceHandleRef());
- ptrSize = ::GetHandleSize(this->ResourceHandleRef());
-
- error = ::AddDragItemFlavor(this->DragRef(),
- this->ItemRef(),
- kABPictResource,
- ptr,
- ptrSize,
- kABdefaultFlavorFlags);
- ::HUnlock (this->ResourceHandleRef());
-
- this->DragInitializedRef() = true;
-
- return error;
-
- } // end Initialize
-
-
-
-
-
- /*=============================== ABPict::Begin ================================*/
- OSErr ABPict::Begin(void)
- {
- OSErr error;
-
- // OVERRIDE of the ABUEnvDragMgr method! but be certain to call
- // the ABUEnvDragMgr method when finished here!!!!
-
- error = Initialize();
- if (error)
- return error;
-
- error = ABUEnvDragMgr::Begin();
-
- return error;
-
- } // end Begin
-
-
-
-
-
-
-
- // end of file
-
-