mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-09 20:43:50 +01:00
lcl: formatting
git-svn-id: trunk@27757 -
This commit is contained in:
parent
94ca121303
commit
9b70fb4a72
@ -4083,75 +4083,81 @@ var
|
||||
Node: TTreeNode;
|
||||
InsertMarkRect: TRect;
|
||||
begin
|
||||
if [tvsUpdating,tvsPainting]*FStates<>[] then exit;
|
||||
Include(FStates,tvsPainting);
|
||||
if [tvsUpdating,tvsPainting] * FStates <> [] then Exit;
|
||||
Include(FStates, tvsPainting);
|
||||
if (tvoAutoItemHeight in fOptions) then
|
||||
UpdateDefaultItemHeight;
|
||||
UpdateScrollbars;
|
||||
with Canvas do begin
|
||||
if Assigned(FOnCustomDraw) or Assigned(FOnAdvancedCustomDraw) then begin
|
||||
DrawRect:=ClientRect;
|
||||
if not CustomDraw(DrawRect,cdPrePaint) then exit;
|
||||
with Canvas do
|
||||
begin
|
||||
if Assigned(FOnCustomDraw) or Assigned(FOnAdvancedCustomDraw) then
|
||||
begin
|
||||
DrawRect := ClientRect;
|
||||
if not CustomDraw(DrawRect, cdPrePaint) then exit;
|
||||
end;
|
||||
// draw nodes
|
||||
Node:=TopItem;
|
||||
Node := TopItem;
|
||||
//write('[TCustomTreeView.DoPaint] A Node=',DbgS(Node));
|
||||
//if Node<>nil then DebugLn(' Node.Text=',Node.Text) else DebugLn('');
|
||||
while Node<>nil do begin
|
||||
while Node <> nil do
|
||||
begin
|
||||
DoPaintNode(Node);
|
||||
Node:=Node.GetNextVisible;
|
||||
Node := Node.GetNextVisible;
|
||||
//write('[TCustomTreeView.DoPaint] B Node=',DbgS(Node));
|
||||
//if Node<>nil then DebugLn(' Node.Text=',Node.Text) else DebugLn('');
|
||||
end;
|
||||
SpaceRect:=Rect(BorderWidth,BorderWidth,
|
||||
(ClientWidth-ScrollBarWidth)-BorderWidth,
|
||||
(ClientHeight-ScrollBarWidth)-BorderWidth);
|
||||
SpaceRect := Rect(BorderWidth, BorderWidth,
|
||||
(ClientWidth - ScrollBarWidth) - BorderWidth,
|
||||
(ClientHeight - ScrollBarWidth) - BorderWidth);
|
||||
// draw insert mark for new root node
|
||||
if (InsertMarkType=tvimAsFirstChild)
|
||||
and (Items.Count=0) then begin
|
||||
Pen.Color:=FTreeLineColor;
|
||||
Brush.Color:=FSelectedColor;
|
||||
InsertMarkRect:=SpaceRect;
|
||||
InsertMarkRect.Bottom:=InsertMarkRect.Top+2;
|
||||
if (InsertMarkType = tvimAsFirstChild) and (Items.Count = 0) then
|
||||
begin
|
||||
Pen.Color := FTreeLineColor;
|
||||
Brush.Color := FSelectedColor;
|
||||
InsertMarkRect := SpaceRect;
|
||||
InsertMarkRect.Bottom := InsertMarkRect.Top + 2;
|
||||
Rectangle(InsertMarkRect);
|
||||
SpaceRect.Top:=InsertMarkRect.Bottom;
|
||||
SpaceRect.Top := InsertMarkRect.Bottom;
|
||||
end;
|
||||
// draw unused space below nodes
|
||||
Node:=BottomItem;
|
||||
if Node<>nil then
|
||||
SpaceRect.Top:=Node.Top+Node.Height-FScrolledTop+BorderWidth;
|
||||
Node := BottomItem;
|
||||
if Node <> nil then
|
||||
SpaceRect.Top := Node.Top + Node.Height - FScrolledTop + BorderWidth;
|
||||
//if Node<>nil then DebugLn('BottomItem=',BottomItem.text) else DebugLn('NO BOTTOMITEM!!!!!!!!!');
|
||||
// TWinControl(Parent).InvalidateRect(Self,SpaceRect,true);
|
||||
if (FBackgroundColor<>clNone) and (SpaceRect.Top<SpaceRect.Bottom) then
|
||||
if (FBackgroundColor <> clNone) and (SpaceRect.Top < SpaceRect.Bottom) then
|
||||
begin
|
||||
//DebugLn(' SpaceRect=',SpaceRect.Left,',',SpaceRect.Top,',',SpaceRect.Right,',',SpaceRect.Bottom);
|
||||
Brush.Color:=FBackgroundColor;
|
||||
Brush.Color := FBackgroundColor;
|
||||
FillRect(SpaceRect);
|
||||
end;
|
||||
// draw border
|
||||
HalfBorderWidth:=BorderWidth shr 1;
|
||||
Pen.Color:=clGray;
|
||||
for a:=0 to BorderWidth-1 do begin
|
||||
if a=HalfBorderWidth then
|
||||
Pen.Color:=clBlack;
|
||||
MoveTo(a,(ClientHeight-ScrollBarWidth)-1-a);
|
||||
LineTo(a,a);
|
||||
LineTo((ClientWidth-ScrollBarWidth)-1-a,a);
|
||||
HalfBorderWidth := BorderWidth shr 1;
|
||||
Pen.Color := clGray;
|
||||
for a := 0 to BorderWidth - 1 do
|
||||
begin
|
||||
if a = HalfBorderWidth then
|
||||
Pen.Color := clBlack;
|
||||
MoveTo(a, (ClientHeight-ScrollBarWidth) - 1 - a);
|
||||
LineTo(a, a);
|
||||
LineTo((ClientWidth - ScrollBarWidth) - 1 - a, a);
|
||||
end;
|
||||
Pen.Color:=clWhite;
|
||||
for a:=0 to BorderWidth-1 do begin
|
||||
if a=HalfBorderWidth then
|
||||
Pen.Color:=clLtGray;
|
||||
MoveTo((ClientWidth-ScrollBarWidth)-1-a,a);
|
||||
LineTo((ClientWidth-ScrollBarWidth)-1-a,(ClientHeight-ScrollBarWidth)-1-a);
|
||||
LineTo(a,(ClientHeight-ScrollBarWidth)-1-a);
|
||||
Pen.Color := clWhite;
|
||||
for a := 0 to BorderWidth - 1 do
|
||||
begin
|
||||
if a = HalfBorderWidth then
|
||||
Pen.Color := clLtGray;
|
||||
MoveTo((ClientWidth - ScrollBarWidth) - 1 - a, a);
|
||||
LineTo((ClientWidth - ScrollBarWidth) - 1 - a, (ClientHeight - ScrollBarWidth) - 1 - a);
|
||||
LineTo(a, (ClientHeight-ScrollBarWidth) - 1 - a);
|
||||
end;
|
||||
if Assigned(FOnCustomDraw) or Assigned(FOnAdvancedCustomDraw) then begin
|
||||
DrawRect:=ClientRect;
|
||||
if not CustomDraw(DrawRect,cdPostPaint) then exit;
|
||||
if Assigned(FOnCustomDraw) or Assigned(FOnAdvancedCustomDraw) then
|
||||
begin
|
||||
DrawRect := ClientRect;
|
||||
if not CustomDraw(DrawRect, cdPostPaint) then exit;
|
||||
end;
|
||||
end;
|
||||
Exclude(FStates,tvsPainting);
|
||||
Exclude(FStates, tvsPainting);
|
||||
end;
|
||||
|
||||
procedure TCustomTreeView.DoPaintNode(Node: TTreeNode);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user