// $Revision: 1.3 $ // Copyright (c) 1994-1995 Taligent, Inc. All rights reserved. #ifndef TaligentSamples_SETCOLORINTERACTOR #include "SetColorInteractor.h" #endif #ifndef Taligent_RGBCOLOR #include #endif #ifndef Taligent_ASSERTIONS #include #endif VersionDefinitionsMacro(TSetColorInteractor, 0); TSetColorInteractor::TSetColorInteractor(TGraphicView* view) : TInteractor(), MMouseEventHandler(), fViewHandle(*view) { Assertion(view != NIL); view->AddInteractor(this); } TSetColorInteractor::~TSetColorInteractor() { TGraphicView* view = (TGraphicView*)fViewHandle.GetView(); if (view) { view->RemoveInteractor(*this); } } // Set the view background color to blue, and wait for mouse up. Then // set it back to white on mouse up and mark ourselves done. bool TSetColorInteractor::MouseButtonDown(TMouseDownEvent& mouseDown, short) { TGraphicView* view = (TGraphicView*)fViewHandle.GetView(); if (view) { view->SetColor(TRGBColor(0.5, 0.7, 1.0)); } return true; } bool TSetColorInteractor::MouseButtonUp(TMouseUpEvent& mouseUp, short) { TGraphicView* view = (TGraphicView*)fViewHandle.GetView(); if (view) { view->SetColor(TRGBColor(1.0, 1.0, 1.0)); } SetDone(true); return true; }