home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / PowerPlant / C3DMFViewer / Sources / C3DMFViewerPane.h < prev    next >
Encoding:
Text File  |  1995-12-04  |  2.2 KB  |  67 lines  |  [TEXT/CWIE]

  1. //    C3DMFViewerPane.h
  2. //
  3. //    A PowerPlant application for viewing QuickDraw3D Metafiles
  4. //
  5. //    by James Jennings
  6. //    Started November 12, 1995
  7. //
  8. /*
  9.     Some lessons learned:
  10.       It's best to use Q3ViewerEvent() for mouse events and
  11.     Q3ViewerDraw() when responding to update events.
  12.     You can pass updates to Q3ViewerEvent() but this won't 
  13.     erase the frame (if recently turned off) and PP has no
  14.     convenient hooks for it (without overriding 
  15.     LApplication::DispatchEvent().)
  16.       We must call FocusDraw() before calling Q3ViewerEvent()
  17.     (to set the port), otherwise, the mouse tracking is funny.
  18.       We don't seem to need to pass activateEvt's.
  19.     
  20.     The QD3D documentation says to ask Q3ViewerEvent() to handle 
  21.     every event, and then to only handle what it declines. 
  22.     I wasn't able to easily do that as part of the PP framework
  23.     but what I did do seems to work.
  24. */
  25.  
  26. #pragma once
  27.  
  28. #include <LPane.h>
  29. #include <QD3DViewer.h>
  30.  
  31. // Declare the Pane ID here so it can be seen by the Doc and the App.
  32. // (Makes things less portable?)
  33. const PaneIDT PaneID_Q3Viewer = 100;
  34.  
  35. class C3DMFViewerPane : public LPane, LCommander {
  36. public:
  37.     enum { class_ID = 'Q3vc' }; // Note: Viewer gestalt selector is 'q3vc'
  38.     static C3DMFViewerPane*    CreateQ3ViewerPaneStream(LStream *inStream);
  39.                     C3DMFViewerPane(LStream *inStream);
  40.     virtual         ~C3DMFViewerPane(void);
  41.     
  42.         // viewer related methods
  43.             void    UseFile(Int16 refNum);
  44.     virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta,
  45.                                     Boolean inRefresh);
  46.     virtual void    MoveBy(Int32 inHorizDelta, Int32 inVertDelta,
  47.                                     Boolean inRefresh);
  48. protected:
  49.     virtual void    ClickSelf(const SMouseDownEvent &inMouseDown);    // mouseDown
  50. //    virtual void    EventMouseUp(const EventRecord &inMacEvent);    // not needed?
  51.     virtual void    DrawSelf();    // update
  52.     virtual void    AdjustCursorSelf(Point inPortPt,    // mouse moved
  53.                                     const EventRecord &inMacEvent);
  54.  
  55. public:
  56.         // commander methods
  57.     virtual Boolean     ObeyCommand(CommandT inCommand, void *ioParam);
  58.     virtual void        FindCommandStatus(CommandT inCommand,
  59.                                 Boolean &outEnabled, Boolean &outUsesMark,
  60.                                 Char16 &outMark, Str255 outName);
  61. protected:
  62.             Boolean    Has3DViewer();
  63.     TQ3ViewerObject    mViewer;
  64.     // helper function: used in ResizeFrameBy() and MoveBy()
  65.             void        FitViewerToPane(void);
  66. };
  67.