mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-06 03:17:22 +01:00
LCL: implemented TColorButton.Margin
git-svn-id: trunk@29156 -
This commit is contained in:
parent
80476d8a9c
commit
746802f909
@ -92,23 +92,27 @@ function TColorButton.GetGlyphSize(Drawing: boolean; PaintRect: TRect): TSize;
|
|||||||
var
|
var
|
||||||
T: TSize;
|
T: TSize;
|
||||||
S: Integer;
|
S: Integer;
|
||||||
|
M: LongInt;
|
||||||
begin
|
begin
|
||||||
if ButtonColorAutoSize and Drawing then
|
if ButtonColorAutoSize and Drawing then
|
||||||
begin
|
begin
|
||||||
T := GetTextSize(Drawing, PaintRect); // ToDo: wordbreak, margins, layout
|
T := GetTextSize(Drawing, PaintRect); // ToDo: wordbreak
|
||||||
//debugln(['TColorButton.GetGlyphSize ',DbgSName(Self),' Caption=',dbgstr(Caption),' T=',dbgs(T),' BorderWidth=',BorderWidth]);
|
//debugln(['TColorButton.GetGlyphSize ',DbgSName(Self),' Caption=',dbgstr(Caption),' T=',dbgs(T),' BorderWidth=',BorderWidth]);
|
||||||
if Caption = '' then S := 0
|
if (T.cx = 0) or (T.cy=0) then S := 0
|
||||||
else S := Spacing;
|
else S := Spacing;
|
||||||
|
M:=BorderWidth;
|
||||||
|
if Margin>=0 then
|
||||||
|
M:=Margin;
|
||||||
|
|
||||||
if Layout in [blGlyphLeft, blGlyphRight] then
|
if Layout in [blGlyphLeft, blGlyphRight] then
|
||||||
begin
|
begin
|
||||||
Result.CX := PaintRect.Right - PaintRect.Left - 2 * BorderWidth - S - T.CX;
|
Result.CX := PaintRect.Right - PaintRect.Left - 2 * M - S - T.CX;
|
||||||
Result.CY := PaintRect.Bottom - PaintRect.Top - 2 * BorderWidth;
|
Result.CY := PaintRect.Bottom - PaintRect.Top - 2 * M;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Result.CX := PaintRect.Right - PaintRect.Left - 2 * BorderWidth;
|
Result.CX := PaintRect.Right - PaintRect.Left - 2 * M;
|
||||||
Result.CY := PaintRect.Bottom - PaintRect.Top - 2 * BorderWidth - S - T.CY;
|
Result.CY := PaintRect.Bottom - PaintRect.Top - 2 * M - S - T.CY;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user