// $Revision: 1.3 $ // CurrentSelectionTarget.C // Copyright (C) 1994, 1995 Taligent, Inc. All rights reserved. #ifndef TaligentSamples_CURRENTSELECTIONTARGET #include "CurrentSelectionTarget.h" #endif #ifndef Taligent_GUICOMPOUNDDOCUMENT #include #endif //................................................................................ TaligentTypeExtensionMacro_Abstract(TCurrentSelectionTarget) TCurrentSelectionTarget::TCurrentSelectionTarget(MSelectionMapping* mapping, MFeedbacker* feedbacker, MGUIBundle* bundle) : TSelectionToolTarget(feedbacker, mapping), fBundle(bundle), fSelection(NIL) { Assertion(bundle != NIL, "TCurrentSelectionTarget::TCurrentSelectionTarget"); } TCurrentSelectionTarget::~TCurrentSelectionTarget() { } TModelSelection* TCurrentSelectionTarget::GetSelection() const { if (!fSelection.GetObject()) { NonConst(this)->fSelection = ::CopyPointer(fBundle->GetCurrentModelSelection()); if (!fSelection) { const TModelPointerTo model(fBundle->GetModelReference()); NonConst(this)->fSelection = model->CreateSelection(); fSelection->SetUndefined(); } } return fSelection; } void TCurrentSelectionTarget::AdoptSelection(TModelSelection* selection) { fBundle->AdoptCurrentModelSelection(selection); fSelection = ::CopyPointer(fBundle->GetCurrentModelSelection()); Assertion(fSelection != NIL, "TCurrentSelectionTarget::AdoptSelection"); }