// $Revision: 1.2 $ // SelectionToolHandler.C // Copyright (C) 1994, 1995 Taligent, Inc. All rights reserved. #ifndef TaligentSamples_SELECTIONTOOLHANDLER #include "SelectionToolHandler.h" #endif #ifndef TaligentSamples_INSERTIONTARGET #include "InsertionTarget.h" #endif #ifndef TaligentSamples_SELECTIONTARGET #include "SelectionTarget.h" #endif #ifndef TaligentSamples_CURRENTSELECTIONTARGET #include "CurrentSelectionTarget.h" #endif #ifndef TaligentSamples_SELECTIONTOOLINTERACTOR #include "SelectionToolInteractor.h" #endif #ifndef TaligentSamples_SELECTIONTOOLHANDLER #include "SelectionToolHandler.h" #endif #ifndef Taligent_TYPENEGOTIATION #include #endif #ifndef Taligent_TOKENS #include #endif #ifndef Taligent_COMPOUNDDOCUMENT #include #endif //................................................................................ TaligentTypeExtensionMacro_Abstract(MSelectionToolHandler) MSelectionToolHandler::MSelectionToolHandler(MFeedbacker* feedbacker, MSelectionMapping* mapping, MGUIBundle* bundle) : MGUIToolHandler(bundle), fFeedbacker(feedbacker), fMapping(mapping), fBundle(bundle) { Assertion(fFeedbacker != NIL && fMapping != NIL && fBundle != NIL, "MSelectionToolHandler::MSelectionToolHandler"); } MSelectionToolHandler::~MSelectionToolHandler() { } MToolTarget* MSelectionToolHandler::CreateToolTarget(const TTypeDescription& type, const TGPoint& where) const { static const TTypeDescription kInsertionTargetType(StaticTypeInfo(TInsertionTarget)); static const TTypeDescription kSelectionTargetType(StaticTypeInfo(TSelectionTarget)); static const TTypeDescription kCurrentSelectionTargetType(StaticTypeInfo(TCurrentSelectionTarget)); MToolTarget* result; if (type == kInsertionTargetType) { result = new TInsertionTarget(GetSelectionMapping(), GetFeedbacker()); } else if (type == kSelectionTargetType) { result = new TSelectionTarget(GetSelectionMapping(), GetFeedbacker()); } else if (type == kCurrentSelectionTargetType) { result = new TCurrentSelectionTarget(GetSelectionMapping(), GetFeedbacker(), fBundle); } else { result = MGUIToolHandler::CreateToolTarget(type, where); } return result; } TToolInteractor* MSelectionToolHandler::CreateToolInteractor(const TGPoint& where, const TToken& hint) const { static const TToken kArrowHint("Arrow"); TToolInteractor* result; if (hint == kArrowHint) { result = new TSelectionToolInteractor((MToolHandler*)this); } else { result = MGUIToolHandler::CreateToolInteractor(where, hint); } return result; } void MSelectionToolHandler::AdoptAndDo(TToolCommandBinding* binding) { MGUIToolHandler::AdoptAndDo(binding); } void MSelectionToolHandler::DoBegin(TToolCommandBinding& binding) { MGUIToolHandler::DoBegin(binding); } void MSelectionToolHandler::DoIncrement(TToolCommandBinding& binding) { MGUIToolHandler::DoIncrement(binding); } void MSelectionToolHandler::AdoptAndDoEnd(TToolCommandBinding* binding) { MGUIToolHandler::AdoptAndDoEnd(binding); } MFeedbacker* MSelectionToolHandler::GetFeedbacker() const { return fFeedbacker; } MSelectionMapping* MSelectionToolHandler::GetSelectionMapping() const { return fMapping; } MGUIBundle* MSelectionToolHandler::GetGUIBundle() const { return fBundle; }