// $Revision: 1.25 $ //------------------------------------------------------------------------------ // // Copyright (C) 1994, 1995 Taligent, Inc. All rights reserved. // // Project: StockBrowser // File: ViewerViews.h // Build/Version: 1.0.0 // // Description: TViewerContentView adopts a TGraphView object into a // scrolling view, displays the stock name and handles all // notification from the model or presenter state. // // TGraphView draws the stock data graph and notifies when // it has finished constructing the graph. // //------------------------------------------------------------------------------ #ifndef TaligentSamples_VIEWERVIEWS #define TaligentSamples_VIEWERVIEWS class TViewerContentView; class TGraphView; #ifndef TaligentSamples_STANDARDGRAPH #include #endif #ifndef TaligentSamples_DRAGOMATIC #include #endif #ifndef Taligent_GRAPHICIMAGE #include #endif #ifndef Taligent_SIMPLEVIEW #include #endif #ifndef Taligent_TEXTDISPLAY #include #endif class TScrollingView; class TStockGraphConstructor; class TStockData; //============================================================================== // TViewerContentView class TViewerContentView : public TDOMDocumentComponentView { public: TaligentTypeExtensionDeclarationsMacro(TViewerContentView) TViewerContentView( TGUIBundle* guiBundleToAlias, const TPaint& backgroundColor = TColorPaint::GetWhite()); virtual ~TViewerContentView(); virtual TStream& operator>>=(TStream& toStream) const; virtual TStream& operator<<=(TStream& fromStream); virtual void AdoptGraphView(TGraphView* theGraphView); //.......................................................................... // This is an obsolete drag and drop override. virtual TModelSelection* CreateSelectionFromPoint(const TGPoint& where) const; protected: TViewerContentView(); // For streaming only virtual void HandleModelOrPresenterStateChanged(const TNotification& note); virtual void HandleGraphViewReady(const TNotification& note); virtual void Update(); virtual GCoordinate GetNameAreaHeight() const; virtual GCoordinate GetTextSize() const; virtual GCoordinate GetExtraSpace() const; virtual void GetWaitingText(TStandardText& text) const; //.......................................................................... // TView override virtual void DrawContents(TGrafPort& port) const; //.......................................................................... // TDocumentComponentView overrides virtual void HandleAfterConnectionToViewRoot(); virtual void HandleBeforeDisconnectionFromViewRoot(); virtual void HandleCurrentSelectionChanged(const TNotification& note); virtual void HandleAllocatedAreaChanged(const TGArea& newArea); private: TViewerContentView(const TViewerContentView& source); TViewerContentView& operator=(const TViewerContentView& source); enum {kOriginalVersion}; TRequestBasedMemberFunctionConnectionTo fConnection; TDeleterFor fBackgroundPaint; TScrollingView* fScrollingView; TGraphView* fGraphView; bool fWaitingForNotification; TTextDisplay fNameDisplay; TGArea fNameArea; // Top part of view in which the name is displayed. }; //============================================================================== // TGraphView class TGraphView : public TSimpleView { public: TaligentTypeExtensionDeclarationsMacro(TGraphView) TGraphView( TStandardGraph* adoptedGraph, const TPaint& backgroundColor = TColorPaint::GetWhite()); virtual ~TGraphView(); virtual TStream& operator>>=(TStream& toStream) const; virtual TStream& operator<<=(TStream& fromStream); virtual void ReconstructGraph( TStockGraphConstructor& graphConstructor, const TStockData& stock); virtual TInterest GetReadyInterest() const; protected: TGraphView(); // For streaming only virtual void GetErrorMessage(TStandardText& fillThisIn) const; //.......................................................................... // TView override virtual void DrawContents(TGrafPort& port) const; private: TGraphView(const TGraphView& source); TGraphView& operator=(const TGraphView& source); enum {kOriginalVersion}; TDeleterFor fBackgroundPaint; TDeleterFor fImage; TDeleterFor fGraph; }; #endif