StartInteraction
The StartInteraction function starts the real work of the selection interactor. Not only do you keep track of what is currently selected (by manipulating the MCanvasSelection* fSelection data member), but you also determine if you should start a drag operation (in case a user clicks on an object and moves it in one stroke). Note that executing the TTranslateCanvasGraphicCmd duplicates some of the work done by the TCanvasGraphicTranslatingInteractor.
void
TCanvasSelectionInteractor::StartInteraction ()
{
TGPoint pt = GetFirstPoint ();
TCanvasGraphicID hit = fCanvasView->Hit (pt);
if ( hit != TCanvasGraphicID::kInvalidID ) {
if ( GetModifierKeys().IsShiftKeyDown() ) {
if ( fSelection->IsGraphicSelected (hit) )
fSelection->DeselectGraphic (hit);
else {}
fSelection->SelectGraphic (hit);
DoBegin (*(fBinding.GetObject()));
}
}
else {
fSelection->DeselectAllGraphics ();
fSelection->SelectGraphic (hit);
DoBegin (*(fBinding.GetObject()));
}
fCanvasView->AdoptCurrentSelection (::CopyPointer(fSelection));
}
else
fRectSelecting = true;
}
[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