mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 00:39:44 +02:00
Object Inspector: Fix the alignment of Checkbox editor.
git-svn-id: trunk@46991 -
This commit is contained in:
parent
3cc613425f
commit
7d9296fe56
@ -1743,8 +1743,8 @@ end;
|
||||
function TOICustomPropertyGrid.GetNameRowHeight: Integer;
|
||||
begin
|
||||
Result := Abs(FNameFont.Height);
|
||||
if Result = 0
|
||||
then Result := 16;
|
||||
if Result = 0 then
|
||||
Result := 16;
|
||||
Inc(Result, 2); // margin
|
||||
end;
|
||||
|
||||
@ -2581,6 +2581,7 @@ end;
|
||||
procedure TOICustomPropertyGrid.AlignEditComponents;
|
||||
var
|
||||
RRect,EditCompRect,EditBtnRect:TRect;
|
||||
TopMargin: Integer;
|
||||
|
||||
function CompareRectangles(r1,r2:TRect):boolean;
|
||||
begin
|
||||
@ -2594,7 +2595,6 @@ begin
|
||||
begin
|
||||
RRect := RowRect(ItemIndex);
|
||||
EditCompRect := RRect;
|
||||
Dec(EditCompRect.Bottom);
|
||||
|
||||
if Layout = oilHorizontal then
|
||||
EditCompRect.Left := RRect.Left + SplitterX
|
||||
@ -2609,7 +2609,7 @@ begin
|
||||
with EditBtnRect do begin
|
||||
Top := EditCompRect.Top;
|
||||
Left := EditCompRect.Right - 20;
|
||||
Bottom := EditCompRect.Bottom;
|
||||
Bottom := EditCompRect.Bottom - 1;
|
||||
Right := EditCompRect.Right;
|
||||
EditCompRect.Right := Left;
|
||||
end;
|
||||
@ -2622,9 +2622,16 @@ begin
|
||||
// resize the edit component
|
||||
if (FCurrentEdit is TEdit) or (FCurrentEdit is TComboBox) then
|
||||
begin
|
||||
{$IFnDEF LCLGTK2}
|
||||
Dec(EditCompRect.Left);
|
||||
{$ENDIF}
|
||||
Dec(EditCompRect.Top);
|
||||
Inc(EditCompRect.Bottom);
|
||||
end
|
||||
else if FCurrentEdit is TCheckBox then
|
||||
begin // Align CheckBox to the middle vertically
|
||||
TopMargin := (EditCompRect.Bottom - EditCompRect.Top - ValueCheckBox.Height) div 2;
|
||||
Inc(EditCompRect.Top, TopMargin);
|
||||
Inc(EditCompRect.Left); // and move it a little right.
|
||||
end;
|
||||
//debugln('TOICustomPropertyGrid.AlignEditComponents A ',dbgsName(FCurrentEdit),' ',dbgs(EditCompRect));
|
||||
if not CompareRectangles(FCurrentEdit.BoundsRect,EditCompRect) then
|
||||
|
@ -3262,6 +3262,7 @@ var
|
||||
Details: TThemedElementDetails;
|
||||
Check: TThemedButton;
|
||||
Sz: TSize;
|
||||
TopMargin, RightMargin: Integer;
|
||||
begin
|
||||
BRect := ARect;
|
||||
fUseCheckbox := FPropertyHook.GetCheckboxForBoolean;
|
||||
@ -3274,13 +3275,20 @@ begin
|
||||
Check := tbCheckBoxUncheckedNormal;
|
||||
Details := ThemeServices.GetElementDetails(Check);
|
||||
Sz := ThemeServices.GetDetailSize(Details);
|
||||
Inc(BRect.Top, 3);
|
||||
TopMargin := (ARect.Bottom - ARect.Top - Sz.cy) div 2;
|
||||
Inc(BRect.Top, TopMargin);
|
||||
{$IFDEF LCLGTK2}
|
||||
RightMargin := 3; // A hack. GTK2 checkbox itself has a left margin.
|
||||
{$ELSE}
|
||||
RightMargin := 1;
|
||||
{$ENDIF}
|
||||
Inc(BRect.Left, RightMargin);
|
||||
BRect.Right := BRect.Left + Sz.cx;
|
||||
BRect.Bottom := BRect.Top + Sz.cy;
|
||||
ThemeServices.DrawElement(ACanvas.Handle, Details, BRect, nil);
|
||||
// Write text after the box
|
||||
BRect := ARect;
|
||||
Inc(BRect.Left, Sz.cx+2);
|
||||
Inc(BRect.Left, Sz.cx+RightMargin+2);
|
||||
end;
|
||||
inherited PropDrawValue(ACanvas, BRect, AState);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user