mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-08 04:17:11 +01:00
lcl: set hint window region on bounds change
git-svn-id: trunk@29643 -
This commit is contained in:
parent
0317bfe926
commit
5647965f20
@ -834,6 +834,7 @@ type
|
||||
AData: Pointer): TRect; virtual;
|
||||
procedure ReleaseHandle;
|
||||
procedure Paint; override;
|
||||
procedure SetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
|
||||
class function GetControlClassDefaultSize: TSize; override;
|
||||
public
|
||||
property Alignment: TAlignment read FAlignment write FAlignment;
|
||||
|
||||
@ -23,7 +23,8 @@
|
||||
|
||||
}
|
||||
|
||||
const HintBorderWidth=2;
|
||||
const
|
||||
HintBorderWidth = 2;
|
||||
|
||||
constructor THintWindow.Create(AOwner: TComponent);
|
||||
begin
|
||||
@ -127,9 +128,10 @@ begin
|
||||
if (Color = clInfoBk) or (Color = clDefault) then
|
||||
begin
|
||||
// draw using themes
|
||||
Details := ThemeServices.GetElementDetails(tttStandardLink);
|
||||
Details := ThemeServices.GetElementDetails(tttStandardNormal);
|
||||
ThemeServices.DrawElement(Canvas.Handle, Details, ARect);
|
||||
InflateRect(ARect, - 2 * HintBorderWidth, - 2 * HintBorderWidth);
|
||||
// ARect := ThemeServices.ContentRect(Canvas.Handle, Details, ARect);
|
||||
InflateRect(ARect, -2 * HintBorderWidth, -2 * HintBorderWidth);
|
||||
ThemeServices.DrawText(Canvas, Details, Caption, ARect, GetDrawTextFlags, 0);
|
||||
end
|
||||
else
|
||||
@ -138,12 +140,28 @@ begin
|
||||
Canvas.Pen.Width := 1;
|
||||
Canvas.FillRect(ARect);
|
||||
DrawEdge(Canvas.Handle, ARect, BDR_RAISEDOUTER, BF_RECT);
|
||||
InflateRect(ARect, - 2 * HintBorderWidth, - 2 * HintBorderWidth);
|
||||
InflateRect(ARect, -2 * HintBorderWidth, -2 * HintBorderWidth);
|
||||
DrawText(Canvas.GetUpdatedHandle([csFontValid]), PChar(Caption),
|
||||
Length(Caption), ARect, GetDrawTextFlags);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure THintWindow.SetBounds(ALeft, ATop, AWidth, AHeight: integer);
|
||||
var
|
||||
ARect: TRect;
|
||||
Details: TThemedElementDetails;
|
||||
Rgn: HRGN;
|
||||
begin
|
||||
inherited SetBounds(ALeft, ATop, AWidth, AHeight);
|
||||
if (Color = clInfoBk) or (Color = clDefault) then
|
||||
begin
|
||||
Details := ThemeServices.GetElementDetails(tttStandardNormal);
|
||||
ARect := ClientRect;
|
||||
Rgn := ThemeServices.GetDetailRegion(Canvas.Handle, Details, ARect);
|
||||
SetWindowRgn(Handle, Rgn, False);
|
||||
end
|
||||
end;
|
||||
|
||||
class function THintWindow.GetControlClassDefaultSize: TSize;
|
||||
begin
|
||||
Result.CX := 25;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user