// $Revision: 1.2 $ // Copyright (C) 1994, 1995 Taligent, Inc. All rights reserved. // TilesSelections.h #ifndef TaligentSample_TILESSELECTIONS #define TaligentSample_TILESSELECTIONS #ifndef TaligentSample_TILESMODEL #include "TilesModel.h" #endif // TTilesSelection is the selection return by TTilesModel::CreateSelection(). // The TTilesSelection can be on an individual TTile, on the whole model or // on none of the model. TTilesSelection inherits from TGUIModelSelectionFor<> // to support selection protocol class TTilesSelection : public TGUIModelSelectionFor { public: // The following macro must be called within class declarations in order to use Taligent // Type Extensions.The macro defines a set of Taligent Type Extension utility functions. // This macro call matches a macro call to TaligentTypeExtensionMacro in TilesSelections.C TaligentTypeExtensionDeclarationsMacro (TTilesSelection) // The following macro must be called when dynamic type casting is required. // The macro defines a set of dynamic casting utility functions. // This macro call matches a macro call to DynamicCastDefinitionsMacro in TilesSelections.C DynamicCastDeclarationsMacro (); // The constructor takes a TModelReference& which it uses to // initialize its TGUIModelSelectionFor base class. TTilesSelection (const TModelReference& theModel); virtual ~TTilesSelection (); // Taligent Type Extensions require copy constructors defined as well // as assignment and streaming operators. TTilesSelection (const TTilesSelection& copy); virtual TStream& operator>>= ( TStream& towhere ) const; virtual TStream& operator<<= ( TStream& fromwhere ); // Provides access to the TTiles to which the selection refers to TileIndex GetLowBound () const; TileIndex GetHighBound () const; TTile* GetTile (); // TGUIModelSelectionFor overrides. Support for selection of // the whole model, none of the model or an undefined selection. virtual void DeselectAll (); virtual void SelectWholeModel (); virtual void SetUndefined (); // Support for selection of one TTile. void SelectTile (TileIndex); // Return true if the selection contains a specific TileIndex. This is used // by the view to provide current selection feedback by drawing a frame around // each tile in the selection. bool ContainsTile (TileIndex) const; // The selection provides support for modifying the color of // the selected TTiles. SetColorAll modifies all the TTiles // in the selection whether it is one Tile or the whole model. void SetColor (TileIndex, const TRGBColor&); void SetColorAll (const TRGBColor&); TRGBColor GetColor (TileIndex whichTile) const; // Used by TMoveCommand to change and get the position of a TTile. Assumes // that only one TTile is selected. void SetPosition (const TGPoint&); TGPoint GetPosition (); protected: // TaligentTypeExtension also requires a true default (void) constructor. But I // don't want it called by clients so I make it protected. TTilesSelection (); private: // Used for versioning during streaming. enum {kOriginalVersion}; // The TilesSelection can't actually contain a pointer to a TTile because // then it could not be flattened. Instead fLowBound and fHighBound, used in // conjunction with the inherited TModelReference will specify the TTile(s) // to which this selection refers. All selections should contain an // address space independent specification on the model. TileIndex fLowBound; TileIndex fHighBound; // Place operator= in private section to prevent it from being called. TTilesSelection& operator= (const TTilesSelection& copy) {return *this;} }; #endif // TaligentSample_TILESSELECTIONS