/usr/lib/lazarus/0.9.30.4/lcl/stdctrls.pp is in lazarus-src-0.9.30.4 0.9.30.4-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 | {
/***************************************************************************
stdctrls.pp
-----------
Initial Revision : Tue Oct 19 CST 1999
***************************************************************************/
*****************************************************************************
* *
* This file is part of the Lazarus Component Library (LCL) *
* *
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
* for details about the copyright. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
*****************************************************************************
}
unit StdCtrls;
{$mode objfpc}{$H+}
{$I lcl_defines.inc}
interface
uses
Classes, SysUtils, types, LCLStrConsts, LCLType, LCLProc, LMessages, Graphics,
GraphType, ExtendedStrings, LCLIntf, ClipBrd, ActnList, Controls,
TextStrings, Forms, Menus, LResources;
type
{ TCustomEdit Options}
TEditCharCase = (ecNormal, ecUppercase, ecLowerCase);
TEchoMode = (emNormal, emNone, emPassword);
{ TScrollBar }
TScrollStyle = (ssNone, ssHorizontal, ssVertical, ssBoth,
ssAutoHorizontal, ssAutoVertical, ssAutoBoth);
TScrollCode = (
// !!! Beware. The position of these enums must correspond to the SB_xxx
// values in LCLType (Delphi compatibility, not our decision)
// MWE: Don't know it this still is a requirement
// afaik have I remeved all casts from the LCL
scLineUp, // = SB_LINEUP
scLineDown, // = SB_LINEDOWN
scPageUp, // = SB_PAGEUP
scPageDown, // = SB_PAGEDOWN
scPosition, // = SB_THUMBPOSITION
scTrack, // = SB_THUMBTRACK
scTop, // = SB_TOP
scBottom, // = SB_BOTTOM
scEndScroll // = SB_ENDSCROLL
);
TScrollEvent = procedure(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer) of object;
{ TCustomScrollBar }
TCustomScrollBar = class(TWinControl)
private
FKind: TScrollBarKind;
FPosition: Integer;
FMin: Integer;
FMax: Integer;
FPageSize: Integer;
FRTLFactor: Integer;
FSmallChange: TScrollBarInc;
FLargeChange: TScrollBarInc;
FOnChange: TNotifyEvent;
FOnScroll: TScrollEvent;
procedure DoScroll(var Message: TLMScroll);
function NotRightToLeft: Boolean;
procedure SetKind(Value: TScrollBarKind);
procedure SetMax(Value: Integer);
procedure SetMin(Value: Integer);
procedure SetPosition(Value: Integer);
procedure SetPageSize(Value: Integer);
procedure CNHScroll(var Message: TLMHScroll); message LM_HSCROLL;
procedure CNVScroll(var Message: TLMVScroll); message LM_VSCROLL;
procedure CNCtlColorScrollBar(var Message: TLMessage); message CN_CTLCOLORSCROLLBAR;
procedure WMEraseBkgnd(var Message: TLMEraseBkgnd); message LM_ERASEBKGND;
protected
class procedure WSRegisterClass; override;
class function GetControlClassDefaultSize: TSize; override;
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
procedure Change; virtual;
procedure Scroll(ScrollCode: TScrollCode; var ScrollPos: Integer); virtual;
procedure CalculatePreferredSize(var PreferredWidth,
PreferredHeight: integer; WithThemeSpace: Boolean); override;
public
constructor Create(AOwner: TComponent); override;
procedure SetParams(APosition, AMin, AMax, APageSize: Integer);
procedure SetParams(APosition, AMin, AMax: Integer);
public
property Kind: TScrollBarKind read FKind write SetKind default sbHorizontal;
property LargeChange: TScrollBarInc read FLargeChange write FLargeChange default 1;
property Max: Integer read FMax write SetMax default 100;
property Min: Integer read FMin write SetMin default 0;
property PageSize: Integer read FPageSize write SetPageSize;
property Position: Integer read FPosition write SetPosition default 0;
property SmallChange: TScrollBarInc read FSmallChange write FSmallChange default 1;
property TabStop default true;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
property OnScroll: TScrollEvent read FOnScroll write FOnScroll;
end;
{ TScrollBar }
TScrollBar = class(TCustomScrollBar)
published
property Align;
property Anchors;
property BidiMode;
property BorderSpacing;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Kind;
property LargeChange;
property Max;
property Min;
property PageSize;
property ParentBidiMode;
property ParentShowHint;
property PopupMenu;
property Position;
property ShowHint;
property SmallChange;
property TabOrder;
property TabStop;
property Visible;
property OnChange;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnScroll;
property OnStartDrag;
property OnUTF8KeyPress;
end;
{ TCustomGroupBox }
TCustomGroupBox = class(TWinControl)
protected
class procedure WSRegisterClass; override;
class function GetControlClassDefaultSize: TSize; override;
procedure CreateParams(var Params: TCreateParams); override;
public
constructor Create(AOwner: TComponent); override;
end;
{ TGroupBox }
TGroupBox = class(TCustomGroupBox)
published
property Align;
property Anchors;
property AutoSize;
property BidiMode;
property BorderSpacing;
property Caption;
property ChildSizing;
property ClientHeight;
property ClientWidth;
property Color;
property Constraints;
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property ParentBidiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnChangeBounds;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDockDrop;
property OnDockOver;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
property OnUTF8KeyPress;
end;
{ TCustomComboBox }
TComboBoxAutoCompleteTextOption = (
cbactEnabled, //Enable Auto-Completion Feature
cbactEndOfLineComplete, //Perform Auto-Complete only when cursor is at end of line
cbactRetainPrefixCase, //Retains the case of characters user has typed if is cbactEndOfLineComplete
cbactSearchCaseSensitive, //Search Text with CaseSensitivity
cbactSearchAscending //Search Text from top of the list
);
TComboBoxAutoCompleteText = set of TComboBoxAutoCompleteTextOption;
const
DefaultComboBoxAutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending];
type
TComboBoxStyle = (
csDropDown, // like an TEdit plus a button to drop down the list, default
csSimple, // like an TEdit plus a TListBox
csDropDownList, // like TLabel plus a button to drop down the list
csOwnerDrawFixed, // like csDropDownList, but custom drawn
csOwnerDrawVariable // like csDropDownList, but custom drawn and with each item can have another height
);
TOwnerDrawState = LCLType.TOwnerDrawState;
TDrawItemEvent = procedure(Control: TWinControl; Index: Integer;
ARect: TRect; State: TOwnerDrawState) of object;
TMeasureItemEvent = procedure(Control: TWinControl; Index: Integer;
var AHeight: Integer) of object;
{ TCustomComboBox }
TCustomComboBox = class(TWinControl)
private
FCharCase: TEditCharCase;
FAutoCompleteText: TComboBoxAutoCompleteText;
FAutoSelect: Boolean;
FAutoSelected: Boolean;
FAutoDropDown: Boolean;
FCanvas: TCanvas;
FDropDownCount: Integer;
FDroppedDown: boolean;
FItemHeight: integer;
FItemIndex: integer;
FItemWidth: integer;
FItems: TStrings;
FMaxLength: integer;
FOnChange: TNotifyEvent;
FOnCloseUp: TNotifyEvent;
FOnDrawItem: TDrawItemEvent;
FOnDropDown: TNotifyEvent;
FOnGetItems: TNotifyEvent;
FOnMeasureItem: TMeasureItemEvent;
FOnSelect: TNotifyEvent;
FReadOnly: Boolean;
FSelLength: integer;
FSelStart: integer;
FSorted: boolean;
FStyle: TComboBoxStyle;
FArrowKeysTraverseList: Boolean;
FReturnArrowState: Boolean; //used to return the state of arrow keys from termporary change
function GetAutoComplete: boolean;
function GetDroppedDown: Boolean;
function GetItemWidth: Integer;
procedure SetAutoComplete(const AValue: boolean);
procedure SetItemWidth(const AValue: Integer);
procedure LMDrawListItem(var TheMessage: TLMDrawListItem); message LM_DrawListItem;
procedure LMMeasureItem(var TheMessage: TLMMeasureItem); message LM_MeasureItem;
procedure LMSelChange(var TheMessage); message LM_SelChange;
procedure CNCommand(var TheMessage: TLMCommand); message CN_Command;
procedure SetReadOnly(const AValue: Boolean);
procedure UpdateSorted;
procedure SetArrowKeysTraverseList(Value: Boolean);
procedure WMChar(var Message: TLMChar); message LM_CHAR;
procedure SetCharCase(eccCharCase: TEditCharCase);
protected
class procedure WSRegisterClass; override;
procedure CreateParams(var Params: TCreateParams); override;
procedure InitializeWnd; override;
procedure DestroyWnd; override;
procedure DoEnter; override;
procedure DoExit; override;
procedure DrawItem(Index: Integer; ARect: TRect;
State: TOwnerDrawState); virtual;
procedure MeasureItem(Index: Integer; var TheHeight: Integer); virtual;
class function GetControlClassDefaultSize: TSize; override;
procedure LMChanged(var Msg); message LM_CHANGED;
procedure Change; virtual;
procedure Select; virtual;
procedure DropDown; virtual;
procedure GetItems; virtual;
procedure SetItems(const Value: TStrings); virtual;
procedure CloseUp; virtual;
procedure AdjustDropDown; virtual;
function GetItemCount: Integer; //override;
function GetItemHeight: Integer; virtual;
function GetSelLength: integer; virtual;
function GetSelStart: integer; virtual;
function GetSelText: string; virtual;
function GetItemIndex: integer; virtual;
function GetMaxLength: integer; virtual;
function IsReadOnlyStored: boolean;
procedure SetDropDownCount(const AValue: Integer); virtual;
procedure SetDroppedDown(const AValue: Boolean); virtual;
procedure SetItemHeight(const AValue: Integer); virtual;
procedure SetItemIndex(const Val: integer); virtual;
procedure SetMaxLength(AValue: integer); virtual;
procedure SetSelLength(Val: integer); virtual;
procedure SetSelStart(Val: integer); virtual;
procedure SetSelText(const Val: string); virtual;
procedure SetSorted(Val: boolean); virtual;
procedure SetStyle(Val: TComboBoxStyle); virtual;
procedure RealSetText(const AValue: TCaption); override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
procedure KeyPress(var Key: char); override;
procedure UTF8KeyPress(var UTF8Key: TUTF8Char); override;
procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X, Y: Integer); override;
function SelectItem(const AnItem: String): Boolean;
property ItemHeight: Integer read GetItemHeight write SetItemHeight;
property ItemWidth: Integer read GetItemWidth write SetItemWidth default 0;
property MaxLength: integer read GetMaxLength write SetMaxLength default 0;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
property OnCloseUp: TNotifyEvent read FOnCloseUp write FOnCloseUp;
property OnDrawItem: TDrawItemEvent read FOnDrawItem write FOnDrawItem;
property OnDropDown: TNotifyEvent read FOnDropDown write FOnDropDown;
property OnGetItems: TNotifyEvent read FOnGetItems write FOnGetItems;
property OnMeasureItem: TMeasureItemEvent
read FOnMeasureItem write FOnMeasureItem;
property OnSelect: TNotifyEvent read FOnSelect write FOnSelect;
property ParentColor default false;
property Sorted: boolean read FSorted write SetSorted default False;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure IntfGetItems;
procedure AddItem(const Item: String; AnObject: TObject); //override;
procedure AddHistoryItem(const Item: string; MaxHistoryCount: integer;
SetAsText, CaseSensitive: boolean);
procedure AddHistoryItem(const Item: string; AnObject: TObject;
MaxHistoryCount: integer; SetAsText, CaseSensitive: boolean);
procedure Clear; virtual;
procedure ClearSelection; //override;
property CharCase: TEditCharCase read FCharCase write SetCharCase default ecNormal;
property DroppedDown: Boolean read GetDroppedDown write SetDroppedDown;
procedure SelectAll;
property AutoComplete: boolean
read GetAutoComplete write SetAutoComplete default False;
property AutoCompleteText: TComboBoxAutoCompleteText
read FAutoCompleteText write FAutoCompleteText
default DefaultComboBoxAutoCompleteText;
property AutoDropDown: Boolean
read FAutoDropDown write FAutoDropDown default False;
property AutoSelect: Boolean read FAutoSelect write FAutoSelect default True;
property AutoSelected: Boolean read FAutoSelected write FAutoSelected;
property AutoSize default True; // Overrides default value
property ArrowKeysTraverseList: Boolean read FArrowKeysTraverseList
write SetArrowKeysTraverseList default True;
property Canvas: TCanvas read FCanvas;
property DropDownCount: Integer read FDropDownCount write SetDropDownCount default 8;
property Items: TStrings read FItems write SetItems;
property ItemIndex: integer read GetItemIndex write SetItemIndex default -1;
property ReadOnly: Boolean read FReadOnly write SetReadOnly stored IsReadOnlyStored;
property SelLength: integer read GetSelLength write SetSelLength;// byte length
property SelStart: integer read GetSelStart write SetSelStart;// byte position
property SelText: String read GetSelText write SetSelText;
property Style: TComboBoxStyle read FStyle write SetStyle default csDropDown;
property TabStop default true;
property Text;
end;
{ TComboBox }
TComboBox = class(TCustomComboBox)
published
property Align;
property Anchors;
property ArrowKeysTraverseList;
property AutoComplete;
property AutoCompleteText;
property AutoDropDown;
property AutoSelect;
property AutoSize;// Note: windows has a fixed height in some styles
property BidiMode;
property BorderSpacing;
property CharCase;
property Color;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property DropDownCount;
property Enabled;
property Font;
property ItemHeight;
property ItemIndex;
property Items;
property ItemWidth;
property MaxLength;
property OnChange;
property OnChangeBounds;
property OnClick;
property OnCloseUp;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnDrawItem;
property OnEndDrag;
property OnDropDown;
property OnEditingDone;
property OnEnter;
property OnExit;
property OnGetItems;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMeasureItem;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
property OnSelect;
property OnUTF8KeyPress;
property ParentBidiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ReadOnly;
property ShowHint;
property Sorted;
property Style;
property TabOrder;
property TabStop;
property Text;
property Visible;
end;
{ TCustomListBox }
TListBoxStyle = (lbStandard, lbOwnerDrawFixed, lbOwnerDrawVariable);
TSelectionChangeEvent = procedure(Sender: TObject; User: boolean) of object;
{ TCustomListBox }
TCustomListBox = class(TWinControl)
private
FCacheValid: Boolean;
FCanvas: TCanvas;
FClickOnSelChange: boolean;
FClickTriggeredBySelectionChange: Boolean;
FColumns: Integer;
FExtendedSelect: boolean;
FIntegralHeight: boolean;
FItemHeight: Integer;
FItemIndex: integer;
FItems: TStrings;
FLockSelectionChange: integer;
FMultiSelect: boolean;
FOnDrawItem: TDrawItemEvent;
FOnMeasureItem: TMeasureItemEvent;
FOnSelectionChange: TSelectionChangeEvent;
FScrollWidth: Integer;
FSorted: boolean;
FStyle: TListBoxStyle;
FTopIndex: integer;
function GetCount: Integer;
function GetScrollWidth: Integer;
function GetTopIndex: Integer;
procedure RaiseIndexOutOfBounds(AIndex: integer);
procedure SetColumns(const AValue: Integer);
procedure SetScrollWidth(const AValue: Integer);
procedure SetTopIndex(const AValue: Integer);
procedure UpdateSelectionMode;
procedure UpdateSorted;
procedure LMDrawListItem(var TheMessage: TLMDrawListItem); message LM_DrawListItem;
procedure LMMeasureItem(var TheMessage: TLMMeasureItem); message LM_MeasureItem;
procedure LMSelChange(var TheMessage); message LM_SelChange;
procedure WMLButtonUp(Var Message: TLMLButtonUp); message LM_LBUTTONUP;
procedure SendItemSelected(Index: integer; IsSelected: boolean);
protected
class procedure WSRegisterClass; override;
procedure AssignItemDataToCache(const AIndex: Integer; const AData: Pointer); virtual; // called to store item data while the handle isn't created
procedure AssignCacheToItemData(const AIndex: Integer; const AData: Pointer); virtual; // called to restore the itemdata after a handle is created
procedure BeginAutoDrag; override;
function CalculateStandardItemHeight: Integer;
procedure Loaded; override;
procedure InitializeWnd; override;
procedure FinalizeWnd; override;
class function GetControlClassDefaultSize: TSize; override;
procedure CheckIndex(const AIndex: Integer);
function GetItemHeight: Integer;
function GetItemIndex: integer; virtual;
function GetSelCount: integer;
function GetSelected(Index: integer): boolean;
function GetCachedDataSize: Integer; virtual; // returns the amount of data needed per item
function GetCachedData(const AIndex: Integer): Pointer;
procedure SetExtendedSelect(Val: boolean); virtual;
procedure SetItemIndex(AIndex: integer); virtual;
procedure SetItems(Value: TStrings); virtual;
procedure SetItemHeight(Value: Integer);
procedure SetMultiSelect(Val: boolean); virtual;
procedure SetSelected(Index: integer; Val: boolean);
procedure SetSorted(Val: boolean); virtual;
procedure SetStyle(Val: TListBoxStyle); virtual;
procedure DrawItem(Index: Integer; ARect: TRect;
State: TOwnerDrawState); virtual;
procedure DoSelectionChange(User: Boolean); virtual;
procedure SendItemIndex;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure Click; override; // make it public
procedure Clear; virtual;
procedure ClearSelection;
function GetIndexAtXY(X, Y: integer): integer;
function GetIndexAtY(Y: integer): integer;
function GetSelectedText: string;
function ItemAtPos(const Pos: TPoint; Existing: Boolean): Integer;
function ItemRect(Index: Integer): TRect;
function ItemVisible(Index: Integer): boolean;
function ItemFullyVisible(Index: Integer): boolean;
procedure LockSelectionChange;
procedure MakeCurrentVisible;
procedure MeasureItem(Index: Integer; var TheHeight: Integer); virtual;
procedure SelectAll; virtual;
procedure UnlockSelectionChange;
public
property Align;
property Anchors;
property BorderStyle default bsSingle;
property Canvas: TCanvas read FCanvas;
property ClickOnSelChange: boolean read FClickOnSelChange
write FClickOnSelChange default true; // true is Delphi behaviour
property Columns: Integer read FColumns write SetColumns default 0;
property Constraints;
property Count: Integer read GetCount; // for Delphi compatability
property ExtendedSelect: boolean read FExtendedSelect write SetExtendedSelect default true;
property Font;
property IntegralHeight: boolean read FIntegralHeight write FIntegralHeight default False; // not implemented
property ItemHeight: Integer read GetItemHeight write SetItemHeight;
property ItemIndex: integer read GetItemIndex write SetItemIndex;
property Items: TStrings read FItems write SetItems;
property MultiSelect: boolean read FMultiSelect write SetMultiSelect default False;
property OnChangeBounds;
property OnClick;
property OnDblClick;
property OnDrawItem: TDrawItemEvent read FOnDrawItem write FOnDrawItem;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMeasureItem: TMeasureItemEvent
read FOnMeasureItem write FOnMeasureItem;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnResize;
property OnSelectionChange: TSelectionChangeEvent read FOnSelectionChange
write FOnSelectionChange;
property OnUTF8KeyPress;
property ParentColor default False;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ScrollWidth: Integer read GetScrollWidth write SetScrollWidth default 0;
property SelCount: integer read GetSelCount;
property Selected[Index: integer]: boolean read GetSelected write SetSelected;
property ShowHint;
property Sorted: boolean read FSorted write SetSorted default False;
property Style: TListBoxStyle read FStyle write SetStyle default lbStandard;
property TabOrder;
property TabStop default true;
property TopIndex: Integer read GetTopIndex write SetTopIndex default 0;
property Visible;
end;
{ TListBox }
TListBox = class(TCustomListBox)
published
property Align;
property Anchors;
property BidiMode;
property BorderSpacing;
property BorderStyle;
property ClickOnSelChange;
property Color;
property Columns;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property ExtendedSelect;
property Enabled;
property Font;
property IntegralHeight;
property Items;
property ItemHeight;
property MultiSelect;
property OnChangeBounds;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnDrawItem;
property OnEnter;
property OnEndDrag;
property OnExit;
property OnKeyPress;
property OnKeyDown;
property OnKeyUp;
property OnMeasureItem;
property OnMouseMove;
property OnMouseDown;
property OnMouseUp;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnResize;
property OnSelectionChange;
property OnShowHint;
property OnStartDrag;
property OnUTF8KeyPress;
property ParentBidiMode;
property ParentColor;
property ParentShowHint;
property ParentFont;
property PopupMenu;
property ScrollWidth;
property ShowHint;
property Sorted;
property Style;
property TabOrder;
property TabStop;
property TopIndex;
property Visible;
end;
{ TCustomEdit }
TCustomEdit = class(TWinControl)
private
FAlignment: TAlignment;
FAutoSelect: Boolean;
FAutoSelected: Boolean;
FCharCase: TEditCharCase;
fCaretPos: TPoint;
FEchoMode: TEchoMode;
FHideSelection: Boolean;
FMaxLength: Integer;
FModified: Boolean;
FPasswordChar: Char;
FReadOnly: Boolean;
FOnChange: TNotifyEvent;
FSelLength: integer;
FSelStart: integer;
procedure SetAlignment(const AValue: TAlignment);
function GetCanUndo: Boolean;
function GetModified: Boolean;
procedure SetCharCase(Value: TEditCharCase);
procedure SetHideSelection(const AValue: Boolean);
procedure SetMaxLength(Value: Integer);
procedure SetModified(Value: Boolean);
procedure SetPasswordChar(const AValue: Char);
protected
class procedure WSRegisterClass; override;
procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
WithThemeSpace: Boolean); override;
procedure CreateWnd; override;
procedure CreateParams(var Params: TCreateParams); override;
procedure TextChanged; override;
procedure Change; virtual;
procedure DoEnter; override;
procedure DoExit; override;
function GetCaretPos: TPoint; virtual;
function GetReadOnly: Boolean; virtual;
function GetSelLength: integer; virtual;
function GetSelStart: integer; virtual;
function GetSelText: string; virtual;
procedure SetCaretPos(const Value: TPoint); virtual;
procedure SetEchoMode(Val: TEchoMode); virtual;
procedure SetReadOnly(Value: Boolean); virtual;
procedure SetSelLength(Val: integer); virtual;
procedure SetSelStart(Val: integer); virtual;
procedure SetSelText(const Val: string); virtual;
function ChildClassAllowed(ChildClass: TClass): boolean; override;
class function GetControlClassDefaultSize: TSize; override;
procedure KeyUpAfterInterface(var Key: Word; Shift: TShiftState); override;
procedure WMChar(var Message: TLMChar); message LM_CHAR;
procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X, Y: Integer); override;
procedure RealSetText(const AValue: TCaption); override;
property AutoSelect: Boolean read FAutoSelect write FAutoSelect default True;
property AutoSelected: Boolean read FAutoSelected write FAutoSelected;
property ParentColor default False;
public
constructor Create(AOwner: TComponent); override;
procedure Clear;
procedure SelectAll;
procedure ClearSelection; virtual;
procedure CopyToClipboard; virtual;
procedure CutToClipboard; virtual;
procedure PasteFromClipboard; virtual;
procedure Undo; virtual;
public
property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
property AutoSize default True;
property BorderStyle default bsSingle;
property CanUndo: Boolean read GetCanUndo;
property CaretPos: TPoint read GetCaretPos write SetCaretPos;
property CharCase: TEditCharCase read FCharCase write SetCharCase default ecNormal;
property EchoMode: TEchoMode read FEchoMode write SetEchoMode default emNormal;
property HideSelection: Boolean read FHideSelection write SetHideSelection default True;
property MaxLength: Integer read FMaxLength write SetMaxLength default 0;
property Modified: Boolean read GetModified write SetModified;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
property PasswordChar: Char read FPasswordChar write SetPasswordChar default #0;
property PopupMenu;
property ReadOnly: Boolean read GetReadOnly write SetReadOnly default false;
property SelLength: integer read GetSelLength write SetSelLength;
property SelStart: integer read GetSelStart write SetSelStart;
property SelText: String read GetSelText write SetSelText;
property TabOrder;
property TabStop default true;
property Text;
end;
{ TMemoScrollbar }
TMemoScrollbar = class(TControlScrollBar)
protected
function GetHorzScrollBar: TControlScrollBar; override;
function GetVertScrollBar: TControlScrollBar; override;
public
property Increment;
property Page;
property Smooth;
property Position;
property Range;
property Size;
property Visible;
end;
{ TCustomMemo }
TCustomMemo = class(TCustomEdit)
private
FHorzScrollBar: TMemoScrollBar;
FLines: TStrings;
FScrollBars: TScrollStyle;
FVertScrollBar: TMemoScrollBar;
FWantReturns: Boolean;
FWantTabs: boolean;
FWordWrap: Boolean;
procedure SetHorzScrollBar(const AValue: TMemoScrollBar);
procedure SetVertScrollBar(const AValue: TMemoScrollBar);
protected
class procedure WSRegisterClass; override;
procedure CreateParams(var Params: TCreateParams); override;
procedure InitializeWnd; override;
procedure FinalizeWnd; override;
function RealGetText: TCaption; override;
procedure RealSetText(const Value: TCaption); override;
function GetCachedText(var CachedText: TCaption): boolean; override;
function GetCaretPos: TPoint; override;
procedure SetCaretPos(const Value: TPoint); override;
procedure SetLines(const Value: TStrings);
procedure SetSelText(const Val: string); override;
procedure SetWantReturns(const AValue: Boolean);
procedure SetWantTabs(const NewWantTabs: boolean);
procedure SetWordWrap(const Value: boolean);
procedure SetScrollBars(const Value: TScrollStyle);
procedure Loaded; override;
procedure ControlKeyDown(var Key: Word; Shift: TShiftState); override;
procedure CNChar(var Message: TLMKeyUp); message CN_CHAR;
class function GetControlClassDefaultSize: TSize; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Append(const Value: String);
public
property Lines: TStrings read FLines write SetLines;
property HorzScrollBar: TMemoScrollBar read FHorzScrollBar write SetHorzScrollBar;
property VertScrollBar: TMemoScrollBar read FVertScrollBar write SetVertScrollBar;
property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars default ssNone;
property WantReturns: Boolean read FWantReturns write SetWantReturns default true;
property WantTabs: Boolean read FWantTabs write SetWantTabs default false;
property WordWrap: Boolean read FWordWrap write SetWordWrap default true;
end;
{ TEdit }
TEdit = class(TCustomEdit)
public
property AutoSelected;
published
property Action;
property Align;
property Alignment;
property Anchors;
property AutoSize;
property AutoSelect;
property BidiMode;
property BorderStyle;
property BorderSpacing;
property CharCase;
property Color;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property EchoMode;
property Enabled;
property Font;
property HideSelection;
property MaxLength;
property ParentBidiMode;
property OnChange;
property OnChangeBounds;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEditingDone;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDrag;
property OnUTF8KeyPress;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PasswordChar;
property PopupMenu;
property ReadOnly;
property ShowHint;
property TabStop;
property TabOrder;
property Text;
property Visible;
end;
{ TMemo }
TMemo = class(TCustomMemo)
published
property Align;
property Alignment;
property Anchors;
property BidiMode;
property BorderSpacing;
property BorderStyle;
property CharCase;
property Color;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property HideSelection;
property Lines;
property MaxLength;
property OnChange;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEditingDone;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnStartDrag;
property OnUTF8KeyPress;
property ParentBidiMode;
property ParentColor;
property ParentFont;
property PopupMenu;
property ParentShowHint;
property ReadOnly;
property ScrollBars;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property WantReturns;
property WantTabs;
property WordWrap;
end;
{ TCustomStaticText }
TStaticBorderStyle = (sbsNone, sbsSingle, sbsSunken);
TCustomStaticText = class(TWinControl)
private
FAlignment: TAlignment;
FFocusControl: TWinControl;
FShowAccelChar: boolean;
FStaticBorderStyle: TStaticBorderStyle;
function GetTransparent: Boolean;
procedure SetAlignment(Value: TAlignment);
procedure SetStaticBorderStyle(Value: TStaticBorderStyle);
procedure SetTransparent(const AValue: Boolean);
procedure WMActivate(var Message: TLMActivate); message LM_ACTIVATE;
protected
class procedure WSRegisterClass; override;
function GetLabelText: String ; virtual;
procedure RealSetText(const AValue: TCaption); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure SetFocusControl(Val: TWinControl); virtual;
procedure SetShowAccelChar(Val: boolean); virtual;
function DialogChar(var Message: TLMKey): boolean; override;
class function GetControlClassDefaultSize: TSize; override;
public
constructor Create(AOwner: TComponent); override;
property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
property BorderStyle: TStaticBorderStyle read FStaticBorderStyle write SetStaticBorderStyle default sbsNone;
property FocusControl: TWinControl read FFocusControl write SetFocusControl;
property ShowAccelChar: boolean read FShowAccelChar write SetShowAccelChar default true;
property Transparent: Boolean read GetTransparent write SetTransparent default True;
end;
{ TStaticText }
TStaticText = class(TCustomStaticText)
published
property Align;
property Alignment;
property Anchors;
property AutoSize;
property BidiMode;
property BorderSpacing;
property BorderStyle;
property Caption;
property Color nodefault;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property FocusControl;
property Font;
property OnChangeBounds;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDrag;
property ParentBidiMode;
property ParentFont;
property ParentColor;
property ShowAccelChar;
property ShowHint;
property TabOrder;
property TabStop;
property Transparent;
property Visible;
end;
{ TButtonControl }
TButtonControl = class(TWinControl)
private
FOnChange: TNotifyEvent;
FClicksDisabled: Boolean;
function IsCheckedStored: boolean;
procedure WMDefaultClicked(var Message: TLMessage); message LM_CLICKED;
protected
class procedure WSRegisterClass; override;
function GetChecked: Boolean; virtual;
procedure SetChecked(Value: Boolean); virtual;
procedure DoOnChange; virtual;
procedure Click; override;
procedure CMWantSpecialKey(var Message: TLMessage); message CM_WANTSPECIALKEY;
protected
property Checked: Boolean read GetChecked write SetChecked stored IsCheckedStored default False;
property ClicksDisabled: Boolean read FClicksDisabled write FClicksDisabled;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
public
constructor Create(TheOwner: TComponent); override;
end;
{ TButtonActionLink - Finish me }
TButtonActionLink = class(TWinControlActionLink)
protected
FClientButton: TButtonControl;
procedure AssignClient(AClient: TObject); override;
procedure SetChecked(Value: Boolean); override;
public
function IsCheckedLinked: Boolean; override;
end;
TButtonActionLinkClass = class of TButtonActionLink;
{ TCustomButton }
TCustomButton = class(TButtonControl)
private
FModalResult: TModalResult;
FShortCut: TShortcut;
FCancel: Boolean;
FDefault: Boolean;
FActive: boolean;
procedure SetCancel(NewCancel: boolean);
procedure SetDefault(Value: Boolean);
procedure SetModalResult(const AValue: TModalResult);
procedure CMUIActivate(var Message: TLMessage); message CM_UIACTIVATE;
procedure WMSetFocus(var Message: TLMSetFocus); message LM_SETFOCUS;
procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS;
procedure UpdateFocus(AFocused: Boolean);
protected
class procedure WSRegisterClass; override;
procedure Click; override;
procedure CreateWnd; override;
procedure CreateParams(var Params: TCreateParams); override;
procedure ControlKeyDown(var Key: Word; Shift: TShiftState); override;
procedure ControlKeyUp(var Key: Word; Shift: TShiftState); override;
function DialogChar(var Message: TLMKey): boolean; override;
function ChildClassAllowed(ChildClass: TClass): boolean; override;
class function GetControlClassDefaultSize: TSize; override;
property ParentColor default false;
procedure WSSetDefault;
procedure WSSetText(const AText: String); override;
procedure TextChanged; override;
procedure Loaded; override;
procedure UpdateDefaultCancel;
public
constructor Create(TheOwner: TComponent); override;
procedure ExecuteDefaultAction; override;
procedure ExecuteCancelAction; override;
procedure ActiveDefaultControlChanged(NewControl: TControl); override;
procedure UpdateRolesForForm; override;
function UseRightToLeftAlignment: Boolean; override;
public
property Active: boolean read FActive stored false;
property Default: Boolean read FDefault write SetDefault default false;
property ModalResult: TModalResult read FModalResult write SetModalResult default mrNone;
property Cancel: Boolean read FCancel write SetCancel default false;
property Color default {$ifdef UseCLDefault}clDefault{$else}clBtnFace{$endif};
property TabStop default true;
end;
{ TButton }
TButton = class(TCustomButton)
public
procedure Click; override;
published
property Action;
property Align;
property Anchors;
property AutoSize;
property BidiMode;
property BorderSpacing;
property Cancel;
property Caption;
property Color;
property Constraints;
property Default;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property ParentBidiMode;
property ModalResult;
property OnChangeBounds;
property OnClick;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDrag;
property OnUTF8KeyPress;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
end;
{ TCustomCheckBox }
TCheckBoxState = (cbUnchecked, cbChecked, cbGrayed);
{ TCustomCheckBox }
TCustomCheckBox = class(TButtonControl)
private
FAllowGrayed: Boolean;
FState: TCheckBoxState;
FShortCut: TShortcut;
procedure SetState(Value: TCheckBoxState);
function GetState: TCheckBoxState;
procedure DoChange(var Msg); message LM_CHANGED;
protected
class procedure WSRegisterClass; override;
procedure Click; override;
procedure DoClickOnChange; virtual;
function RetrieveState: TCheckBoxState;
procedure InitializeWnd; override;
procedure Toggle; virtual;
function DialogChar(var Message: TLMKey): boolean; override;
function GetChecked: Boolean; override;
procedure SetChecked(Value: Boolean); override;
procedure RealSetText(const Value: TCaption); override;
procedure ApplyChanges; virtual;
class function GetControlClassDefaultSize: TSize; override;
procedure Loaded; override;
procedure WSSetText(const AText: String); override;
procedure TextChanged; override;
procedure CreateParams(var Params: TCreateParams); override;
public
constructor Create(TheOwner: TComponent); override;
public
property AllowGrayed: Boolean read FAllowGrayed write FAllowGrayed default false;
property State: TCheckBoxState read GetState write SetState default cbUnchecked;
property OnChange;
end;
// Normal checkbox
{ TCheckBox }
TCheckBox = class(TCustomCheckBox)
public
constructor Create(TheOwner: TComponent); override;
published
property Action;
property Align;
property AllowGrayed;
property Anchors;
property AutoSize default True;
property BidiMode;
property BorderSpacing;
property Caption;
property Checked;
property Color nodefault;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property Hint;
property OnChange;
property OnChangeBounds;
property OnClick;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEditingDone;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyPress;
property OnKeyDown;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDrag;
property OnUTF8KeyPress;
property ParentColor;
property ParentFont;
property ParentShowHint;
property ParentBidiMode;
property PopupMenu;
property ShowHint;
property State;
property TabOrder;
property TabStop default True;
property Visible;
end;
{ TToggleBox }
TToggleBox = class(TCustomCheckBox)
protected
class procedure WSRegisterClass; override;
procedure CreateParams(var Params: TCreateParams); override;
public
constructor Create(TheOwner: TComponent); override;
published
property AllowGrayed;
property Anchors;
property AutoSize;
property BorderSpacing;
property Caption;
property Checked;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Hint;
property OnChange;
property OnClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property State;
property TabOrder;
property TabStop default True;
property Visible;
end;
{ TRadioButton }
TRadioButton = class(TCustomCheckBox)
protected
class procedure WSRegisterClass; override;
procedure ApplyChanges; override;
function DialogChar(var Message: TLMKey): boolean; override;
procedure RealSetText(const Value: TCaption); override;
procedure DoClickOnChange; override;
procedure CreateParams(var Params: TCreateParams); override;
public
constructor Create(TheOwner: TComponent); override;
published
property Align;
property Anchors;
property AutoSize default True;
property BidiMode;
property BorderSpacing;
property Caption;
property Checked;
property Color;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property Hint;
property OnChange;
property OnChangeBounds;
property OnClick;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDrag;
property ParentBidiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop default False;
property Visible;
end;
{ TCustomLabel }
TCustomLabel = class(TGraphicControl)
private
FAlignment: TAlignment;
FFocusControl: TWinControl;
FOptimalFill: Boolean;
FShowAccelChar: Boolean;
FWordWrap: Boolean;
FLayout: TTextLayout;
FInternalSetBounds: Boolean;
procedure SetAlignment(Value: TAlignment);
procedure SetOptimalFill(const AValue: Boolean);
protected
class procedure WSRegisterClass; override;
function CanTab: boolean; override;
procedure DoMeasureTextPosition(var TextTop: integer;
var TextLeft: integer); virtual;
function HasMultiLine : boolean;
procedure CalculatePreferredSize(
var PreferredWidth, PreferredHeight: integer;
WithThemeSpace: Boolean); override;
procedure CalculateSize(MaxWidth: integer;
var NeededWidth, NeededHeight: integer);
procedure DoAutoSize; override;
function DialogChar(var Message: TLMKey): boolean; override;
procedure TextChanged; override;
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
procedure FontChanged(Sender: TObject); override;
class function GetControlClassDefaultSize: TSize; override;
procedure WMActivate(var Message: TLMActivate); message LM_ACTIVATE;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
function GetLabelText: string; virtual;
function GetTransparent: boolean;
procedure SetColor(NewColor: TColor); override;
procedure SetFocusControl(Value: TWinControl);
procedure SetLayout(Value: TTextLayout);
procedure SetShowAccelChar(Value: Boolean);
procedure SetTransparent(NewTransparent: boolean);
procedure SetWordWrap(Value: Boolean);
procedure Loaded; override;
procedure UpdateSize;
property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
property FocusControl: TWinControl read FFocusControl write SetFocusControl;
property Layout: TTextLayout read FLayout write SetLayout default tlTop;
property ShowAccelChar: Boolean read FShowAccelChar write SetShowAccelChar default true;
property Transparent: boolean read GetTransparent write SetTransparent default true;
property WordWrap: Boolean read FWordWrap write SetWordWrap default false;
property OptimalFill: Boolean read FOptimalFill write SetOptimalFill default false;
public
constructor Create(TheOwner: TComponent); override;
function CalcFittingFontHeight(const TheText: string;
MaxWidth, MaxHeight: Integer; var FontHeight,
NeededWidth, NeededHeight: integer): Boolean;
function ColorIsStored: boolean; override;
function AdjustFontForOptimalFill: Boolean;
procedure Paint; override;
procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); override;
property AutoSize default True;
property Color default clNone;
end;
{ TLabel }
TLabel = class(TCustomLabel)
published
property Align;
property Alignment;
property Anchors;
property AutoSize;
property BidiMode;
property BorderSpacing;
property Caption;
property Color;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property FocusControl;
property Font;
property Layout;
property ParentBidiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowAccelChar;
property ShowHint;
property Transparent;
property Visible;
property WordWrap;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnMouseEnter;
property OnMouseLeave;
property OnChangeBounds;
property OnContextPopup;
property OnResize;
property OnStartDrag;
property OptimalFill;
end;
procedure Register;
implementation
uses
WSControls, WSStdCtrls; // Widgetset uses circle is allowed
type
TMemoStrings = class(TStrings)
private
FMemo: TCustomMemo;
FMemoWidgetClass: TWSCustomMemoClass;
protected
function Get(Index: Integer): String; override;
function GetCount: Integer; override;
public
constructor Create(AMemo: TCustomMemo);
procedure Clear; override;
procedure Delete(index: Integer); override;
procedure Insert(index: Integer; const S: String); override;
property MemoWidgetClass: TWSCustomMemoClass read FMemoWidgetClass write FMemoWidgetClass;
end;
procedure Register;
begin
RegisterComponents('Standard',[TButton, TLabel,TEdit,TMemo,TToggleBox,TCheckBox,
TRadioButton,TListBox,TComboBox,TScrollBar,TGroupBox]);
RegisterComponents('Additional',[TStaticText]);
end;
procedure InternalDrawItem(Control:TControl; Canvas: TCanvas; ARect:TRect; const Text: string);
var
OldBrushStyle: TBrushStyle;
OldTextStyle: TTextStyle;
NewTextStyle: TTextStyle;
begin
OldBrushStyle := Canvas.Brush.Style;
Canvas.Brush.Style := bsClear;
OldTextStyle := Canvas.TextStyle;
NewTextStyle := OldTextStyle;
NewTextStyle.Layout := tlCenter;
NewTextStyle.RightToLeft := Control.UseRightToLeftReading;
if Control.UseRightToLeftAlignment then
begin
NewTextStyle.Alignment := taRightJustify;
ARect.Right := ARect.Right - 2;
end
else
begin
NewTextStyle.Alignment := taLeftJustify;
ARect.Left := ARect.Left + 2;
end;
Canvas.TextStyle := NewTextStyle;
Canvas.TextRect(ARect, ARect.Left, ARect.Top, Text);
Canvas.Brush.Style := OldBrushStyle;
Canvas.TextStyle := OldTextStyle;
end;
{$I customgroupbox.inc}
{$I customcombobox.inc}
{$I customlistbox.inc}
{$I custommemo.inc}
{$I customedit.inc}
{$I customlabel.inc}
{$I customcheckbox.inc}
{$I scrollbar.inc}
{$I memoscrollbar.inc}
{$I memo.inc}
{$I memostrings.inc}
{$I edit.inc}
{$I buttoncontrol.inc}
{$I buttons.inc}
{$I checkbox.inc}
{$I radiobutton.inc}
{$I togglebox.inc}
{$I customstatictext.inc}
end.
|