mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 20:40:40 +02:00
gtk: implement DT_VCENTER, DT_BOTTOM flags for DrawText. Based on patch of Luiz Americo (issue #0008565)
git-svn-id: trunk@18702 -
This commit is contained in:
parent
db2dc88340
commit
4a235bd95f
@ -3071,11 +3071,26 @@ var
|
||||
begin
|
||||
// ignore word and line breaks
|
||||
TextExtentPoint(Str, Count, AP);
|
||||
theRect.Bottom := theRect.Top + TM.tmHeight;
|
||||
if (Flags and DT_CALCRECT)<>0 then
|
||||
theRect.Right := theRect.Left + AP.cX
|
||||
else
|
||||
begin
|
||||
theRect.Right := theRect.Left + Min(MaxWidth, AP.cX);
|
||||
theRect.Bottom := theRect.Top + TM.tmHeight;
|
||||
if (Flags and DT_VCENTER) > 0 then
|
||||
begin
|
||||
OffsetRect(theRect, 0, ((Rect.Bottom - Rect.Top) - (theRect.Bottom - theRect.Top)) div 2);
|
||||
{$ifdef Gtk1}
|
||||
//gtk1 overestimate TM.tmHeight leading to wrong calculation of the center offset
|
||||
OffsetRect(theRect, 0, 1);
|
||||
{$endif}
|
||||
end
|
||||
else
|
||||
if (Flags and DT_BOTTOM) > 0 then
|
||||
begin
|
||||
OffsetRect(theRect, 0, (Rect.Bottom - Rect.Top) - (theRect.Bottom - theRect.Top));
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user