mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-26 05:00:25 +02:00
LCL, CoolBar: paint a grabber for bands. No grabbing functionality yet.
git-svn-id: trunk@40150 -
This commit is contained in:
parent
7f287a7a36
commit
7bef18943c
@ -19,7 +19,9 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
const
|
const
|
||||||
ControlPosLeft = 5;
|
GrabLeft = 2;
|
||||||
|
GrabWidth = 9;
|
||||||
|
ControlLeft = GrabLeft + GrabWidth + 6;
|
||||||
|
|
||||||
{ TCoolBand }
|
{ TCoolBand }
|
||||||
|
|
||||||
@ -86,7 +88,7 @@ procedure TCoolBand.ResetControlProps;
|
|||||||
begin
|
begin
|
||||||
FControl.AnchorSide[akLeft].Control := Nil;
|
FControl.AnchorSide[akLeft].Control := Nil;
|
||||||
FControl.BorderSpacing.Left := 0;
|
FControl.BorderSpacing.Left := 0;
|
||||||
FControl.Left := ControlPosLeft;
|
FControl.Left := ControlLeft;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCoolBand.SetBorderStyle(aValue: TBorderStyle);
|
procedure TCoolBand.SetBorderStyle(aValue: TBorderStyle);
|
||||||
@ -162,7 +164,8 @@ end;
|
|||||||
|
|
||||||
procedure TCoolBand.SetControlWidth;
|
procedure TCoolBand.SetControlWidth;
|
||||||
begin
|
begin
|
||||||
FControl.Width := FCoolBar.Width - FControl.Left - 6;
|
if not (FControl is TCustomCheckBox) then
|
||||||
|
FControl.Width := FCoolBar.Width - FControl.Left - 6;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCoolBand.UpdControl;
|
procedure TCoolBand.UpdControl;
|
||||||
@ -171,10 +174,10 @@ begin
|
|||||||
if Assigned(FTextLabel) then
|
if Assigned(FTextLabel) then
|
||||||
begin
|
begin
|
||||||
if Assigned(FControl) then
|
if Assigned(FControl) then
|
||||||
FTextLabel.Top := FTop+3 // Adjust text position for the control (which is higher).
|
FTextLabel.Top := FTop+4 // Adjust text position for the control (which is higher).
|
||||||
else
|
else
|
||||||
FTextLabel.Top := FTop+1;
|
FTextLabel.Top := FTop+1;
|
||||||
FTextLabel.Left := ControlPosLeft;
|
FTextLabel.Left := ControlLeft;
|
||||||
FTextLabel.Visible := FCoolBar.ShowText;
|
FTextLabel.Visible := FCoolBar.ShowText;
|
||||||
end;
|
end;
|
||||||
if Assigned(FControl) then
|
if Assigned(FControl) then
|
||||||
@ -499,6 +502,7 @@ procedure TCustomCoolBar.OnIdle(Sender: TObject; var Done: Boolean);
|
|||||||
begin
|
begin
|
||||||
Assert(Assigned(FNewBand) and Assigned(FNewControl),
|
Assert(Assigned(FNewBand) and Assigned(FNewControl),
|
||||||
'TCoolBar.OnIdle: FNewBand or FNewControl not assigned');
|
'TCoolBar.OnIdle: FNewBand or FNewControl not assigned');
|
||||||
|
DebugLn('TCoolBar.OnIdle');
|
||||||
FNewBand.Control := FNewControl;
|
FNewBand.Control := FNewControl;
|
||||||
Application.RemoveOnIdleHandler(@OnIdle);
|
Application.RemoveOnIdleHandler(@OnIdle);
|
||||||
FNewBand := Nil;
|
FNewBand := Nil;
|
||||||
@ -554,15 +558,35 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomCoolBar.Paint;
|
procedure TCustomCoolBar.Paint;
|
||||||
|
|
||||||
|
procedure PaintGrabber(aRect: TRect);
|
||||||
|
begin
|
||||||
|
Canvas.Pen.Color := clBtnHighlight;
|
||||||
|
Canvas.MoveTo(aRect.Left+2, aRect.Top);
|
||||||
|
Canvas.LineTo(aRect.Left, aRect.Top);
|
||||||
|
Canvas.LineTo(aRect.Left, aRect.Bottom+1);
|
||||||
|
Canvas.Pen.Color := clBtnShadow;
|
||||||
|
Canvas.MoveTo(aRect.Right, aRect.Top);
|
||||||
|
Canvas.LineTo(aRect.Right, aRect.Bottom);
|
||||||
|
Canvas.LineTo(aRect.Left, aRect.Bottom);
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
i, BottomY: Integer;
|
i, BottomY: Integer;
|
||||||
begin
|
begin
|
||||||
inherited Paint;
|
inherited Paint;
|
||||||
for i := 0 to FBands.Count-1 do
|
for i := 0 to FBands.Count-1 do
|
||||||
begin
|
begin
|
||||||
BottomY := FBands[i].FTop + FBands[i].Height + 1;
|
BottomY := FBands[i].FTop+FBands[i].Height+2;
|
||||||
if FBandBorderStyle = bsSingle then // ToDo: paint the border properly
|
// Paint a grabber
|
||||||
|
PaintGrabber(Rect(GrabLeft, FBands[i].FTop, GrabLeft+GrabWidth, BottomY-1));
|
||||||
|
// Paint a separator border below the band.
|
||||||
|
if FBandBorderStyle = bsSingle then
|
||||||
|
begin
|
||||||
Canvas.Line(3, BottomY, Width-3, BottomY);
|
Canvas.Line(3, BottomY, Width-3, BottomY);
|
||||||
|
Canvas.Pen.Color := clBtnHighlight;
|
||||||
|
Canvas.Line(3, BottomY+1, Width-3, BottomY+1);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user