@@ -64,6 +64,7 @@ interface
64
64
Windows,
65
65
ActiveX,
66
66
CommCtrl,
67
+ UxTheme,
67
68
{$else}
68
69
FakeActiveX,
69
70
{$endif}
@@ -244,14 +245,25 @@ interface
244
245
DEFAULT_NODE_HEIGHT = 18;
245
246
DEFAULT_SPACING = 3;
246
247
248
+ LIS_NORMAL = 1;
249
+ {$EXTERNALSYM LIS_NORMAL}
250
+ LIS_HOT = 2;
251
+ {$EXTERNALSYM LIS_HOT}
252
+ LIS_SELECTED = 3;
253
+ {$EXTERNALSYM LIS_SELECTED}
254
+ LIS_DISABLED = 4;
255
+ {$EXTERNALSYM LIS_DISABLED}
256
+ LIS_SELECTEDNOTFOCUS = 5;
257
+ {$EXTERNALSYM LIS_SELECTEDNOTFOCUS}
258
+
247
259
var // Clipboard format IDs used in OLE drag'n drop and clipboard transfers.
248
260
CF_VIRTUALTREE,
249
261
CF_VTREFERENCE,
250
262
CF_VRTF,
251
263
CF_VRTFNOOBJS, // Unfortunately CF_RTF* is already defined as being
252
264
// registration strings so I have to use different identifiers.
253
265
CF_HTML,
254
- CF_CSV: Word ;
266
+ CF_CSV: TClipboardFormat ;
255
267
256
268
MMXAvailable: Boolean; // necessary to know because the blend code uses MMX instructions
257
269
IsWinVistaOrAbove: Boolean;
@@ -711,7 +723,7 @@ THitInfo = record
711
723
712
724
// OLE drag'n drop support
713
725
TFormatEtcArray = array of TFormatEtc;
714
- TFormatArray = array of Word ;
726
+ TFormatArray = array of TClipboardFormat ;
715
727
716
728
// IDataObject.SetData support
717
729
TInternalStgMedium = packed record
@@ -3545,7 +3557,7 @@ TCustomVirtualStringTree = class(TBaseVirtualTree)
3545
3557
destructor Destroy(); override;
3546
3558
function AddChild(Parent: PVirtualNode; UserData: Pointer = nil): PVirtualNode; override;
3547
3559
function ComputeNodeHeight(Canvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; S: String = ''): Integer; virtual;
3548
- function ContentToClipboard(Format: Word ; Source: TVSTTextSourceType): HGLOBAL;
3560
+ function ContentToClipboard(Format: TClipboardFormat ; Source: TVSTTextSourceType): HGLOBAL;
3549
3561
procedure ContentToCustom(Source: TVSTTextSourceType);
3550
3562
function ContentToHTML(Source: TVSTTextSourceType; const Caption: String = ''): String;
3551
3563
function ContentToRTF(Source: TVSTTextSourceType): AnsiString;
@@ -4082,8 +4094,8 @@ TVirtualDrawTree = class(TCustomVirtualDrawTree)
4082
4094
// OLE Clipboard and drag'n drop helper
4083
4095
procedure EnumerateVTClipboardFormats(TreeClass: TVirtualTreeClass; const List: TStrings); overload;
4084
4096
procedure EnumerateVTClipboardFormats(TreeClass: TVirtualTreeClass; var Formats: TFormatEtcArray); overload;
4085
- function GetVTClipboardFormatDescription(AFormat: Word ): string;
4086
- procedure RegisterVTClipboardFormat(AFormat: Word ; TreeClass: TVirtualTreeClass; Priority: Cardinal); overload;
4097
+ function GetVTClipboardFormatDescription(AFormat: TClipboardFormat ): string;
4098
+ procedure RegisterVTClipboardFormat(AFormat: TClipboardFormat ; TreeClass: TVirtualTreeClass; Priority: Cardinal); overload;
4087
4099
function RegisterVTClipboardFormat(Description: string; TreeClass: TVirtualTreeClass; Priority: Cardinal;
4088
4100
tymed: Integer = TYMED_HGLOBAL; ptd: PDVTargetDevice = nil; dwAspect: Integer = DVASPECT_CONTENT;
4089
4101
lindex: Integer = -1): Word; overload;
@@ -4390,8 +4402,8 @@ TClipboardFormatList = class
4390
4402
const AllowedFormats: TClipboardFormats = nil); overload;
4391
4403
procedure EnumerateFormats(TreeClass: TVirtualTreeClass; const Formats: TStrings); overload;
4392
4404
function FindFormat(FormatString: string): PClipboardFormatListEntry; overload;
4393
- function FindFormat(FormatString: string; var Fmt: Word ): TVirtualTreeClass; overload;
4394
- function FindFormat(Fmt: Word ; out Description: string): TVirtualTreeClass; overload;
4405
+ function FindFormat(FormatString: string; var Fmt: TClipboardFormat ): TVirtualTreeClass; overload;
4406
+ function FindFormat(Fmt: TClipboardFormat ; out Description: string): TVirtualTreeClass; overload;
4395
4407
end;
4396
4408
4397
4409
var
@@ -4572,7 +4584,7 @@ function TClipboardFormatList.FindFormat(FormatString: string): PClipboardFormat
4572
4584
4573
4585
//----------------------------------------------------------------------------------------------------------------------
4574
4586
4575
- function TClipboardFormatList.FindFormat(FormatString: string; var Fmt: Word ): TVirtualTreeClass;
4587
+ function TClipboardFormatList.FindFormat(FormatString: string; var Fmt: TClipboardFormat ): TVirtualTreeClass;
4576
4588
4577
4589
var
4578
4590
I: Integer;
@@ -4594,7 +4606,7 @@ function TClipboardFormatList.FindFormat(FormatString: string; var Fmt: Word): T
4594
4606
4595
4607
//----------------------------------------------------------------------------------------------------------------------
4596
4608
4597
- function TClipboardFormatList.FindFormat(Fmt: Word ; out Description: string): TVirtualTreeClass;
4609
+ function TClipboardFormatList.FindFormat(Fmt: TClipboardFormat ; out Description: string): TVirtualTreeClass;
4598
4610
4599
4611
var
4600
4612
I: Integer;
@@ -4667,7 +4679,7 @@ procedure EnumerateVTClipboardFormats(TreeClass: TVirtualTreeClass; var Formats:
4667
4679
4668
4680
//----------------------------------------------------------------------------------------------------------------------
4669
4681
4670
- function GetVTClipboardFormatDescription(AFormat: Word ): string;
4682
+ function GetVTClipboardFormatDescription(AFormat: TClipboardFormat ): string;
4671
4683
4672
4684
begin
4673
4685
if InternalClipboardFormats = nil then
@@ -4678,7 +4690,7 @@ function GetVTClipboardFormatDescription(AFormat: Word): string;
4678
4690
4679
4691
//----------------------------------------------------------------------------------------------------------------------
4680
4692
4681
- procedure RegisterVTClipboardFormat(AFormat: Word ; TreeClass: TVirtualTreeClass; Priority: Cardinal);
4693
+ procedure RegisterVTClipboardFormat(AFormat: TClipboardFormat ; TreeClass: TVirtualTreeClass; Priority: Cardinal);
4682
4694
4683
4695
// Registers the given clipboard format for the given TreeClass.
4684
4696
@@ -7422,8 +7434,9 @@ procedure TVirtualTreeColumn.ComputeHeaderLayout(DC: HDC; const Client: TRect; U
7422
7434
TextSpacing: Integer;
7423
7435
UseText: Boolean;
7424
7436
R: TRect;
7425
- //todo
7426
- //Theme: HTHEME;
7437
+ {$ifdef Windows}
7438
+ Theme: HTHEME;
7439
+ {$endif}
7427
7440
7428
7441
begin
7429
7442
UseText := Length(FText) > 0;
@@ -7460,9 +7473,12 @@ procedure TVirtualTreeColumn.ComputeHeaderLayout(DC: HDC; const Client: TRect; U
7460
7473
if tsUseExplorerTheme in FHeader.Treeview.FStates then
7461
7474
begin
7462
7475
R := Rect(0, 0, 100, 100);
7463
- //Theme := OpenThemeData(FHeader.Treeview.Handle, 'HEADER');
7464
- //GetThemePartSize(Theme, DC, HP_HEADERSORTARROW, HSAS_SORTEDUP, @R, TS_TRUE, SortGlyphSize);
7465
- //CloseThemeData(Theme);
7476
+
7477
+ {$ifdef Windows}
7478
+ Theme := OpenThemeData(FHeader.Treeview.Handle, 'HEADER');
7479
+ GetThemePartSize(Theme, DC, HP_HEADERSORTARROW, HSAS_SORTEDUP, @R, TS_TRUE, SortGlyphSize);
7480
+ CloseThemeData(Theme);
7481
+ {$endif}
7466
7482
end
7467
7483
else
7468
7484
begin
@@ -12235,7 +12251,7 @@ function TClipboardFormats.Add(const S: string): Integer;
12235
12251
// ancestors.
12236
12252
12237
12253
var
12238
- Format: Word ;
12254
+ Format: TClipboardFormat ;
12239
12255
RegisteredClass: TVirtualTreeClass;
12240
12256
12241
12257
begin
@@ -12254,7 +12270,7 @@ procedure TClipboardFormats.Insert(Index: Integer; const S: string);
12254
12270
// ancestors.
12255
12271
12256
12272
var
12257
- Format: Word ;
12273
+ Format: TClipboardFormat ;
12258
12274
RegisteredClass: TVirtualTreeClass;
12259
12275
12260
12276
begin
@@ -14255,7 +14271,9 @@ procedure TBaseVirtualTree.PrepareBitmaps(NeedButtons, NeedLines: Boolean);
14255
14271
Bits: Pointer;
14256
14272
Size: TSize;
14257
14273
{$ifdef ThemeSupport}
14258
- //Theme: HTHEME;
14274
+ {$ifdef Windows}
14275
+ Theme: HTHEME;
14276
+ {$endif}
14259
14277
{$EndIf ThemeSupport}
14260
14278
R: TRect;
14261
14279
@@ -14309,8 +14327,7 @@ procedure TBaseVirtualTree.PrepareBitmaps(NeedButtons, NeedLines: Boolean);
14309
14327
Size.cy := Size.cx;
14310
14328
14311
14329
{$ifdef ThemeSupport}
14312
- //todo
14313
- {
14330
+ {$ifdef Windows}
14314
14331
if tsUseThemes in FStates then
14315
14332
begin
14316
14333
Theme := OpenThemeData(Handle, 'TREEVIEW');
@@ -14322,7 +14339,7 @@ procedure TBaseVirtualTree.PrepareBitmaps(NeedButtons, NeedLines: Boolean);
14322
14339
end
14323
14340
else
14324
14341
Theme := 0;
14325
- }
14342
+ {$endif }
14326
14343
{$endif ThemeSupport}
14327
14344
14328
14345
if NeedButtons then
@@ -14421,9 +14438,8 @@ procedure TBaseVirtualTree.PrepareBitmaps(NeedButtons, NeedLines: Boolean);
14421
14438
end;
14422
14439
14423
14440
{$ifdef ThemeSupport}
14424
- //todo
14441
+ {$ifdef Windows}
14425
14442
// Overwrite glyph images if theme is active.
14426
- {
14427
14443
if (tsUseThemes in FStates) and (Theme <> 0) then
14428
14444
begin
14429
14445
R := Rect(0, 0, Size.cx, Size.cy);
@@ -14440,7 +14456,7 @@ procedure TBaseVirtualTree.PrepareBitmaps(NeedButtons, NeedLines: Boolean);
14440
14456
FHotMinusBM.Canvas.Draw(0, 0, FMinusBM);
14441
14457
end;
14442
14458
end;
14443
- }
14459
+ {$endif }
14444
14460
{$endif ThemeSupport}
14445
14461
end;
14446
14462
@@ -15624,8 +15640,10 @@ procedure TBaseVirtualTree.SetWindowTheme(const Theme: String);
15624
15640
15625
15641
begin
15626
15642
FChangingTheme := True;
15627
- //lcl: todo
15628
- //UxTheme.SetWindowTheme(Handle, PAnsiChar(Theme), nil);
15643
+
15644
+ {$ifdef Windows}
15645
+ UxTheme.SetWindowTheme(Handle, PWideChar(Theme), nil);
15646
+ {$endif}
15629
15647
end;
15630
15648
15631
15649
@@ -24426,7 +24444,9 @@ procedure TBaseVirtualTree.PaintNodeButton(Canvas: TCanvas; Node: PVirtualNode;
24426
24444
Bitmap: TBitmap;
24427
24445
XPos: Integer;
24428
24446
IsHot: Boolean;
24429
- //Theme: HTHEME;
24447
+ {$ifdef Windows}
24448
+ Theme: HTHEME;
24449
+ {$endif}
24430
24450
Glyph: Integer;
24431
24451
State: Integer;
24432
24452
Pos: TRect;
@@ -24445,11 +24465,12 @@ procedure TBaseVirtualTree.PaintNodeButton(Canvas: TCanvas; Node: PVirtualNode;
24445
24465
Glyph := IfThen(IsHot, TVP_HOTGLYPH, TVP_GLYPH);
24446
24466
State := IfThen(vsExpanded in Node.States, GLPS_OPENED, GLPS_CLOSED);
24447
24467
Pos := Rect(XPos, R.Top + ButtonY, XPos + FPlusBM.Width, R.Top + ButtonY + FPlusBM.Height);
24448
- {
24468
+
24469
+ {$ifdef Windows}
24449
24470
Theme := OpenThemeData(Handle, 'TREEVIEW');
24450
24471
DrawThemeBackground(Theme, Canvas.Handle, Glyph, State, Pos, nil);
24451
24472
CloseThemeData(Theme);
24452
- }
24473
+ {$endif }
24453
24474
end
24454
24475
else
24455
24476
begin
@@ -24615,8 +24636,10 @@ procedure TBaseVirtualTree.PrepareCell(var PaintInfo: TVTPaintInfo; WindowOrgX,
24615
24636
FocusRect,
24616
24637
InnerRect: TRect;
24617
24638
{$ifdef ThemeSupport}
24618
- //RowRect: TRect;
24619
- //Theme: HTHEME;
24639
+ {$ifdef Windows}
24640
+ Theme: HTHEME;
24641
+ RowRect: TRect;
24642
+ {$endif}
24620
24643
{$endif ThemeSupport}
24621
24644
24622
24645
//--------------- local functions -------------------------------------------
@@ -24642,8 +24665,7 @@ procedure TBaseVirtualTree.PrepareCell(var PaintInfo: TVTPaintInfo; WindowOrgX,
24642
24665
end;
24643
24666
24644
24667
//---------------------------------------------------------------------------
24645
- //lcl: todo
24646
- {
24668
+ {$ifdef Windows}
24647
24669
procedure DrawBackground(State: Integer);
24648
24670
begin
24649
24671
// if the full row selection is disabled or toGridExtensions is in the MiscOptions, draw the selection
@@ -24665,14 +24687,13 @@ procedure TBaseVirtualTree.PrepareCell(var PaintInfo: TVTPaintInfo; WindowOrgX,
24665
24687
DrawThemeBackground(Theme, PaintInfo.Canvas.Handle, LVP_LISTDETAIL, State, RowRect, nil);
24666
24688
CloseThemeData(Theme);
24667
24689
end;
24668
- }
24690
+ {$endif }
24669
24691
24670
24692
//--------------- end local functions ---------------------------------------
24671
24693
24672
24694
begin
24673
24695
{$ifdef ThemeSupport}
24674
- //todo
24675
- {
24696
+ {$ifdef Windows}
24676
24697
if tsUseExplorerTheme in FStates then
24677
24698
begin
24678
24699
Theme := OpenThemeData(Application.Handle, 'Explorer::TreeView');
@@ -24682,7 +24703,7 @@ procedure TBaseVirtualTree.PrepareCell(var PaintInfo: TVTPaintInfo; WindowOrgX,
24682
24703
if toShowVertGridLines in FOptions.PaintOptions then
24683
24704
Dec(RowRect.Right);
24684
24705
end;
24685
- }
24706
+ {$endif }
24686
24707
{$endif ThemeSupport}
24687
24708
24688
24709
with PaintInfo, Canvas do
@@ -24741,12 +24762,11 @@ procedure TBaseVirtualTree.PrepareCell(var PaintInfo: TVTPaintInfo; WindowOrgX,
24741
24762
(toFullRowSelect in FOptions.FSelectionOptions) then
24742
24763
InnerRect := CellRect;
24743
24764
if not IsRectEmpty(InnerRect) then
24744
- //todo
24745
- {
24765
+ {$ifdef Windows}
24746
24766
if tsUseExplorerTheme in FStates then
24747
24767
DrawBackground(TREIS_SELECTED)
24748
24768
else
24749
- }
24769
+ {$endif }
24750
24770
if MMXAvailable and (toUseBlendedSelection in FOptions.PaintOptions) then
24751
24771
AlphaBlendSelection(Brush.Color)
24752
24772
else
@@ -24777,8 +24797,7 @@ procedure TBaseVirtualTree.PrepareCell(var PaintInfo: TVTPaintInfo; WindowOrgX,
24777
24797
InnerRect := CellRect;
24778
24798
if not IsRectEmpty(InnerRect) then
24779
24799
{$ifdef ThemeSupport}
24780
- //todo
24781
- {
24800
+ {$ifdef Windows}
24782
24801
if Theme <> 0 then
24783
24802
begin
24784
24803
// If the node is also hot, its background will be drawn later.
@@ -24787,7 +24806,7 @@ procedure TBaseVirtualTree.PrepareCell(var PaintInfo: TVTPaintInfo; WindowOrgX,
24787
24806
DrawBackground(IfThen(Self.Focused, TREIS_SELECTED, TREIS_SELECTEDNOTFOCUS));
24788
24807
end
24789
24808
else
24790
- }
24809
+ {$endif }
24791
24810
{$endif ThemeSupport}
24792
24811
if MMXAvailable and (toUseBlendedSelection in FOptions.PaintOptions) then
24793
24812
AlphaBlendSelection(Brush.Color)
@@ -24799,13 +24818,12 @@ procedure TBaseVirtualTree.PrepareCell(var PaintInfo: TVTPaintInfo; WindowOrgX,
24799
24818
end;
24800
24819
24801
24820
{$ifdef ThemeSupport}
24802
- //todo
24803
- {
24821
+ {$ifdef Windows}
24804
24822
if (Theme <> 0) and (toHotTrack in FOptions.FPaintOptions) and (Node = FCurrentHotNode) and
24805
24823
((Column = FCurrentHotColumn) or (toFullRowSelect in FOptions.FSelectionOptions)) then
24806
24824
DrawBackground(IfThen((vsSelected in Node.States) and not (toAlwaysHideSelection in FOptions.FPaintOptions),
24807
24825
TREIS_HOTSELECTED, TREIS_HOT));
24808
- }
24826
+ {$endif }
24809
24827
{$endif ThemeSupport}
24810
24828
24811
24829
if (Column = FFocusedColumn) or (toFullRowSelect in FOptions.FSelectionOptions) then
@@ -24824,37 +24842,34 @@ procedure TBaseVirtualTree.PrepareCell(var PaintInfo: TVTPaintInfo; WindowOrgX,
24824
24842
SetBkColor(Handle, 0);
24825
24843
24826
24844
{$ifdef ThemeSupport}
24827
- //todo
24828
- {
24845
+ {$ifdef Windows}
24829
24846
if not (toExtendedFocus in FOptions.FSelectionOptions) and (toFullRowSelect in FOptions.FSelectionOptions) and
24830
24847
(Theme <> 0) then
24831
24848
FocusRect := RowRect
24832
24849
else
24833
- }
24850
+ {$endif }
24834
24851
{$endif ThemeSupport}
24835
24852
if toGridExtensions in FOptions.FMiscOptions then
24836
24853
FocusRect := CellRect
24837
24854
else
24838
24855
FocusRect := InnerRect;
24839
24856
24840
24857
{$ifdef ThemeSupport}
24841
- //todo
24842
- {
24858
+ {$ifdef Windows}
24843
24859
if tsUseExplorerTheme in FStates then
24844
24860
InflateRect(FocusRect, -1, -1);
24845
- }
24861
+ {$endif }
24846
24862
{$endif ThemeSupport}
24847
24863
24848
24864
if (tsUseExplorerTheme in FStates) and IsWinVistaOrAbove then
24849
24865
begin
24850
24866
//Draw focused unselected style like Windows 7 Explorer
24851
- //lcl: todo
24852
- {
24867
+ {$ifdef Windows}
24853
24868
if not (vsSelected in Node.States) then
24854
24869
DrawThemedFocusRect(LIS_NORMAL)
24855
24870
else
24856
24871
DrawBackground(TREIS_HOTSELECTED);
24857
- }
24872
+ {$endif }
24858
24873
end
24859
24874
else
24860
24875
LCLIntf.DrawFocusRect(Handle, FocusRect);
0 commit comments