// $Revision: 1.6 $ // ViewerPresenterState.C // Copyright (C) 1994, 1995 Taligent, Inc. All rights reserved. #ifndef TaligentSamples_VIEWERPRESENTERSTATE #include "ViewerPresenterState.h" #endif #ifndef TaligentSamples_VIEWERPRESENTER #include "ViewerPresenter.h" #endif #ifndef TaligentSamples_STOCKGRAPHCONSTRUCTOR #include "StockGraphConstructor.h" #endif TaligentTypeExtensionMacro(TViewerPresenterState); TViewerPresenterState* TViewerPresenterState::LookupForWriting(const TPresenterStateReference& presenterState) { TViewerPresenterState* viewerPresenterState; ::DynamicCastTo(viewerPresenterState, TGUIPresenterState::LookupForWriting(presenterState)); return viewerPresenterState; } const TViewerPresenterState* TViewerPresenterState::LookupForReading(const TPresenterStateReference& presenterState) { const TViewerPresenterState* viewerPresenterState; ::DynamicCastTo(viewerPresenterState, TGUIPresenterState::LookupForReading(presenterState)); return viewerPresenterState; } TViewerPresenterState::TViewerPresenterState() : TGUIPresenterState(), fGraphConstructor(NIL) { } TViewerPresenterState::TViewerPresenterState(const TViewerPresenterState& source) : TGUIPresenterState(source), fGraphConstructor(NIL) { fGraphConstructor = ::CopyPointer(source.fGraphConstructor); } TViewerPresenterState::TViewerPresenterState(const TModelReference& model) : TGUIPresenterState(model), fGraphConstructor(NIL) { } TViewerPresenterState::~TViewerPresenterState() { } TViewerPresenterState& TViewerPresenterState::operator=(const TViewerPresenterState& source) { if (&source != this) { TGUIPresenterState::operator=(source); fGraphConstructor = ::CopyPointer(source.fGraphConstructor); } return *this; } TStream& TViewerPresenterState::operator>>=(TStream& toStream) const { ::WriteVersion(toStream, kOriginalVersion); TGUIPresenterState::operator>>=(toStream); ::Flatten(fGraphConstructor, toStream); return toStream; } TStream& TViewerPresenterState::operator<<=(TStream& fromStream) { ::ReadVersion(fromStream, kOriginalVersion, kOriginalVersion); TGUIPresenterState::operator<<=(fromStream); TStockGraphConstructor* graphConstructor = NIL; ::Resurrect(graphConstructor, fromStream); AdoptGraphConstructor(graphConstructor); return fromStream; } void TViewerPresenterState::AdoptGraphConstructor(TStockGraphConstructor* constructor) { delete fGraphConstructor; fGraphConstructor = constructor; } TStockGraphConstructor* TViewerPresenterState::OrphanGraphConstructor() { TStockGraphConstructor* orphan = fGraphConstructor; fGraphConstructor = NIL; return orphan; } TStockGraphConstructor* TViewerPresenterState::GetGraphConstructor() { return fGraphConstructor; } TModelPresenterStateInterest TViewerPresenterState::GetNewGraphConstructorInterest() const { return TModelPresenterStateInterest(*this, "TViewerPresenterState::kNewGraphConstructor"); } TGUIPresenter* TViewerPresenterState::HandleCreatePresenter(const TGUIBundle& guiBundle) const { return new TViewerPresenter(guiBundle); }