1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
#ifndef TCUSTOMTREEVIEW_H
#define TCUSTOMTREEVIEW_H
#include <TWinControl.h>
#include <TTreeNode.h>
#include <TCustomImageList.h>
#include <gtk/gtktree.h>
#include <gtk/gtktreeitem.h>
enum THitTest {htAbove, htBelow, htNowhere, htOnItem, htOnButton, htOnIcon,
htOnIndent, htOnLabel, htOnRight, htOnStateIcon, htToLeft, htToRight};
// THitTests = set of THitTest;
enum TSortType {stNone, stData, stText, stBoth};
/*
ETreeViewError = class(Exception);
TTVChangingEvent = procedure(Sender: TObject; Node: TTreeNode;
var AllowChange: Boolean) of object;
TTVChangedEvent = procedure(Sender: TObject; Node: TTreeNode) of object;
TTVEditingEvent = procedure(Sender: TObject; Node: TTreeNode;
var AllowEdit: Boolean) of object;
TTVEditedEvent = procedure(Sender: TObject; Node: TTreeNode; var S: string) of object;
TTVExpandingEvent = procedure(Sender: TObject; Node: TTreeNode;
var AllowExpansion: Boolean) of object;
TTVCollapsingEvent = procedure(Sender: TObject; Node: TTreeNode;
var AllowCollapse: Boolean) of object;
TTVExpandedEvent = procedure(Sender: TObject; Node: TTreeNode) of object;
TTVCompareEvent = procedure(Sender: TObject; Node1, Node2: TTreeNode;
Data: Integer; var Compare: Integer) of object;
TTVCustomDrawEvent = procedure(Sender: TCustomTreeView; const ARect: TRect;
var DefaultDraw: Boolean) of object;
TTVCustomDrawItemEvent = procedure(Sender: TCustomTreeView; Node: TTreeNode;
State: TCustomDrawState; var DefaultDraw: Boolean) of object;
*/
class TTreeNodes;
class TCustomTreeView : public TWinControl {
friend class TTreeNodes;
friend class TTreeNode;
protected:
void init(TComponent *AOwner);
// procedure SetTreeNodes(Value: TTreeNodes);
void SetTreeNodes(TTreeNodes* Value);
// FImages: TCustomImageList;
TCustomImageList *FImages;
// FStateImages: TCustomImageList;
TCustomImageList *FStateImages;
// procedure SetImages(Value: TCustomImageList);
void SetImages(TCustomImageList *val);
TCustomImageList * getImages() { return FImages; }
// procedure SetStateImages(Value: TCustomImageList);
void SetStateImages(TCustomImageList *val);
TCustomImageList * getStateImages() { return FStateImages; }
/*
FAutoExpand: Boolean;
FBorderStyle: TBorderStyle;
FCanvas: TCanvas;
FCanvasChanged: Boolean;
FDefEditProc: Pointer;
FDragged: Boolean;
FDragImage: TDragImageList;
FDragNode: TTreeNode;
FEditHandle: HWND;
FEditInstance: Pointer;
FHideSelection: Boolean;
FHotTrack: Boolean;
FImageChangeLink: TChangeLink;
FLastDropTarget: TTreeNode;
FManualNotify: Boolean;
FMemStream: TMemoryStream;
FRClickNode: TTreeNode;
FRightClickSelect: Boolean;
FReadOnly: Boolean;
FRowSelect: Boolean;
FSaveIndex: Integer;
FSaveIndent: Integer;
FSaveItems: TStringList;
FSaveTopIndex: Integer;
FShowButtons: Boolean;
FShowLines: Boolean;
FShowRoot: Boolean;
FSortType: TSortType;
FStateChanging: Boolean;
FStateChangeLink: TChangeLink;
FToolTips: Boolean;
FWideText: WideString;
FOnEditing: TTVEditingEvent;
FOnEdited: TTVEditedEvent;
FOnExpanded: TTVExpandedEvent;
FOnExpanding: TTVExpandingEvent;
FOnCollapsed: TTVExpandedEvent;
FOnCollapsing: TTVCollapsingEvent;
FOnChanging: TTVChangingEvent;
FOnChange: TTVChangedEvent;
FOnCompare: TTVCompareEvent;
FOnDeletion: TTVExpandedEvent;
FOnCustomDraw: TTVCustomDrawEvent;
FOnCustomDrawItem: TTVCustomDrawItemEvent;
FOnGetImageIndex: TTVExpandedEvent;
FOnGetSelectedIndex: TTVExpandedEvent;
procedure CanvasChanged(Sender: TObject);
procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED;
procedure CMCtl3DChanged(var Message: TMessage); message CM_CTL3DCHANGED;
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure CMDrag(var Message: TCMDrag); message CM_DRAG;
procedure CNNotify(var Message: TWMNotify); message CN_NOTIFY;
procedure EditWndProc(var Message: TMessage);
procedure DoDragOver(Source: TDragObject; X, Y: Integer; CanDrop: Boolean);
function GetChangeDelay: Integer;
function GetDropTarget: TTreeNode;
function GetIndent: Integer;
function GetNodeFromItem(const Item: TTVItem): TTreeNode;
function GetTopItem: TTreeNode;
procedure ImageListChange(Sender: TObject);
procedure SetAutoExpand(Value: Boolean);
procedure SetBorderStyle(Value: TBorderStyle);
procedure SetButtonStyle(Value: Boolean);
procedure SetChangeDelay(Value: Integer);
procedure SetDropTarget(Value: TTreeNode);
procedure SetHideSelection(Value: Boolean);
procedure SetHotTrack(Value: Boolean);
procedure SetImageList(Value: HImageList; Flags: Integer);
procedure SetIndent(Value: Integer);
procedure SetLineStyle(Value: Boolean);
procedure SetReadOnly(Value: Boolean);
procedure SetRootStyle(Value: Boolean);
procedure SetRowSelect(Value: Boolean);
procedure SetSortType(Value: TSortType);
procedure SetToolTips(Value: Boolean);
procedure SetTopItem(Value: TTreeNode);
procedure OnChangeTimer(Sender: TObject);
procedure WMLButtonDown(var Message: TWMLButtonDown); message WM_LBUTTONDOWN;
procedure WMRButtonDown(var Message: TWMRButtonDown); message WM_RBUTTONDOWN;
procedure WMRButtonUp(var Message: TWMRButtonUp); message WM_RBUTTONUP;
procedure WMNotify(var Message: TWMNotify); message WM_NOTIFY;
procedure CMSysColorChange(var Message: TMessage); message CM_SYSCOLORCHANGE;
*/
protected:
// property Items: TTreeNodes read FTreeNodes write SetTreeNodes;
TTreeNodes *FTreeNodes;
property <TCustomTreeView, TTreeNodes*> Items;
TTreeNodes *getItems() { return FTreeNodes; }
// property Images: TCustomImageList read FImages write SetImages;
property <TCustomTreeView, TCustomImageList *> Images;
// property StateImages: TCustomImageList read FStateImages write SetStateImages;
property <TCustomTreeView, TCustomImageList *> StateImages;
// property Selected: TTreeNode read GetSelection write SetSelection;
// function GetSelection: TTreeNode;
// procedure SetSelection(Value: TTreeNode);
TTreeNode *GetSelection();
void SetSelection(TTreeNode *);
/*
FChangeTimer: TTimer;
function CanEdit(Node: TTreeNode): Boolean; dynamic;
function CanChange(Node: TTreeNode): Boolean; dynamic;
function CanCollapse(Node: TTreeNode): Boolean; dynamic;
function CanExpand(Node: TTreeNode): Boolean; dynamic;
procedure Change(Node: TTreeNode); dynamic;
procedure Collapse(Node: TTreeNode); dynamic;
function CreateNode: TTreeNode; virtual;
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
function CustomDraw(const ARect: TRect; Stage: TCustomDrawStage): Boolean; virtual;
function CustomDrawItem(Node: TTreeNode; State: TCustomDrawState;
Stage: TCustomDrawStage): Boolean; virtual;
procedure Delete(Node: TTreeNode); dynamic;
procedure DestroyWnd; override;
procedure DoEndDrag(Target: TObject; X, Y: Integer); override;
procedure DoStartDrag(var DragObject: TDragObject); override;
procedure Edit(const Item: TTVItem); dynamic;
procedure Expand(Node: TTreeNode); dynamic;
function GetDragImages: TDragImageList; override;
procedure GetImageIndex(Node: TTreeNode); virtual;
procedure GetSelectedIndex(Node: TTreeNode); virtual;
function IsCustomDrawn(Target: TCustomDrawTarget; Stage: TCustomDrawStage): Boolean;
procedure Loaded; override;
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
procedure SetDragMode(Value: TDragMode); override;
procedure WndProc(var Message: TMessage); override;
property AutoExpand: Boolean read FAutoExpand write SetAutoExpand default False;
property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle default bsSingle;
property ChangeDelay: Integer read GetChangeDelay write SetChangeDelay default 0;
property HideSelection: Boolean read FHideSelection write SetHideSelection default True;
property HotTrack: Boolean read FHotTrack write SetHotTrack default False;
property Indent: Integer read GetIndent write SetIndent;
property ReadOnly: Boolean read FReadOnly write SetReadOnly default False;
property RightClickSelect: Boolean read FRightClickSelect write FRightClickSelect default False;
property RowSelect: Boolean read FRowSelect write SetRowSelect default False;
property ShowButtons: Boolean read FShowButtons write SetButtonStyle default True;
property ShowLines: Boolean read FShowLines write SetLineStyle default True;
property ShowRoot: Boolean read FShowRoot write SetRootStyle default True;
property SortType: TSortType read FSortType write SetSortType default stNone;
property ToolTips: Boolean read FToolTips write SetToolTips default True;
property OnCustomDraw: TTVCustomDrawEvent read FOnCustomDraw write FOnCustomDraw;
property OnCustomDrawItem: TTVCustomDrawItemEvent read FOnCustomDrawItem write FOnCustomDrawItem;
property OnEditing: TTVEditingEvent read FOnEditing write FOnEditing;
property OnEdited: TTVEditedEvent read FOnEdited write FOnEdited;
property OnExpanding: TTVExpandingEvent read FOnExpanding write FOnExpanding;
property OnExpanded: TTVExpandedEvent read FOnExpanded write FOnExpanded;
property OnCollapsing: TTVCollapsingEvent read FOnCollapsing write FOnCollapsing;
property OnCollapsed: TTVExpandedEvent read FOnCollapsed write FOnCollapsed;
property OnChanging: TTVChangingEvent read FOnChanging write FOnChanging;
property OnChange: TTVChangedEvent read FOnChange write FOnChange;
property OnCompare: TTVCompareEvent read FOnCompare write FOnCompare;
property OnDeletion: TTVExpandedEvent read FOnDeletion write FOnDeletion;
property OnGetImageIndex: TTVExpandedEvent read FOnGetImageIndex write FOnGetImageIndex;
property OnGetSelectedIndex: TTVExpandedEvent read FOnGetSelectedIndex write FOnGetSelectedIndex;
*/
public:
TCustomTreeView(TComponent *AOwner);
TCustomTreeView(GtkWidget *parent);
property <TCustomTreeView, TTreeNode *> Selected;
virtual ~TCustomTreeView();
/*
function AlphaSort: Boolean;
function CustomSort(SortProc: TTVCompare; Data: Longint): Boolean;
procedure FullCollapse;
procedure FullExpand;
function GetHitTestInfoAt(X, Y: Integer): THitTests;
function GetNodeAt(X, Y: Integer): TTreeNode;
function IsEditing: Boolean;
procedure LoadFromFile(const FileName: string);
procedure LoadFromStream(Stream: TStream);
procedure SaveToFile(const FileName: string);
procedure SaveToStream(Stream: TStream);
property Canvas: TCanvas read FCanvas;
property DropTarget: TTreeNode read GetDropTarget write SetDropTarget;
property TopItem: TTreeNode read GetTopItem write SetTopItem;
*/
};
#endif
|