You've already forked lazarus-ccr
TvPlanIt: Fix painting of text in VpNavBar on Cocoa.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8839 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -500,7 +500,7 @@ uses
|
|||||||
VpNavBarPainter;
|
VpNavBarPainter;
|
||||||
|
|
||||||
const
|
const
|
||||||
DEFAULT_ITEMSPACING = 8;
|
DEFAULT_ITEMSPACING = 12;
|
||||||
|
|
||||||
{$IFNDEF PAINTER}
|
{$IFNDEF PAINTER}
|
||||||
{DrawNavTab - returns the usable text area inside the tab rect.}
|
{DrawNavTab - returns the usable text area inside the tab rect.}
|
||||||
|
@ -591,8 +591,9 @@ begin
|
|||||||
AItem.LabelRect := R;
|
AItem.LabelRect := R;
|
||||||
|
|
||||||
bkMode := SetBkMode(Canvas.Handle, TRANSPARENT);
|
bkMode := SetBkMode(Canvas.Handle, TRANSPARENT);
|
||||||
AHeight:= DrawText(Canvas.Handle, PChar(s), Length(s), R, DT_CENTER or DT_VCENTER or DT_WORDBREAK);
|
DrawText(Canvas.Handle, PChar(s), Length(s), R, DT_CENTER or DT_VCENTER or DT_WORDBREAK);
|
||||||
SetBkMode(Canvas.Handle, bkMode);
|
SetBkMode(Canvas.Handle, bkMode);
|
||||||
|
AHeight := HeightOf(R);
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
R.Top := CurPos;
|
R.Top := CurPos;
|
||||||
@ -611,7 +612,6 @@ begin
|
|||||||
AItem.DisplayName := s;
|
AItem.DisplayName := s;
|
||||||
DrawText(Canvas.Handle, PChar(s), Length(s), R, DT_LEFT or DT_CALCRECT);
|
DrawText(Canvas.Handle, PChar(s), Length(s), R, DT_LEFT or DT_CALCRECT);
|
||||||
txtWidth := WidthOf(R);
|
txtWidth := WidthOf(R);
|
||||||
AHeight := HeightOf(R);
|
|
||||||
R.Right := R.Left + txtWidth + 1;
|
R.Right := R.Left + txtWidth + 1;
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
OffsetRect(R, 0, -1); // Better centering of text
|
OffsetRect(R, 0, -1); // Better centering of text
|
||||||
@ -623,6 +623,7 @@ begin
|
|||||||
// AHeight := DrawText(Canvas.Handle, PChar(s), Length(s), R, DT_LEFT or DT_VCENTER);
|
// AHeight := DrawText(Canvas.Handle, PChar(s), Length(s), R, DT_LEFT or DT_VCENTER);
|
||||||
SetBkMode(Canvas.Handle, bkMode);
|
SetBkMode(Canvas.Handle, bkMode);
|
||||||
|
|
||||||
|
AHeight := HeightOf(R);
|
||||||
if AHeight < FSmallImagesSize then
|
if AHeight < FSmallImagesSize then
|
||||||
AHeight := FSmallImagesSize;
|
AHeight := FSmallImagesSize;
|
||||||
end;
|
end;
|
||||||
@ -634,7 +635,7 @@ end;
|
|||||||
function TVpNavBarPainter.DrawLargeIcon(Canvas: TCanvas; AItem: TVpNavBtnItem;
|
function TVpNavBarPainter.DrawLargeIcon(Canvas: TCanvas; AItem: TVpNavBtnItem;
|
||||||
CurPos: Integer): Boolean;
|
CurPos: Integer): Boolean;
|
||||||
const
|
const
|
||||||
MARGIN = 2;
|
MARGIN = 1;
|
||||||
var
|
var
|
||||||
W, H: Integer;
|
W, H: Integer;
|
||||||
R: TRect;
|
R: TRect;
|
||||||
@ -1098,7 +1099,8 @@ begin
|
|||||||
Right := 1;
|
Right := 1;
|
||||||
Bottom := 1;
|
Bottom := 1;
|
||||||
end;
|
end;
|
||||||
SH := DrawText(Canvas.Handle, 'W W', 3, TestRect, DT_SINGLELINE or DT_CALCRECT);
|
DrawText(Canvas.Handle, 'W W', 3, TestRect, DT_SINGLELINE or DT_CALCRECT);
|
||||||
|
SH := HeightOf(TestRect);
|
||||||
|
|
||||||
{get double line height}
|
{get double line height}
|
||||||
with TestRect do begin
|
with TestRect do begin
|
||||||
@ -1107,7 +1109,8 @@ begin
|
|||||||
Right := 1;
|
Right := 1;
|
||||||
Bottom := 1;
|
Bottom := 1;
|
||||||
end;
|
end;
|
||||||
DH := DrawText(Canvas.Handle, 'W W', 3, TestRect, DT_WORDBREAK or DT_CALCRECT);
|
DrawText(Canvas.Handle, 'W W', 3, TestRect, DT_WORDBREAK or DT_CALCRECT);
|
||||||
|
DH := HeightOf(TestRect);
|
||||||
|
|
||||||
{see if the text can fit within the existing rect without growing}
|
{see if the text can fit within the existing rect without growing}
|
||||||
TestRect := Rect;
|
TestRect := Rect;
|
||||||
|
Reference in New Issue
Block a user