home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C++ / Applications / Nuntius 1.2 / src / Nuntius / UGroupViewCmds.h < prev    next >
Encoding:
Text File  |  1994-03-06  |  4.1 KB  |  150 lines  |  [TEXT/MPS ]

  1. // Copyright © 1992 Peter Speck, speck@dat.ruc.dk. All rights reserved.
  2. // UGroupViewCmds.h
  3.  
  4. #define __UGROUPVIEWCMDS__
  5.  
  6. class TGroupListView;
  7. class TGroupTreeView;
  8. class TGroupTree;
  9. class TGroupList;
  10.  
  11. #ifndef __UGRIDVIEW__
  12. #include <UGridView.h>
  13. #endif
  14.  
  15. class TGroupTracker : public TTracker
  16. {    
  17.     public:
  18.         virtual pascal void DoIt(); // Override
  19.         virtual pascal void DoFocus();
  20.             
  21.         virtual pascal void TrackConstrain(TrackPhase aTrackPhase,
  22.                                         const VPoint &anchorPoint,
  23.                                           const VPoint &previousPoint,
  24.                                         VPoint &nextPoint,
  25.                                         Boolean mouseDidMove);
  26.         virtual pascal void ConstrainOnce(Boolean didMouseMove);
  27.  
  28.         virtual pascal void TrackFeedback(TrackPhase aTrackPhase,
  29.                                         const VPoint &anchorPoint,
  30.                                         const VPoint &previousPoint,
  31.                                         const VPoint &nextPoint,
  32.                                         Boolean mouseDidMove,
  33.                                         Boolean turnItOn); // Override
  34.             
  35.         virtual pascal TTracker *TrackMouse(TrackPhase aTrackPhase,
  36.                                              VPoint &anchorPoint,
  37.                                              VPoint &previousPoint,
  38.                                              VPoint &nextPoint,
  39.                                              Boolean mouseDidMove); // Override
  40.  
  41.         TGroupTracker();
  42.         virtual pascal void Initialize();
  43.         virtual pascal void IGroupTracker(
  44.                                                 CommandNumber itsCommandNumber,
  45.                                                 const VPoint &itsMouse,
  46.                                                 Boolean makingCopy);
  47.         virtual pascal void Free();
  48.  
  49.     protected:
  50.         PicHandle fGrayPictH;
  51.         CPoint fMouseOffsetInGrayPict;
  52.         TGroupList *fDraggedGroups;
  53.         
  54.         virtual void MakeGrayPict();
  55.         virtual void WasDraggedToGroupTree();
  56.         virtual void CreateListOfDraggedGroups();
  57.         virtual void CheckForExistingGroups(TGroupListView *hitGroupListView, Boolean makingCopy);
  58.         virtual void GetBeforeGroupName(TGroupListView *groupListView, short beforeRow, CStr255 &name);
  59.  
  60.         
  61.     private:
  62.         Boolean fMakingCopy;
  63.         Boolean fDoesDragGray;
  64.         Boolean fHasDrawedOnDesktop;
  65.         CPoint fCurrentGrayPos;
  66.  
  67.         TGroupListView *fHitGroupListView;
  68.         TGroupList *fHitGroupList;
  69.         VRect fOldInsertMarkRect; // in local GridView coords
  70.         CStr255 fInsertBeforeName; // empty if append
  71.         Boolean fHasDrawedInsertMark;
  72.  
  73.         void StartGrayDrag();
  74.         void DrawGray();
  75.  
  76.         void DrawInsertMark();
  77.         Boolean CalcNewHit(VPoint globalMouse, TGroupListView *&groupListView, 
  78.                                                                     VRect &newMarkRect, VPoint &localMouse);
  79.         void RemoveOldInsertMark();
  80.         void TestForHit(VPoint globalMouse);
  81.  
  82.         void DragToGroupList();
  83.         void DidNotHitWindow();
  84. };
  85.  
  86.  
  87. //--------------------------------------------------------------------
  88. class TGroupViewKeyCommand : public TCommand
  89. {
  90.     public:
  91.         virtual pascal void DoIt(); // Override
  92.         
  93.         TGroupViewKeyCommand();
  94.         virtual pascal void Initialize();
  95.         void IGroupViewKeyCommand(TGridView *gv);
  96.         virtual pascal void Free();
  97.     protected:
  98.         TGridView *fGridView;
  99.         ArrayIndex fLastLine;
  100.         CStr255 fCurrentSelectedName;
  101.         ArrayIndex fCurrentSelectedLine;
  102.         CStr255 fCandidateName;
  103.         ArrayIndex fCandidateLine;
  104.  
  105.         virtual void SetUp();
  106.         virtual void DoLine(ArrayIndex line, const CStr255 &text);
  107.         virtual void SetDown();
  108.         virtual void HandleNoFound();
  109.         virtual void DoAllLines();
  110.         virtual void DoOneLine(ArrayIndex line);
  111.         virtual void GetLineText(ArrayIndex line, CStr255 &text);
  112. };
  113.  
  114.  
  115. class TGroupViewTypeNameCommand : public TGroupViewKeyCommand
  116. {
  117.     public:
  118.         TGroupViewTypeNameCommand();
  119.         virtual pascal void Initialize();
  120.         void IGroupViewTypeNameCommand(TGridView *gv, TToolboxEvent *event);
  121.         virtual pascal void Free();
  122.     protected:
  123.         CStr255 fTypeChars;
  124.         unsigned long fLastTick, fCharTick;
  125.         char fChar;
  126.  
  127.         virtual void SetUp();
  128.         virtual void SetDown();
  129.         virtual void DoLine(ArrayIndex line, const CStr255 &text);
  130.         virtual void HandleNoFound();
  131. };
  132.  
  133. class TGroupViewTabKeyCommand : public TGroupViewKeyCommand
  134. {
  135.     public:
  136.         TGroupViewTabKeyCommand();
  137.         virtual pascal void Initialize();
  138.         void IGroupViewTabKeyCommand(TGridView *gv, Boolean forward);
  139.         virtual pascal void Free();
  140.     protected:
  141.         Boolean fForward;
  142.         CStr255 fFirstLastName;
  143.         ArrayIndex fFirstLastLine;
  144.         
  145.         virtual void DoLine(ArrayIndex line, const CStr255 &text);
  146.         virtual void DoForwardLine(ArrayIndex line, const CStr255 &text);
  147.         virtual void DoBackwardLine(ArrayIndex line, const CStr255 &text);
  148.         virtual void HandleNoFound();
  149. };
  150.