1 | unit Dpi.StdCtrls;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, Controls, StdCtrls, Forms, Dpi.Controls, Dpi.Graphics;
|
---|
7 |
|
---|
8 | type
|
---|
9 | { TMemo }
|
---|
10 |
|
---|
11 | TMemo = class(TWinControl)
|
---|
12 | private
|
---|
13 | NativeMemo: StdCtrls.TMemo;
|
---|
14 | function GetLines: TStrings;
|
---|
15 | function GetReadOnly: Boolean;
|
---|
16 | function GetScrollBars: TScrollStyle;
|
---|
17 | function GetWordWrap: Boolean;
|
---|
18 | procedure SetLines(AValue: TStrings);
|
---|
19 | procedure SetReadOnly(AValue: Boolean);
|
---|
20 | procedure SetScrollBars(AValue: TScrollStyle);
|
---|
21 | procedure SetWordWrap(AValue: Boolean);
|
---|
22 | protected
|
---|
23 | function GetNativeWinControl: Controls.TWinControl; override;
|
---|
24 | function GetNativeMemo: StdCtrls.TMemo; virtual;
|
---|
25 | public
|
---|
26 | procedure Clear;
|
---|
27 | constructor Create(TheOwner: TComponent); override;
|
---|
28 | destructor Destroy; override;
|
---|
29 | published
|
---|
30 | property Lines: TStrings read GetLines write SetLines;
|
---|
31 | property WordWrap: Boolean read GetWordWrap write SetWordWrap default True;
|
---|
32 | property ReadOnly: Boolean read GetReadOnly write SetReadOnly default False;
|
---|
33 | property ScrollBars: TScrollStyle read GetScrollBars write SetScrollBars default ssNone;
|
---|
34 | end;
|
---|
35 |
|
---|
36 | { TEdit }
|
---|
37 |
|
---|
38 | TEdit = class(TWinControl)
|
---|
39 | private
|
---|
40 | function GetSelLength: Integer;
|
---|
41 | function GetSelStart: Integer;
|
---|
42 | procedure SetSelLength(AValue: Integer);
|
---|
43 | procedure SetSelStart(AValue: Integer);
|
---|
44 | protected
|
---|
45 | function GetNativeWinControl: Controls.TWinControl; override;
|
---|
46 | function GetNativeEdit: StdCtrls.TEdit; virtual;
|
---|
47 | function GetText: TCaption; override;
|
---|
48 | procedure SetText(AValue: TCaption); override;
|
---|
49 | public
|
---|
50 | NativeEdit: StdCtrls.TEdit;
|
---|
51 | destructor Destroy; override;
|
---|
52 | property SelLength: Integer read GetSelLength write SetSelLength;
|
---|
53 | property SelStart: Integer read GetSelStart write SetSelStart;
|
---|
54 | published
|
---|
55 | property Text;
|
---|
56 | property BorderStyle default bsSingle;
|
---|
57 | property ParentFont;
|
---|
58 | end;
|
---|
59 |
|
---|
60 | { TComboBox }
|
---|
61 |
|
---|
62 | TComboBox = class(TWinControl)
|
---|
63 | private
|
---|
64 | NativeComboBox: StdCtrls.TComboBox;
|
---|
65 | public
|
---|
66 | function GetNativeComboBox: StdCtrls.TComboBox;
|
---|
67 | constructor Create(TheOwner: TComponent); override;
|
---|
68 | destructor Destroy; override;
|
---|
69 | end;
|
---|
70 |
|
---|
71 | { TCheckBox }
|
---|
72 |
|
---|
73 | TCheckBox = class(TWinControl)
|
---|
74 | private
|
---|
75 | NativeCheckBox: StdCtrls.TCheckBox;
|
---|
76 | public
|
---|
77 | function GetNativeCheckBox: StdCtrls.TCheckBox;
|
---|
78 | constructor Create(TheOwner: TComponent); override;
|
---|
79 | destructor Destroy; override;
|
---|
80 | end;
|
---|
81 |
|
---|
82 | { TRadioButton }
|
---|
83 |
|
---|
84 | TRadioButton = class(TWinControl)
|
---|
85 | private
|
---|
86 | NativeRadioButton: StdCtrls.TRadioButton;
|
---|
87 | public
|
---|
88 | function GetNativeRadioButton: StdCtrls.TRadioButton;
|
---|
89 | constructor Create(TheOwner: TComponent); override;
|
---|
90 | destructor Destroy; override;
|
---|
91 | end;
|
---|
92 |
|
---|
93 | { TButton }
|
---|
94 |
|
---|
95 | TButton = class(TWinControl)
|
---|
96 | private
|
---|
97 | protected
|
---|
98 | function GetNativeWinControl: Controls.TWinControl; override;
|
---|
99 | public
|
---|
100 | NativeButton: StdCtrls.TButton;
|
---|
101 | destructor Destroy; override;
|
---|
102 | published
|
---|
103 | property Visible;
|
---|
104 | end;
|
---|
105 |
|
---|
106 | TDrawItemEvent = procedure(Control: TWinControl; Index: Integer;
|
---|
107 | ARect: TRect; State: TOwnerDrawState) of object;
|
---|
108 | TListBoxStyle = StdCtrls.TListBoxStyle;
|
---|
109 |
|
---|
110 | { TListBox }
|
---|
111 |
|
---|
112 | TListBox = class(TWinControl)
|
---|
113 | private
|
---|
114 | FCanvas: TCanvas;
|
---|
115 | FOnDrawItem: TDrawItemEvent;
|
---|
116 | function GetBorderStyle: TBorderStyle;
|
---|
117 | function GetCount: Integer;
|
---|
118 | function GetExtendedSelect: Boolean;
|
---|
119 | function GetIntegralHeight: Boolean;
|
---|
120 | function GetItemHeight: Integer;
|
---|
121 | function GetItemIndex: Integer;
|
---|
122 | function GetItems: TStrings;
|
---|
123 | function GetOnSelectionChange: TSelectionChangeEvent;
|
---|
124 | function GetParentFont: Boolean;
|
---|
125 | function GetScrollWidth: Integer;
|
---|
126 | function GetStyle: TListBoxStyle;
|
---|
127 | function GetTopIndex: Integer;
|
---|
128 | procedure SetBorderStyle(AValue: TBorderStyle);
|
---|
129 | procedure SetExtendedSelect(AValue: Boolean);
|
---|
130 | procedure SetIntegralHeight(AValue: Boolean);
|
---|
131 | procedure SetItemHeight(AValue: Integer);
|
---|
132 | procedure SetItemIndex(AValue: Integer);
|
---|
133 | procedure SetItems(AValue: TStrings);
|
---|
134 | procedure SetOnDrawItem(AValue: TDrawItemEvent);
|
---|
135 | procedure SetOnSelectionChange(AValue: TSelectionChangeEvent);
|
---|
136 | procedure SetParentFont(AValue: Boolean);
|
---|
137 | procedure SetScrollWidth(AValue: Integer);
|
---|
138 | procedure SetStyle(AValue: TListBoxStyle);
|
---|
139 | procedure SetTopIndex(AValue: Integer);
|
---|
140 | procedure DoDrawItemNative(Control: Controls.TWinControl; Index: Integer;
|
---|
141 | ARect: TRect; State: TOwnerDrawState);
|
---|
142 | protected
|
---|
143 | function GetNativeWinControl: Controls.TWinControl; override;
|
---|
144 | function GetNativeListBox: StdCtrls.TListBox; virtual;
|
---|
145 | public
|
---|
146 | NativeListBox: StdCtrls.TListBox;
|
---|
147 | constructor Create(AOwner: TComponent); override;
|
---|
148 | destructor Destroy; override;
|
---|
149 | property ItemIndex: Integer read GetItemIndex write SetItemIndex;
|
---|
150 | property Items: TStrings read GetItems write SetItems;
|
---|
151 | property Count: Integer read GetCount;
|
---|
152 | property Canvas: TCanvas read FCanvas;
|
---|
153 | published
|
---|
154 | property ParentColor;
|
---|
155 | property TopIndex: Integer read GetTopIndex write SetTopIndex default 0;
|
---|
156 | property ScrollWidth: Integer read GetScrollWidth write SetScrollWidth default 0;
|
---|
157 | property ParentFont: Boolean read GetParentFont write SetParentFont default True;
|
---|
158 | property ItemHeight: Integer read GetItemHeight write SetItemHeight;
|
---|
159 | property IntegralHeight: Boolean read GetIntegralHeight write SetIntegralHeight default False;
|
---|
160 | property ExtendedSelect: Boolean read GetExtendedSelect write SetExtendedSelect default True;
|
---|
161 | property BorderStyle: TBorderStyle read GetBorderStyle write SetBorderStyle default bsNone;
|
---|
162 | property Visible;
|
---|
163 | property Anchors;
|
---|
164 | property OnSelectionChange: TSelectionChangeEvent read GetOnSelectionChange
|
---|
165 | write SetOnSelectionChange;
|
---|
166 | property Style: TListBoxStyle read GetStyle write SetStyle default lbStandard;
|
---|
167 | property OnDrawItem: TDrawItemEvent read FOnDrawItem write SetOnDrawItem;
|
---|
168 | end;
|
---|
169 |
|
---|
170 | { TScrollBar }
|
---|
171 |
|
---|
172 | TScrollBar = class(TWinControl)
|
---|
173 | private
|
---|
174 | function GetKind: TScrollBarKind;
|
---|
175 | function GetMax: Integer;
|
---|
176 | function GetMin: Integer;
|
---|
177 | function GetOnChange: TNotifyEvent;
|
---|
178 | function GetPageSize: Integer;
|
---|
179 | function GetPosition: Integer;
|
---|
180 | procedure SetKind(AValue: TScrollBarKind);
|
---|
181 | procedure SetMax(AValue: Integer);
|
---|
182 | procedure SetMin(AValue: Integer);
|
---|
183 | procedure SetOnChange(AValue: TNotifyEvent);
|
---|
184 | procedure SetPageSize(AValue: Integer);
|
---|
185 | procedure SetPosition(AValue: Integer);
|
---|
186 | protected
|
---|
187 | function GetNativeWinControl: Controls.TWinControl; override;
|
---|
188 | function GetNativeScrollBar: StdCtrls.TScrollBar; virtual;
|
---|
189 | public
|
---|
190 | NativeScrollBar: StdCtrls.TScrollBar;
|
---|
191 | constructor Create(TheOwner: TComponent); override;
|
---|
192 | destructor Destroy; override;
|
---|
193 | published
|
---|
194 | property PageSize: Integer read GetPageSize write SetPageSize;
|
---|
195 | property Min: Integer read GetMin write SetMin default 0;
|
---|
196 | property Max: Integer read GetMax write SetMax default 100;
|
---|
197 | property Position: Integer read GetPosition write SetPosition default 0;
|
---|
198 | property Kind: TScrollBarKind read GetKind write SetKind default sbHorizontal;
|
---|
199 | property OnChange: TNotifyEvent read GetOnChange write SetOnChange;
|
---|
200 | property Visible;
|
---|
201 | end;
|
---|
202 |
|
---|
203 | procedure Register;
|
---|
204 |
|
---|
205 |
|
---|
206 | implementation
|
---|
207 |
|
---|
208 | uses
|
---|
209 | Dpi.Common;
|
---|
210 |
|
---|
211 | procedure Register;
|
---|
212 | begin
|
---|
213 | RegisterComponents(DpiControlsComponentPaletteName, [TEdit, TButton,
|
---|
214 | TScrollBar, TListBox, TCheckBox, TComboBox]);
|
---|
215 | end;
|
---|
216 |
|
---|
217 | { TMemo }
|
---|
218 |
|
---|
219 | function TMemo.GetLines: TStrings;
|
---|
220 | begin
|
---|
221 | Result := GetNativeMemo.Lines;
|
---|
222 | end;
|
---|
223 |
|
---|
224 | function TMemo.GetReadOnly: Boolean;
|
---|
225 | begin
|
---|
226 | Result := GetNativeMemo.ReadOnly;
|
---|
227 | end;
|
---|
228 |
|
---|
229 | function TMemo.GetScrollBars: TScrollStyle;
|
---|
230 | begin
|
---|
231 | Result := GetNativeMemo.ScrollBars;
|
---|
232 | end;
|
---|
233 |
|
---|
234 | function TMemo.GetWordWrap: Boolean;
|
---|
235 | begin
|
---|
236 | Result := GetNativeMemo.WordWrap;
|
---|
237 | end;
|
---|
238 |
|
---|
239 | procedure TMemo.SetLines(AValue: TStrings);
|
---|
240 | begin
|
---|
241 | GetNativeMemo.Lines := AValue;
|
---|
242 | end;
|
---|
243 |
|
---|
244 | procedure TMemo.SetReadOnly(AValue: Boolean);
|
---|
245 | begin
|
---|
246 | GetNativeMemo.ReadOnly := AValue;
|
---|
247 | end;
|
---|
248 |
|
---|
249 | procedure TMemo.SetScrollBars(AValue: TScrollStyle);
|
---|
250 | begin
|
---|
251 | GetNativeMemo.ScrollBars := AValue;
|
---|
252 | end;
|
---|
253 |
|
---|
254 | procedure TMemo.SetWordWrap(AValue: Boolean);
|
---|
255 | begin
|
---|
256 | GetNativeMemo.WordWrap := AValue;
|
---|
257 | end;
|
---|
258 |
|
---|
259 | function TMemo.GetNativeWinControl: Controls.TWinControl;
|
---|
260 | begin
|
---|
261 | Result := GetNativeMemo;
|
---|
262 | end;
|
---|
263 |
|
---|
264 | procedure TMemo.Clear;
|
---|
265 | begin
|
---|
266 | GetNativeMemo.Clear;
|
---|
267 | end;
|
---|
268 |
|
---|
269 | function TMemo.GetNativeMemo: StdCtrls.TMemo;
|
---|
270 | begin
|
---|
271 | if not Assigned(NativeMemo) then NativeMemo := StdCtrls.TMemo.Create(nil);
|
---|
272 | Result := NativeMemo;
|
---|
273 | end;
|
---|
274 |
|
---|
275 | constructor TMemo.Create(TheOwner: TComponent);
|
---|
276 | begin
|
---|
277 | inherited Create(TheOwner);
|
---|
278 | end;
|
---|
279 |
|
---|
280 | destructor TMemo.Destroy;
|
---|
281 | begin
|
---|
282 | FreeAndNil(NativeMemo);
|
---|
283 | inherited;
|
---|
284 | end;
|
---|
285 |
|
---|
286 | { TEdit }
|
---|
287 |
|
---|
288 | function TEdit.GetText: TCaption;
|
---|
289 | begin
|
---|
290 | Result := GetNativeEdit.Text;
|
---|
291 | end;
|
---|
292 |
|
---|
293 | procedure TEdit.SetText(AValue: TCaption);
|
---|
294 | begin
|
---|
295 | GetNativeEdit.Text := AValue;
|
---|
296 | end;
|
---|
297 |
|
---|
298 | destructor TEdit.Destroy;
|
---|
299 | begin
|
---|
300 | FreeAndNil(NativeEdit);
|
---|
301 | inherited;
|
---|
302 | end;
|
---|
303 |
|
---|
304 | function TEdit.GetSelLength: Integer;
|
---|
305 | begin
|
---|
306 | Result := GetNativeEdit.SelLength;
|
---|
307 | end;
|
---|
308 |
|
---|
309 | function TEdit.GetSelStart: Integer;
|
---|
310 | begin
|
---|
311 | Result := GetNativeEdit.SelStart;
|
---|
312 | end;
|
---|
313 |
|
---|
314 | procedure TEdit.SetSelLength(AValue: Integer);
|
---|
315 | begin
|
---|
316 | GetNativeEdit.SelLength := AValue;
|
---|
317 | end;
|
---|
318 |
|
---|
319 | procedure TEdit.SetSelStart(AValue: Integer);
|
---|
320 | begin
|
---|
321 | GetNativeEdit.SelStart := AValue;
|
---|
322 | end;
|
---|
323 |
|
---|
324 | function TEdit.GetNativeWinControl: Controls.TWinControl;
|
---|
325 | begin
|
---|
326 | Result := GetNativeEdit;
|
---|
327 | end;
|
---|
328 |
|
---|
329 | function TEdit.GetNativeEdit: StdCtrls.TEdit;
|
---|
330 | begin
|
---|
331 | if not Assigned(NativeEdit) then NativeEdit := StdCtrls.TEdit.Create(nil);
|
---|
332 | Result := NativeEdit;
|
---|
333 | end;
|
---|
334 |
|
---|
335 | { TCheckBox }
|
---|
336 |
|
---|
337 | function TCheckBox.GetNativeCheckBox: StdCtrls.TCheckBox;
|
---|
338 | begin
|
---|
339 | if not Assigned(NativeCheckBox) then NativeCheckBox := StdCtrls.TCheckBox.Create(nil);
|
---|
340 | Result := NativeCheckBox;
|
---|
341 | end;
|
---|
342 |
|
---|
343 | constructor TCheckBox.Create(TheOwner: TComponent);
|
---|
344 | begin
|
---|
345 | inherited Create(TheOwner);
|
---|
346 | end;
|
---|
347 |
|
---|
348 | destructor TCheckBox.Destroy;
|
---|
349 | begin
|
---|
350 | FreeAndNil(NativeCheckBox);
|
---|
351 | inherited;
|
---|
352 | end;
|
---|
353 |
|
---|
354 | { TComboBox }
|
---|
355 |
|
---|
356 | function TComboBox.GetNativeComboBox: StdCtrls.TComboBox;
|
---|
357 | begin
|
---|
358 | if not Assigned(NativeComboBox) then NativeComboBox := StdCtrls.TComboBox.Create(nil);
|
---|
359 | Result := NativeComboBox;
|
---|
360 | end;
|
---|
361 |
|
---|
362 | constructor TComboBox.Create(TheOwner: TComponent);
|
---|
363 | begin
|
---|
364 | inherited Create(TheOwner);
|
---|
365 | end;
|
---|
366 |
|
---|
367 | destructor TComboBox.Destroy;
|
---|
368 | begin
|
---|
369 | FreeAndNil(NativeComboBox);
|
---|
370 | inherited;
|
---|
371 | end;
|
---|
372 |
|
---|
373 | { TRadioButton }
|
---|
374 |
|
---|
375 | function TRadioButton.GetNativeRadioButton: StdCtrls.TRadioButton;
|
---|
376 | begin
|
---|
377 | if not Assigned(NativeRadioButton) then NativeRadioButton := StdCtrls.TRadioButton.Create(nil);
|
---|
378 | Result := NativeRadioButton;
|
---|
379 | end;
|
---|
380 |
|
---|
381 | constructor TRadioButton.Create(TheOwner: TComponent);
|
---|
382 | begin
|
---|
383 | inherited Create(TheOwner);
|
---|
384 | end;
|
---|
385 |
|
---|
386 | destructor TRadioButton.Destroy;
|
---|
387 | begin
|
---|
388 | FreeAndNil(NativeRadioButton);
|
---|
389 | inherited;
|
---|
390 | end;
|
---|
391 |
|
---|
392 | { TButton }
|
---|
393 |
|
---|
394 | function TButton.GetNativeWinControl: Controls.TWinControl;
|
---|
395 | begin
|
---|
396 | if not Assigned(NativeButton) then NativeButton := StdCtrls.TButton.Create(nil);
|
---|
397 | Result := NativeButton;
|
---|
398 | end;
|
---|
399 |
|
---|
400 | destructor TButton.Destroy;
|
---|
401 | begin
|
---|
402 | FreeAndNil(NativeButton);
|
---|
403 | inherited;
|
---|
404 | end;
|
---|
405 |
|
---|
406 | { TScrollBar }
|
---|
407 |
|
---|
408 | function TScrollBar.GetKind: TScrollBarKind;
|
---|
409 | begin
|
---|
410 | Result := GetNativeScrollBar.Kind;
|
---|
411 | end;
|
---|
412 |
|
---|
413 | function TScrollBar.GetMax: Integer;
|
---|
414 | begin
|
---|
415 | Result := GetNativeScrollBar.Max;
|
---|
416 | end;
|
---|
417 |
|
---|
418 | function TScrollBar.GetMin: Integer;
|
---|
419 | begin
|
---|
420 | Result := GetNativeScrollBar.Min;
|
---|
421 | end;
|
---|
422 |
|
---|
423 | function TScrollBar.GetOnChange: TNotifyEvent;
|
---|
424 | begin
|
---|
425 | Result := GetNativeScrollBar.OnChange;
|
---|
426 | end;
|
---|
427 |
|
---|
428 | function TScrollBar.GetPageSize: Integer;
|
---|
429 | begin
|
---|
430 | Result := GetNativeScrollBar.PageSize;
|
---|
431 | end;
|
---|
432 |
|
---|
433 | function TScrollBar.GetPosition: Integer;
|
---|
434 | begin
|
---|
435 | Result := GetNativeScrollBar.Position;
|
---|
436 | end;
|
---|
437 |
|
---|
438 | procedure TScrollBar.SetKind(AValue: TScrollBarKind);
|
---|
439 | begin
|
---|
440 | GetNativeScrollBar.Kind := AValue;
|
---|
441 | end;
|
---|
442 |
|
---|
443 | procedure TScrollBar.SetMax(AValue: Integer);
|
---|
444 | begin
|
---|
445 | GetNativeScrollBar.Max := AValue;
|
---|
446 | end;
|
---|
447 |
|
---|
448 | procedure TScrollBar.SetMin(AValue: Integer);
|
---|
449 | begin
|
---|
450 | GetNativeScrollBar.Min := Avalue;
|
---|
451 | end;
|
---|
452 |
|
---|
453 | procedure TScrollBar.SetOnChange(AValue: TNotifyEvent);
|
---|
454 | begin
|
---|
455 | GetNativeScrollBar.OnChange := AValue;
|
---|
456 | end;
|
---|
457 |
|
---|
458 | procedure TScrollBar.SetPageSize(AValue: Integer);
|
---|
459 | begin
|
---|
460 | GetNativeScrollBar.PageSize := AValue;
|
---|
461 | end;
|
---|
462 |
|
---|
463 | procedure TScrollBar.SetPosition(AValue: Integer);
|
---|
464 | begin
|
---|
465 | GetNativeScrollBar.Position := AValue;
|
---|
466 | end;
|
---|
467 |
|
---|
468 | function TScrollBar.GetNativeWinControl: Controls.TWinControl;
|
---|
469 | begin
|
---|
470 | Result := GetNativeScrollBar;
|
---|
471 | end;
|
---|
472 |
|
---|
473 | function TScrollBar.GetNativeScrollBar: StdCtrls.TScrollBar;
|
---|
474 | begin
|
---|
475 | if not Assigned(NativeScrollBar) then NativeScrollBar := StdCtrls.TScrollBar.Create(nil);
|
---|
476 | Result := NativeScrollBar;
|
---|
477 | end;
|
---|
478 |
|
---|
479 | constructor TScrollBar.Create(TheOwner: TComponent);
|
---|
480 | begin
|
---|
481 | inherited;
|
---|
482 | end;
|
---|
483 |
|
---|
484 | destructor TScrollBar.Destroy;
|
---|
485 | begin
|
---|
486 | FreeAndNil(NativeScrollBar);
|
---|
487 | inherited;
|
---|
488 | end;
|
---|
489 |
|
---|
490 | { TListBox }
|
---|
491 |
|
---|
492 | function TListBox.GetBorderStyle: TBorderStyle;
|
---|
493 | begin
|
---|
494 | Result := GetNativeListBox.BorderStyle;
|
---|
495 | end;
|
---|
496 |
|
---|
497 | function TListBox.GetCount: Integer;
|
---|
498 | begin
|
---|
499 | Result := GetNativeListBox.Count;
|
---|
500 | end;
|
---|
501 |
|
---|
502 | function TListBox.GetExtendedSelect: Boolean;
|
---|
503 | begin
|
---|
504 | Result := GetNativeListBox.ExtendedSelect;
|
---|
505 | end;
|
---|
506 |
|
---|
507 | function TListBox.GetIntegralHeight: Boolean;
|
---|
508 | begin
|
---|
509 | Result := GetNativeListBox.IntegralHeight;
|
---|
510 | end;
|
---|
511 |
|
---|
512 | function TListBox.GetItemHeight: Integer;
|
---|
513 | begin
|
---|
514 | Result := ScaleFromNative(GetNativeListBox.ItemHeight);
|
---|
515 | end;
|
---|
516 |
|
---|
517 | function TListBox.GetItemIndex: Integer;
|
---|
518 | begin
|
---|
519 | Result := GetNativeListBox.ItemIndex;
|
---|
520 | end;
|
---|
521 |
|
---|
522 | function TListBox.GetItems: TStrings;
|
---|
523 | begin
|
---|
524 | Result := GetNativeListBox.Items;
|
---|
525 | end;
|
---|
526 |
|
---|
527 | function TListBox.GetOnSelectionChange: TSelectionChangeEvent;
|
---|
528 | begin
|
---|
529 | Result := GetNativeListBox.OnSelectionChange;
|
---|
530 | end;
|
---|
531 |
|
---|
532 | function TListBox.GetParentFont: Boolean;
|
---|
533 | begin
|
---|
534 | Result := GetNativeListBox.ParentFont;
|
---|
535 | end;
|
---|
536 |
|
---|
537 | function TListBox.GetScrollWidth: Integer;
|
---|
538 | begin
|
---|
539 | Result := GetNativeListBox.ScrollWidth;
|
---|
540 | end;
|
---|
541 |
|
---|
542 | function TListBox.GetStyle: TListBoxStyle;
|
---|
543 | begin
|
---|
544 | Result := GetNativeListBox.Style;
|
---|
545 | end;
|
---|
546 |
|
---|
547 | function TListBox.GetTopIndex: Integer;
|
---|
548 | begin
|
---|
549 | Result := GetNativeListBox.TopIndex;
|
---|
550 | end;
|
---|
551 |
|
---|
552 | procedure TListBox.SetBorderStyle(AValue: TBorderStyle);
|
---|
553 | begin
|
---|
554 | GetNativeListBox.BorderStyle := AValue;
|
---|
555 | end;
|
---|
556 |
|
---|
557 | procedure TListBox.SetExtendedSelect(AValue: Boolean);
|
---|
558 | begin
|
---|
559 | GetNativeListBox.ExtendedSelect := AValue;
|
---|
560 | end;
|
---|
561 |
|
---|
562 | procedure TListBox.SetIntegralHeight(AValue: Boolean);
|
---|
563 | begin
|
---|
564 | GetNativeListBox.IntegralHeight := AValue;
|
---|
565 | end;
|
---|
566 |
|
---|
567 | procedure TListBox.SetItemHeight(AValue: Integer);
|
---|
568 | begin
|
---|
569 | GetNativeListBox.ItemHeight := ScaleToNative(AValue);
|
---|
570 | end;
|
---|
571 |
|
---|
572 | procedure TListBox.SetItemIndex(AValue: Integer);
|
---|
573 | begin
|
---|
574 | GetNativeListBox.ItemIndex := AValue;
|
---|
575 | end;
|
---|
576 |
|
---|
577 | procedure TListBox.SetItems(AValue: TStrings);
|
---|
578 | begin
|
---|
579 | GetNativeListBox.Items := AValue;
|
---|
580 | end;
|
---|
581 |
|
---|
582 | procedure TListBox.SetOnDrawItem(AValue: TDrawItemEvent);
|
---|
583 | begin
|
---|
584 | FOnDrawItem := AValue;
|
---|
585 | if Assigned(AValue) then
|
---|
586 | GetNativeListBox.OnDrawItem := DoDrawItemNative
|
---|
587 | else GetNativeListBox.OnDrawItem := nil;
|
---|
588 | end;
|
---|
589 |
|
---|
590 | procedure TListBox.SetOnSelectionChange(AValue: TSelectionChangeEvent);
|
---|
591 | begin
|
---|
592 | GetNativeListBox.OnSelectionChange := AValue;
|
---|
593 | end;
|
---|
594 |
|
---|
595 | procedure TListBox.SetParentFont(AValue: Boolean);
|
---|
596 | begin
|
---|
597 | GetNativeListBox.ParentFont := AValue;
|
---|
598 | end;
|
---|
599 |
|
---|
600 | procedure TListBox.SetScrollWidth(AValue: Integer);
|
---|
601 | begin
|
---|
602 | GetNativeListBox.ScrollWidth := AValue;
|
---|
603 | end;
|
---|
604 |
|
---|
605 | procedure TListBox.SetStyle(AValue: TListBoxStyle);
|
---|
606 | begin
|
---|
607 | GetNativeListBox.Style := AValue;
|
---|
608 | end;
|
---|
609 |
|
---|
610 | procedure TListBox.SetTopIndex(AValue: Integer);
|
---|
611 | begin
|
---|
612 | GetNativeListBox.TopIndex := AValue;
|
---|
613 | end;
|
---|
614 |
|
---|
615 | procedure TListBox.DoDrawItemNative(Control: Controls.TWinControl;
|
---|
616 | Index: Integer; ARect: TRect; State: TOwnerDrawState);
|
---|
617 | begin
|
---|
618 | if Assigned(FOnDrawItem) then
|
---|
619 | FOnDrawItem(Self, Index, ScaleRectFromNative(ARect), State);
|
---|
620 | end;
|
---|
621 |
|
---|
622 | function TListBox.GetNativeWinControl: Controls.TWinControl;
|
---|
623 | begin
|
---|
624 | Result := GetNativeListBox;
|
---|
625 | end;
|
---|
626 |
|
---|
627 | function TListBox.GetNativeListBox: StdCtrls.TListBox;
|
---|
628 | begin
|
---|
629 | if not Assigned(NativeListBox) then NativeListBox := StdCtrls.TListBox.Create(nil);
|
---|
630 | Result := NativeListBox;
|
---|
631 | end;
|
---|
632 |
|
---|
633 | constructor TListBox.Create(AOwner: TComponent);
|
---|
634 | begin
|
---|
635 | inherited;
|
---|
636 | FCanvas := TCanvas.Create;
|
---|
637 | FCanvas.NativeCanvas := GetNativeListBox.Canvas;
|
---|
638 | end;
|
---|
639 |
|
---|
640 | destructor TListBox.Destroy;
|
---|
641 | begin
|
---|
642 | FreeAndNil(FCanvas);
|
---|
643 | FreeAndNil(NativeListBox);
|
---|
644 | inherited;
|
---|
645 | end;
|
---|
646 |
|
---|
647 |
|
---|
648 | initialization
|
---|
649 |
|
---|
650 | RegisterClasses([TButton]);
|
---|
651 |
|
---|
652 | end.
|
---|
653 |
|
---|