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