home *** CD-ROM | disk | FTP | other *** search
- #include "MST_Defines.h"
- #include "MST_Externs.h"
- #include "MST_Prototypes.h"
-
-
- /*_____________________________________________________________________________
- Close_AboutMST()- close our About Box window
- _____________________________________________________________________________*/
-
- void Close_AboutMST()
- {
- /*
- • Since we have no data associated with our About Box window to save, closing
- • our about box is short and simple. First check to make sure an About Box
- • exists. If our program has a flaw in its algorithm somewhere and put us
- • at this point by mistake, we don't want to call DisposDialog() on a NIL
- • pointer. The result would be a crash. Then we call DisposDialog() to
- • destroy the window and free up its memory. The operating system will take
- • care of generating the appropriate update and activate events, not only
- • for us, but for programs in the background as well. So don't worry about
- • other windows at this point...a properly structured program will handle
- • it all automatically using events. Lastly, we set our pointer to NIL,
- • indicating there is no current About Box.
- */
-
- if (AboutMSTDlog==NIL) return;
- DisposDialog (AboutMSTDlog);
- AboutMSTDlog = NIL;
- }
-
-
- /*_____________________________________________________________________________
- Open_AboutMST()- create & display our About Box window
- _____________________________________________________________________________*/
-
-
- void Open_AboutMST()
- {
-
- /*
- • Here we create and display our About Box. First we check to see if it
- • is already open. If so, we make it the active window (bringing it
- • to the front of all the other windows of our application) by calling
- • SelectWindow(). Otherwise, we create it from our template numbered
- • ResID_AboutMST stored in our resource fork. The third parameter
- • for GetNewDialog (e.g., -1 typecast to a WindowPtr) tells the
- • window manager to place the window in front of all other windows
- • belonging to our application. Then we make it visible (don't
- • rely on the "initially visible" bit being set in the dialog template).
- •
- • Note the really cool thing is that we don't explicitly have to draw
- • the contents of the window. Just sit back and let the operating system
- • generate an update event, which it will because this is a new window.
- • Your update routine will handle the rest.
- */
-
- if (AboutMSTDlog!=NIL) { SelectWindow (AboutMSTDlog); return; }
-
- AboutMSTDlog = GetNewDialog (ResID_AboutMST, NIL, (WindowPtr)-1);
- ShowWindow (AboutMSTDlog);
- }
-
-
- /*_____________________________________________________________________________
- Update_AboutMST()- Draw our About Box window
- _____________________________________________________________________________*/
-
-
- void UpDate_AboutMST()
- {
- GDHandle saveDevice;
- CGrafPtr saveCGrafPtr;
- int loop1;
-
- if (AboutMSTDlog==NIL) return; /*Make sure the about box exists*/
-
- /*
- • Now save the current Grafport and set the current port to our About Box.
- */
- GetGWorld (&saveCGrafPtr,&saveDevice);
- SetGWorld ((CGrafPtr)AboutMSTDlog,saveDevice);
-
- /*
- • Now we begin updating. You MUST call BeginUpdate() just before
- • and EndUpdate() just after doing your drawing. These two calls
- • restrict your drawing to just that portion of the window that
- • needs updating, and resets the window's update region to empty,
- • thus clearing the window's update event.
- •
- • Note: Dialogs, which are merely windows with a little more data added
- • to their struct, actually have their own routines for handling
- • updates, activate events, etc. Which ones are available depends
- • upon the type of dialog (alert, modal, or modeless). Here we treat
- • dialogs just like windows, except for the call to DrawDialog() for
- • the About Box. DrawDialog() simply draws all the dialog items (see
- • the DITL resources) for the dialog, such as static text and buttons.
- */
-
- BeginUpdate(AboutMSTDlog);
- DrawDialog(AboutMSTDlog); /*Draw the static text in the DITL resource*/
-
- /*
- • Now draw the little dotted line around the text
- */
- for (loop1=13;loop1<=AboutMSTDlog->portRect.right-13;loop1+=2)
- {
- MoveTo (loop1,AboutMSTDlog->portRect.top+13);
- Line (0,0);
-
- MoveTo (loop1,AboutMSTDlog->portRect.bottom-13);
- Line (0,0);
- }
- for (loop1=13;loop1<=AboutMSTDlog->portRect.bottom-13;loop1+=2)
- {
- MoveTo (AboutMSTDlog->portRect.left+13, loop1);
- Line (0,0);
-
- MoveTo (AboutMSTDlog->portRect.right-13, loop1);
- Line (0,0);
- }
-
- /*
- • Now finish up by balancing with a call to EndUpdate(), and restore
- • Quickdraw's pointer to the current Grafport to whatever it was
- • before you updated.
- */
-
- EndUpdate(AboutMSTDlog);
- SetGWorld (saveCGrafPtr,saveDevice);
- }
-
-
- /*_____________________________________________________________________________
- Do_AboutMST()- handle events directed to the About Box
- _____________________________________________________________________________*/
-
-
- void Do_AboutMST (EventRecord *thisEvent)
-
- /*
- • This is just a stub of a function to demonstrate where
- • you could add code to handle mouseclicks, keydowns, or other
- • events directed to the About Box window.
- */
-
- {
- }
-