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

View File

@ -1847,6 +1847,7 @@ var
ADrawFlags: DWord; ADrawFlags: DWord;
Bevel: TGraphicsBevelCut; Bevel: TGraphicsBevelCut;
ARect: TRect; ARect: TRect;
Tmp: Integer;
begin begin
// default painting // default painting
ARect := R; // in order to pass by reference ARect := R; // in order to pass by reference
@ -1965,6 +1966,22 @@ begin
if Details.Part in [TABP_PANE, TABP_BODY] then if Details.Part in [TABP_PANE, TABP_BODY] then
FillWithColor(ARect, clBackground); FillWithColor(ARect, clBackground);
end; 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;
end; end;