use obj.Reference.Handle instead of obj.Handle in lcl since obj.Handle is deprecated now (for converted gdi objects)

git-svn-id: trunk@13307 -
This commit is contained in:
paul 2007-12-13 02:01:24 +00:00
parent afe2d66374
commit 2e413c5941
6 changed files with 20 additions and 20 deletions

View File

@ -8198,9 +8198,8 @@ end;
procedure TGridColumnTitle.SetFont(const AValue: TFont); procedure TGridColumnTitle.SetFont(const AValue: TFont);
begin begin
if AValue.Handle<>FFont.Handle then begin if not FFont.IsEqual(AValue) then
FFont.Assign(AValue); FFont.Assign(AValue);
end;
end; end;
procedure TGridColumnTitle.SetLayout(const AValue: TTextLayout); procedure TGridColumnTitle.SetLayout(const AValue: TTextLayout);
@ -8467,9 +8466,8 @@ end;
procedure TGridColumn.SetFont(const AValue: TFont); procedure TGridColumn.SetFont(const AValue: TFont);
begin begin
if AValue.Handle<>FFont.Handle then begin if not FFont.IsEqual(AValue) then
FFont.Assign(AValue); FFont.Assign(AValue);
end;
end; end;
procedure TGridColumn.SetLayout(const AValue: TTextLayout); procedure TGridColumn.SetLayout(const AValue: TTextLayout);

View File

@ -36,19 +36,19 @@ var
OldFont: HGDIOBJ; OldFont: HGDIOBJ;
LabelText: string; LabelText: string;
begin begin
if (Parent=nil) or (not Parent.HandleAllocated) then exit; if (Parent=nil) or (not Parent.HandleAllocated) then Exit;
DC := GetDC(Parent.Handle); DC := GetDC(Parent.Handle);
try try
R := Rect(0,0, Width, Height); R := Rect(0, 0, Width, Height);
OldFont:=SelectObject(DC, Font.Handle); OldFont := SelectObject(DC, Font.Reference.Handle);
Flags:=DT_CalcRect; Flags := DT_CalcRect;
if WordWrap then if WordWrap then
inc(Flags, DT_WordBreak) inc(Flags, DT_WordBreak)
else else
if not HasMultiLine then if not HasMultiLine then
inc(Flags, DT_SingleLine); inc(Flags, DT_SingleLine);
LabelText:=GetLabelText; LabelText := GetLabelText;
DrawText(DC, PChar(LabelText), Length(LabelText), R, Flags); DrawText(DC, PChar(LabelText), Length(LabelText), R, Flags);
SelectObject(DC, OldFont); SelectObject(DC, OldFont);
// add one to be able to display disabled label // add one to be able to display disabled label
@ -338,7 +338,7 @@ begin
and (CurFontHeight<=MaxFontHeight) do begin and (CurFontHeight<=MaxFontHeight) do begin
AFont.Height:=CurFontHeight; // NOTE: some TFont do not allow any integer AFont.Height:=CurFontHeight; // NOTE: some TFont do not allow any integer
//debugln('TCustomLabel.CalcFittingFontHeight A ',dbgs(MinFontHeight),'<=',dbgs(AFont.Height),'<=',dbgs(MaxFontHeight)); //debugln('TCustomLabel.CalcFittingFontHeight A ',dbgs(MinFontHeight),'<=',dbgs(AFont.Height),'<=',dbgs(MaxFontHeight));
OldFont:=SelectObject(DC, AFont.Handle); OldFont := SelectObject(DC, AFont.Reference.Handle);
DrawText(DC, PChar(TheText), Length(TheText), R, Flags); DrawText(DC, PChar(TheText), Length(TheText), R, Flags);
SelectObject(DC, OldFont); SelectObject(DC, OldFont);
NeededWidth := R.Right - R.Left; NeededWidth := R.Right - R.Left;

View File

@ -4343,9 +4343,9 @@ procedure TWinControl.EraseBackground(DC: HDC);
var var
ARect: TRect; ARect: TRect;
begin begin
if DC=0 then exit; if DC = 0 then Exit;
ARect:=Rect(0,0,Width,Height); ARect := Rect(0, 0, Width, Height);
FillRect(DC,ARect,Brush.Handle) FillRect(DC, ARect, Brush.Reference.Handle)
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------

View File

@ -165,7 +165,7 @@ var
// fill with background color // fill with background color
OldBitmapHandle := SelectObject(hdcNewBitmap, NewBitmap); OldBitmapHandle := SelectObject(hdcNewBitmap, NewBitmap);
Windows.FillRect(hdcNewBitmap, BitmapRect, BitBtn.Brush.Handle); Windows.FillRect(hdcNewBitmap, BitmapRect, BitBtn.Brush.Reference.Handle);
if AState <> bsDisabled then if AState <> bsDisabled then
begin begin
if (srcWidth <> 0) and (srcHeight <> 0) then if (srcWidth <> 0) and (srcHeight <> 0) then
@ -237,7 +237,7 @@ begin
BitBtnLayout := BitBtn.Layout; BitBtnLayout := BitBtn.Layout;
BitBtnDC := GetDC(BitBtnHandle); BitBtnDC := GetDC(BitBtnHandle);
hdcNewBitmap := CreateCompatibleDC(BitBtnDC); hdcNewBitmap := CreateCompatibleDC(BitBtnDC);
OldFontHandle := SelectObject(hdcNewBitmap, BitBtn.Font.Handle); OldFontHandle := SelectObject(hdcNewBitmap, BitBtn.Font.Reference.Handle);
{$IFDEF WindowsUnicodeSupport} {$IFDEF WindowsUnicodeSupport}
if UnicodeEnabledOS then if UnicodeEnabledOS then
begin begin

View File

@ -259,7 +259,7 @@ begin
if AWinControl.Font.IsDefault then if AWinControl.Font.IsDefault then
lhFont := GetStockObject(DEFAULT_GUI_FONT) lhFont := GetStockObject(DEFAULT_GUI_FONT)
else else
lhFont := AWinControl.Font.Handle; lhFont := AWinControl.Font.Reference.Handle;
Windows.SendMessage(Window, WM_SETFONT, WPARAM(lhFont), 0) Windows.SendMessage(Window, WM_SETFONT, WPARAM(lhFont), 0)
end; end;
end; end;
@ -280,7 +280,7 @@ begin
if AWinControl.Font.IsDefault then if AWinControl.Font.IsDefault then
lhFont := GetStockObject(DEFAULT_GUI_FONT) lhFont := GetStockObject(DEFAULT_GUI_FONT)
else else
lhFont := AWinControl.Font.Handle; lhFont := AWinControl.Font.Reference.Handle;
Windows.SendMessage(Buddy, WM_SETFONT, lhFont, 0); Windows.SendMessage(Buddy, WM_SETFONT, lhFont, 0);
end end
else else
@ -467,7 +467,7 @@ class procedure TWin32WSWinControl.SetFont(const AWinControl: TWinControl; const
begin begin
if not WSCheckHandleAllocated(AWinControl, 'SetFont') if not WSCheckHandleAllocated(AWinControl, 'SetFont')
then Exit; then Exit;
Windows.SendMessage(AWinControl.Handle, WM_SETFONT, Windows.WParam(AFont.Handle), 1); Windows.SendMessage(AWinControl.Handle, WM_SETFONT, Windows.WParam(AFont.Reference.Handle), 1);
end; end;
class procedure TWin32WSWinControl.SetText(const AWinControl: TWinControl; const AText: string); class procedure TWin32WSWinControl.SetText(const AWinControl: TWinControl; const AText: string);

View File

@ -80,7 +80,7 @@ type
TWSBitmapReference = object(TWSGDIObjReference) TWSBitmapReference = object(TWSGDIObjReference)
property Handle: THandle read FRef.Handle; property Handle: THandle read FRef.Handle;
end; end;
TWSBrushReference = object(TWSGDIObjReference) TWSBrushReference = object(TWSGDIObjReference)
property _lclHandle: THandle write FRef.Handle; property _lclHandle: THandle write FRef.Handle;
property Handle: THandle read FRef.Handle; property Handle: THandle read FRef.Handle;
@ -105,7 +105,9 @@ type
property Handle: THandle read FRef.Handle; property Handle: THandle read FRef.Handle;
end; end;
TWSIconReference = object(TWSReference)
property Handle: THandle read FRef.Handle;
end;
implementation implementation