From 5647965f20a02fdbccf86246f9a335713389e9ff Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 22 Feb 2011 06:47:55 +0000 Subject: [PATCH] lcl: set hint window region on bounds change git-svn-id: trunk@29643 - --- lcl/forms.pp | 1 + lcl/include/hintwindow.inc | 26 ++++++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lcl/forms.pp b/lcl/forms.pp index bcb482e6aa..7692b5d922 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -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; diff --git a/lcl/include/hintwindow.inc b/lcl/include/hintwindow.inc index ca4d92f7d4..b6937cfee9 100644 --- a/lcl/include/hintwindow.inc +++ b/lcl/include/hintwindow.inc @@ -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;