XGraphics unitXCustomControl classXCanvases.pas unit

    XCanvases unit of XCL is containing definition of XCanvas class, which is very similar to TCanvas of VCL. But in XCL, XCanvas is not necessarily part of applet. If You are using only MFC-based controls, You do not need in this unit. To make possible to include or not to include XCanvases unit into applet optionally, Canvas property of XWindow is of type Pointer and creating of Canvas for it is impemented like add-on. I.e., if You use canvases, global object GlobalCanvasManager is created and intercepts events OnCreateWindow, OnDestroyWindow, OnBeginPaint and OnEndPaint of global object GlobalWindowsManager and intercepting ones, performs necessary tasks of creating, destroying XCanvas object, allocating and releasing its handle.
    In differ to other add-ons, You must delete reference to XCanvases unit from everywhere to ensure that it is not in use (because GlobalCanvasManager is created in 'initialization' section). And You do not need to include it in uses clause if You do not work with it directly. It can be included just by using XControls.pas unit (where self-painted not windowed controls are defined).
    You may get Canvas : Pointer with typcast XCanvas( SomeWindow.Canvas ) to obtain Canvas property of XWindow (if You need it). I suggest to use for this function XCanvases.GetWindowCanvas( W : XWindow ) : XCanvas. This will ensure that XCanvases unit is in use and Canvas property of XWindow is setuped to properly created XCanvas object.


XCanvas = class( TObject );

Properties of XCanvas:

 

Methods of XCanvas:

Events of XCanvas:

 


XCanvasManager = class( TObject );

XGraphicsManager events:

A single global variable GlobalCanvasManager : XCanvasManager is declared here. It is only used to keep these events above. These events are called by XCanvas objects. Thus, if add-on XRotateFonts.pas is included, it uses event OnTextArea to provide correct calculating of text output parameters for rotated fonts.


 

goto XCL page

goto home page