1
{%MainUnit fpcanvas.pp}
3
This file is part of the Free Pascal run time library.
4
Copyright (c) 2003 by the Free Pascal development team
6
Implementation of TFPCanvasHelper
8
See the file COPYING.FPC, included in this distribution,
9
for details about the copyright.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
**********************************************************************}
18
constructor TFPCanvasHelper.Create;
22
FFixedCanvas := false;
26
destructor TFPCanvasHelper.destroy;
33
procedure TFPCanvasHelper.SetFixedCanvas (AValue : boolean);
35
FFixedCanvas := AValue;
38
procedure TFPCanvasHelper.NotifyCanvas;
39
// called to unbind from canvas
42
FCanvas.CheckHelper (self);
45
procedure TFPCanvasHelper.CheckAllocated (ValueNeeded:boolean);
47
procedure RaiseErrAllocation;
49
Raise TFPFontException.CreateFmt (ErrAllocation,
50
[EFont, ErrAlloc[ValueNeeded]]);
54
if (Allocated <> ValueNeeded) then
58
procedure TFPCanvasHelper.SetFPColor(const AValue:TFPColor);
63
procedure TFPCanvasHelper.Changing;
65
if Assigned(FOnChanging) then FOnChanging(Self);
68
procedure TFPCanvasHelper.Changed;
70
if Assigned(FOnChange) then FOnChange(Self);
73
procedure TFPCanvasHelper.Lock;
78
procedure TFPCanvasHelper.UnLock;
83
procedure TFPCanvasHelper.SetFlags (index:integer; AValue:boolean);
86
FFlags := FFlags or (1 shl index)
88
FFlags := FFlags and not (1 shl index);
91
function TFPCanvasHelper.GetFlags (index:integer) : boolean;
93
result := (FFlags and (1 shl index)) <> 0;
96
function TFPCanvasHelper.GetAllocated : boolean;
99
result := assigned(FCanvas)
101
result := FAllocated;
104
procedure TFPCanvasHelper.AllocateResources (ACanvas : TFPCustomCanvas;
107
if FFixedCanvas and FAllocated then
110
if DelayAllocate and CanDelay then exit;
120
procedure TFPCanvasHelper.DeallocateResources;
124
DoDeallocateResources;
132
procedure TFPCanvasHelper.DoCopyProps (From:TFPCanvasHelper);
134
FPColor := from.FPColor;
137
procedure TFPCanvasHelper.DoAllocateResources;
141
procedure TFPCanvasHelper.DoDeallocateResources;