mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 16:09:41 +02:00
win32: revert r20538 #dda7ce7306 (fixes bug #0013940)
git-svn-id: trunk@20550 -
This commit is contained in:
parent
e12e8cb597
commit
1235f2dd11
@ -148,22 +148,12 @@ var
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
procedure DrawBitmap(AState: TButtonState; UseThemes: Boolean);
|
procedure DrawBitmap(AState: TButtonState; UseThemes: Boolean);
|
||||||
const
|
|
||||||
ButtonsDetail: array[TButtonState] of TThemedButton = (
|
|
||||||
{ bsUp } tbPushButtonNormal,
|
|
||||||
{ bsDisabled } tbPushButtonDisabled,
|
|
||||||
{ bsDown } tbPushButtonPressed,
|
|
||||||
{ bsExclusive } tbPushButtonNormal,
|
|
||||||
{ bsHot } tbPushButtonHot
|
|
||||||
);
|
|
||||||
|
|
||||||
var
|
var
|
||||||
TextFlags: integer; // flags for caption (enabled or disabled)
|
TextFlags: integer; // flags for caption (enabled or disabled)
|
||||||
glyphWidth, glyphHeight: integer;
|
glyphWidth, glyphHeight: integer;
|
||||||
OldBitmapHandle: HBITMAP; // Handle of the provious bitmap in hdcNewBitmap
|
OldBitmapHandle: HBITMAP; // Handle of the provious bitmap in hdcNewBitmap
|
||||||
AIndex: Integer;
|
AIndex: Integer;
|
||||||
AEffect: TGraphicsDrawEffect;
|
AEffect: TGraphicsDrawEffect;
|
||||||
Details: TThemedElementDetails;
|
|
||||||
begin
|
begin
|
||||||
glyphWidth := srcWidth;
|
glyphWidth := srcWidth;
|
||||||
glyphHeight := srcHeight;
|
glyphHeight := srcHeight;
|
||||||
@ -225,28 +215,19 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
SetBkMode(hdcNewBitmap, TRANSPARENT);
|
SetBkMode(hdcNewBitmap, TRANSPARENT);
|
||||||
if not UseThemes then
|
{$IFDEF WindowsUnicodeSupport}
|
||||||
|
if UnicodeEnabledOS then
|
||||||
begin
|
begin
|
||||||
{$IFDEF WindowsUnicodeSupport}
|
ButtonCaptionW := UTF8ToUTF16(ButtonCaption);
|
||||||
if UnicodeEnabledOS then
|
DrawStateW(hdcNewBitmap, 0, nil, LPARAM(ButtonCaptionW), 0, XDestText, YDestText, 0, 0, TextFlags);
|
||||||
begin
|
|
||||||
ButtonCaptionW := UTF8ToUTF16(ButtonCaption);
|
|
||||||
DrawStateW(hdcNewBitmap, 0, nil, LPARAM(ButtonCaptionW), 0, XDestText, YDestText, 0, 0, TextFlags);
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
ButtonCaptionA := Utf8ToAnsi(ButtonCaption);
|
|
||||||
DrawState(hdcNewBitmap, 0, nil, LPARAM(ButtonCaptionA), 0, XDestText, YDestText, 0, 0, TextFlags);
|
|
||||||
end;
|
|
||||||
{$ELSE}
|
|
||||||
DrawState(hdcNewBitmap, 0, nil, LPARAM(ButtonCaption), 0, XDestText, YDestText, 0, 0, TextFlags);
|
|
||||||
{$ENDIF}
|
|
||||||
end
|
end
|
||||||
else
|
else begin
|
||||||
begin
|
ButtonCaptionA := Utf8ToAnsi(ButtonCaption);
|
||||||
Details := ThemeServices.GetElementDetails(ButtonsDetail[AState]);
|
DrawState(hdcNewBitmap, 0, nil, LPARAM(ButtonCaptionA), 0, XDestText, YDestText, 0, 0, TextFlags);
|
||||||
ThemeServices.DrawText(hdcNewBitmap, Details, ButtonCaption,
|
|
||||||
Rect(XDestText, YDestText, XDestText + TextSize.cx, YDestText + TextSize.cy), 0, 0);
|
|
||||||
end;
|
end;
|
||||||
|
{$ELSE}
|
||||||
|
DrawState(hdcNewBitmap, 0, nil, LPARAM(ButtonCaption), 0, XDestText, YDestText, 0, 0, TextFlags);
|
||||||
|
{$ENDIF}
|
||||||
SelectObject(hdcNewBitmap, OldBitmapHandle);
|
SelectObject(hdcNewBitmap, OldBitmapHandle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user