1{ $Id: wsstdctrls.pp 58099 2018-06-03 20:36:08Z ondrej $} 2{ 3 ***************************************************************************** 4 * WSStdCtrls.pp * 5 * ------------- * 6 * * 7 * * 8 ***************************************************************************** 9 10 ***************************************************************************** 11 This file is part of the Lazarus Component Library (LCL) 12 13 See the file COPYING.modifiedLGPL.txt, included in this distribution, 14 for details about the license. 15 ***************************************************************************** 16} 17unit WSStdCtrls; 18 19{$mode objfpc}{$H+} 20{$I lcl_defines.inc} 21 22interface 23//////////////////////////////////////////////////// 24// I M P O R T A N T 25//////////////////////////////////////////////////// 26// 1) Only class methods allowed 27// 2) Class methods have to be published and virtual 28// 3) To get as little as posible circles, the uses 29// clause should contain only those LCL units 30// needed for registration. WSxxx units are OK 31// 4) To improve speed, register only classes in the 32// initialization section which actually 33// implement something 34// 5) To enable your XXX widgetset units, look at 35// the uses clause of the XXXintf.pp 36//////////////////////////////////////////////////// 37uses 38 Classes, 39//////////////////////////////////////////////////// 40// To get as little as possible circles, 41// uncomment only when needed for registration 42//////////////////////////////////////////////////// 43 Graphics, Controls, StdCtrls, 44//////////////////////////////////////////////////// 45 Clipbrd, LazUTF8, WSLCLClasses, WSControls, WSFactory; 46 47type 48 { TWSScrollBar } 49 50 TWSScrollBar = class(TWSWinControl) 51 published 52 class procedure SetParams(const AScrollBar: TCustomScrollBar); virtual; 53 class procedure SetKind(const AScrollBar: TCustomScrollBar; const AIsHorizontal: Boolean); virtual; 54 end; 55 TWSScrollBarClass = class of TWSScrollBar; 56 57 { TWSCustomGroupBox } 58 59 TWSCustomGroupBox = class(TWSCustomControl) 60 published 61 end; 62 63 { TWSGroupBox } 64 65 TWSGroupBox = class(TWSCustomGroupBox) 66 published 67 class function GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override; 68 end; 69 70 { TWSCustomComboBox } 71 72 TWSCustomComboBox = class(TWSWinControl) 73 published 74 class function GetDroppedDown(const ACustomComboBox: TCustomComboBox): Boolean; virtual; 75 class function GetSelStart(const ACustomComboBox: TCustomComboBox): integer; virtual; 76 class function GetSelLength(const ACustomComboBox: TCustomComboBox): integer; virtual; 77 class function GetItemIndex(const ACustomComboBox: TCustomComboBox): integer; virtual; 78 class function GetMaxLength(const ACustomComboBox: TCustomComboBox): integer; virtual; 79 80 class procedure SetArrowKeysTraverseList(const ACustomComboBox: TCustomComboBox; 81 NewTraverseList: boolean); virtual; 82 class procedure SetDropDownCount(const ACustomComboBox: TCustomComboBox; NewCount: Integer); virtual; 83 class procedure SetDroppedDown(const ACustomComboBox: TCustomComboBox; ADroppedDown: Boolean); virtual; 84 class procedure SetSelStart(const ACustomComboBox: TCustomComboBox; NewStart: integer); virtual; 85 class procedure SetSelLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); virtual; 86 class procedure SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer); virtual; 87 class procedure SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); virtual; 88 class procedure SetStyle(const ACustomComboBox: TCustomComboBox; NewStyle: TComboBoxStyle); virtual; 89 90 class function GetItems(const ACustomComboBox: TCustomComboBox): TStrings; virtual; 91 class procedure FreeItems(var AItems: TStrings); virtual; 92 class procedure Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean); virtual; 93 94 class function GetItemHeight(const ACustomComboBox: TCustomComboBox): Integer; virtual; 95 class procedure SetItemHeight(const ACustomComboBox: TCustomComboBox; const AItemHeight: Integer); virtual; 96 end; 97 TWSCustomComboBoxClass = class of TWSCustomComboBox; 98 99 { TWSComboBox } 100 101 TWSComboBox = class(TWSCustomComboBox) 102 published 103 end; 104 105 { TWSCustomListBox } 106 107 TWSCustomListBox = class(TWSWinControl) 108 published 109 class procedure DragStart(const ACustomListBox: TCustomListBox); virtual; 110 111 class function GetIndexAtXY(const ACustomListBox: TCustomListBox; X, Y: integer): integer; virtual; 112 class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; virtual; 113 class function GetItemRect(const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect): boolean; virtual; 114 class function GetScrollWidth(const ACustomListBox: TCustomListBox): Integer; virtual; 115 class function GetSelCount(const ACustomListBox: TCustomListBox): integer; virtual; 116 class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; virtual; 117 class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; virtual; 118 class procedure FreeStrings(var AStrings: TStrings); virtual; 119 class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; virtual; 120 121 class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); virtual; 122 123 class procedure SetBorder(const ACustomListBox: TCustomListBox); virtual; 124 class procedure SetColumnCount(const ACustomListBox: TCustomListBox; ACount: Integer); virtual; 125 class procedure SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer); virtual; 126 class procedure SetScrollWidth(const ACustomListBox: TCustomListBox; const AScrollWidth: Integer); virtual; 127 class procedure SetSelectionMode(const ACustomListBox: TCustomListBox; const AExtendedSelect, 128 AMultiSelect: boolean); virtual; 129 class procedure SetStyle(const ACustomListBox: TCustomListBox); virtual; 130 class procedure SetSorted(const ACustomListBox: TCustomListBox; AList: TStrings; ASorted: boolean); virtual; 131 class procedure SetTopIndex(const ACustomListBox: TCustomListBox; const NewTopIndex: integer); virtual; 132 end; 133 TWSCustomListBoxClass = class of TWSCustomListBox; 134 135 { TWSListBox } 136 137 TWSListBox = class(TWSCustomListBox) 138 published 139 end; 140 141 { TWSCustomEdit } 142 143 TWSCustomEdit = class(TWSWinControl) 144 published 145 class function GetCanUndo(const ACustomEdit: TCustomEdit): Boolean; virtual; 146 class function GetCaretPos(const ACustomEdit: TCustomEdit): TPoint; virtual; 147 class function GetSelStart(const ACustomEdit: TCustomEdit): integer; virtual; 148 class function GetSelLength(const ACustomEdit: TCustomEdit): integer; virtual; 149 150 class procedure SetAlignment(const ACustomEdit: TCustomEdit; const AAlignment: TAlignment); virtual; 151 class procedure SetCaretPos(const ACustomEdit: TCustomEdit; const NewPos: TPoint); virtual; 152 class procedure SetCharCase(const ACustomEdit: TCustomEdit; NewCase: TEditCharCase); virtual; 153 class procedure SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode); virtual; 154 class procedure SetHideSelection(const ACustomEdit: TCustomEdit; NewHideSelection: Boolean); virtual; 155 class procedure SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer); virtual; 156 class procedure SetNumbersOnly(const ACustomEdit: TCustomEdit; NewNumbersOnly: Boolean); virtual; 157 class procedure SetPasswordChar(const ACustomEdit: TCustomEdit; NewChar: char); virtual; 158 class procedure SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean); virtual; 159 class procedure SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); virtual; 160 class procedure SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer); virtual; 161 class procedure SetSelText(const ACustomEdit: TCustomEdit; const NewSelText: string); virtual; 162 class procedure SetTextHint(const ACustomEdit: TCustomEdit; const ATextHint: string); virtual; 163 class function CreateEmulatedTextHintFont(const ACustomEdit: TCustomEdit): TFont; virtual; 164 165 class procedure Cut(const ACustomEdit: TCustomEdit); virtual; 166 class procedure Copy(const ACustomEdit: TCustomEdit); virtual; 167 class procedure Paste(const ACustomEdit: TCustomEdit); virtual; 168 class procedure Undo(const ACustomEdit: TCustomEdit); virtual; 169 end; 170 TWSCustomEditClass = class of TWSCustomEdit; 171 172 { TWSCustomMemo } 173 174 TWSCustomMemo = class(TWSCustomEdit) 175 published 176 class procedure AppendText(const ACustomMemo: TCustomMemo; const AText: string); virtual; 177 class function GetStrings(const ACustomMemo: TCustomMemo): TStrings; virtual; 178 class procedure FreeStrings(var AStrings: TStrings); virtual; 179 class procedure SetScrollbars(const ACustomMemo: TCustomMemo; const NewScrollbars: TScrollStyle); virtual; 180 class procedure SetWantTabs(const ACustomMemo: TCustomMemo; const NewWantTabs: boolean); virtual; 181 class procedure SetWantReturns(const ACustomMemo: TCustomMemo; const NewWantReturns: boolean); virtual; 182 class procedure SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean); virtual; 183 class procedure SetSelText(const ACustomEdit: TCustomEdit; const NewSelText: string); override; 184 end; 185 TWSCustomMemoClass = class of TWSCustomMemo; 186 187 { TWSEdit } 188 189 TWSEdit = class(TWSCustomEdit) 190 published 191 end; 192 193 { TWSMemo } 194 195 TWSMemo = class(TWSCustomMemo) 196 published 197 end; 198 199 { TWSCustomStaticText } 200 201 TWSCustomStaticTextClass = class of TWSCustomStaticText; 202 TWSCustomStaticText = class(TWSWinControl) 203 published 204 class procedure SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment); virtual; 205 class procedure SetStaticBorderStyle(const ACustomStaticText: TCustomStaticText; const NewBorderStyle: TStaticBorderStyle); virtual; 206 class function GetDefaultColor(const AControl: TControl; 207 const ADefaultColorType: TDefaultColorType): TColor; override; 208 end; 209 210 { TWSStaticText } 211 212 TWSStaticText = class(TWSCustomStaticText) 213 published 214 end; 215 216 { TWSButtonControl } 217 218 TWSButtonControl = class(TWSWinControl) 219 published 220 class function GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override; 221 end; 222 223 { TWSButton } 224 225 TWSButton = class(TWSButtonControl) 226 published 227 class procedure SetDefault(const AButton: TCustomButton; ADefault: Boolean); virtual; 228 class procedure SetShortCut(const AButton: TCustomButton; const ShortCutK1, ShortCutK2: TShortCut); virtual; 229 end; 230 TWSButtonClass = class of TWSButton; 231 232 { TWSCustomCheckBox } 233 234 TWSCustomCheckBox = class(TWSButtonControl) 235 published 236 class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; virtual; 237 class procedure SetShortCut(const ACustomCheckBox: TCustomCheckBox; const ShortCutK1, ShortCutK2: TShortCut); virtual; 238 class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); virtual; 239 class procedure SetAlignment(const ACustomCheckBox: TCustomCheckBox; const NewAlignment: TLeftRight); virtual; 240 end; 241 TWSCustomCheckBoxClass = class of TWSCustomCheckBox; 242 243 { TWSCheckBox } 244 245 TWSCheckBox = class(TWSCustomCheckBox) 246 published 247 end; 248 249 { TWSToggleBox } 250 251 TWSToggleBox = class(TWSCustomCheckBox) 252 published 253 end; 254 255 { TWSRadioButton } 256 257 TWSRadioButton = class(TWSCustomCheckBox) 258 published 259 end; 260 261 { WidgetSetRegistration } 262 263 procedure RegisterCustomScrollBar; 264 procedure RegisterCustomGroupBox; 265 procedure RegisterCustomComboBox; 266 procedure RegisterCustomListBox; 267 procedure RegisterCustomEdit; 268 procedure RegisterCustomMemo; 269 procedure RegisterButtonControl; 270 procedure RegisterCustomButton; 271 procedure RegisterCustomCheckBox; 272 procedure RegisterToggleBox; 273 procedure RegisterRadioButton; 274 procedure RegisterCustomStaticText; 275 procedure RegisterCustomLabel; 276 277implementation 278 279uses 280 LResources; 281 282{ TWSGroupBox } 283 284class function TWSGroupBox.GetDefaultColor(const AControl: TControl; 285 const ADefaultColorType: TDefaultColorType): TColor; 286begin 287 Result:=DefBtnColors[ADefaultColorType]; 288end; 289 290{ TWSScrollBar } 291 292class procedure TWSScrollBar.SetParams(const AScrollBar: TCustomScrollBar); 293begin 294end; 295 296class procedure TWSScrollBar.SetKind(const AScrollBar: TCustomScrollBar; 297 const AIsHorizontal: Boolean); 298begin 299 RecreateWnd(AScrollBar); 300end; 301 302{ TWSCustomListBox } 303 304class procedure TWSCustomListBox.DragStart(const ACustomListBox: TCustomListBox); 305begin 306end; 307 308class function TWSCustomListBox.GetIndexAtXY( 309 const ACustomListBox: TCustomListBox; X, Y: integer): integer; 310begin 311 Result := -1; 312end; 313 314class function TWSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox): integer; 315begin 316 Result := 0; 317end; 318 319class function TWSCustomListBox.GetItemRect( 320 const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect 321 ): boolean; 322begin 323 FillChar(ARect,SizeOf(ARect),0); 324 Result:=false; 325end; 326 327class function TWSCustomListBox.GetScrollWidth( 328 const ACustomListBox: TCustomListBox): Integer; 329begin 330 Result := 0; 331end; 332 333class function TWSCustomListBox.GetSelCount(const ACustomListBox: TCustomListBox): integer; 334begin 335 Result := 0; 336end; 337 338class function TWSCustomListBox.GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; 339begin 340 Result := false; 341end; 342 343class function TWSCustomListBox.GetStrings(const ACustomListBox: TCustomListBox): TStrings; 344begin 345 Result := nil; 346end; 347 348class procedure TWSCustomListBox.FreeStrings(var AStrings: TStrings); 349begin 350 AStrings.Free; 351 AStrings := nil; 352end; 353 354class function TWSCustomListBox.GetTopIndex(const ACustomListBox: TCustomListBox): integer; 355begin 356 Result := 0; 357end; 358 359class procedure TWSCustomListBox.SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); 360begin 361end; 362 363class procedure TWSCustomListBox.SetBorder(const ACustomListBox: TCustomListBox); 364begin 365end; 366 367class procedure TWSCustomListBox.SetColumnCount(const ACustomListBox: TCustomListBox; 368 ACount: Integer); 369begin 370end; 371 372class procedure TWSCustomListBox.SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer); 373begin 374end; 375 376class procedure TWSCustomListBox.SetScrollWidth( 377 const ACustomListBox: TCustomListBox; const AScrollWidth: Integer); 378begin 379 380end; 381 382class procedure TWSCustomListBox.SetSelectionMode(const ACustomListBox: TCustomListBox; 383 const AExtendedSelect, AMultiSelect: boolean); 384begin 385end; 386 387class procedure TWSCustomListBox.SetStyle(const ACustomListBox: TCustomListBox); 388begin 389end; 390 391class procedure TWSCustomListBox.SetSorted(const ACustomListBox: TCustomListBox; 392 AList: TStrings; ASorted: boolean); 393begin 394end; 395 396class procedure TWSCustomListBox.SetTopIndex(const ACustomListBox: TCustomListBox; 397 const NewTopIndex: integer); 398begin 399end; 400 401{ TWSCustomComboBox } 402 403class function TWSCustomComboBox.GetDroppedDown( 404 const ACustomComboBox: TCustomComboBox): Boolean; 405begin 406 Result := False; 407end; 408 409class function TWSCustomComboBox.GetSelStart(const ACustomComboBox: TCustomComboBox 410 ): integer; 411begin 412 Result := -1; 413end; 414 415class function TWSCustomComboBox.GetSelLength(const ACustomComboBox: TCustomComboBox 416 ): integer; 417begin 418 Result := 0; 419end; 420 421class function TWSCustomComboBox.GetItemIndex(const ACustomComboBox: TCustomComboBox 422 ): integer; 423begin 424 Result := -1; 425end; 426 427class function TWSCustomComboBox.GetMaxLength(const ACustomComboBox: TCustomComboBox 428 ): integer; 429begin 430 Result := 0; 431end; 432 433class procedure TWSCustomComboBox.SetArrowKeysTraverseList( 434 const ACustomComboBox: TCustomComboBox; NewTraverseList: boolean); 435begin 436end; 437 438class procedure TWSCustomComboBox.SetDropDownCount( 439 const ACustomComboBox: TCustomComboBox; NewCount: Integer); 440begin 441end; 442 443class procedure TWSCustomComboBox.SetDroppedDown( 444 const ACustomComboBox: TCustomComboBox; ADroppedDown: Boolean); 445begin 446end; 447 448class procedure TWSCustomComboBox.SetMaxLength(const ACustomComboBox: TCustomComboBox; 449 NewLength: integer); 450begin 451end; 452 453class procedure TWSCustomComboBox.SetSelStart(const ACustomComboBox: TCustomComboBox; 454 NewStart: integer); 455begin 456end; 457 458class procedure TWSCustomComboBox.SetSelLength(const ACustomComboBox: TCustomComboBox; 459 NewLength: integer); 460begin 461end; 462 463class procedure TWSCustomComboBox.SetItemIndex(const ACustomComboBox: TCustomComboBox; 464 NewIndex: integer); 465begin 466end; 467 468class procedure TWSCustomComboBox.SetStyle(const ACustomComboBox: TCustomComboBox; 469 NewStyle: TComboBoxStyle); 470begin 471end; 472 473class function TWSCustomComboBox.GetItems(const ACustomComboBox: TCustomComboBox 474 ): TStrings; 475begin 476 Result := nil; 477end; 478 479class procedure TWSCustomComboBox.FreeItems(var AItems: TStrings); 480begin 481 AItems.Free; 482 AItems := nil; 483end; 484 485class procedure TWSCustomComboBox.Sort(const ACustomComboBox: TCustomComboBox; 486 AList: TStrings; IsSorted: boolean); 487begin 488end; 489 490class function TWSCustomComboBox.GetItemHeight(const ACustomComboBox: TCustomComboBox): Integer; 491begin 492 Result := 0; 493end; 494 495class procedure TWSCustomComboBox.SetItemHeight(const ACustomComboBox: TCustomComboBox; const AItemHeight: Integer); 496begin 497end; 498 499{ TWSCustomEdit } 500 501class function TWSCustomEdit.GetCanUndo(const ACustomEdit: TCustomEdit 502 ): Boolean; 503begin 504 Result := False; 505end; 506 507class function TWSCustomEdit.GetCaretPos(const ACustomEdit: TCustomEdit): TPoint; 508begin 509 Result := Point(0, 0); 510end; 511 512class function TWSCustomEdit.GetSelStart(const ACustomEdit: TCustomEdit): integer; 513begin 514 result := -1; 515end; 516 517class function TWSCustomEdit.GetSelLength(const ACustomEdit: TCustomEdit): integer; 518begin 519 result := 0; 520end; 521 522class procedure TWSCustomEdit.SetAlignment(const ACustomEdit: TCustomEdit; 523 const AAlignment: TAlignment); 524begin 525end; 526 527class procedure TWSCustomEdit.SetCaretPos(const ACustomEdit: TCustomEdit; const NewPos: TPoint); 528begin 529end; 530 531class procedure TWSCustomEdit.SetCharCase(const ACustomEdit: TCustomEdit; NewCase: TEditCharCase); 532begin 533end; 534 535class procedure TWSCustomEdit.SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode); 536begin 537end; 538 539class procedure TWSCustomEdit.SetHideSelection(const ACustomEdit: TCustomEdit; 540 NewHideSelection: Boolean); 541begin 542end; 543 544class procedure TWSCustomEdit.SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer); 545begin 546end; 547 548class procedure TWSCustomEdit.SetNumbersOnly(const ACustomEdit: TCustomEdit; 549 NewNumbersOnly: Boolean); 550begin 551end; 552 553class procedure TWSCustomEdit.SetPasswordChar(const ACustomEdit: TCustomEdit; NewChar: char); 554begin 555end; 556 557class procedure TWSCustomEdit.SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean); 558begin 559end; 560 561class procedure TWSCustomEdit.SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); 562begin 563end; 564 565class procedure TWSCustomEdit.SetTextHint(const ACustomEdit: TCustomEdit; 566 const ATextHint: string); 567begin 568end; 569 570class procedure TWSCustomEdit.SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer); 571begin 572end; 573 574class procedure TWSCustomEdit.SetSelText(const ACustomEdit: TCustomEdit; 575 const NewSelText: string); 576var 577 OldText, NewText: string; 578 OldPos: Integer; 579begin 580 OldPos := ACustomEdit.SelStart; 581 OldText := ACustomEdit.Text; 582 NewText := UTF8Copy(OldText, 1, OldPos) + 583 NewSelText + 584 UTF8Copy(OldText, OldPos + ACustomEdit.SelLength + 1, MaxInt); 585 ACustomEdit.Text := NewText; 586 ACustomEdit.SelStart := OldPos + UTF8Length(NewSelText); 587end; 588 589class procedure TWSCustomEdit.Cut(const ACustomEdit: TCustomEdit); 590begin 591 ACustomEdit.CopyToClipboard; 592 ACustomEdit.ClearSelection; 593end; 594 595class procedure TWSCustomEdit.Copy(const ACustomEdit: TCustomEdit); 596begin 597 if (ACustomEdit.EchoMode = emNormal) and (ACustomEdit.SelLength > 0) then 598 Clipboard.AsText := ACustomEdit.SelText; 599end; 600 601class function TWSCustomEdit.CreateEmulatedTextHintFont( 602 const ACustomEdit: TCustomEdit): TFont; 603begin 604 Result := TFont.Create; 605 try 606 Result.Assign(ACustomEdit.Font); 607 Result.Color := clGrayText; 608 except 609 Result.Free; 610 Result := nil; 611 raise; 612 end; 613end; 614 615class procedure TWSCustomEdit.Paste(const ACustomEdit: TCustomEdit); 616begin 617 if Clipboard.HasFormat(CF_TEXT) then 618 ACustomEdit.SelText := Clipboard.AsText; 619end; 620 621class procedure TWSCustomEdit.Undo(const ACustomEdit: TCustomEdit); 622begin 623 // nothing 624end; 625 626{ TWSCustomMemo } 627 628class procedure TWSCustomMemo.AppendText(const ACustomMemo: TCustomMemo; const AText: string); 629begin 630end; 631 632class function TWSCustomMemo.GetStrings(const ACustomMemo: TCustomMemo): TStrings; 633begin 634 Result := ACustomMemo.Lines; //use default if the WS has not defined any 635end; 636 637class procedure TWSCustomMemo.FreeStrings(var AStrings: TStrings); 638begin 639 AStrings.Free; 640 AStrings := nil; 641end; 642 643class procedure TWSCustomMemo.SetScrollbars(const ACustomMemo: TCustomMemo; const NewScrollbars: TScrollStyle); 644begin 645end; 646 647class procedure TWSCustomMemo.SetSelText(const ACustomEdit: TCustomEdit; 648 const NewSelText: string); 649begin 650 TCustomMemo(ACustomEdit).Lines.BeginUpdate; 651 try 652 TWSCustomEdit.SetSelText(ACustomEdit, NewSelText); 653 finally 654 TCustomMemo(ACustomEdit).Lines.EndUpdate; 655 end; 656end; 657 658class procedure TWSCustomMemo.SetWantTabs(const ACustomMemo: TCustomMemo; const NewWantTabs: boolean); 659begin 660end; 661 662class procedure TWSCustomMemo.SetWantReturns(const ACustomMemo: TCustomMemo; const NewWantReturns: boolean); 663begin 664end; 665 666class procedure TWSCustomMemo.SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean); 667begin 668end; 669 670{ TWSCustomStaticText } 671 672class procedure TWSCustomStaticText.SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment); 673begin 674end; 675 676class procedure TWSCustomStaticText.SetStaticBorderStyle( 677 const ACustomStaticText: TCustomStaticText; 678 const NewBorderStyle: TStaticBorderStyle); 679begin 680 // nothing 681end; 682 683class function TWSCustomStaticText.GetDefaultColor(const AControl: TControl; 684 const ADefaultColorType: TDefaultColorType): TColor; 685begin 686 Result:=DefBtnColors[ADefaultColorType]; 687end; 688 689{ TWSButton } 690 691class procedure TWSButton.SetDefault(const AButton: TCustomButton; ADefault: Boolean); 692begin 693end; 694 695class procedure TWSButton.SetShortCut(const AButton: TCustomButton; 696 const ShortCutK1, ShortCutK2: TShortCut); 697begin; 698end; 699 700{ TWSCustomCheckBox } 701 702class function TWSCustomCheckBox.RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; 703begin 704 Result := cbUnchecked; 705end; 706 707class procedure TWSCustomCheckBox.SetShortCut(const ACustomCheckBox: TCustomCheckBox; 708 const ShortCutK1, ShortCutK2: TShortCut); 709begin 710end; 711 712class procedure TWSCustomCheckBox.SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); 713begin 714end; 715 716class procedure TWSCustomCheckBox.SetAlignment( 717 const ACustomCheckBox: TCustomCheckBox; const NewAlignment: TLeftRight); 718begin 719end; 720 721{ WidgetSetRegistration } 722 723procedure RegisterCustomScrollBar; 724const 725 Done: Boolean = False; 726begin 727 if Done then exit; 728 WSRegisterCustomScrollBar; 729// if not WSRegisterCustomScrollBar then 730// RegisterWSComponent(TCustomScrollBar, TWSCustomScrollBar); 731 Done := True; 732end; 733 734procedure RegisterCustomGroupBox; 735const 736 Done: Boolean = False; 737begin 738 if Done then exit; 739 WSRegisterCustomGroupBox; 740// if not WSRegisterCustomGroupBox then 741// RegisterWSComponent(TCustomGroupBox, TWSCustomGroupBox); 742 Done := True; 743end; 744 745procedure RegisterCustomComboBox; 746const 747 Done: Boolean = False; 748begin 749 if Done then exit; 750 WSRegisterCustomComboBox; 751// if not WSRegisterCustomComboBox then 752// RegisterWSComponent(TCustomComboBox, TWSCustomComboBox); 753 Done := True; 754end; 755 756procedure RegisterCustomListBox; 757const 758 Done: Boolean = False; 759begin 760 if Done then exit; 761 WSRegisterCustomListBox; 762// if not WSRegisterCustomListBox then 763// RegisterWSComponent(TCustomListBox, TWSCustomListBox); 764 Done := True; 765end; 766 767procedure RegisterCustomEdit; 768const 769 Done: Boolean = False; 770begin 771 if Done then exit; 772 WSRegisterCustomEdit; 773// if not WSRegisterCustomEdit then 774// RegisterWSComponent(TCustomEdit, TWSCustomEdit); 775 Done := True; 776end; 777 778procedure RegisterCustomMemo; 779const 780 Done: Boolean = False; 781begin 782 if Done then exit; 783 WSRegisterCustomMemo; 784 RegisterPropertyToSkip(TCustomMemo, 'BevelInner', 'VCL compatibility property', ''); 785 RegisterPropertyToSkip(TCustomMemo, 'BevelOuter', 'VCL compatibility property', ''); 786 RegisterPropertyToSkip(TCustomMemo, 'BevelEdges', 'VCL compatibility property', ''); 787 RegisterPropertyToSkip(TCustomMemo, 'Margins', 'VCL compatibility property', ''); 788// if not WSRegisterCustomMemo then 789// RegisterWSComponent(TCustomMemo, TWSCustomMemo); 790 Done := True; 791end; 792 793procedure RegisterButtonControl; 794const 795 Done: Boolean = False; 796begin 797 if Done then exit; 798 WSRegisterButtonControl; 799 RegisterPropertyToSkip(TButtonControl, 'UseOnChange', 800 'Removed in 0.9.27. It was an old workaround which is not needed anymore.', 801 ''); 802// if not WSRegisterButtonControl then 803// RegisterWSComponent(TButtonControl, TWSButtonControl); 804 Done := True; 805end; 806 807procedure RegisterCustomButton; 808const 809 Done: Boolean = False; 810begin 811 if Done then exit; 812 WSRegisterCustomButton; 813// if not WSRegisterCustomButton then 814// RegisterWSComponent(TCustomButton, TWSButton); 815 Done := True; 816end; 817 818procedure RegisterCustomCheckBox; 819const 820 Done: Boolean = False; 821begin 822 if Done then exit; 823 WSRegisterCustomCheckBox; 824 RegisterPropertyToSkip(TCustomCheckBox, 'Alignment', 'VCL compatibility property', ''); 825 RegisterPropertyToSkip(TCustomCheckBox, 'WordWrap', 'VCL compatibility property', ''); 826// if not WSRegisterCustomCheckBox then 827// RegisterWSComponent(TCustomCheckBox, TWSCustomCheckBox); 828 Done := True; 829end; 830 831procedure RegisterToggleBox; 832const 833 Done: Boolean = False; 834begin 835 if Done then exit; 836 WSRegisterToggleBox; 837// if not WSRegisterToggleBox then 838// RegisterWSComponent(TToggleBox, TWSToggleBox); 839 Done := True; 840end; 841 842procedure RegisterRadioButton; 843const 844 Done: Boolean = False; 845begin 846 if Done then exit; 847 WSRegisterRadioButton; 848 RegisterPropertyToSkip(TRadioButton, 'State', 'Removed in 0.9.29. It should not be allowed to set the State directly', ''); 849 RegisterPropertyToSkip(TRadioButton, 'AllowGrayed', 'Removed in 0.9.29. Grayed state is not supported by TRadioButton', ''); 850// if not WSRegisterRadioButton then 851// RegisterWSComponent(TRadioButton, TWSRadioButton); 852 Done := True; 853end; 854 855procedure RegisterCustomStaticText; 856const 857 Done: Boolean = False; 858begin 859 if Done then exit; 860 WSRegisterCustomStaticText; 861// if not WSRegisterCustomStaticText then 862// RegisterWSComponent(TCustomStaticText, TWSCustomStaticText); 863 Done := True; 864end; 865 866procedure RegisterCustomLabel; 867const 868 Done: Boolean = False; 869begin 870 if Done then exit; 871 WSRegisterCustomLabel; 872// if not WSRegisterCustomLabel then 873// RegisterWSComponent(TCustomLabel, TWSCustomLabel); 874 Done := True; 875end; 876 877{ TWSButtonControl } 878 879class function TWSButtonControl.GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; 880begin 881 Result := DefBtnColors[ADefaultColorType]; 882end; 883 884end. 885