Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 2.9 KB

File metadata and controls

55 lines (40 loc) · 2.9 KB
title Framework
parent CustomControls Package
permalink /tB/Packages/CustomControls/Framework/
has_toc false

Framework

The framework half of the CustomControls package --- the interfaces, callback objects, and drawing primitives an author of a custom control writes against. The eight concrete Waynes… controls in the package are themselves built on this framework; the same pieces are available to user code that needs to implement an entirely new custom control.

A custom control:

  1. Implements ICustomControl (or ICustomForm for a form-class custom control).
  2. Stores the CustomControlContext passed to it on Initialize and uses it to request repaints, create timers, or change the focused element.
  3. Inside Paint, builds one or more ElementDescriptor records and passes them to the Canvas via RuntimeUICCCanvasAddElement --- the framework rasterises them, handles input routing, and dispatches events back through the descriptor's AddressOf-registered callbacks.
Class MyControl
    Implements CustomControls.ICustomControl

    Private Context As CustomControls.CustomControlContext

    Private Sub OnInitialize(ByVal Ctx As CustomControls.CustomControlContext) _
            Implements CustomControls.ICustomControl.Initialize
        Set Me.Context = Ctx
    End Sub

    Private Sub OnDestroy() _
            Implements CustomControls.ICustomControl.Destroy
    End Sub

    Private Sub OnPaint(ByVal Canvas As CustomControls.Canvas) _
            Implements CustomControls.ICustomControl.Paint
        ' build ElementDescriptor records and call Canvas.RuntimeUICCCanvasAddElement
    End Sub
End Class

Interfaces

  • ICustomControl -- the interface implemented by every concrete custom control: Initialize, Destroy, Paint
  • ICustomForm -- the analogous interface for custom form classes

Callback objects

Drawing primitives

  • Canvas -- the drawing surface passed to Paint; RuntimeUICCCanvasAddElement, plus size and DPI accessors
  • SerializeInfo -- the per-instance serializer returned by CustomControlContext.GetSerializer; RuntimeUISrzDeserialize, design-mode flags, owner handle, runtime mode