Download Now

    Reference TSurfaceCustomControl

    Declared in Codebot.Controls.pas on line 203

    TSurfaceCustomControl is the base class for custom windowed controls which require an ISurface object
      TSurfaceCustomControl = class(TCustomControl, IFloatPropertyNotify)
      protected
        { Allow controls direct access to draw state }
        FDrawState: TDrawState;
        { Float property change notification }
        procedure PropChange(Prop: PFloat); virtual;
        { Override ThemeAware and return true to subscribe to global theme changes }
        function ThemeAware: Boolean; virtual;
        { Invoked when the theme is changed }
        procedure ThemeChanged; virtual;
        { Paint is now final, so use Draw to access Surface }
        procedure Paint; override; final;
        { While Draw is executing Surface refers to a valid ISurface }
        procedure Draw; virtual;
        { Surface is only valid while Draw is executing }
        property Surface: ISurface read GetSurface;
        { Visual representation of the control. Is it pressed, hot, checked, etc }
        property DrawState: TDrawState read FDrawState write SetDrawState;
        { Theme name determines the styling for a control }
        property ThemeName: string read FThemeName write SetThemeName;
        { Draw event handler }
        property OnDraw: TDrawEvent read FOnDraw write FOnDraw;
      public
        { Create a new control }
        constructor Create(AOwner: TComponent); override;
        destructor Destroy; override;
      end;

    See also

    IFloatPropertyNotify in Codebot.System.pas
    ISurface in Codebot.Graphics.Types.pas
    PFloat in Codebot.System.pas
    TDrawEvent in Codebot.Graphics.pas
    TDrawState in Codebot.Graphics.Types.pas