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 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901
|
{ $Id$}
{
*****************************************************************************
* WSStdCtrls.pp *
* ------------- *
* *
* *
*****************************************************************************
*****************************************************************************
This file is part of the Lazarus Component Library (LCL)
See the file COPYING.modifiedLGPL.txt, included in this distribution,
for details about the license.
*****************************************************************************
}
unit WSStdCtrls;
{$mode objfpc}{$H+}
{$I lcl_defines.inc}
interface
////////////////////////////////////////////////////
// I M P O R T A N T
////////////////////////////////////////////////////
// 1) Only class methods allowed
// 2) Class methods have to be published and virtual
// 3) To get as little as posible circles, the uses
// clause should contain only those LCL units
// needed for registration. WSxxx units are OK
// 4) To improve speed, register only classes in the
// initialization section which actually
// implement something
// 5) To enable your XXX widgetset units, look at
// the uses clause of the XXXintf.pp
////////////////////////////////////////////////////
uses
Classes,
////////////////////////////////////////////////////
// To get as little as possible circles,
// uncomment only when needed for registration
////////////////////////////////////////////////////
Graphics, Controls, StdCtrls,
////////////////////////////////////////////////////
Clipbrd, LazUTF8, WSLCLClasses, WSControls, WSFactory;
type
{ TWSScrollBar }
TWSScrollBar = class(TWSWinControl)
published
class procedure SetParams(const AScrollBar: TCustomScrollBar); virtual;
class procedure SetKind(const AScrollBar: TCustomScrollBar; const AIsHorizontal: Boolean); virtual;
end;
TWSScrollBarClass = class of TWSScrollBar;
{ TWSCustomGroupBox }
TWSCustomGroupBox = class(TWSCustomControl)
published
end;
{ TWSGroupBox }
TWSGroupBox = class(TWSCustomGroupBox)
published
class function GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override;
end;
{ TWSCustomComboBox }
TWSCustomComboBox = class(TWSWinControl)
published
class function GetDroppedDown(const ACustomComboBox: TCustomComboBox): Boolean; virtual;
class function GetSelStart(const ACustomComboBox: TCustomComboBox): integer; virtual;
class function GetSelLength(const ACustomComboBox: TCustomComboBox): integer; virtual;
class function GetItemIndex(const ACustomComboBox: TCustomComboBox): integer; virtual;
class function GetMaxLength(const ACustomComboBox: TCustomComboBox): integer; virtual;
class procedure SetArrowKeysTraverseList(const ACustomComboBox: TCustomComboBox;
NewTraverseList: boolean); virtual;
class procedure SetDropDownCount(const ACustomComboBox: TCustomComboBox; NewCount: Integer); virtual;
class procedure SetDroppedDown(const ACustomComboBox: TCustomComboBox; ADroppedDown: Boolean); virtual;
class procedure SetSelStart(const ACustomComboBox: TCustomComboBox; NewStart: integer); virtual;
class procedure SetSelLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); virtual;
class procedure SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer); virtual;
class procedure SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); virtual;
class procedure SetStyle(const ACustomComboBox: TCustomComboBox; NewStyle: TComboBoxStyle); virtual;
class procedure SetReadOnly(const ACustomComboBox: TCustomComboBox; NewReadOnly: boolean); virtual;
class procedure SetTextHint(const ACustomComboBox: TCustomComboBox; const ATextHint: string); virtual;
class function GetItems(const ACustomComboBox: TCustomComboBox): TStrings; virtual;
class procedure FreeItems(var AItems: TStrings); virtual;
class procedure Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean); virtual;
class function GetItemHeight(const ACustomComboBox: TCustomComboBox): Integer; virtual;
class procedure SetItemHeight(const ACustomComboBox: TCustomComboBox; const AItemHeight: Integer); virtual;
end;
TWSCustomComboBoxClass = class of TWSCustomComboBox;
{ TWSComboBox }
TWSComboBox = class(TWSCustomComboBox)
published
end;
{ TWSCustomListBox }
TWSCustomListBox = class(TWSWinControl)
published
class procedure DragStart(const ACustomListBox: TCustomListBox); virtual;
class function GetIndexAtXY(const ACustomListBox: TCustomListBox; X, Y: integer): integer; virtual;
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; virtual;
class function GetItemRect(const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect): boolean; virtual;
class function GetScrollWidth(const ACustomListBox: TCustomListBox): Integer; virtual;
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; virtual;
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; virtual;
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; virtual;
class procedure FreeStrings(var AStrings: TStrings); virtual;
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; virtual;
class procedure SelectItem(const ACustomListBox: TCustomListBox;
AIndex: integer; ASelected: boolean); virtual;
class procedure SelectRange(const ACustomListBox: TCustomListBox;
ALow, AHigh: integer; ASelected: boolean); virtual;
class procedure SetBorder(const ACustomListBox: TCustomListBox); virtual;
class procedure SetColumnCount(const ACustomListBox: TCustomListBox; ACount: Integer); virtual;
class procedure SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer); virtual;
class procedure SetScrollWidth(const ACustomListBox: TCustomListBox; const AScrollWidth: Integer); virtual;
class procedure SetSelectionMode(const ACustomListBox: TCustomListBox; const AExtendedSelect,
AMultiSelect: boolean); virtual;
class procedure SetStyle(const ACustomListBox: TCustomListBox); virtual;
class procedure SetSorted(const ACustomListBox: TCustomListBox; AList: TStrings; ASorted: boolean); virtual;
class procedure SetTopIndex(const ACustomListBox: TCustomListBox; const NewTopIndex: integer); virtual;
end;
TWSCustomListBoxClass = class of TWSCustomListBox;
{ TWSListBox }
TWSListBox = class(TWSCustomListBox)
published
end;
{ TWSCustomEdit }
TWSCustomEdit = class(TWSWinControl)
published
class function GetCanUndo(const ACustomEdit: TCustomEdit): Boolean; virtual;
class function GetCaretPos(const ACustomEdit: TCustomEdit): TPoint; virtual;
class function GetSelStart(const ACustomEdit: TCustomEdit): integer; virtual;
class function GetSelLength(const ACustomEdit: TCustomEdit): integer; virtual;
class procedure SetAlignment(const ACustomEdit: TCustomEdit; const AAlignment: TAlignment); virtual;
class procedure SetCaretPos(const ACustomEdit: TCustomEdit; const NewPos: TPoint); virtual;
class procedure SetCharCase(const ACustomEdit: TCustomEdit; NewCase: TEditCharCase); virtual;
class procedure SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode); virtual;
class procedure SetHideSelection(const ACustomEdit: TCustomEdit; NewHideSelection: Boolean); virtual;
class procedure SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer); virtual;
class procedure SetNumbersOnly(const ACustomEdit: TCustomEdit; NewNumbersOnly: Boolean); virtual;
class procedure SetPasswordChar(const ACustomEdit: TCustomEdit; NewChar: char); virtual;
class procedure SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean); virtual;
class procedure SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); virtual;
class procedure SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer); virtual;
class procedure SetSelText(const ACustomEdit: TCustomEdit; const NewSelText: string); virtual;
class procedure SetTextHint(const ACustomEdit: TCustomEdit; const ATextHint: string); virtual;
class procedure Cut(const ACustomEdit: TCustomEdit); virtual;
class procedure Copy(const ACustomEdit: TCustomEdit); virtual;
class procedure Paste(const ACustomEdit: TCustomEdit); virtual;
class procedure Undo(const ACustomEdit: TCustomEdit); virtual;
end;
TWSCustomEditClass = class of TWSCustomEdit;
{ TWSCustomMemo }
TWSCustomMemo = class(TWSCustomEdit)
published
class procedure AppendText(const ACustomMemo: TCustomMemo; const AText: string); virtual;
class function GetStrings(const ACustomMemo: TCustomMemo): TStrings; virtual;
class procedure FreeStrings(var AStrings: TStrings); virtual;
class procedure SetScrollbars(const ACustomMemo: TCustomMemo; const NewScrollbars: TScrollStyle); virtual;
class procedure SetWantTabs(const ACustomMemo: TCustomMemo; const NewWantTabs: boolean); virtual;
class procedure SetWantReturns(const ACustomMemo: TCustomMemo; const NewWantReturns: boolean); virtual;
class procedure SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean); virtual;
class procedure SetSelText(const ACustomEdit: TCustomEdit; const NewSelText: string); override;
end;
TWSCustomMemoClass = class of TWSCustomMemo;
{ TWSEdit }
TWSEdit = class(TWSCustomEdit)
published
end;
{ TWSMemo }
TWSMemo = class(TWSCustomMemo)
published
end;
{ TWSCustomStaticText }
TWSCustomStaticTextClass = class of TWSCustomStaticText;
TWSCustomStaticText = class(TWSWinControl)
published
class procedure SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment); virtual;
class procedure SetStaticBorderStyle(const ACustomStaticText: TCustomStaticText; const NewBorderStyle: TStaticBorderStyle); virtual;
class function GetDefaultColor(const AControl: TControl;
const ADefaultColorType: TDefaultColorType): TColor; override;
end;
{ TWSStaticText }
TWSStaticText = class(TWSCustomStaticText)
published
end;
{ TWSButtonControl }
TWSButtonControl = class(TWSWinControl)
published
class function GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override;
end;
{ TWSButton }
TWSButton = class(TWSButtonControl)
published
class procedure SetDefault(const AButton: TCustomButton; ADefault: Boolean); virtual;
class procedure SetShortCut(const AButton: TCustomButton; const ShortCutK1, ShortCutK2: TShortCut); virtual;
end;
TWSButtonClass = class of TWSButton;
{ TWSCustomCheckBox }
TWSCustomCheckBox = class(TWSButtonControl)
published
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; virtual;
class procedure SetShortCut(const ACustomCheckBox: TCustomCheckBox; const ShortCutK1, ShortCutK2: TShortCut); virtual;
class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); virtual;
class procedure SetAlignment(const ACustomCheckBox: TCustomCheckBox; const NewAlignment: TLeftRight); virtual;
end;
TWSCustomCheckBoxClass = class of TWSCustomCheckBox;
{ TWSCheckBox }
TWSCheckBox = class(TWSCustomCheckBox)
published
end;
{ TWSToggleBox }
TWSToggleBox = class(TWSCustomCheckBox)
published
end;
{ TWSRadioButton }
TWSRadioButton = class(TWSCustomCheckBox)
published
end;
{ WidgetSetRegistration }
procedure RegisterCustomScrollBar;
procedure RegisterCustomGroupBox;
procedure RegisterCustomComboBox;
procedure RegisterCustomListBox;
procedure RegisterCustomEdit;
procedure RegisterCustomMemo;
procedure RegisterButtonControl;
procedure RegisterCustomButton;
procedure RegisterCustomCheckBox;
procedure RegisterToggleBox;
procedure RegisterRadioButton;
procedure RegisterCustomStaticText;
procedure RegisterCustomLabel;
implementation
uses
LResources;
{ TWSGroupBox }
class function TWSGroupBox.GetDefaultColor(const AControl: TControl;
const ADefaultColorType: TDefaultColorType): TColor;
begin
Result:=DefBtnColors[ADefaultColorType];
end;
{ TWSScrollBar }
class procedure TWSScrollBar.SetParams(const AScrollBar: TCustomScrollBar);
begin
end;
class procedure TWSScrollBar.SetKind(const AScrollBar: TCustomScrollBar;
const AIsHorizontal: Boolean);
begin
RecreateWnd(AScrollBar);
end;
{ TWSCustomListBox }
class procedure TWSCustomListBox.DragStart(const ACustomListBox: TCustomListBox);
begin
end;
class function TWSCustomListBox.GetIndexAtXY(
const ACustomListBox: TCustomListBox; X, Y: integer): integer;
begin
Result := -1;
end;
class function TWSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox): integer;
begin
Result := 0;
end;
class function TWSCustomListBox.GetItemRect(
const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect
): boolean;
begin
FillChar(ARect,SizeOf(ARect),0);
Result:=false;
end;
class function TWSCustomListBox.GetScrollWidth(
const ACustomListBox: TCustomListBox): Integer;
begin
Result := 0;
end;
class function TWSCustomListBox.GetSelCount(const ACustomListBox: TCustomListBox): integer;
begin
Result := 0;
end;
class function TWSCustomListBox.GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean;
begin
Result := false;
end;
class function TWSCustomListBox.GetStrings(const ACustomListBox: TCustomListBox): TStrings;
begin
Result := nil;
end;
class procedure TWSCustomListBox.FreeStrings(var AStrings: TStrings);
begin
AStrings.Free;
AStrings := nil;
end;
class function TWSCustomListBox.GetTopIndex(const ACustomListBox: TCustomListBox): integer;
begin
Result := 0;
end;
class procedure TWSCustomListBox.SelectItem(const ACustomListBox: TCustomListBox;
AIndex: integer; ASelected: boolean);
begin
end;
class procedure TWSCustomListBox.SelectRange(const ACustomListBox: TCustomListBox;
ALow, AHigh: integer; ASelected: boolean);
var
OldTopIndex, i: Integer;
begin // A default implementation. A widgetset can override it with a better one.
OldTopIndex := ACustomListBox.TopIndex; //prevent scrolling to last Item selected on Windows, Issue #0036929
ACustomListBox.Items.BeginUpdate; //prevent visual update when selecting large ranges on Windows, Issue #0036929
try
for i := ALow to AHigh do
SelectItem(ACustomListBox, i, ASelected);
ACustomListBox.TopIndex := OldTopIndex;
finally
ACustomListBox.Items.EndUpdate;
end;
end;
class procedure TWSCustomListBox.SetBorder(const ACustomListBox: TCustomListBox);
begin
end;
class procedure TWSCustomListBox.SetColumnCount(const ACustomListBox: TCustomListBox;
ACount: Integer);
begin
end;
class procedure TWSCustomListBox.SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer);
begin
end;
class procedure TWSCustomListBox.SetScrollWidth(
const ACustomListBox: TCustomListBox; const AScrollWidth: Integer);
begin
end;
class procedure TWSCustomListBox.SetSelectionMode(const ACustomListBox: TCustomListBox;
const AExtendedSelect, AMultiSelect: boolean);
begin
end;
class procedure TWSCustomListBox.SetStyle(const ACustomListBox: TCustomListBox);
begin
end;
class procedure TWSCustomListBox.SetSorted(const ACustomListBox: TCustomListBox;
AList: TStrings; ASorted: boolean);
begin
end;
class procedure TWSCustomListBox.SetTopIndex(const ACustomListBox: TCustomListBox;
const NewTopIndex: integer);
begin
end;
{ TWSCustomComboBox }
class function TWSCustomComboBox.GetDroppedDown(
const ACustomComboBox: TCustomComboBox): Boolean;
begin
Result := False;
end;
class function TWSCustomComboBox.GetSelStart(const ACustomComboBox: TCustomComboBox
): integer;
begin
Result := -1;
end;
class function TWSCustomComboBox.GetSelLength(const ACustomComboBox: TCustomComboBox
): integer;
begin
Result := 0;
end;
class function TWSCustomComboBox.GetItemIndex(const ACustomComboBox: TCustomComboBox
): integer;
begin
Result := -1;
end;
class function TWSCustomComboBox.GetMaxLength(const ACustomComboBox: TCustomComboBox
): integer;
begin
Result := 0;
end;
class procedure TWSCustomComboBox.SetArrowKeysTraverseList(
const ACustomComboBox: TCustomComboBox; NewTraverseList: boolean);
begin
end;
class procedure TWSCustomComboBox.SetDropDownCount(
const ACustomComboBox: TCustomComboBox; NewCount: Integer);
begin
end;
class procedure TWSCustomComboBox.SetDroppedDown(
const ACustomComboBox: TCustomComboBox; ADroppedDown: Boolean);
begin
end;
class procedure TWSCustomComboBox.SetMaxLength(const ACustomComboBox: TCustomComboBox;
NewLength: integer);
begin
end;
class procedure TWSCustomComboBox.SetSelStart(const ACustomComboBox: TCustomComboBox;
NewStart: integer);
begin
end;
class procedure TWSCustomComboBox.SetSelLength(const ACustomComboBox: TCustomComboBox;
NewLength: integer);
begin
end;
class procedure TWSCustomComboBox.SetItemIndex(const ACustomComboBox: TCustomComboBox;
NewIndex: integer);
begin
end;
class procedure TWSCustomComboBox.SetStyle(const ACustomComboBox: TCustomComboBox;
NewStyle: TComboBoxStyle);
begin
end;
class procedure TWSCustomComboBox.SetReadOnly(const ACustomComboBox: TCustomComboBox;
NewReadOnly: boolean);
begin
end;
class procedure TWSCustomComboBox.SetTextHint(
const ACustomComboBox: TCustomComboBox; const ATextHint: string);
begin
end;
class function TWSCustomComboBox.GetItems(const ACustomComboBox: TCustomComboBox
): TStrings;
begin
Result := nil;
end;
class procedure TWSCustomComboBox.FreeItems(var AItems: TStrings);
begin
AItems.Free;
AItems := nil;
end;
class procedure TWSCustomComboBox.Sort(const ACustomComboBox: TCustomComboBox;
AList: TStrings; IsSorted: boolean);
begin
end;
class function TWSCustomComboBox.GetItemHeight(const ACustomComboBox: TCustomComboBox): Integer;
begin
Result := 0;
end;
class procedure TWSCustomComboBox.SetItemHeight(const ACustomComboBox: TCustomComboBox; const AItemHeight: Integer);
begin
end;
{ TWSCustomEdit }
class function TWSCustomEdit.GetCanUndo(const ACustomEdit: TCustomEdit
): Boolean;
begin
Result := False;
end;
class function TWSCustomEdit.GetCaretPos(const ACustomEdit: TCustomEdit): TPoint;
begin
Result := Point(0, 0);
end;
class function TWSCustomEdit.GetSelStart(const ACustomEdit: TCustomEdit): integer;
begin
result := -1;
end;
class function TWSCustomEdit.GetSelLength(const ACustomEdit: TCustomEdit): integer;
begin
result := 0;
end;
class procedure TWSCustomEdit.SetAlignment(const ACustomEdit: TCustomEdit;
const AAlignment: TAlignment);
begin
end;
class procedure TWSCustomEdit.SetCaretPos(const ACustomEdit: TCustomEdit; const NewPos: TPoint);
begin
end;
class procedure TWSCustomEdit.SetCharCase(const ACustomEdit: TCustomEdit; NewCase: TEditCharCase);
begin
end;
class procedure TWSCustomEdit.SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode);
begin
end;
class procedure TWSCustomEdit.SetHideSelection(const ACustomEdit: TCustomEdit;
NewHideSelection: Boolean);
begin
end;
class procedure TWSCustomEdit.SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer);
begin
end;
class procedure TWSCustomEdit.SetNumbersOnly(const ACustomEdit: TCustomEdit;
NewNumbersOnly: Boolean);
begin
end;
class procedure TWSCustomEdit.SetPasswordChar(const ACustomEdit: TCustomEdit; NewChar: char);
begin
end;
class procedure TWSCustomEdit.SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean);
begin
end;
class procedure TWSCustomEdit.SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer);
begin
end;
class procedure TWSCustomEdit.SetTextHint(const ACustomEdit: TCustomEdit;
const ATextHint: string);
begin
end;
class procedure TWSCustomEdit.SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer);
begin
end;
class procedure TWSCustomEdit.SetSelText(const ACustomEdit: TCustomEdit;
const NewSelText: string);
var
OldText, NewText: string;
OldPos: Integer;
begin
OldPos := ACustomEdit.SelStart;
OldText := ACustomEdit.Text;
NewText := UTF8Copy(OldText, 1, OldPos) +
NewSelText +
UTF8Copy(OldText, OldPos + ACustomEdit.SelLength + 1, MaxInt);
ACustomEdit.Text := NewText;
ACustomEdit.SelStart := OldPos + UTF8Length(NewSelText);
end;
class procedure TWSCustomEdit.Cut(const ACustomEdit: TCustomEdit);
begin
ACustomEdit.CopyToClipboard;
ACustomEdit.ClearSelection;
end;
class procedure TWSCustomEdit.Copy(const ACustomEdit: TCustomEdit);
begin
if (ACustomEdit.EchoMode = emNormal) and (ACustomEdit.SelLength > 0) then
Clipboard.AsText := ACustomEdit.SelText;
end;
class procedure TWSCustomEdit.Paste(const ACustomEdit: TCustomEdit);
begin
if Clipboard.HasFormat(CF_TEXT) then
ACustomEdit.SelText := Clipboard.AsText;
end;
class procedure TWSCustomEdit.Undo(const ACustomEdit: TCustomEdit);
begin
// nothing
end;
{ TWSCustomMemo }
class procedure TWSCustomMemo.AppendText(const ACustomMemo: TCustomMemo; const AText: string);
begin
end;
class function TWSCustomMemo.GetStrings(const ACustomMemo: TCustomMemo): TStrings;
begin
Result := ACustomMemo.Lines; //use default if the WS has not defined any
end;
class procedure TWSCustomMemo.FreeStrings(var AStrings: TStrings);
begin
AStrings.Free;
AStrings := nil;
end;
class procedure TWSCustomMemo.SetScrollbars(const ACustomMemo: TCustomMemo; const NewScrollbars: TScrollStyle);
begin
end;
class procedure TWSCustomMemo.SetSelText(const ACustomEdit: TCustomEdit;
const NewSelText: string);
begin
TCustomMemo(ACustomEdit).Lines.BeginUpdate;
try
TWSCustomEdit.SetSelText(ACustomEdit, NewSelText);
finally
TCustomMemo(ACustomEdit).Lines.EndUpdate;
end;
end;
class procedure TWSCustomMemo.SetWantTabs(const ACustomMemo: TCustomMemo; const NewWantTabs: boolean);
begin
end;
class procedure TWSCustomMemo.SetWantReturns(const ACustomMemo: TCustomMemo; const NewWantReturns: boolean);
begin
end;
class procedure TWSCustomMemo.SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean);
begin
end;
{ TWSCustomStaticText }
class procedure TWSCustomStaticText.SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment);
begin
end;
class procedure TWSCustomStaticText.SetStaticBorderStyle(
const ACustomStaticText: TCustomStaticText;
const NewBorderStyle: TStaticBorderStyle);
begin
// nothing
end;
class function TWSCustomStaticText.GetDefaultColor(const AControl: TControl;
const ADefaultColorType: TDefaultColorType): TColor;
begin
Result:=DefBtnColors[ADefaultColorType];
end;
{ TWSButton }
class procedure TWSButton.SetDefault(const AButton: TCustomButton; ADefault: Boolean);
begin
end;
class procedure TWSButton.SetShortCut(const AButton: TCustomButton;
const ShortCutK1, ShortCutK2: TShortCut);
begin;
end;
{ TWSCustomCheckBox }
class function TWSCustomCheckBox.RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState;
begin
Result := cbUnchecked;
end;
class procedure TWSCustomCheckBox.SetShortCut(const ACustomCheckBox: TCustomCheckBox;
const ShortCutK1, ShortCutK2: TShortCut);
begin
end;
class procedure TWSCustomCheckBox.SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState);
begin
end;
class procedure TWSCustomCheckBox.SetAlignment(
const ACustomCheckBox: TCustomCheckBox; const NewAlignment: TLeftRight);
begin
end;
{ WidgetSetRegistration }
procedure RegisterCustomScrollBar;
const
Done: Boolean = False;
begin
if Done then exit;
WSRegisterCustomScrollBar;
// if not WSRegisterCustomScrollBar then
// RegisterWSComponent(TCustomScrollBar, TWSCustomScrollBar);
Done := True;
end;
procedure RegisterCustomGroupBox;
const
Done: Boolean = False;
begin
if Done then exit;
WSRegisterCustomGroupBox;
// if not WSRegisterCustomGroupBox then
// RegisterWSComponent(TCustomGroupBox, TWSCustomGroupBox);
Done := True;
end;
procedure RegisterCustomComboBox;
const
Done: Boolean = False;
begin
if Done then exit;
WSRegisterCustomComboBox;
// if not WSRegisterCustomComboBox then
// RegisterWSComponent(TCustomComboBox, TWSCustomComboBox);
Done := True;
end;
procedure RegisterCustomListBox;
const
Done: Boolean = False;
begin
if Done then exit;
WSRegisterCustomListBox;
// if not WSRegisterCustomListBox then
// RegisterWSComponent(TCustomListBox, TWSCustomListBox);
Done := True;
end;
procedure RegisterCustomEdit;
const
Done: Boolean = False;
begin
if Done then exit;
WSRegisterCustomEdit;
// if not WSRegisterCustomEdit then
// RegisterWSComponent(TCustomEdit, TWSCustomEdit);
Done := True;
end;
procedure RegisterCustomMemo;
const
Done: Boolean = False;
begin
if Done then exit;
WSRegisterCustomMemo;
RegisterPropertyToSkip(TCustomMemo, 'BevelInner', 'VCL compatibility property', '');
RegisterPropertyToSkip(TCustomMemo, 'BevelOuter', 'VCL compatibility property', '');
RegisterPropertyToSkip(TCustomMemo, 'BevelEdges', 'VCL compatibility property', '');
RegisterPropertyToSkip(TCustomMemo, 'Margins', 'VCL compatibility property', '');
// if not WSRegisterCustomMemo then
// RegisterWSComponent(TCustomMemo, TWSCustomMemo);
Done := True;
end;
procedure RegisterButtonControl;
const
Done: Boolean = False;
begin
if Done then exit;
WSRegisterButtonControl;
RegisterPropertyToSkip(TButtonControl, 'UseOnChange',
'Removed in 0.9.27. It was an old workaround which is not needed anymore.',
'');
// if not WSRegisterButtonControl then
// RegisterWSComponent(TButtonControl, TWSButtonControl);
Done := True;
end;
procedure RegisterCustomButton;
const
Done: Boolean = False;
begin
if Done then exit;
WSRegisterCustomButton;
// if not WSRegisterCustomButton then
// RegisterWSComponent(TCustomButton, TWSButton);
Done := True;
end;
procedure RegisterCustomCheckBox;
const
Done: Boolean = False;
begin
if Done then exit;
WSRegisterCustomCheckBox;
RegisterPropertyToSkip(TCustomCheckBox, 'Alignment', 'VCL compatibility property', '');
RegisterPropertyToSkip(TCustomCheckBox, 'WordWrap', 'VCL compatibility property', '');
// if not WSRegisterCustomCheckBox then
// RegisterWSComponent(TCustomCheckBox, TWSCustomCheckBox);
Done := True;
end;
procedure RegisterToggleBox;
const
Done: Boolean = False;
begin
if Done then exit;
WSRegisterToggleBox;
// if not WSRegisterToggleBox then
// RegisterWSComponent(TToggleBox, TWSToggleBox);
Done := True;
end;
procedure RegisterRadioButton;
const
Done: Boolean = False;
begin
if Done then exit;
WSRegisterRadioButton;
RegisterPropertyToSkip(TRadioButton, 'State', 'Removed in 0.9.29. It should not be allowed to set the State directly', '');
RegisterPropertyToSkip(TRadioButton, 'AllowGrayed', 'Removed in 0.9.29. Grayed state is not supported by TRadioButton', '');
// if not WSRegisterRadioButton then
// RegisterWSComponent(TRadioButton, TWSRadioButton);
Done := True;
end;
procedure RegisterCustomStaticText;
const
Done: Boolean = False;
begin
if Done then exit;
WSRegisterCustomStaticText;
// if not WSRegisterCustomStaticText then
// RegisterWSComponent(TCustomStaticText, TWSCustomStaticText);
Done := True;
end;
procedure RegisterCustomLabel;
const
Done: Boolean = False;
begin
if Done then exit;
WSRegisterCustomLabel;
// if not WSRegisterCustomLabel then
// RegisterWSComponent(TCustomLabel, TWSCustomLabel);
Done := True;
end;
{ TWSButtonControl }
class function TWSButtonControl.GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor;
begin
Result := DefBtnColors[ADefaultColorType];
end;
end.
|