Adopting or setting
The current selection is adopted or set by calling AdoptCurrentSelection or SetCurrentSelection.
void AdoptCurrentSelection( MCanvasSelection* aSelection );
void SetCurrentSelection( MCanvasSelection& ) = 0;
Retrieving
The current selection is retrieved by calling CopyCurrentSelection.
MCanvasSelection* CopyCurrentSelection () const;
Creating
A new empty selection is created by calling CreateEmptySelection.
A simple GrafEdit program can implement the above functions based on an MCanvasSelection member variable in the canvas view. However, TStandardCanvasView delegates AdoptCurrentSelection and CopyCurrentSelection to the TStandardCanvasPresenterState, and CreateEmptySelection to the TStandardCanvasModel.MCanvasSelection* CreateEmptySelection () const;
TCanvasView derived classes need to register for notifications of changes to the underlying representation and have the representation call functions to keep the canvas view in sync with the representation. TStandardCanvasView handles this for you.