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:
paul 2009-02-16 02:20:39 +00:00
parent db2dc88340
commit 4a235bd95f

View File

@ -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