Canvas views

A canvas view draws the contents of the underlying canvas representation, and facilitates selection of an interaction with canvas graphics in the underlying representation. Canvas views are mostly called by the GrafEdit framework; however, some canvas view functions are called directly by the classes that you create for your application (such as by the interactor classes). You derive from TCanvasView to provide the required application appearance and behavior.

As shown in Figure 38, TCanvasView derives from TContentView and MToolHandler.


TCanvasView displays the current graphical state of the canvas representations (TContentView) and facilitates interaction associated with cursor tools (MToolHandler). It provides reasonable default implementations for many related functions. However, you do need to override the following functions:

      EnumerateGraphics
      AdoptCurrentSelection
      SetCurrentSelection
      CopyCurrentSelection
      CreateEmptySelection
      AdoptAndDo
      DoBegin
      DoIncrement
      AdoptAndDoEnd
The ContentView::PrivateInitialize function is called after the view is fully constructed and performs any initialization to the view such as create menus and palettes for the application.

The TCanvasView HandleActivate and HandleDeactivate functions take the view from an active state to an inactive state, respectively. Derived classes can override these functions for a variety of reasons, such as activating and deactivating menus and palettes along with the view. Any implementation of these functions should begin by calling the parent implementations.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker