DrawFeedback

The DrawFeedback function, although derived, draws a simple selection rectangle.

      void        
      TCanvasRectDragInteractor::DrawFeedback ()
      {
          unsigned long n = GetNumberOfPoints ();
          if ( n > 0 ) {
          
              MToolHandler* toolHandler = GetToolHandler ();
              MGraphic* oldFeedbackGraphic = toolHandler->OrphanFeedbackGraphic (true);
              TGrafBundle* bundle = NIL;
              if ( oldFeedbackGraphic ) 
                  bundle = oldFeedbackGraphic->OrphanBundle ();
              else
                  bundle = new TGrafBundle(new TColorPaint(TRGBColor(0.,0.,0.)),
                                  TAttributeState::kFrame);
              delete oldFeedbackGraphic;
          
              TGRect r (GetFirstPoint(),GetLastPoint());
              r.OrderPoints ();
          
              TPolygon* newFeedbackGraphic = new TPolygon (r, bundle);
              TGRect bounds = newFeedbackGraphic->GetLooseFitBounds ();
              bounds.Inset (TGPoint(-1.,-1.));
              TGArea totalArea (bounds);
          
              toolHandler->AdoptFeedbackGraphic (newFeedbackGraphic, totalArea, totalArea);
              }
      }

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker