lcl: draw treeview expand/collapse signs using ThemeServices

git-svn-id: trunk@17221 -
This commit is contained in:
paul 2008-11-04 15:32:34 +00:00
parent 6a6339a7f0
commit 2cb12dde77
2 changed files with 27 additions and 9 deletions

View File

@ -4163,10 +4163,17 @@ var
Result := BorderWidth - FScrolledLeft;
end;
procedure DrawExpandSign(MidX,MidY: integer; CollapseSign: boolean);
procedure DrawExpandSign(MidX, MidY: integer; CollapseSign: boolean);
const
PlusMinusDetail: array[Boolean] of TThemedTreeview =
(
ttGlyphClosed,
ttGlyphOpened
);
var
HalfSize, ALeft, ATop, ARight, ABottom: integer;
Points: PPoint;
Details: TThemedElementDetails;
begin
if not ShowButtons then exit;
with Canvas do
@ -4184,14 +4191,8 @@ var
tvestPlusMinus:
begin
// draw a plus or a minus sign
Rectangle(ALeft, ATop, ARight+1, ABottom+1);
MoveTo(ALeft+2,MidY);
LineTo(ARight-2+1,MidY);
if not CollapseSign then
begin
MoveTo(MidX,ATop+2);
LineTo(MidX,ABottom-2+1);
end;
Details := ThemeServices.GetElementDetails(PlusMinusDetail[CollapseSign]);
ThemeServices.DrawElement(Canvas.Handle, Details, Rect(ALeft, ATop, ARight + 1, ABottom + 1), nil);
end;
tvestArrow:
begin

View File

@ -1847,6 +1847,7 @@ var
ADrawFlags: DWord;
Bevel: TGraphicsBevelCut;
ARect: TRect;
Tmp: Integer;
begin
// default painting
ARect := R; // in order to pass by reference
@ -1965,6 +1966,22 @@ begin
if Details.Part in [TABP_PANE, TABP_BODY] then
FillWithColor(ARect, clBackground);
end;
teTreeView:
begin
if Details.Part = TVP_GLYPH then
begin
Rectangle(DC, ARect.Left, ARect.Top, ARect.Right, ARect.Bottom);
Tmp := (ARect.Bottom + ARect.Top) shr 1;
MoveToEx(DC, ARect.Left + 2, Tmp, nil);
LineTo(DC, ARect.Right - 2, Tmp);
if Details.State = 1 then
begin
Tmp := (ARect.Left + ARect.Right) shr 1;
MoveToEx(DC, Tmp, ARect.Top + 2, nil);
LineTo(DC, Tmp, ARect.Bottom - 2);
end;
end;
end;
end;
end;