1{ $Id: lcltype.pp 61638 2019-07-28 10:44:39Z martin $ } 2{ 3 /*************************************************************************** 4 LCLType.pp 5 ---------- 6 Component Library Windows Controls 7 Initial Revision : Fri Jul 23 20:00:00 PDT 1999 8 9 10 ***************************************************************************/ 11 12 ***************************************************************************** 13 This file is part of the Lazarus Component Library (LCL) 14 15 See the file COPYING.modifiedLGPL.txt, included in this distribution, 16 for details about the license. 17 ***************************************************************************** 18} 19 20{ 21@author(Curtis White <cwhite@aracnet.com>) 22@created(17-Oct-1999) 23@lastmod(17-Oct-1999) 24 25This unit is being created specifically for compatibility with Delphi. It 26should only be used for constants and type definitions that are included in 27the Delphi Windows unit. This is only done for compatibiltiy. 28 29} 30 31unit LCLType; 32 33{$mode objfpc}{$H+}{$macro on} 34 35interface 36 37 38{$ifdef Trace} 39 {$ASSERTIONS ON} 40{$endif} 41 42uses 43{$IFDEF USE_UTF8BIDI_LCL} 44 UTF8BIDI, 45{$ENDIF USE_UTF8BIDI_LCL} 46{$ifdef WINDOWS} 47 windows, 48{$endif WINDOWS} 49 Classes, SysUtils; 50 51{$ifdef WinCE} 52 {$define extdecl := cdecl} 53{$else} 54 {$define extdecl := stdcall} 55{$endif} 56 57type 58{$IFDEF USE_UTF8BIDI_LCL} 59 TUTF8Char = UTF8BIDI.TUTF8Char; 60{$ELSE USE_UTF8BIDI_LCL} 61 TUTF8Char = String[7]; // UTF-8 character is at most 6 bytes plus a #0 62{$ENDIF USE_UTF8BIDI_LCL} 63 UINT = LongWord; 64 UINT_PTR = PtrUInt; 65 66 TTranslateString = type String; 67 68 TCriticalSection = PtrUInt; 69 PCriticalSection = ^TCriticalSection; 70 71 TDockImageOperation = (disShow, disMove, disHide); 72 73 // Types for native Handle integration 74 75 TNativeHandleType = (nhtWindowsHWND, nhtX11TWindow, nhtCocoaNSWindow, 76 nhtQtQWidget); 77 TNativeHandleTypes = set of TNativeHandleType; 78 79 TNativeCanvasType = (nctWindowsDC, nctLazCanvas); 80 TNativeCanvasTypes = set of TNativeCanvasType; 81 82 // Callback types for new LCLIntf dialogs 83 84 // -1 indicates that the dialog was canceled and no item selected 85 TOnShowSelectItemDialogResult = procedure (ASelectedItem: Integer) of object; 86 87 {$ifndef WINDOWS} 88 PInt = ^integer; 89 THandle = type PtrUInt; // define our own, because the SysUtils.THandle = System.THandle is a longint 90 HANDLE = THandle; 91 PHandle = ^THandle; 92 93 { Provided for compatibility with Windows registry ONLY } 94 HKEY = Integer; 95 HDC = type THandle; 96 HHOOK = type THandle; 97 HFONT = type THandle; 98 HGDIOBJ = type THandle; 99 HPEN = type THandle; 100 HRGN = type THandle; 101 HINST = type THandle; 102 HICON = type THandle; 103 HIMAGELIST = type THandle; 104 HCURSOR = HICON; 105 HGLOBAL = type THandle; 106 HWND = type THandle; 107 HMENU = type THandle; 108 HBITMAP = type THandle; 109 HPALETTE = type THandle; 110 HBRUSH = type THandle; 111 HMONITOR = type THandle; 112 113 Bool = LongBool; 114 Short = SmallInt; 115 PRect = ^TRect; 116 117 WPARAM = type PtrInt; //LongInt or Int64 on CPU64; 118 LPARAM = type PtrInt; //LongInt or Int64 on CPU64; 119 LRESULT = type PtrInt; //LongInt or Int64 on CPU64; 120 121 ULONG_PTR = type PtrUInt; 122 123{$else} 124 HKEY = Windows.HKEY; 125 HDC = Windows.HDC; 126 HHOOK = Windows.HHOOK; 127 HFONT = Windows.HFont; 128 HGDIOBJ = Windows.HGDIOBJ; 129 HPEN = Windows.HPEN; 130 HRGN = Windows.HRGN; 131 HINST = Windows.HINST; 132 HICON = Windows.HICON; 133 HIMAGELIST = Windows.HIMAGELIST; 134 HCURSOR = HICON; 135 BOOL = Windows.BOOL; 136 HGLOBAL = Windows.HGLOBAL; 137 Short = Windows.Short; 138 HWND = Windows.HWND; 139 HMENU = Windows.HMENU; 140 HBITMAP = Windows.HBITMAP; 141 HPALETTE = Windows.HPALETTE; 142 HBRUSH = Windows.HBRUSH; 143 HMONITOR = HANDLE; 144 145 WPARAM = Windows.WPARAM; 146 LPARAM = Windows.LPARAM; 147 LRESULT = Windows.LRESULT; 148 149{$endif} 150 151 TLCLIntfHandle = type THandle; 152 153 PHKEY = ^HKEY; 154 155const 156 INVALID_HANDLE_VALUE = HANDLE(-1); // prior to 1.1 it was 0, see for example FileOpen 157 158 MAXBYTE = Byte($FF); 159 MAXWORD = Word($FFFF); 160 MAXDWORD = DWord($FFFFFFFF); 161 162 MINCHAR = $80; 163 MAXCHAR = $7F; 164 MINSHORT = $8000; 165 MAXSHORT = $7FFF; 166 MINLONG = DWord($80000000); 167 MAXLONG = $7FFFFFFF; 168 169 170const 171//============================================== 172// Binary raster operations 173//============================================== 174 R2_BLACK = 1; { 0 } 175 R2_NOTMERGEPEN = 2; { DPon } 176 R2_MASKNOTPEN = 3; { DPna } 177 R2_NOTCOPYPEN = 4; { PN } 178 R2_MASKPENNOT = 5; { PDna } 179 R2_NOT = 6; { Dn } 180 R2_XORPEN = 7; { DPx } 181 R2_NOTMASKPEN = 8; { DPan } 182 R2_MASKPEN = 9; { DPa } 183 R2_NOTXORPEN = 10; { DPxn } 184 R2_NOP = 11; { D } 185 R2_MERGENOTPEN = 12; { DPno } 186 R2_COPYPEN = 13; { P } 187 R2_MERGEPENNOT = 14; { PDno } 188 R2_MERGEPEN = 15; { DPo } 189 R2_WHITE = 16; { 1 } 190 R2_LAST = 16; 191 192//============================================== 193// Ternary raster operations 194//============================================== 195 SRCCOPY = $00CC0020; { dest = source } 196 SRCPAINT = $00EE0086; { dest = source OR dest } 197 SRCAND = $008800C6; { dest = source AND dest } 198 SRCINVERT = $00660046; { dest = source XOR dest } 199 SRCERASE = $00440328; { dest = source AND (NOT dest ) } 200 NOTSRCCOPY = $00330008; { dest = (NOT source) } 201 NOTSRCERASE = $001100A6; { dest = (NOT src) AND (NOT dest) } 202 MERGECOPY = $00C000CA; { dest = (source AND pattern) } 203 MERGEPAINT = $00BB0226; { dest = (NOT source) OR dest } 204 PATCOPY = $00F00021; { dest = pattern } 205 PATPAINT = $00FB0A09; { dest = DPSnoo } 206 PATINVERT = $005A0049; { dest = pattern XOR dest } 207 DSTINVERT = $00550009; { dest = (NOT dest) } 208 BLACKNESS = $00000042; { dest = BLACK } 209 WHITENESS = $00FF0062; { dest = WHITE } 210 211type 212 TKeyBoardState = array[0..255] of byte; 213 214 PABC = ^TABC; 215 216 _ABC = record 217 abcA: Integer; 218 abcB: UINT; 219 abcC: Integer; 220 end; 221 TABC = _ABC; 222 223 224const 225 ETO_OPAQUE = 2; 226 ETO_CLIPPED = 4; 227 ETO_RTLREADING = 128; 228 229 CS_VREDRAW = dword(1); 230 CS_HREDRAW = dword(2); 231 232//------------ 233// CombineRgn Mode flags 234//------------ 235 RGN_AND = 1; 236 RGN_OR = 2; 237 RGN_XOR = 3; 238 RGN_DIFF = 4; 239 RGN_COPY = 5; 240 241//------------ 242// DrawText flags 243//------------ 244 DT_TOP = $0; 245 DT_LEFT = $0; 246 DT_CENTER = $1; 247 DT_RIGHT = $2; 248 DT_VCENTER = $4; 249 DT_BOTTOM = $8; 250 DT_WORDBREAK = $10; 251 DT_SINGLELINE = $20; 252 DT_EXPANDTABS = $40; 253 DT_NOCLIP = $100; 254 DT_CALCRECT = $400; 255 DT_NOPREFIX = $800; 256 DT_INTERNAL = $1000; 257 DT_EDITCONTROL = $2000; 258 DT_END_ELLIPSIS = $8000; 259 DT_MODIFYSTRING = $10000; 260 DT_RTLREADING = $20000; 261 262//============================================== 263// Draw frame constants 264//============================================== 265 266//------------ 267// Draw frame control flags 268//------------ 269 DFC_CAPTION = $01; 270 DFC_MENU = $02; 271 DFC_SCROLL = $03; 272 DFC_BUTTON = $04; 273 274//------------ 275// Draw frame control Styles 276//------------ 277 DFCS_BUTTONCHECK = 0; 278 DFCS_BUTTONRADIOIMAGE = 1; 279 DFCS_BUTTONRADIOMASK = 2; 280 DFCS_BUTTONRADIO = 4; 281 DFCS_BUTTON3STATE = 8; 282 DFCS_BUTTONPUSH = 16; 283 284 DFCS_CAPTIONCLOSE = 0; 285 DFCS_CAPTIONMIN = 1; 286 DFCS_CAPTIONMAX = 2; 287 DFCS_CAPTIONRESTORE = 3; 288 DFCS_CAPTIONHELP = 4; 289 290 DFCS_MENUARROW = 0; 291 DFCS_MENUCHECK = 1; 292 DFCS_MENUBULLET = 2; 293 294 DFCS_SCROLLDOWN = 1; 295 DFCS_SCROLLLEFT = 2; 296 DFCS_SCROLLRIGHT = 3; 297 DFCS_SCROLLCOMBOBOX = 5; 298 DFCS_SCROLLSIZEGRIP = 8; 299 DFCS_SCROLLUP = 0; 300 301 DFCS_INACTIVE = 256; 302 DFCS_PUSHED = 512; 303 DFCS_CHECKED = 1024; 304 DFCS_TRANSPARENT = 2048; 305 DFCS_HOT = 4096; 306 DFCS_ADJUSTRECT = 8192; 307 DFCS_FLAT = 16384; 308 DFCS_MONO = 32768; 309 310 HTERROR = -2; 311 HTTRANSPARENT = -1; 312 HTNOWHERE = 0; 313 HTCLIENT = 1; 314 HTCAPTION = 2; 315 316 MSGF_DIALOGBOX = 0; 317 MSGF_MESSAGEBOX = 1; 318 MSGF_MENU = 2; 319 MSGF_MOVE = 3; 320 MSGF_SIZE = 4; 321 MSGF_SCROLLBAR = 5; 322 MSGF_NEXTWINDOW = 6; 323 324 325// PEEKMESSAGE stuff 326 PM_Noremove = 0; 327 PM_Remove = 1; 328 329//============================================== 330// Menu constants 331//============================================== 332 333 MF_BYCOMMAND = 0; 334 MF_BYPOSITION = $400; 335 MF_BYHANDLE = $800; // introduced by the LCL 336 337 MF_SEPARATOR = $800; 338 339 MF_ENABLED = 0; 340 MF_GRAYED = 1; 341 MF_DISABLED = 2; 342 343 MF_UNCHECKED = 0; 344 MF_CHECKED = 8; 345 MF_USECHECKBITMAPS = $200; 346 347 MF_STRING = 0; 348 MF_BITMAP = 4; 349 MF_OWNERDRAW = $100; 350 351 MF_POPUP = $10; 352 MF_MENUBARBREAK = $20; 353 MF_MENUBREAK = $40; 354 355 MF_UNHILITE = 0; 356 MF_HILITE = $80; 357 358 MF_DEFAULT = $1000; 359 MF_SYSMENU = $2000; 360 MF_HELP = $4000; 361 MF_RIGHTJUSTIFY = $4000; 362 363 MF_MOUSESELECT = $8000; 364 365 MF_UNSUPPORTED = $FFFFFFFF; 366 367//============================================== 368// Keyboard constants 369//============================================== 370 371//------------ 372// KeyFlags (High word part !!!) 373//------------ 374 KF_EXTENDED = $100; 375 KF_DLGMODE = $800; 376 KF_MENUMODE = $1000; 377 KF_ALTDOWN = $2000; 378 KF_REPEAT = $4000; 379 KF_UP = $8000; 380 381// TShortCut additions: 382 scMeta = $1000; 383 384//------------- 385// Virtual keys 386//------------- 387// 388// Basic keys up to $FF have values and meaning compatible with the Windows API as described here: 389// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp 390// 391// Starting with $100 and upwards the key constants are LCL additions 392// 393 VK_UNKNOWN = 0; // defined by LCL 394 VK_LBUTTON = 1; 395 VK_RBUTTON = 2; 396 VK_CANCEL = 3; 397 VK_MBUTTON = 4; 398 VK_XBUTTON1 = 5; 399 VK_XBUTTON2 = 6; 400 VK_BACK = 8; // The "Backspace" key, dont confuse with the 401 // Android BACK key which is mapped to VK_ESCAPE 402 VK_TAB = 9; 403 VK_CLEAR = 12; 404 VK_RETURN = 13; // The "Enter" key, also used for a keypad center press 405 VK_SHIFT = 16; // See also VK_LSHIFT, VK_RSHIFT 406 VK_CONTROL = 17; // See also VK_LCONTROL, VK_RCONTROL 407 VK_MENU = 18; // The ALT key. Also called "Option" in Mac OS X. See also VK_LMENU, VK_RMENU 408 VK_PAUSE = 19; // Pause/Break key 409 VK_CAPITAL = 20; // CapsLock key 410 VK_KANA = 21; 411 VK_HANGUL = 21; 412 VK_JUNJA = 23; 413 VK_FINAL = 24; 414 VK_HANJA = 25; 415 VK_KANJI = 25; 416 VK_ESCAPE = 27; // Also used for the hardware Back key in Android 417 VK_CONVERT = 28; 418 VK_NONCONVERT = 29; 419 VK_ACCEPT = 30; 420 VK_MODECHANGE = 31; 421 VK_SPACE = 32; 422 VK_PRIOR = 33; // Page Up 423 VK_NEXT = 34; // Page Down 424 VK_END = 35; 425 VK_HOME = 36; 426 VK_LEFT = 37; 427 VK_UP = 38; 428 VK_RIGHT = 39; 429 VK_DOWN = 40; 430 VK_SELECT = 41; 431 VK_PRINT = 42; // PrintScreen key 432 VK_EXECUTE = 43; 433 VK_SNAPSHOT = 44; 434 VK_INSERT = 45; 435 VK_DELETE = 46; 436 VK_HELP = 47; 437 VK_0 = $30; 438 VK_1 = $31; 439 VK_2 = $32; 440 VK_3 = $33; 441 VK_4 = $34; 442 VK_5 = $35; 443 VK_6 = $36; 444 VK_7 = $37; 445 VK_8 = $38; 446 VK_9 = $39; 447 //3A-40 Undefined 448 VK_A = $41; 449 VK_B = $42; 450 VK_C = $43; 451 VK_D = $44; 452 VK_E = $45; 453 VK_F = $46; 454 VK_G = $47; 455 VK_H = $48; 456 VK_I = $49; 457 VK_J = $4A; 458 VK_K = $4B; 459 VK_L = $4C; 460 VK_M = $4D; 461 VK_N = $4E; 462 VK_O = $4F; 463 VK_P = $50; 464 VK_Q = $51; 465 VK_R = $52; 466 VK_S = $53; 467 VK_T = $54; 468 VK_U = $55; 469 VK_V = $56; 470 VK_W = $57; 471 VK_X = $58; 472 VK_Y = $59; 473 VK_Z = $5A; 474 475 VK_LWIN = $5B; // In Mac OS X this is the Apple, or Command key. Windows Key in PC keyboards 476 VK_RWIN = $5C; // In Mac OS X this is the Apple, or Command key. Windows Key in PC keyboards 477 VK_APPS = $5D; // The PopUp key in PC keyboards 478 // $5E reserved 479 VK_SLEEP = $5F; 480 481 VK_NUMPAD0 = 96; // $60 482 VK_NUMPAD1 = 97; 483 VK_NUMPAD2 = 98; 484 VK_NUMPAD3 = 99; 485 VK_NUMPAD4 = 100; 486 VK_NUMPAD5 = 101; 487 VK_NUMPAD6 = 102; 488 VK_NUMPAD7 = 103; 489 VK_NUMPAD8 = 104; 490 VK_NUMPAD9 = 105; 491 VK_MULTIPLY = 106; // VK_MULTIPLY up to VK_DIVIDE are usually in the numeric keypad in PC keyboards 492 VK_ADD = 107; 493 VK_SEPARATOR = 108; 494 VK_SUBTRACT = 109; 495 VK_DECIMAL = 110; 496 VK_DIVIDE = 111; 497 VK_F1 = 112; 498 VK_F2 = 113; 499 VK_F3 = 114; 500 VK_F4 = 115; 501 VK_F5 = 116; 502 VK_F6 = 117; 503 VK_F7 = 118; 504 VK_F8 = 119; 505 VK_F9 = 120; 506 VK_F10 = 121; 507 VK_F11 = 122; 508 VK_F12 = 123; 509 VK_F13 = 124; 510 VK_F14 = 125; 511 VK_F15 = 126; 512 VK_F16 = 127; 513 VK_F17 = 128; 514 VK_F18 = 129; 515 VK_F19 = 130; 516 VK_F20 = 131; 517 VK_F21 = 132; 518 VK_F22 = 133; 519 VK_F23 = 134; 520 VK_F24 = 135; // $87 521 522 // $88-$8F unassigned 523 524 VK_NUMLOCK = $90; 525 VK_SCROLL = $91; 526 527 // $92-$96 OEM specific 528 // $97-$9F Unassigned 529 530 // not in VCL defined: 531 //MWE: And should not be used. 532 // The keys they are on map to another VK 533 534// VK_SEMICOLON = 186; 535// VK_EQUAL = 187; // $BB 536// VK_COMMA = 188; 537// VK_POINT = 190; 538// VK_SLASH = 191; 539// VK_AT = 192; 540 541 // VK_L & VK_R - left and right Alt, Ctrl and Shift virtual keys. 542 // When Application.ExtendedKeysSupport is false, these keys are 543 // used only as parameters to GetAsyncKeyState() and GetKeyState(). 544 // No other API or message will distinguish left and right keys in this way 545 // 546 // When Application.ExtendedKeysSupport is true, these keys will be sent 547 // on KeyDown / KeyUp instead of the generic VK_SHIFT, VK_CONTROL, etc. 548 VK_LSHIFT = $A0; 549 VK_RSHIFT = $A1; 550 VK_LCONTROL = $A2; 551 VK_RCONTROL = $A3; 552 VK_LMENU = $A4; // Left ALT key (also named Option in Mac OS X) 553 VK_RMENU = $A5; // Right ALT key (also named Option in Mac OS X) 554 555 VK_BROWSER_BACK = $A6; 556 VK_BROWSER_FORWARD = $A7; 557 VK_BROWSER_REFRESH = $A8; 558 VK_BROWSER_STOP = $A9; 559 VK_BROWSER_SEARCH = $AA; 560 VK_BROWSER_FAVORITES = $AB; 561 VK_BROWSER_HOME = $AC; 562 VK_VOLUME_MUTE = $AD; 563 VK_VOLUME_DOWN = $AE; 564 VK_VOLUME_UP = $AF; 565 VK_MEDIA_NEXT_TRACK = $B0; 566 VK_MEDIA_PREV_TRACK = $B1; 567 VK_MEDIA_STOP = $B2; 568 VK_MEDIA_PLAY_PAUSE = $B3; 569 VK_LAUNCH_MAIL = $B4; 570 VK_LAUNCH_MEDIA_SELECT = $B5; 571 VK_LAUNCH_APP1 = $B6; 572 VK_LAUNCH_APP2 = $B7; 573 574 // VK_OEM keys are utilized only when Application.ExtendedKeysSupport is false 575 576 // $B8-$B9 Reserved 577 VK_OEM_1 = $BA; // Used for miscellaneous characters; it can vary by keyboard. 578 // For the US standard keyboard, the ';:' key 579 VK_OEM_PLUS = $BB; // For any country/region, the '+' key 580 VK_OEM_COMMA = $BC; // For any country/region, the ',' key 581 VK_OEM_MINUS = $BD; // For any country/region, the '-' key 582 VK_OEM_PERIOD = $BE; // For any country/region, the '.' key 583 VK_OEM_2 = $BF; // Used for miscellaneous characters; it can vary by keyboard. 584 // For the US standard keyboard, the '/?' key 585 VK_OEM_3 = $C0; // Used for miscellaneous characters; it can vary by keyboard. 586 // For the US standard keyboard, the '`~' key 587 // $C1-$D7 Reserved 588 // $D8-$DA Unassigned 589 VK_OEM_4 = $DB; // Used for miscellaneous characters; it can vary by keyboard. 590 // For the US standard keyboard, the '[{' key 591 VK_OEM_5 = $DC; // Used for miscellaneous characters; it can vary by keyboard. 592 // For the US standard keyboard, the '\|' key 593 VK_OEM_6 = $DD; // Used for miscellaneous characters; it can vary by keyboard. 594 // For the US standard keyboard, the ']}' key 595 VK_OEM_7 = $DE; // Used for miscellaneous characters; it can vary by keyboard. 596 // For the US standard keyboard, the 'single-quote/double-quote' key 597 VK_OEM_8 = $DF; // Used for miscellaneous characters; it can vary by keyboard. 598 599 // $E0 Reserved 600 // $E1 OEM specific 601 VK_OEM_102 = $E2; // Either the angle bracket key or the backslash key on the RT 102-key keyboard 602 603 // $E3-$E4 OEM specific 604 605 VK_PROCESSKEY = $E7; // IME Process key 606 607 // $E8 Unassigned 608 // $E9-$F5 OEM specific 609 610 VK_ATTN = $F6; 611 VK_CRSEL = $F7; 612 VK_EXSEL = $F8; 613 VK_EREOF = $F9; 614 VK_PLAY = $FA; 615 VK_ZOOM = $FB; 616 VK_NONAME = $FC; 617 VK_PA1 = $FD; 618 VK_OEM_CLEAR = $FE; 619 620 VK_HIGHESTVALUE = $FFFF; 621 VK_UNDEFINED = $FF; // defined by LCL 622 623//============================================== 624// LCL aliases for more clear naming of keys 625//============================================== 626 627 VK_LCL_EQUAL = VK_OEM_PLUS; // The "=+" Key 628 VK_LCL_COMMA = VK_OEM_COMMA; // The ",<" Key 629 VK_LCL_POINT = VK_OEM_PERIOD;// The ".>" Key 630 VK_LCL_SLASH = VK_OEM_2; // The "/?" Key 631 VK_LCL_SEMI_COMMA = VK_OEM_1; // The ";:" Key 632 VK_LCL_MINUS = VK_OEM_MINUS; // The "-_" Key 633 VK_LCL_OPEN_BRAKET = VK_OEM_4; // The "[{" Key 634 VK_LCL_CLOSE_BRAKET= VK_OEM_6; // The "]}" Key 635 VK_LCL_BACKSLASH = VK_OEM_5; // The "\|" Key 636 VK_LCL_TILDE = VK_OEM_3; // The "`~" Key 637 VK_LCL_QUOTE = VK_OEM_7; // The "'"" Key 638 639 VK_LCL_ALT = VK_MENU; 640 VK_LCL_LALT = VK_LMENU; 641 VK_LCL_RALT = VK_RMENU; 642 643 VK_LCL_CAPSLOCK = VK_CAPITAL; 644 645//============================================== 646// New LCL defined keys 647//============================================== 648 649 VK_LCL_POWER = $100; 650 VK_LCL_CALL = $101; 651 VK_LCL_ENDCALL = $102; 652 VK_LCL_AT = $103; // Not equivalent to anything < $FF, will only be sent by a primary "@" key 653 // but not for a @ key as secondary action of a "2" key for example 654 655//============================================== 656// 657//============================================== 658 659const 660 661 { 3D border styles } 662 BDR_RAISEDOUTER = 1; 663 BDR_SUNKENOUTER = 2; 664 BDR_RAISEDINNER = 4; 665 BDR_SUNKENINNER = 8; 666 667 BDR_OUTER = 3; 668 BDR_INNER = 12; 669 BDR_RAISED = 5; 670 BDR_SUNKEN = 10; 671 672 EDGE_BUMP = (BDR_RAISEDOUTER or BDR_SUNKENINNER); 673 EDGE_ETCHED = (BDR_SUNKENOUTER or BDR_RAISEDINNER); 674 EDGE_RAISED = (BDR_RAISEDOUTER or BDR_RAISEDINNER); 675 EDGE_SUNKEN = (BDR_SUNKENOUTER or BDR_SUNKENINNER); 676 677 { Border flags } 678 BF_LEFT = 1; 679 BF_TOP = 2; 680 BF_RIGHT = 4; 681 BF_BOTTOM = 8; 682 683 BF_TOPLEFT = (BF_TOP or BF_LEFT); 684 BF_TOPRIGHT = (BF_TOP or BF_RIGHT); 685 BF_BOTTOMLEFT = (BF_BOTTOM or BF_LEFT); 686 BF_BOTTOMRIGHT = (BF_BOTTOM or BF_RIGHT); 687 BF_RECT = (BF_LEFT or BF_TOP or BF_RIGHT or BF_BOTTOM); 688 BF_DIAGONAL = $10; 689 690 BF_DIAGONAL_ENDTOPRIGHT = (BF_DIAGONAL or BF_TOP or BF_RIGHT); 691 BF_DIAGONAL_ENDTOPLEFT = (BF_DIAGONAL or BF_TOP or BF_LEFT); 692 BF_DIAGONAL_ENDBOTTOMLEFT = (BF_DIAGONAL or BF_BOTTOM or BF_LEFT); 693 BF_DIAGONAL_ENDBOTTOMRIGHT = (BF_DIAGONAL or BF_BOTTOM or BF_RIGHT); 694 695 BF_MIDDLE = $800; { Fill in the middle } 696 BF_SOFT = $1000; { For softer buttons. Not sure what the use is for this } 697 BF_ADJUST = $2000; { Calculate the space left over } 698 BF_FLAT = $4000; { For flat rather than 3D borders } 699 BF_MONO = $8000; { For monochrome borders } 700 701{Dialog codes} 702 DLGC_WANTARROWS = 1; 703 DLGC_WANTTAB = 2; 704 DLGC_WANTALLKEYS = 4; 705 706 DLGC_WANTCHARS = $80; 707 708{ScrollWindowEx} 709 SW_SMOOTHSCROLL = 16; 710 SW_ERASE = 4; 711 SW_INVALIDATE = 2; 712 SW_SCROLLCHILDREN = 1; 713 714//============================================== 715// owner drawn constants 716//============================================== 717 //CtlType 718 //winuser.h 719 ODT_MENU = 1; 720 ODT_LISTBOX = 2; 721 ODT_COMBOBOX = 3; 722 ODT_BUTTON = 4; 723 ODT_STATIC = 5; 724 //commctrl.h 725 ODT_HEADER = 100; 726 ODT_TAB = 101; 727 ODT_LISTVIEW = 102; 728 729 //itemAction 730 ODA_DRAWENTIRE = 1; 731 ODA_SELECT = 2; 732 ODA_FOCUS = 4; 733 734 //itemState 735 ODS_SELECTED = $0001; 736 ODS_GRAYED = $0002; 737 ODS_DISABLED = $0004; 738 ODS_CHECKED = $0008; 739 ODS_FOCUS = $0010; 740 ODS_DEFAULT = $0020; 741 ODS_HOTLIGHT = $0040; 742 ODS_INACTIVE = $0080; 743 ODS_NOACCEL = $0100; 744 ODS_NOFOCUSRECT = $0200; 745 ODS_COMBOBOXEDIT = $1000; 746 747 748 749//============================================== 750// GetWindowLong() constants 751//============================================== 752 GWL_WNDPROC = -4; 753 GWL_HINSTANCE = -6; 754 GWL_HWNDPARENT = -8; 755 GWL_STYLE = -16; 756 GWL_EXSTYLE = -20; 757 GWL_USERDATA = -21; 758 GWL_ID = -12; 759 760 MB_OK = $00000000; 761 MB_OKCANCEL = $00000001; 762 MB_ABORTRETRYIGNORE = $00000002; 763 MB_YESNOCANCEL = $00000003; 764 MB_YESNO = $00000004; 765 MB_RETRYCANCEL = $00000005; 766 MB_CANCELTRYCONTINUE = $00000006; // not yet supported by MessageDlg 767 768 MB_HELP = $00004000; // not yet supported by MessageDlg 769 770 MB_ICONHAND = $00000010; 771 MB_ICONQUESTION = $00000020; 772 MB_ICONEXCLAMATION = $00000030; 773 MB_ICONASTERISK = $00000040; 774 MB_ICONWARNING = MB_ICONEXCLAMATION; 775 MB_ICONERROR = MB_ICONHAND; 776 MB_ICONSTOP = MB_ICONHAND; 777 MB_ICONINFORMATION = MB_ICONASTERISK; 778 779 IDOK = 1; ID_OK = IDOK; 780 IDCANCEL = 2; ID_CANCEL = IDCANCEL; 781 IDABORT = 3; ID_ABORT = IDABORT; 782 IDRETRY = 4; ID_RETRY = IDRETRY; 783 IDIGNORE = 5; ID_IGNORE = IDIGNORE; 784 IDYES = 6; ID_YES = IDYES; 785 IDNO = 7; ID_NO = IDNO; 786 IDCLOSE = 8; ID_CLOSE = IDCLOSE; 787 IDHELP = 9; ID_HELP = IDHELP; 788 789 MB_DEFBUTTON1 = $00000000; 790 MB_DEFBUTTON2 = $00000100; 791 MB_DEFBUTTON3 = $00000200; 792 MB_DEFBUTTON4 = $00000300; 793 794{Region Flags} 795 Error = 0; 796 NullRegion = 1; 797 SimpleRegion = 2; 798 ComplexRegion = 3; 799 Region_Error = Error; 800 801 802{Scroll bar stuff} 803 SB_Horz = 0; 804 SB_Vert = 1; 805 SB_CTL = 2; 806 SB_BOTH = 3; //What would this do ??? it is not a used winapi constant 807 808{Scroll Bar Commands} 809 SB_LINEUP = 0; 810 SB_LINELEFT = 0; 811 SB_LINEDOWN = 1; 812 SB_LINERIGHT = 1; 813 SB_PAGEUP = 2; 814 SB_PAGELEFT = 2; 815 SB_PAGEDOWN = 3; 816 SB_PAGERIGHT = 3; 817 SB_THUMBPOSITION = 4; 818 SB_THUMBTRACK = 5; 819 SB_TOP = 6; 820 SB_LEFT = 6; 821 SB_BOTTOM = 7; 822 SB_RIGHT = 7; 823 SB_ENDSCROLL = 8; 824 SB_POLICY_CONTINUOUS = 10; 825 SB_POLICY_DISCONTINUOUS = 11; 826 SB_POLICY_DELAYED=12; 827 828 SBS_HORZ = 0; 829 SBS_VERT = 1; 830 SBS_TOPALIGN = 2; 831 SBS_LEFTALIGN = 2; 832 SBS_BOTTOMALIGN = 4; 833 SBS_RIGHTALIGN = 4; 834 SBS_SIZEBOXTOPLEFTALIGN = 2; 835 SBS_SIZEBOXBOTTOMRIGHTALIGN = 4; 836 SBS_SIZEBOX = 8; 837 SBS_SIZEGRIP = $10; 838 839 SIF_RANGE = 1; 840 SIF_PAGE = 2; 841 SIF_POS = 4; 842 SIF_DISABLENOSCROLL = 8; 843 SIF_TRACKPOS = $10; 844 SIF_ALL = (SIF_RANGE or SIF_PAGE or SIF_POS or SIF_TRACKPOS); 845 SIF_UPDATEPOLICY = $100; 846 847 848{ WMWindowPosChanged message constants} 849 SWP_NOSIZE = $00001; 850 SWP_NOMOVE = $00002; 851 SWP_NOZORDER = $00004; 852 SWP_NOREDRAW = $00008; 853 SWP_NOACTIVATE = $00010; 854 SWP_DRAWFRAME = $00020; 855 SWP_FRAMECHANGED = $00020; 856 SWP_SHOWWINDOW = $00040; 857 SWP_HIDEWINDOW = $00080; 858 SWP_NOCOPYBITS = $00100; 859 SWP_NOOWNERZORDER = $00200; 860 SWP_NOREPOSITION = $00200; 861 SWP_NOSENDCHANGING = $00400; 862 SWP_DEFERERASE = $02000; 863 SWP_ASYNCWINDOWPOS = $04000; 864 SWP_STATECHANGED = $08000; // used by windows but not documented (used even in wine) 865 SWP_SourceIsInterface = $10000; // this flag can be combined with the above 866 867{ WMSIZE message constants} 868 SIZE_RESTORED = 0; // the default 869 SIZE_MINIMIZED = 1; 870 SIZE_MAXIMIZED = 2; 871 SIZE_MAXSHOW = 3; 872 SIZE_MAXHIDE = 4; 873 SIZE_FULLSCREEN = 16; // non-winapi value to support wsFullScreen state 874 Size_SourceIsInterface = 128; // this flag can be combined with the above 875 876 SIZENORMAL = SIZE_RESTORED; 877 SIZEICONIC = SIZE_MINIMIZED; 878 SIZEFULLSCREEN = SIZE_MAXIMIZED; 879 SIZEZOOMSHOW = SIZE_MAXSHOW; 880 SIZEZOOMHIDE = SIZE_MAXHIDE; 881 882{ WMMove Message Constants } 883 Move_Default = 0; 884 Move_SourceIsInterface = 128; // this flag can be combined with the above 885 886//============================================== 887// Window Styles 888//============================================== 889 WS_OVERLAPPED = 0; 890 WS_POPUP = DWORD($80000000); 891 WS_CHILD = DWORD($40000000); 892 WS_MINIMIZE = DWORD($20000000); 893 WS_VISIBLE = DWORD($10000000); 894 WS_DISABLED = DWORD($8000000); 895 WS_CLIPSIBLINGS = DWORD($4000000); 896 WS_CLIPCHILDREN = DWORD($2000000); 897 WS_MAXIMIZE = DWORD($1000000); 898 WS_BORDER = DWORD($800000); 899 WS_DLGFRAME = DWORD($400000); 900 WS_CAPTION = DWORD(WS_BORDER or WS_DLGFRAME); 901 WS_VSCROLL = DWORD($200000); 902 WS_HSCROLL = DWORD($100000); 903 WS_SYSMENU = DWORD($80000); 904 WS_THICKFRAME = DWORD($40000); 905 WS_GROUP = DWORD($20000); 906 WS_TABSTOP = DWORD($10000); 907 908 WS_MINIMIZEBOX = DWORD($20000); 909 WS_MAXIMIZEBOX = DWORD($10000); 910 911 WS_TILED = WS_OVERLAPPED; 912 913 WS_ICONIC = WS_MINIMIZE; 914 915 WS_SIZEBOX = WS_THICKFRAME; 916 917 { Common Window Styles } 918 WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED or WS_CAPTION or WS_SYSMENU 919 or WS_THICKFRAME or WS_MINIMIZEBOX or WS_MAXIMIZEBOX); 920 WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW; 921 WS_POPUPWINDOW = (WS_POPUP or WS_BORDER or WS_SYSMENU); 922 WS_CHILDWINDOW = (WS_CHILD); 923 924 { Extended Window Styles } 925 WS_EX_DLGMODALFRAME = 1; 926 WS_EX_NOPARENTNOTIFY = 4; 927 WS_EX_TOPMOST = 8; 928 WS_EX_ACCEPTFILES = $10; 929 WS_EX_TRANSPARENT = $20; 930 WS_EX_MDICHILD = $40; 931 WS_EX_TOOLWINDOW = $80; 932 WS_EX_WINDOWEDGE = $100; 933 WS_EX_CLIENTEDGE = $200; 934 WS_EX_CONTEXTHELP = $400; 935 936 WS_EX_RIGHT = $1000; 937 WS_EX_LEFT = 0; 938 WS_EX_RTLREADING = $2000; 939 WS_EX_LTRREADING = 0; 940 WS_EX_LEFTSCROLLBAR = $4000; 941 WS_EX_RIGHTSCROLLBAR = 0; 942 943 WS_EX_CONTROLPARENT = $10000; 944 WS_EX_STATICEDGE = $20000; 945 WS_EX_APPWINDOW = $40000; 946 WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE or WS_EX_CLIENTEDGE); 947 WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE or WS_EX_TOOLWINDOW or WS_EX_TOPMOST); 948 949 { Button styles } 950 BS_PUSHBUTTON = $00000000; 951 BS_DEFPUSHBUTTON = $00000001; 952 BS_AUTOCHECKBOX = $00000003; 953 BS_RADIOBUTTON = $00000004; 954 BS_3STATE = $00000005; 955 BS_GROUPBOX = $00000007; 956 BS_OWNERDRAW = $0000000B; 957 BS_RIGHTBUTTON = $00000020; 958 BS_PUSHLIKE = $00001000; 959 960 { Edit styles } 961 ES_LEFT = $0000; 962 ES_CENTER = $0001; 963 ES_RIGHT = $0002; 964 ES_MULTILINE = $0004; 965 ES_AUTOVSCROLL = $0040; 966 ES_AUTOHSCROLL = $0080; 967 ES_NOHIDESEL = $0100; 968 ES_NUMBER = $2000; 969 ES_READONLY = $0800; 970 ES_WANTRETURN = $1000; 971 972 { Combobox style } 973 CBS_SIMPLE = $0001; 974 CBS_DROPDOWN = $0002; 975 CBS_DROPDOWNLIST = $0003; 976 CBS_OWNERDRAWFIXED = $0010; 977 CBS_OWNERDRAWVARIABLE = $0020; 978 CBS_AUTOHSCROLL = $0040; 979 CBS_SORT = $0100; 980 CBS_HASSTRINGS = $0200; 981 982 { Listbox style } 983 LBS_NOTIFY = $0001; 984 LBS_SORT = $0002; 985 LBS_NOREDRAW = $0004; 986 LBS_MULTIPLESEL = $0008; 987 LBS_OWNERDRAWFIXED = $0010; 988 LBS_OWNERDRAWVARIABLE = $0020; 989 LBS_HASSTRINGS = $0040; 990 LBS_USETABSTOPS = $0080; 991 LBS_NOINTEGRALHEIGHT = $0100; 992 LBS_MULTICOLUMN = $0200; 993 LBS_WANTKEYBOARDINPUT = $0400; 994 LBS_EXTENDEDSEL = $0800; 995 LBS_DISABLENOSCROLL = $1000; 996 LBS_NODATA = $2000; 997 LBS_NOSEL = $4000; 998 LBS_STANDARD = $A00003; 999 1000const 1001//============================================== 1002// SetWindowPos Flags 1003//============================================== 1004 HWND_TOP = 0; 1005 HWND_BOTTOM = 1; 1006 HWND_TOPMOST = HWND(-1); 1007 HWND_NOTOPMOST = HWND(-2); 1008 1009//============================================== 1010// ShowWindow() Commands 1011//============================================== 1012 SW_HIDE = 0; 1013 SW_SHOWNORMAL = 1; 1014 SW_NORMAL = 1; 1015 SW_SHOWMINIMIZED = 2; 1016 SW_SHOWMAXIMIZED = 3; 1017 SW_MAXIMIZE = 3; 1018 SW_SHOWNOACTIVATE = 4; 1019 SW_SHOW = 5; 1020 SW_MINIMIZE = 6; 1021 SW_SHOWMINNOACTIVE = 7; 1022 SW_SHOWNA = 8; 1023 SW_RESTORE = 9; 1024 SW_SHOWDEFAULT = 10; 1025 SW_MAX = 10; 1026 SW_SHOWFULLSCREEN = 11; // LCL Addition 1027 1028//============================================== 1029// Redrawindow() flags 1030//============================================== 1031 RDW_INVALIDATE = $0001; 1032 RDW_INTERNALPAINT = $0002; 1033 RDW_ERASE = $0004; 1034 RDW_VALIDATE = $0008; 1035 RDW_NOINTERNALPAINT = $0010; 1036 RDW_NOERASE = $0020; 1037 RDW_NOCHILDREN = $0040; 1038 RDW_ALLCHILDREN = $0080; 1039 RDW_UPDATENOW = $0100; 1040 RDW_ERASENOW = $0200; 1041 RDW_FRAME = $0400; 1042 RDW_NOFRAME = $0800; 1043 1044 1045const 1046 { DIB color table identifiers } 1047 1048 DIB_RGB_COLORS = 0; { color table in RGBs } 1049 DIB_PAL_COLORS = 1; { color table in palette indices } 1050 1051const 1052 { Gradient Fill Modes } 1053 GRADIENT_FILL_RECT_H = 0; 1054 GRADIENT_FILL_RECT_V = 1; 1055 GRADIENT_FILL_TRIANGLE = 2; 1056 1057 1058type 1059 PNMHdr = ^TNMHdr; 1060 tagNMHDR = record 1061 hwndFrom: HWND; 1062 idFrom: PtrUInt; 1063 code: Integer; 1064 end; 1065 TNMHdr = tagNMHDR; 1066 NMHDR = tagNMHDR; 1067 1068 PScreenInfo = ^TScreenInfo; 1069 TScreenInfo = record 1070 PixelsPerInchX: Integer; 1071 PixelsPerInchY: Integer; 1072 ColorDepth: Integer; 1073 Initialized: boolean; 1074 end; 1075 1076{ monitor support } 1077const 1078 MONITOR_UNIMPL = HMONITOR(-1); 1079 1080 MONITOR_DEFAULTTONULL = $00000000; 1081 MONITOR_DEFAULTTOPRIMARY = $00000001; 1082 MONITOR_DEFAULTTONEAREST = $00000002; 1083 1084 MONITORINFOF_PRIMARY = $00000001; 1085 CCHDEVICENAME = 32; 1086 1087type 1088 tagMonitorInfo = record 1089 cbSize: DWord; 1090 rcMonitor: TRect; 1091 rcWork: TRect; 1092 dwFlags: DWord; 1093 end; 1094 PMonitorInfo = ^TMonitorInfo; 1095 TMonitorInfo = tagMonitorInfo; 1096 1097 tagMonitorInfoEx = record 1098 cbSize: DWord; 1099 rcMonitor: TRect; 1100 rcWork: TRect; 1101 dwFlags: DWord; 1102 szDevice: array[0..CCHDEVICENAME - 1] of Char; 1103 end; 1104 PMonitorInfoEx = ^TMonitorInfoEx; 1105 TMonitorInfoEx = tagMonitorInfoEx; 1106 1107 tagMonitorInfoExW = record 1108 cbSize: DWord; 1109 rcMonitor: TRect; 1110 rcWork: TRect; 1111 dwFlags: DWord; 1112 szDevice: array[0..CCHDEVICENAME - 1] of WideChar; 1113 end; 1114 PMonitorInfoExW = ^TMonitorInfoExW; 1115 TMonitorInfoExW = tagMonitorInfoExW; 1116 1117 MONITOR_DPI_TYPE = ( 1118 MDT_EFFECTIVE_DPI = 0, 1119 MDT_ANGULAR_DPI = 1, 1120 MDT_RAW_DPI = 2, 1121 MDT_DEFAULT = MDT_EFFECTIVE_DPI); 1122 TMonitorDpiType = MONITOR_DPI_TYPE; 1123 1124{painting stuff} 1125 1126 PDrawItemStruct = ^TDrawItemStruct; 1127 tagDrawItemStruct = record 1128 ctlType: UINT; 1129 ctlID : UINT; 1130 itemID : UINT; 1131 itemAction : UINT; 1132 itemState : UINT; 1133 hwndItem: HWND; 1134 _hDC: HDC; 1135 rcItem: TRect; 1136 itemData : ULONG_PTR; 1137 end; 1138 TDrawItemStruct = tagDrawItemStruct; 1139 DrawItemStruct = tagDrawItemStruct; 1140 1141 // ToDo: move this to StdCtrls 1142 TOwnerDrawStateType = ( 1143 odSelected, odGrayed, odDisabled, odChecked, 1144 odFocused, odDefault, odHotLight, odInactive, odNoAccel, 1145 odNoFocusRect, odReserved1, odReserved2, odComboBoxEdit, 1146 odBackgroundPainted // item background already painted 1147 ); 1148 TOwnerDrawState = set of TOwnerDrawStateType; 1149 1150 PDrawListItemStruct = ^TDrawListItemStruct; 1151 TDrawListItemStruct = record 1152 ItemID: UINT; 1153 Area: TRect; 1154 DC: HDC; 1155 ItemState: TOwnerDrawState; 1156 end; 1157 1158 PMeasureItemStruct = ^TMeasureItemStruct; 1159 TMeasureItemStruct = record 1160 CtlType : UINT; 1161 CtlID : UINT; 1162 itemID : UINT; 1163 itemWidth : UINT; 1164 itemHeight : UINT; 1165 itemData : ULONG_PTR; 1166 end; 1167 1168 PPaintStruct = ^TPaintStruct; 1169 tagPAINTSTRUCT = record 1170 hdc: HDC; 1171 fErase: BOOL; 1172 rcPaint: TRect; 1173 fRestore: BOOL; 1174 fIncUpdate: BOOL; 1175 rgbReserved: array[0..31] of Byte; 1176 end; 1177 TPaintStruct = tagPAINTSTRUCT; 1178 1179 PAINTSTRUCT = tagPAINTSTRUCT; 1180 1181 1182 PWindowPos = ^TWIndowPos; 1183 tagWindowPos = record 1184 _hwnd : HWND; 1185 hwndInsertAfter: HWND; 1186 x : Integer; 1187 y : Integer; 1188 cx : Integer; 1189 cy : Integer; 1190 flags: UINT; 1191 end; 1192 TWindowPos = tagWindowPos; 1193 WindowPos = tagWindowPos; 1194 1195 tagScrollInfo = record 1196 cbSize : UINT; 1197 fMask : UINT; 1198 nMin: Integer; 1199 nMax: Integer; 1200 nPage: UInt; 1201 nPos: Integer; 1202 nTrackPos: Integer; 1203 end; 1204 PScrollInfo = ^TScrollInfo; 1205 TScrollInfo = tagScrollinfo; 1206 1207{ Palette Structures } 1208 PPaletteEntry = ^tagPaletteEntry; 1209 tagPALETTEENTRY = record 1210 peRed: Byte; 1211 peGreen: Byte; 1212 peBlue: Byte; 1213 peFlags: Byte; 1214 end; 1215 TPaletteEntry = tagPALETTEENTRY; 1216 PALETTEENTRY = tagPALETTEENTRY; 1217 1218 PLogPalette = ^tagLogPalette; 1219 tagLOGPALETTE = record 1220 palVersion: Word; 1221 palNumEntries: Word; 1222 palPalEntry: array[0..0] of tagPaletteEntry; 1223 end; 1224 LOGPALETTE = tagLOGPALETTE; 1225 TLOGPALETTE = tagLOGPALETTE; 1226 1227{ GradientFill Structures } 1228 PTriVertex = ^tagTriVertex; 1229 tagTRIVERTEX = record 1230 x: Longint; 1231 y: Longint; 1232 Red: Word; 1233 Green: Word; 1234 Blue: Word; 1235 Alpha: Word; 1236 end; 1237 TRIVERTEX = tagTRIVERTEX; 1238 TTriVertex = TRIVERTEX; 1239 1240 PGradientTriangle = ^tagGradientTriangle; 1241 tagGRADIENTTRIANGLE = record 1242 Vertex1: Cardinal; 1243 Vertex2: Cardinal; 1244 Vertex3: Cardinal; 1245 end; 1246 GRADIENTTRIANGLE = tagGRADIENTTRIANGLE; 1247 TGradientTriangle = GRADIENTTRIANGLE; 1248 1249 PGradientRect = ^tagGradientRect; 1250 tagGRADIENTRECT = record 1251 UpperLeft: Cardinal; 1252 LowerRight: Cardinal; 1253 end; 1254 GRADIENTRECT = tagGRADIENTRECT; 1255 TGradientRect = GRADIENTRECT; 1256 1257{ ********************************** } 1258{ B I T M A P S T U F F } 1259 1260 { TBitmap is an encapsulation of a matrix of pixels. } 1261 PBitmap = ^TagBitmap; 1262 tagBITMAP = record 1263 bmType: Longint; 1264 bmWidth: Longint; 1265 bmHeight: Longint; 1266 bmWidthBytes: Longint; 1267 bmPlanes: Word; 1268 bmBitsPixel: Word; 1269 bmBits: Pointer; 1270 end; 1271 BITMAP = tagBITMAP; 1272 1273 1274 PBitmapCoreHeader = ^TBitmapCoreHeader; 1275 tagBITMAPCOREHEADER = packed record // use packed, this is the .bmp file format 1276 bcSize: DWORD; 1277 bcWidth: Word; 1278 bcHeight: Word; 1279 bcPlanes: Word; 1280 bcBitCount: Word; 1281 end; 1282 TBitmapCoreHeader = tagBITMAPCOREHEADER; 1283 BITMAPCOREHEADER = tagBITMAPCOREHEADER; 1284 1285 1286 PBitmapInfoHeader = ^TBitmapInfoHeader; 1287 tagBITMAPINFOHEADER = packed record // use packed, this is the .bmp file format 1288 biSize : DWORD; 1289 biWidth : Longint; 1290 biHeight : Longint; 1291 biPlanes : WORD; 1292 biBitCount : WORD; 1293 biCompression : DWORD; 1294 biSizeImage : DWORD; 1295 biXPelsPerMeter : Longint; 1296 biYPelsPerMeter : Longint; 1297 biClrUsed : DWORD; 1298 biClrImportant : DWORD; 1299 end; 1300 TBitmapInfoHeader = tagBITMAPINFOHEADER; 1301 BITMAPINFOHEADER = tagBITMAPINFOHEADER; 1302 1303 1304 PRGBTriple = ^TRGBTriple; 1305 tagRGBTRIPLE = record 1306 rgbtBlue: Byte; 1307 rgbtGreen: Byte; 1308 rgbtRed: Byte; 1309 end; 1310 TRGBTriple = tagRGBTRIPLE; 1311 RGBTRIPLE = tagRGBTRIPLE; 1312 1313 PRGBQUAD = ^TRGBQUAD; 1314 tagRGBQUAD = record 1315 rgbBlue : BYTE; 1316 rgbGreen : BYTE; 1317 rgbRed : BYTE; 1318 rgbReserved : BYTE; 1319 end; 1320 TRGBQuad = tagRGBQUAD; 1321 RGBQUAD = tagRGBQUAD; 1322 1323 TRGBAQuad = record 1324 Blue: Byte; 1325 Green: Byte; 1326 Red: Byte; 1327 Alpha: Byte; 1328 end; 1329 PRGBAQuad = ^TRGBAQuad; 1330 TRGBAQuadArray = array of TRGBAQuad; 1331 1332 1333 PBitmapInfo = ^TBitmapInfo; 1334 tagBITMAPINFO = record 1335 bmiHeader: TBitmapInfoHeader; 1336 bmiColors: array[0..0] of TRGBQuad; 1337 end; 1338 TBitmapInfo = tagBITMAPINFO; 1339 BITMAPINFO = tagBITMAPINFO; 1340 1341 PBitmapCoreInfo = ^TBitmapCoreInfo; 1342 tagBITMAPCOREINFO = record 1343 bmciHeader: TBitmapCoreHeader; 1344 bmciColors: array[0..0] of TRGBTriple; 1345 Reserved: array[0..0] of Char; 1346 end; 1347 TBitmapCoreInfo = tagBITMAPCOREINFO; 1348 BITMAPCOREINFO = tagBITMAPCOREINFO; 1349 1350 1351 PBitmapFileHeader = ^TBitmapFileHeader; 1352 tagBITMAPFILEHEADER = packed record 1353 bfType: Word; 1354 bfSize: DWORD; 1355 bfReserved1: Word; 1356 bfReserved2: Word; 1357 bfOffBits: DWORD; 1358 end; 1359 TBitmapFileHeader = tagBITMAPFILEHEADER; 1360 BITMAPFILEHEADER = tagBITMAPFILEHEADER; 1361 1362 1363 PDIBSection = ^TDIBSection; 1364 tagDIBSECTION = record 1365 dsBm: TagBitmap; 1366 dsBmih: tagBITMAPINFOHEADER; 1367 dsBitfields: array[0..2] of DWORD; 1368 dshSection: THandle; 1369 dsOffset: DWORD; 1370 end; 1371 TDIBSection = tagDIBSECTION; 1372 DIBSECTION = tagDIBSECTION; 1373 1374 tagHELPINFO = record 1375 cbSize: DWORD; 1376 iContextType: Integer; 1377 iCtrlId: Integer; 1378 hItemHandle: THandle; 1379 dwContextId: DWORD; 1380 MousePos: TPOINT; 1381 end; 1382 THelpInfo = tagHelpInfo; 1383 PHelpInfo = ^THelpInfo; 1384 1385const 1386 RASTER_FONTTYPE = 1; 1387 DEVICE_FONTTYPE = 2; 1388 TRUETYPE_FONTTYPE = 4; 1389 1390 GCP_DBCS = 1; 1391 1392// context type 1393 HELPINFO_WINDOW = $0001; 1394 HELPINFO_MENUITEM = $0002; 1395 1396// DoOnHelp commands 1397 HELP_CONTEXT = 1; 1398 HELP_COMMAND = 258; 1399 1400//============================================== 1401// Background Modes 1402//============================================== 1403 TRANSPARENT = 1; 1404 OPAQUE = 2; 1405 BKMODE_LAST = 2; 1406 1407//============================================== 1408// Font constants 1409//============================================== 1410 1411//------------ 1412// Font Styles 1413//------------ 1414 LF_FULLFACESIZE = 64; 1415 LF_FACESIZE = 32; 1416 1417 OUT_DEFAULT_PRECIS = 0; 1418 OUT_STRING_PRECIS = 1; 1419 OUT_CHARACTER_PRECIS = 2; 1420 OUT_STROKE_PRECIS = 3; 1421 OUT_TT_PRECIS = 4; 1422 OUT_DEVICE_PRECIS = 5; 1423 OUT_RASTER_PRECIS = 6; 1424 OUT_TT_ONLY_PRECIS = 7; 1425 OUT_OUTLINE_PRECIS = 8; 1426 OUT_SCREEN_OUTLINE_PRECIS = 9; 1427 1428 CLIP_DEFAULT_PRECIS = 0; 1429 CLIP_CHARACTER_PRECIS = 1; 1430 CLIP_STROKE_PRECIS = 2; 1431 CLIP_MASK = 15; 1432 CLIP_LH_ANGLES = (1 shl 4); 1433 CLIP_TT_ALWAYS = (2 shl 4); 1434 CLIP_EMBEDDED = (8 shl 4); 1435 1436 DEFAULT_QUALITY = 0; 1437 DRAFT_QUALITY = 1; 1438 PROOF_QUALITY = 2; 1439 NONANTIALIASED_QUALITY = 3; 1440 ANTIALIASED_QUALITY = 4; 1441 CLEARTYPE_QUALITY = 5; 1442 CLEARTYPE_NATURAL_QUALITY = 6; 1443 1444 DEFAULT_PITCH = 0; 1445 FIXED_PITCH = 1; 1446 VARIABLE_PITCH = 2; 1447 MONO_FONT = 8; 1448 1449 // font character sets 1450 ANSI_CHARSET = 0; 1451 DEFAULT_CHARSET = 1; 1452 SYMBOL_CHARSET = 2; 1453 // added for ISO_8859_2 under gtk 1454 FCS_ISO_10646_1 = 4; // Unicode; 1455 FCS_ISO_8859_1 = 5; // ISO Latin-1 (Western Europe); 1456 FCS_ISO_8859_2 = 6; // ISO Latin-2 (Eastern Europe); 1457 FCS_ISO_8859_3 = 7; // ISO Latin-3 (Southern Europe); 1458 FCS_ISO_8859_4 = 8; // ISO Latin-4 (Northern Europe); 1459 FCS_ISO_8859_5 = 9; // ISO Cyrillic; 1460 FCS_ISO_8859_6 = 10; // ISO Arabic; 1461 FCS_ISO_8859_7 = 11; // ISO Greek; 1462 FCS_ISO_8859_8 = 12; // ISO Hebrew; 1463 FCS_ISO_8859_9 = 13; // ISO Latin-5 (Turkish); 1464 FCS_ISO_8859_10 = 14; // ISO Latin-6 (Nordic); 1465 FCS_ISO_8859_15 = 15; // ISO Latin-9, or Latin-0 (Revised Western-European); 1466 //FCS_koi8_r = 16; // KOI8 Russian; 1467 //FCS_koi8_u = 17; // KOI8 Ukrainian (see RFC 2319); 1468 //FCS_koi8_ru = 18; // KOI8 Russian/Ukrainian 1469 //FCS_koi8_uni = 19; // KOI8 ``Unified'' (Russian, Ukrainian, and Byelorussian); 1470 //FCS_koi8_e = 20; // KOI8 ``European,'' ISO-IR-111, or ECMA-Cyrillic; 1471 // end of our own additions 1472 MAC_CHARSET = 77; 1473 SHIFTJIS_CHARSET = 128; 1474 HANGEUL_CHARSET = 129; 1475 JOHAB_CHARSET = 130; 1476 GB2312_CHARSET = 134; 1477 CHINESEBIG5_CHARSET = 136; 1478 GREEK_CHARSET = 161; 1479 TURKISH_CHARSET = 162; 1480 VIETNAMESE_CHARSET = 163; 1481 HEBREW_CHARSET = 177; 1482 ARABIC_CHARSET = 178; 1483 BALTIC_CHARSET = 186; 1484 RUSSIAN_CHARSET = 204; 1485 THAI_CHARSET = 222; 1486 EASTEUROPE_CHARSET = 238; 1487 OEM_CHARSET = 255; 1488 // additional charsets 1489 1490//----------- 1491// Font Sets 1492//----------- 1493 FS_LATIN1 = 1; 1494 FS_LATIN2 = 2; 1495 FS_CYRILLIC = 4; 1496 FS_GREEK = 8; 1497 FS_TURKISH = $10; 1498 FS_HEBREW = $20; 1499 FS_ARABIC = $40; 1500 FS_BALTIC = $80; 1501 FS_VIETNAMESE = $00000100; 1502 FS_THAI = $10000; 1503 FS_JISJAPAN = $20000; 1504 FS_CHINESESIMP = $40000; 1505 FS_WANSUNG = $80000; 1506 FS_CHINESETRAD = $100000; 1507 FS_JOHAB = $200000; 1508 FS_SYMBOL = DWORD($80000000); 1509 1510//--------------- 1511// Font Families 1512//--------------- 1513 FF_DONTCARE = (0 shl 4); 1514 FF_ROMAN = (1 shl 4); 1515 FF_SWISS = (2 shl 4); 1516 FF_MODERN = (3 shl 4); 1517 FF_SCRIPT = (4 shl 4); 1518 FF_DECORATIVE = (5 shl 4); 1519 1520//-------------- 1521// Font Weights 1522//-------------- 1523 FW_DONTCARE = 0; 1524 FW_THIN = 100; 1525 FW_EXTRALIGHT = 200; 1526 FW_LIGHT = 300; 1527 FW_NORMAL = 400; 1528 FW_MEDIUM = 500; 1529 FW_SEMIBOLD = 600; 1530 FW_BOLD = 700; 1531 FW_EXTRABOLD = 800; 1532 FW_HEAVY = 900; 1533 FW_ULTRALIGHT = FW_EXTRALIGHT; 1534 FW_REGULAR = FW_NORMAL; 1535 FW_DEMIBOLD = FW_SEMIBOLD; 1536 FW_ULTRABOLD = FW_EXTRABOLD; 1537 FW_BLACK = FW_HEAVY; 1538 1539 FOUNDRYCHAR_OPEN = '['; // added for support foundry encoded in family name 1540 FOUNDRYCHAR_CLOSE = ']'; // also needed to drop foundry when creating font in windows 1541 1542//-------------- 1543// XFLD constans 1544//-------------- 1545 XLFD_FONTNAME_REG = 0; 1546 XLFD_FOUNDRY = 1; 1547 XLFD_FAMILY = 2; 1548 XLFD_WEIGHTNAME = 3; 1549 XLFD_SLANT = 4; 1550 XLFD_WIDTHNAME = 5; 1551 XLFD_STYLENAME = 6; 1552 XLFD_PIXELSIZE = 7; 1553 XLFD_POINTSIZE = 8; 1554 XLFD_RESX = 9; 1555 XLFD_RESY = 10; 1556 XLFD_SPACING = 11; 1557 XLFD_AVG_WIDTH = 12; 1558 XLFD_CHARSET_REG = 13; 1559 XLFD_CHARSET_COD = 14; 1560 1561 1562 1563//============================================== 1564// Brush constants 1565//============================================== 1566 1567//-------------- 1568// Brush Styles 1569//-------------- 1570 1571 BS_SOLID = 0; 1572 BS_NULL = 1; 1573 BS_HOLLOW = BS_NULL; 1574 BS_HATCHED = 2; 1575 BS_PATTERN = 3; 1576 BS_INDEXED = 4; 1577 BS_DIBPATTERN = 5; 1578 BS_DIBPATTERNPT = 6; 1579 BS_PATTERN8X8 = 7; 1580 BS_DIBPATTERN8X8 = 8; 1581 BS_MONOPATTERN = 9; 1582 1583//-------------- 1584// Hatch Styles 1585//-------------- 1586 1587 HS_HORIZONTAL = 0; { ----- } 1588 HS_VERTICAL = 1; { ||||| } 1589 HS_FDIAGONAL = 2; { ///// } 1590 HS_BDIAGONAL = 3; { \\\\\ } 1591 HS_CROSS = 4; { +++++ } 1592 HS_DIAGCROSS = 5; { xxxxx } 1593 1594//============================================== 1595// Pen constants 1596//============================================== 1597 1598//------------ 1599// Pen Styles 1600//------------ 1601 1602 PS_SOLID = 0; 1603 PS_DASH = 1; { ------- } 1604 PS_DOT = 2; { ....... } 1605 PS_DASHDOT = 3; { _._._._ } 1606 PS_DASHDOTDOT = 4; { _.._.._ } 1607 PS_NULL = 5; 1608 PS_INSIDEFRAME = 6; 1609 PS_USERSTYLE = 7; 1610 PS_ALTERNATE = 8; 1611 PS_STYLE_MASK = 15; 1612 1613 PS_ENDCAP_ROUND = 0; 1614 PS_ENDCAP_SQUARE = $100; 1615 PS_ENDCAP_FLAT = $200; 1616 PS_ENDCAP_MASK = 3840; 1617 1618 PS_JOIN_ROUND = 0; 1619 PS_JOIN_BEVEL = $1000; 1620 PS_JOIN_MITER = $2000; 1621 PS_JOIN_MASK = 61440; 1622 1623 PS_COSMETIC = 0; 1624 PS_GEOMETRIC = $10000; 1625 PS_TYPE_MASK = $F0000; 1626 1627 1628//============================================== 1629// Mapping modes for SetMapMode/GetMapMode 1630//============================================== 1631 1632 MM_TEXT = 1; 1633 MM_LOMETRIC = 2; 1634 MM_HIMETRIC = 3; 1635 MM_LOENGLISH = 4; 1636 MM_HIENGLISH = 5; 1637 MM_TWIPS = 6; 1638 MM_ISOTROPIC = 7; 1639 MM_ANISOTROPIC = 8; 1640 1641 1642//============================================== 1643// API system Color constants pbd 1644// note these are usually shown ORed with 1645// $80000000 as these would have interfered with 1646// other MS color enumerations 1647// GetSysColor and SetSysColor expects the values 1648// below 1649//============================================== 1650 1651type 1652 COLORREF = Cardinal; 1653 TColorRef = COLORREF; 1654 1655const 1656 CLR_NONE = TColorRef($FFFFFFFF); 1657 CLR_DEFAULT = TColorRef($FF000000); 1658 CLR_INVALID = TColorRef($FFFFFFFF); 1659 1660 COLOR_SCROLLBAR = 0; 1661 COLOR_BACKGROUND = 1; 1662 COLOR_ACTIVECAPTION = 2; 1663 COLOR_INACTIVECAPTION = 3; 1664 COLOR_MENU = 4; 1665 COLOR_WINDOW = 5; 1666 COLOR_WINDOWFRAME = 6; 1667 COLOR_MENUTEXT = 7; 1668 COLOR_WINDOWTEXT = 8; 1669 COLOR_CAPTIONTEXT = 9; 1670 COLOR_ACTIVEBORDER = 10; 1671 COLOR_INACTIVEBORDER = 11; 1672 COLOR_APPWORKSPACE = 12; 1673 COLOR_HIGHLIGHT = 13; 1674 COLOR_HIGHLIGHTTEXT = 14; 1675 COLOR_BTNFACE = 15; 1676 COLOR_BTNSHADOW = 16; 1677 COLOR_GRAYTEXT = 17; 1678 COLOR_BTNTEXT = 18; 1679 COLOR_INACTIVECAPTIONTEXT = 19; 1680 COLOR_BTNHIGHLIGHT = 20; 1681 COLOR_3DDKSHADOW = 21; 1682 COLOR_3DLIGHT = 22; 1683 COLOR_INFOTEXT = 23; 1684 COLOR_INFOBK = 24; 1685 // PBD: 25 is unassigned in all the docs I can find 1686 // if someone finds what this is supposed to be then fill it in 1687 // note defaults below, and cl[ColorConst] in graphics 1688 COLOR_HOTLIGHT = 26; 1689 COLOR_GRADIENTACTIVECAPTION = 27; 1690 COLOR_GRADIENTINACTIVECAPTION = 28; 1691 COLOR_MENUHILIGHT = 29; 1692 COLOR_MENUBAR = 30; 1693 1694 COLOR_FORM = 31; 1695 1696 COLOR_ENDCOLORS = COLOR_FORM; 1697 1698 COLOR_DESKTOP = COLOR_BACKGROUND; 1699 COLOR_3DFACE = COLOR_BTNFACE; 1700 COLOR_3DSHADOW = COLOR_BTNSHADOW; 1701 COLOR_3DHIGHLIGHT = COLOR_BTNHIGHLIGHT; 1702 COLOR_3DHILIGHT = COLOR_BTNHIGHLIGHT; 1703 COLOR_BTNHILIGHT = COLOR_BTNHIGHLIGHT; 1704 1705 MAX_SYS_COLORS = COLOR_ENDCOLORS; 1706 SYS_COLOR_BASE = TColorRef($80000000); 1707 1708 // !! deprecated colors !! 1709 1710 // CLX base, mapped, pseudo, rgb values 1711 COLOR_clForeground = 32; 1712 COLOR_clButton = COLOR_clForeground+1; 1713 COLOR_clLight = COLOR_clForeground+2; 1714 COLOR_clMidlight = COLOR_clForeground+3; 1715 COLOR_clDark = COLOR_clForeground+4; 1716 COLOR_clMid = COLOR_clForeground+5; 1717 COLOR_clText = COLOR_clForeground+6; 1718 COLOR_clBrightText = COLOR_clForeground+7; 1719 COLOR_clButtonText = COLOR_clForeground+8; 1720 COLOR_clBase = COLOR_clForeground+9; 1721 //clBackground 1722 COLOR_clShadow = COLOR_clForeground+10; 1723 //clHighlight 1724 COLOR_clHighlightedText = COLOR_clForeground+11; 1725 1726 // CLX normal, mapped, pseudo, rgb values 1727 COLOR_clNormalForeground = 44; 1728 COLOR_clNormalButton = COLOR_clNormalForeground+1; 1729 COLOR_clNormalLight = COLOR_clNormalForeground+2; 1730 COLOR_clNormalMidlight = COLOR_clNormalForeground+3; 1731 COLOR_clNormalDark = COLOR_clNormalForeground+4; 1732 COLOR_clNormalMid = COLOR_clNormalForeground+5; 1733 COLOR_clNormalText = COLOR_clNormalForeground+6; 1734 COLOR_clNormalBrightText = COLOR_clNormalForeground+7; 1735 COLOR_clNormalButtonText = COLOR_clNormalForeground+8; 1736 COLOR_clNormalBase = COLOR_clNormalForeground+9; 1737 COLOR_clNormalBackground = COLOR_clNormalForeground+10; 1738 COLOR_clNormalShadow = COLOR_clNormalForeground+11; 1739 COLOR_clNormalHighlight = COLOR_clNormalForeground+12; 1740 COLOR_clNormalHighlightedText = COLOR_clNormalForeground+13; 1741 1742 // CLX disabled, mapped, pseudo, rgb values 1743 COLOR_clDisabledForeground = 58; 1744 COLOR_clDisabledButton = COLOR_clDisabledForeground+1; 1745 COLOR_clDisabledLight = COLOR_clDisabledForeground+2; 1746 COLOR_clDisabledMidlight = COLOR_clDisabledForeground+3; 1747 COLOR_clDisabledDark = COLOR_clDisabledForeground+4; 1748 COLOR_clDisabledMid = COLOR_clDisabledForeground+5; 1749 COLOR_clDisabledText = COLOR_clDisabledForeground+6; 1750 COLOR_clDisabledBrightText = COLOR_clDisabledForeground+7; 1751 COLOR_clDisabledButtonText = COLOR_clDisabledForeground+8; 1752 COLOR_clDisabledBase = COLOR_clDisabledForeground+9; 1753 COLOR_clDisabledBackground = COLOR_clDisabledForeground+10; 1754 COLOR_clDisabledShadow = COLOR_clDisabledForeground+11; 1755 COLOR_clDisabledHighlight = COLOR_clDisabledForeground+12; 1756 COLOR_clDisabledHighlightedText = COLOR_clDisabledForeground+13; 1757 1758 // CLX active, mapped, pseudo, rgb values 1759 COLOR_clActiveForeground = 72; 1760 COLOR_clActiveButton = COLOR_clActiveForeground+1; 1761 COLOR_clActiveLight = COLOR_clActiveForeground+2; 1762 COLOR_clActiveMidlight = COLOR_clActiveForeground+3; 1763 COLOR_clActiveDark = COLOR_clActiveForeground+4; 1764 COLOR_clActiveMid = COLOR_clActiveForeground+5; 1765 COLOR_clActiveText = COLOR_clActiveForeground+6; 1766 COLOR_clActiveBrightText = COLOR_clActiveForeground+7; 1767 COLOR_clActiveButtonText = COLOR_clActiveForeground+8; 1768 COLOR_clActiveBase = COLOR_clActiveForeground+9; 1769 COLOR_clActiveBackground = COLOR_clActiveForeground+10; 1770 COLOR_clActiveShadow = COLOR_clActiveForeground+11; 1771 COLOR_clActiveHighlight = COLOR_clActiveForeground+12; 1772 COLOR_clActiveHighlightedText = COLOR_clActiveForeground+13; 1773 1774//============================================== 1775// Stock Objects 1776//============================================== 1777 1778 WHITE_BRUSH = 0; 1779 LTGRAY_BRUSH = 1; 1780 GRAY_BRUSH = 2; 1781 DKGRAY_BRUSH = 3; 1782 BLACK_BRUSH = 4; 1783 NULL_BRUSH = 5; 1784 HOLLOW_BRUSH = NULL_BRUSH; 1785 WHITE_PEN = 6; 1786 BLACK_PEN = 7; 1787 NULL_PEN = 8; 1788 OEM_FIXED_FONT = 10; 1789 ANSI_FIXED_FONT = 11; 1790 ANSI_VAR_FONT = 12; 1791 SYSTEM_FONT = 13; 1792 DEVICE_DEFAULT_FONT = 14; 1793 DEFAULT_PALETTE = 15; 1794 SYSTEM_FIXED_FONT = 16; 1795 DEFAULT_GUI_FONT = 17; 1796 DC_BRUSH = 18; 1797 DC_PEN = 19; 1798 STOCK_LAST = 19; 1799 1800//============================================== 1801// Stock Pixmap Types 1802//============================================== 1803 idButtonBase = 0; 1804 idButtonOk = idButtonBase + 1; 1805 idButtonCancel = idButtonBase + 2; 1806 idButtonHelp = idButtonBase + 3; 1807 idButtonYes = idButtonBase + 4; 1808 idButtonNo = idButtonBase + 5; 1809 idButtonClose = idButtonBase + 6; 1810 idButtonAbort = idButtonBase + 7; 1811 idButtonRetry = idButtonBase + 8; 1812 idButtonIgnore = idButtonBase + 9; 1813 idButtonAll = idButtonBase + 10; 1814 idButtonYesToAll = idButtonBase + 11; 1815 idButtonNoToAll = idButtonBase + 12; 1816 idButtonOpen = idButtonBase + 13; 1817 idButtonSave = idButtonBase + 14; 1818 idButtonShield = idButtonBase + 15; 1819 1820 idDialogBase = $FF; 1821 idDialogWarning = idDialogBase + 1; 1822 idDialogError = idDialogBase + 2; 1823 idDialogInfo = idDialogBase + 3; 1824 idDialogConfirm = idDialogBase + 4; 1825 idDialogShield = idDialogBase + 5; 1826 1827 1828//============================================== 1829// Devicecontext object types 1830//============================================== 1831 OBJ_PEN = 1; 1832 OBJ_BRUSH = 2; 1833 OBJ_DC = 3; 1834 OBJ_METADC = 4; 1835 OBJ_PAL = 5; 1836 OBJ_FONT = 6; 1837 OBJ_BITMAP = 7; 1838 OBJ_REGION = 8; 1839 OBJ_METAFILE = 9; 1840 OBJ_MEMDC = 10; 1841 OBJ_EXTPEN = 11; 1842 OBJ_ENHMETADC = 12; 1843 OBJ_ENHMETAFILE = 13; 1844 OBJ_COLORSPACE = 14; 1845 1846 1847//============================================== 1848// SystemMetrics constants 1849//============================================== 1850 1851 SM_CXSCREEN = 0; 1852 SM_CYSCREEN = 1; 1853 SM_CXVSCROLL = 2; 1854 SM_CYHSCROLL = 3; 1855 SM_CYCAPTION = 4; 1856 SM_CXBORDER = 5; 1857 SM_CYBORDER = 6; 1858 SM_CXDLGFRAME = 7; 1859 SM_CYDLGFRAME = 8; 1860 SM_CYVTHUMB = 9; 1861 SM_CXHTHUMB = 10; 1862 SM_CXICON = 11; 1863 SM_CYICON = 12; 1864 SM_CXCURSOR = 13; 1865 SM_CYCURSOR = 14; 1866 SM_CYMENU = 15; 1867 SM_CXFULLSCREEN = 16; 1868 SM_CYFULLSCREEN = 17; 1869 SM_CYKANJIWINDOW = 18; 1870 SM_MOUSEPRESENT = 19; 1871 SM_CYVSCROLL = 20; 1872 SM_CXHSCROLL = 21; 1873 SM_DEBUG = 22; 1874 SM_SWAPBUTTON = 23; 1875 SM_RESERVED1 = 24; 1876 SM_RESERVED2 = 25; 1877 SM_RESERVED3 = 26; 1878 SM_RESERVED4 = 27; 1879 SM_CXMIN = 28; 1880 SM_CYMIN = 29; 1881 SM_CXSIZE = 30; 1882 SM_CYSIZE = 31; 1883 SM_CXFRAME = 32; 1884 SM_CYFRAME = 33; 1885 SM_CXMINTRACK = 34; 1886 SM_CYMINTRACK = 35; 1887 SM_CXDOUBLECLK = 36; 1888 SM_CYDOUBLECLK = 37; 1889 SM_CXICONSPACING = 38; 1890 SM_CYICONSPACING = 39; 1891 SM_MENUDROPALIGNMENT = 40; 1892 SM_PENWINDOWS = 41; 1893 SM_DBCSENABLED = 42; 1894 SM_CMOUSEBUTTONS = 43; 1895 1896 SM_CXFIXEDFRAME = SM_CXDLGFRAME; 1897 SM_CYFIXEDFRAME = SM_CYDLGFRAME; 1898 SM_CXSIZEFRAME = SM_CXFRAME; 1899 SM_CYSIZEFRAME = SM_CYFRAME; 1900 1901 SM_SECURE = 44; 1902 SM_CXEDGE = 45; 1903 SM_CYEDGE = 46; 1904 SM_CXMINSPACING = 47; 1905 SM_CYMINSPACING = 48; 1906 SM_CXSMICON = 49; 1907 SM_CYSMICON = 50; 1908 SM_CYSMCAPTION = 51; 1909 SM_CXSMSIZE = 52; 1910 SM_CYSMSIZE = 53; 1911 SM_CXMENUSIZE = 54; 1912 SM_CYMENUSIZE = 55; 1913 SM_ARRANGE = 56; 1914 SM_CXMINIMIZED = 57; 1915 SM_CYMINIMIZED = 58; 1916 SM_CXMAXTRACK = 59; 1917 SM_CYMAXTRACK = 60; 1918 SM_CXMAXIMIZED = 61; 1919 SM_CYMAXIMIZED = 62; 1920 SM_NETWORK = 63; 1921 SM_CLEANBOOT = 67; 1922 SM_CXDRAG = 68; 1923 SM_CYDRAG = 69; 1924 SM_SHOWSOUNDS = 70; 1925 SM_CXMENUCHECK = 71; 1926 SM_CYMENUCHECK = 72; 1927 SM_SLOWMACHINE = 73; 1928 SM_MIDEASTENABLED = 74; 1929 SM_MOUSEWHEELPRESENT = 75; 1930 SM_CMETRICS = 76; 1931 1932 SM_XVIRTUALSCREEN = 76; 1933 SM_YVIRTUALSCREEN = 77; 1934 SM_CXVIRTUALSCREEN = 78; 1935 SM_CYVIRTUALSCREEN = 79; 1936 SM_CMONITORS = 80; 1937 SM_SAMEDISPLAYFORMAT = 81; 1938 1939 SM_SWSCROLLBARSPACING = 120; 1940 1941 {needed for accurate maximized window size, since under X11 we cannot get it until 1942 window is decorated by wm. see issue #21119.} 1943 SM_LCLMAXIMIZEDWIDTH = 121; 1944 SM_LCLMAXIMIZEDHEIGHT = 122; 1945 1946 SM_LCLHasFormAlphaBlend = 123; 1947 1948 SM_REMOTESESSION = $1000; 1949 1950//============================================== 1951// SystemParametersInfo constants 1952//============================================== 1953 SPI_GETBEEP = 1; 1954 SPI_SETBEEP = 2; 1955 SPI_GETMOUSE = 3; 1956 SPI_SETMOUSE = 4; 1957 SPI_GETBORDER = 5; 1958 SPI_SETBORDER = 6; 1959 SPI_GETKEYBOARDSPEED = 10; 1960 SPI_SETKEYBOARDSPEED = 11; 1961 SPI_LANGDRIVER = 12; 1962 SPI_ICONHORIZONTALSPACING = 13; 1963 SPI_GETSCREENSAVETIMEOUT = 14; 1964 SPI_SETSCREENSAVETIMEOUT = 15; 1965 SPI_GETSCREENSAVEACTIVE = 16; 1966 SPI_SETSCREENSAVEACTIVE = 17; 1967 SPI_GETGRIDGRANULARITY = 18; 1968 SPI_SETGRIDGRANULARITY = 19; 1969 SPI_SETDESKWALLPAPER = 20; 1970 SPI_SETDESKPATTERN = 21; 1971 SPI_GETKEYBOARDDELAY = 22; 1972 SPI_SETKEYBOARDDELAY = 23; 1973 SPI_ICONVERTICALSPACING = 24; 1974 SPI_GETICONTITLEWRAP = 25; 1975 SPI_SETICONTITLEWRAP = 26; 1976 SPI_GETMENUDROPALIGNMENT = 27; 1977 SPI_SETMENUDROPALIGNMENT = 28; 1978 SPI_SETDOUBLECLKWIDTH = 29; 1979 SPI_SETDOUBLECLKHEIGHT = 30; 1980 SPI_GETICONTITLELOGFONT = 31; 1981 SPI_SETDOUBLECLICKTIME = 32; 1982 SPI_SETMOUSEBUTTONSWAP = 33; 1983 SPI_SETICONTITLELOGFONT = 34; 1984 SPI_GETFASTTASKSWITCH = 35; 1985 SPI_SETFASTTASKSWITCH = 36; 1986 SPI_SETDRAGFULLWINDOWS = 37; 1987 SPI_GETDRAGFULLWINDOWS = 38; 1988 SPI_GETNONCLIENTMETRICS = 41; 1989 SPI_SETNONCLIENTMETRICS = 42; 1990 SPI_GETMINIMIZEDMETRICS = 43; 1991 SPI_SETMINIMIZEDMETRICS = 44; 1992 SPI_GETICONMETRICS = 45; 1993 SPI_SETICONMETRICS = 46; 1994 SPI_SETWORKAREA = 47; 1995 SPI_GETWORKAREA = 48; 1996 SPI_SETPENWINDOWS = 49; 1997 SPI_GETFILTERKEYS = 50; 1998 SPI_SETFILTERKEYS = 51; 1999 SPI_GETTOGGLEKEYS = 52; 2000 SPI_SETTOGGLEKEYS = 53; 2001 SPI_GETMOUSEKEYS = 54; 2002 SPI_SETMOUSEKEYS = 55; 2003 SPI_GETSHOWSOUNDS = 56; 2004 SPI_SETSHOWSOUNDS = 57; 2005 SPI_GETSTICKYKEYS = 58; 2006 SPI_SETSTICKYKEYS = 59; 2007 SPI_GETACCESSTIMEOUT = 60; 2008 SPI_SETACCESSTIMEOUT = 61; 2009 SPI_GETSERIALKEYS = 62; 2010 SPI_SETSERIALKEYS = 63; 2011 SPI_GETSOUNDSENTRY = 64; 2012 SPI_SETSOUNDSENTRY = 65; 2013 SPI_GETHIGHCONTRAST = 66; 2014 SPI_SETHIGHCONTRAST = 67; 2015 SPI_GETKEYBOARDPREF = 68; 2016 SPI_SETKEYBOARDPREF = 69; 2017 SPI_GETSCREENREADER = 70; 2018 SPI_SETSCREENREADER = 71; 2019 SPI_GETANIMATION = 72; 2020 SPI_SETANIMATION = 73; 2021 SPI_GETFONTSMOOTHING = 74; 2022 SPI_SETFONTSMOOTHING = 75; 2023 SPI_SETDRAGWIDTH = 76; 2024 SPI_SETDRAGHEIGHT = 77; 2025 SPI_SETHANDHELD = 78; 2026 SPI_GETLOWPOWERTIMEOUT = 79; 2027 SPI_GETPOWEROFFTIMEOUT = 80; 2028 SPI_SETLOWPOWERTIMEOUT = 81; 2029 SPI_SETPOWEROFFTIMEOUT = 82; 2030 SPI_GETLOWPOWERACTIVE = 83; 2031 SPI_GETPOWEROFFACTIVE = 84; 2032 SPI_SETLOWPOWERACTIVE = 85; 2033 SPI_SETPOWEROFFACTIVE = 86; 2034 SPI_SETCURSORS = 87; 2035 SPI_SETICONS = 88; 2036 SPI_GETDEFAULTINPUTLANG = 89; 2037 SPI_SETDEFAULTINPUTLANG = 90; 2038 SPI_SETLANGTOGGLE = 91; 2039 SPI_GETWINDOWSEXTENSION = 92; 2040 SPI_SETMOUSETRAILS = 93; 2041 SPI_GETMOUSETRAILS = 94; 2042 SPI_GETSNAPTODEFBUTTON = 95; 2043 SPI_SETSNAPTODEFBUTTON = 96; 2044 SPI_SCREENSAVERRUNNING = 97; 2045 SPI_SETSCREENSAVERRUNNING = 97; 2046 SPI_GETMOUSEHOVERWIDTH = 98; 2047 SPI_SETMOUSEHOVERWIDTH = 99; 2048 SPI_GETMOUSEHOVERHEIGHT = 100; 2049 SPI_SETMOUSEHOVERHEIGHT = 101; 2050 SPI_GETMOUSEHOVERTIME = 102; 2051 SPI_SETMOUSEHOVERTIME = 103; 2052 SPI_GETWHEELSCROLLLINES = 104; 2053 SPI_SETWHEELSCROLLLINES = 105; 2054 SPI_GETMENUSHOWDELAY = 106; 2055 SPI_SETMENUSHOWDELAY = 107; 2056 SPI_GETSHOWIMEUI = 110; 2057 SPI_SETSHOWIMEUI = 111; 2058 SPI_GETMOUSESPEED = 112; 2059 SPI_SETMOUSESPEED = 113; 2060 SPI_GETSCREENSAVERRUNNING = 114; 2061 SPI_GETDESKWALLPAPER = 115; 2062 SPI_GETACTIVEWINDOWTRACKING = 4096; 2063 SPI_SETACTIVEWINDOWTRACKING = 4097; 2064 SPI_GETMENUANIMATION = 4098; 2065 SPI_SETMENUANIMATION = 4099; 2066 SPI_GETCOMBOBOXANIMATION = 4100; 2067 SPI_SETCOMBOBOXANIMATION = 4101; 2068 SPI_GETLISTBOXSMOOTHSCROLLING = 4102; 2069 SPI_SETLISTBOXSMOOTHSCROLLING = 4103; 2070 SPI_GETGRADIENTCAPTIONS = 4104; 2071 SPI_SETGRADIENTCAPTIONS = 4105; 2072 SPI_GETKEYBOARDCUES = 4106; 2073 SPI_SETKEYBOARDCUES = 4107; 2074 SPI_GETMENUUNDERLINES = 4106; 2075 SPI_SETMENUUNDERLINES = 4107; 2076 SPI_GETACTIVEWNDTRKZORDER = 4108; 2077 SPI_SETACTIVEWNDTRKZORDER = 4109; 2078 SPI_GETHOTTRACKING = 4110; 2079 SPI_SETHOTTRACKING = 4111; 2080 SPI_GETMENUFADE = 4114; 2081 SPI_SETMENUFADE = 4115; 2082 SPI_GETSELECTIONFADE = 4116; 2083 SPI_SETSELECTIONFADE = 4117; 2084 SPI_GETTOOLTIPANIMATION = 4118; 2085 SPI_SETTOOLTIPANIMATION = 4119; 2086 SPI_GETTOOLTIPFADE = 4120; 2087 SPI_SETTOOLTIPFADE = 4121; 2088 SPI_GETCURSORSHADOW = 4122; 2089 SPI_SETCURSORSHADOW = 4123; 2090 SPI_GETUIEFFECTS = 4158; 2091 SPI_SETUIEFFECTS = 4159; 2092 SPI_GETFOREGROUNDLOCKTIMEOUT = 8192; 2093 SPI_SETFOREGROUNDLOCKTIMEOUT = 8193; 2094 SPI_GETACTIVEWNDTRKTIMEOUT = 8194; 2095 SPI_SETACTIVEWNDTRKTIMEOUT = 8195; 2096 SPI_GETFOREGROUNDFLASHCOUNT = 8196; 2097 SPI_SETFOREGROUNDFLASHCOUNT = 8197; 2098 SPI_GETCARETWIDTH = 8198; 2099 SPI_SETCARETWIDTH = 8199; 2100 SPI_GETMOUSESONAR = 4124; 2101 SPI_SETMOUSESONAR = 4125; 2102 SPI_GETMOUSECLICKLOCK = 4126; 2103 SPI_SETMOUSECLICKLOCK = 4127; 2104 SPI_GETMOUSEVANISH = 4128; 2105 SPI_SETMOUSEVANISH = 4129; 2106 SPI_GETFLATMENU = 4130; 2107 SPI_SETFLATMENU = 4131; 2108 SPI_GETDROPSHADOW = 4132; 2109 SPI_SETDROPSHADOW = 4133; 2110 SPI_GETBLOCKSENDINPUTRESETS = 4134; 2111 SPI_SETBLOCKSENDINPUTRESETS = 4135; 2112 SPI_GETMOUSECLICKLOCKTIME = 8200; 2113 SPI_SETMOUSECLICKLOCKTIME = 8201; 2114 SPI_GETFONTSMOOTHINGTYPE = 8202; 2115 SPI_SETFONTSMOOTHINGTYPE = 8203; 2116 SPI_GETFONTSMOOTHINGCONTRAST = 8204; 2117 SPI_SETFONTSMOOTHINGCONTRAST = 8205; 2118 SPI_GETFOCUSBORDERWIDTH = 8206; 2119 SPI_SETFOCUSBORDERWIDTH = 8207; 2120 SPI_GETFOCUSBORDERHEIGHT = 8208; 2121 SPI_SETFOCUSBORDERHEIGHT = 8209; 2122 SPI_GETFONTSMOOTHINGORIENTATION = 8210; 2123 SPI_SETFONTSMOOTHINGORIENTATION = 8211; 2124 2125//============================================== 2126// GetDeviceCaps constants 2127//============================================== 2128 BI_RGB = 0; 2129 BI_RLE8 = 1; 2130 BI_RLE4 = 2; 2131 BI_BITFIELDS = 3; 2132 2133 2134 HORZSIZE = 4; { Horizontal size in millimeters } 2135 VERTSIZE = 6; { Vertical size in millimeters } 2136 HORZRES = 8; { Horizontal width in pixels } 2137 VERTRES = 10; { Vertical height in pixels } 2138 BITSPIXEL = 12; { Number of bits per pixel } 2139 PLANES = 14; { Number of planes } 2140 NUMCOLORS = 24; { Number of colors } 2141 LOGPIXELSX = 88; { Logical pixelsinch in X } 2142 LOGPIXELSY = 90; { Logical pixelsinch in Y } 2143 SIZEPALETTE = 104; { Number of entries in physical palette } 2144 NUMRESERVED = 106; { Number of reserved entries in palette } 2145 2146 2147//============================================== 2148// Text Alignment Options 2149//============================================== 2150 TA_NOUPDATECP = 0; 2151 TA_UPDATECP = 1; 2152 TA_LEFT = 0; 2153 TA_RIGHT = 2; 2154 TA_CENTER = 6; 2155 TA_TOP = 0; 2156 TA_BOTTOM = 8; 2157 TA_BASELINE = $18; 2158 TA_RTLREADING = $100; 2159 TA_MASK = (TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING); 2160 2161//============================================== 2162// PolyFill() Modes 2163//============================================== 2164 ALTERNATE = 1; 2165 WINDING = 2; 2166 POLYFILL_LAST = 2; 2167 2168//============================================== 2169// StretchBlt() Modes 2170//============================================== 2171 2172 BLACKONWHITE = 1; 2173 WHITEONBLACK = 2; 2174 COLORONCOLOR = 3; 2175 HALFTONE = 4; 2176 MAXSTRETCHBLTMODE = 4; 2177 2178 { constants for CreateDIBitmap } 2179 2180 CBM_INIT = 4; { initialize bitmap } 2181 2182//============================================== 2183// Predefined Resource Types 2184//============================================== 2185type 2186 {$if defined(FPC_OS_UNICODE) or (defined(VER2_6) and defined(UNICODE))} 2187 TResourceType = PWideChar; 2188 {$else} 2189 TResourceType = PChar; 2190 {$endif} 2191const 2192{$ifdef windows} 2193 RT_CURSOR = Windows.RT_CURSOR; 2194 RT_BITMAP = Windows.RT_BITMAP; 2195 RT_ICON = Windows.RT_ICON; 2196 RT_MENU = Windows.RT_MENU; 2197 RT_DIALOG = Windows.RT_DIALOG; 2198 RT_STRING = Windows.RT_STRING; 2199 RT_FONTDIR = Windows.RT_FONTDIR; 2200 RT_FONT = Windows.RT_FONT; 2201 RT_ACCELERATOR = Windows.RT_ACCELERATOR; 2202 RT_RCDATA = Windows.RT_RCDATA; 2203 RT_MESSAGETABLE = Windows.RT_MESSAGETABLE; 2204 RT_GROUP_CURSOR = Windows.RT_GROUP_CURSOR; 2205 RT_GROUP_ICON = Windows.RT_GROUP_ICON; 2206 RT_VERSION = Windows.RT_VERSION; 2207{$else} 2208 RT_CURSOR = TResourceType(1); 2209 RT_BITMAP = TResourceType(2); 2210 RT_ICON = TResourceType(3); 2211 RT_MENU = TResourceType(4); 2212 RT_DIALOG = TResourceType(5); 2213 RT_STRING = TResourceType(6); 2214 RT_FONTDIR = TResourceType(7); 2215 RT_FONT = TResourceType(8); 2216 RT_ACCELERATOR = TResourceType(9); 2217 RT_RCDATA = TResourceType(10); 2218 RT_MESSAGETABLE = TResourceType(11); 2219 RT_GROUP_CURSOR = TResourceType(12); 2220 RT_GROUP_ICON = TResourceType(14); 2221 RT_VERSION = TResourceType(16); 2222{$endif} 2223 2224 // The following resource types are not available in Windows CE 2225{$ifdef mswindows} 2226 RT_ANICURSOR = Windows.RT_ANICURSOR; 2227 RT_ANIICON = Windows.RT_ANIICON; 2228 RT_HTML = Windows.RT_HTML; 2229 RT_MANIFEST = Windows.RT_MANIFEST; 2230{$else} 2231 RT_ANICURSOR = TResourceType(21); 2232 RT_ANIICON = TResourceType(22); 2233 RT_HTML = TResourceType(23); 2234 RT_MANIFEST = TResourceType(24); 2235{$endif} 2236 2237//============================================== 2238// Load/CopyImage constants 2239//============================================== 2240const 2241 // types 2242 IMAGE_BITMAP = 0; 2243 IMAGE_ICON = 1; 2244 IMAGE_CURSOR = 2; 2245 IMAGE_ENHMETAFILE = 3; 2246 2247 // loadflags 2248 LR_DEFAULTCOLOR = $0000; 2249 LR_MONOCHROME = $0001; 2250 LR_COLOR = $0002; 2251 LR_COPYRETURNORG = $0004; 2252 LR_COPYDELETEORG = $0008; 2253 LR_LOADFROMFILE = $0010; 2254 LR_LOADTRANSPARENT = $0020; 2255 LR_DEFAULTSIZE = $0040; 2256 LR_VGACOLOR = $0080; 2257 LR_LOADMAP3DCOLORS = $1000; 2258 LR_CREATEDIBSECTION = $2000; 2259 LR_COPYFROMRESOURCE = $4000; 2260 LR_SHARED = $8000; 2261 2262 2263 2264type 2265 TFarProc = Pointer; 2266 2267 TFNWndProc = TFarProc; 2268 2269 PLogFontA = ^TLogFontA; 2270 PLogFontW = ^TLogFontW; 2271 PLogFont = PLogFontA; 2272 2273 //win32, win64, but not wince because that is lfFaceName has WideChar on wince 2274 {$ifdef MSWINDOWS} 2275 LOGFONTA = Windows.LogFont; 2276 LOGFONTW = Windows.LogFontW; 2277 {$else} 2278 2279 LOGFONTA = record 2280 lfHeight: Longint; 2281 lfWidth: Longint; 2282 lfEscapement: Longint; // angle, in tenths of degrees of each line of text 2283 lfOrientation: Longint;// angle, in tenths of degrees of each character's base line 2284 lfWeight: Longint; 2285 lfItalic: Byte; 2286 lfUnderline: Byte; 2287 lfStrikeOut: Byte; 2288 lfCharSet: Byte; 2289 lfOutPrecision: Byte; 2290 lfClipPrecision: Byte; 2291 lfQuality: Byte; 2292 lfPitchAndFamily: Byte; 2293 lfFaceName: array[0..LF_FACESIZE - 1] of AnsiChar; 2294 end; 2295 2296 LOGFONTW = record 2297 lfHeight: Longint; 2298 lfWidth: Longint; 2299 lfEscapement: Longint; 2300 lfOrientation: Longint; 2301 lfWeight: Longint; 2302 lfItalic: Byte; 2303 lfUnderline: Byte; 2304 lfStrikeOut: Byte; 2305 lfCharSet: Byte; 2306 lfOutPrecision: Byte; 2307 lfClipPrecision: Byte; 2308 lfQuality: Byte; 2309 lfPitchAndFamily: Byte; 2310 lfFaceName: array[0..LF_FACESIZE - 1] of WideChar; 2311 end; 2312 {$endif} 2313 tagLOGFONTA = LOGFONTA; 2314 tagLOGFONTW = LOGFONTW; 2315 tagLOGFONT = tagLOGFONTA; 2316 2317 TLogFontA = tagLOGFONTA; 2318 TLogFontW = tagLOGFONTW; 2319 TLogFont = TLogFontA; 2320 2321 2322 LOGFONT = LOGFONTA; 2323 LPLOGFONT = ^LOGFONT; 2324 2325 PLogBrush = ^TLogBrush; 2326 tagLOGBRUSH = record 2327 lbStyle: LongWord; 2328 lbColor: TColorRef; 2329 lbHatch: PtrUInt; 2330 end; 2331 TLogBrush = tagLOGBRUSH; 2332 LOGBRUSH = tagLOGBRUSH; 2333 2334 // non-winapi radial gradient log info 2335 TLogGradientStop = record 2336 radColorR, radColorG, radColorB, radColorA: Word; 2337 radPosition: Double; // must be in 0..1 2338 end; 2339 TLogRadialGradient = record 2340 radCenterX, radCenterY, radRadius, radFocalX, radFocalY: Integer; 2341 radStops: array of TLogGradientStop; 2342 end; 2343 2344 PMaxLogPalette = ^TMaxLogPalette; // not in Windows Headers 2345 TMaxLogPalette = record 2346 palVersion: Word; 2347 palNumEntries: Word; 2348 palPalEntry: array [Byte] of TPaletteEntry; 2349 end; 2350 2351 PEnumLogFontA = ^TEnumLogFontA; 2352 PEnumLogFontW = ^TEnumLogFontW; 2353 PEnumLogFont = PEnumLogFontA; 2354 2355 tagENUMLOGFONTA = record 2356 elfLogFont: TLogFontA; 2357 elfFullName: array[0..LF_FULLFACESIZE - 1] of AnsiChar; 2358 elfStyle: array[0..LF_FACESIZE - 1] of AnsiChar; 2359 end; 2360 2361 tagENUMLOGFONTW = record 2362 elfLogFont: TLogFontW; 2363 elfFullName: array[0..LF_FULLFACESIZE - 1] of WideChar; 2364 elfStyle: array[0..LF_FACESIZE - 1] of WideChar; 2365 end; 2366 2367 tagENUMLOGFONT = tagENUMLOGFONTA; 2368 TEnumLogFontA = tagENUMLOGFONTA; 2369 TEnumLogFontW = tagENUMLOGFONTW; 2370 TEnumLogFont = TEnumLogFontA; 2371 2372 ENUMLOGFONTA = tagENUMLOGFONTA; 2373 2374 ENUMLOGFONTW = tagENUMLOGFONTW; 2375 2376 ENUMLOGFONT = ENUMLOGFONTA; 2377 2378 PEnumLogFontExA = ^TEnumLogFontExA; 2379 PEnumLogFontExW = ^TEnumLogFontExW; 2380 PEnumLogFontEx = PEnumLogFontExA; 2381 2382 tagENUMLOGFONTEXA = record 2383 elfLogFont: TLogFontA; 2384 elfFullName: array[0..LF_FULLFACESIZE - 1] of AnsiChar; 2385 elfStyle: array[0..LF_FACESIZE - 1] of AnsiChar; 2386 elfScript: array[0..LF_FACESIZE - 1] of AnsiChar; 2387 end; 2388 2389 tagENUMLOGFONTEXW = record 2390 elfLogFont: TLogFontW; 2391 elfFullName: array[0..LF_FULLFACESIZE - 1] of WideChar; 2392 elfStyle: array[0..LF_FACESIZE - 1] of WideChar; 2393 elfScript: array[0..LF_FACESIZE - 1] of WideChar; 2394 end; 2395 2396 tagENUMLOGFONTEX = tagENUMLOGFONTEXA; 2397 TEnumLogFontExA = tagENUMLOGFONTEXA; 2398 TEnumLogFontExW = tagENUMLOGFONTEXW; 2399 TEnumLogFontEx = TEnumLogFontExA; 2400 2401 ENUMLOGFONTEXA = tagENUMLOGFONTEXA; 2402 2403 ENUMLOGFONTEXW = tagENUMLOGFONTEXW; 2404 2405 ENUMLOGFONTEX = ENUMLOGFONTEXA; 2406 2407 PLogPen = ^TLogPen; 2408 tagLOGPEN = record 2409 lopnStyle: LongWord; 2410 lopnWidth: TPoint; 2411 lopnColor: TColorRef; 2412 end; 2413 TLogPen = tagLOGPEN; 2414 LOGPEN = tagLOGPEN; 2415 2416 PExtLogPen = ^TExtLogPen; 2417 tagEXTLOGPEN = record 2418 elpPenStyle: LongWord; 2419 elpWidth: LongWord; 2420 elpBrushStyle: LongWord; 2421 elpColor: TColorRef; 2422 elpHatch: PtrInt; 2423 elpNumEntries: DWORD; 2424 elpStyleEntry: array[0..0] of DWORD; 2425 end; 2426 TExtLogPen = tagEXTLOGPEN; 2427 EXTLOGPEN = tagEXTLOGPEN; 2428 2429 2430type 2431 2432 PTextMetricA = ^TTextMetricA; 2433 PTextMetricW = ^TTextMetricW; 2434 PTextMetric = PTextMetricA; 2435 2436 tagTextMetricA = record 2437 tmHeight: Longint; 2438 tmAscent: Longint; 2439 tmDescent: Longint; 2440 tmInternalLeading: Longint; 2441 tmExternalLeading: Longint; 2442 tmAveCharWidth: Longint; 2443 tmMaxCharWidth: Longint; 2444 tmWeight: Longint; 2445 tmOverhang: Longint; 2446 tmDigitizedAspectX: Longint; 2447 tmDigitizedAspectY: Longint; 2448 tmFirstChar: AnsiChar; 2449 tmLastChar: AnsiChar; 2450 tmDefaultChar: AnsiChar; 2451 tmBreakChar: AnsiChar; 2452 tmItalic: Byte; 2453 tmUnderlined: Byte; 2454 tmStruckOut: Byte; 2455 tmPitchAndFamily: Byte; 2456 tmCharSet: Byte; 2457 end; 2458 2459 2460 tagTEXTMETRICW = record 2461 tmHeight: Longint; 2462 tmAscent: Longint; 2463 tmDescent: Longint; 2464 tmInternalLeading: Longint; 2465 tmExternalLeading: Longint; 2466 tmAveCharWidth: Longint; 2467 tmMaxCharWidth: Longint; 2468 tmWeight: Longint; 2469 tmOverhang: Longint; 2470 tmDigitizedAspectX: Longint; 2471 tmDigitizedAspectY: Longint; 2472 tmFirstChar: WideChar; 2473 tmLastChar: WideChar; 2474 tmDefaultChar: WideChar; 2475 tmBreakChar: WideChar; 2476 tmItalic: Byte; 2477 tmUnderlined: Byte; 2478 tmStruckOut: Byte; 2479 tmPitchAndFamily: Byte; 2480 tmCharSet: Byte; 2481 end; 2482 tagTEXTMETRIC = tagTEXTMETRICA; 2483 TTextMetricA = tagTEXTMETRICA; 2484 TTextMetricW = tagTEXTMETRICW; 2485 TTextMetric = TTextMetricA; 2486 TEXTMETRICA = tagTEXTMETRICA; 2487 TEXTMETRICW = tagTEXTMETRICW; 2488 TEXTMETRIC = TEXTMETRICA; 2489 2490 2491 TNewTextMetric = record 2492 tmHeight: Longint; 2493 tmAscent: Longint; 2494 tmDescent: Longint; 2495 tmInternalLeading: Longint; 2496 tmExternalLeading: Longint; 2497 tmAveCharWidth: Longint; 2498 tmMaxCharWidth: Longint; 2499 tmWeight: Longint; 2500 tmOverhang: Longint; 2501 tmDigitizedAspectX: Longint; 2502 tmDigitizedAspectY: Longint; 2503 tmFirstChar: AnsiChar; 2504 tmLastChar: AnsiChar; 2505 tmDefaultChar: AnsiChar; 2506 tmBreakChar: AnsiChar; 2507 tmItalic: Byte; 2508 tmUnderlined: Byte; 2509 tmStruckOut: Byte; 2510 tmPitchAndFamily: Byte; 2511 tmCharSet: Byte; 2512 ntmFlags: DWORD; 2513 ntmSizeEM: UINT; 2514 ntmCellHeight: UINT; 2515 ntmAvgWidth: UINT; 2516 end; 2517 2518 TFontSignature = record 2519 fsUsb : array[0..3] of DWORD; 2520 fsCsb : array[0..1] of DWORD; 2521 end; 2522 2523 TNewTextMetricEx = record 2524 ntmentm : TNewTextMetric; 2525 ntmeFontSignature : TFontSignature; 2526 end; 2527 2528 FontEnumProc = function (var ELogFont:TEnumLogFont; var Metric:TNewTextMetric; 2529 FontType:longint; Data:LParam):longint; extdecl; 2530 2531 FontEnumExProc = function (var ELogFont: TEnumLogFontEx; var Metric: TNewTextMetricEx; 2532 FontType: Longint; Data:LParam):Longint; extdecl; 2533 2534 MonitorEnumProc = function(hMonitor: HMONITOR; hdcMonitor: HDC; lprcMonitor: PRect; 2535 dwData: LPARAM): LongBool; extdecl; 2536 2537 PWndClassExA = ^TWndClassExA; 2538 PWndClassExW = ^TWndClassExW; 2539 PWndClassEx = PWndClassExA; 2540 2541 tagWNDCLASSEXA = record 2542 cbSize: UINT; 2543 style: UINT; 2544 lpfnWndProc: TFNWndProc; 2545 cbClsExtra: Integer; 2546 cbWndExtra: Integer; 2547 hInstance: HINST; 2548 _hIcon: HICON; 2549 hCursor: HCURSOR; 2550 hbrBackground: HBRUSH; 2551 lpszMenuName: PAnsiChar; 2552 lpszClassName: PAnsiChar; 2553 hIconSm: HICON; 2554 end; 2555 2556 tagWNDCLASSEXW = record 2557 cbSize: UINT; 2558 style: UINT; 2559 lpfnWndProc: TFNWndProc; 2560 cbClsExtra: Integer; 2561 cbWndExtra: Integer; 2562 hInstance: HINST; 2563 _hIcon: HICON; 2564 hCursor: HCURSOR; 2565 hbrBackground: HBRUSH; 2566 lpszMenuName: PWideChar; 2567 lpszClassName: PWideChar; 2568 hIconSm: HICON; 2569 end; 2570 2571 tagWNDCLASSEX = tagWNDCLASSEXA; 2572 TWndClassExA = tagWNDCLASSEXA; 2573 TWndClassExW = tagWNDCLASSEXW; 2574 TWndClassEx = TWndClassExA; 2575 WNDCLASSEXA = tagWNDCLASSEXA; 2576 WNDCLASSEXW = tagWNDCLASSEXW; 2577 WNDCLASSEX = WNDCLASSEXA; 2578 2579 PWndClassA = ^TWndClassA; 2580 PWndClassW = ^TWndClassW; 2581 PWndClass = PWndClassA; 2582 2583 tagWNDCLASSA = record 2584 style: UINT; 2585 lpfnWndProc: TFNWndProc; 2586 cbClsExtra: Integer; 2587 cbWndExtra: Integer; 2588 hInstance: HINST; 2589 hIcon: HICON; 2590 hCursor: HCURSOR; 2591 hbrBackground: HBRUSH; 2592 lpszMenuName: PAnsiChar; 2593 lpszClassName: PAnsiChar; 2594 end; 2595 2596 tagWNDCLASSW = record 2597 style: UINT; 2598 lpfnWndProc: TFNWndProc; 2599 cbClsExtra: Integer; 2600 cbWndExtra: Integer; 2601 hInstance: HINST; 2602 hIcon: HICON; 2603 hCursor: HCURSOR; 2604 hbrBackground: HBRUSH; 2605 lpszMenuName: PWideChar; 2606 lpszClassName: PWideChar; 2607 end; 2608 2609 tagWNDCLASS = tagWNDCLASSA; 2610 TWndClassA = tagWNDCLASSA; 2611 TWndClassW = tagWNDCLASSW; 2612 TWndClass = TWndClassA; 2613 WNDCLASSA = tagWNDCLASSA; 2614 WNDCLASSW = tagWNDCLASSW; 2615 WNDCLASS = WNDCLASSA; 2616 2617const 2618 DefaultLogFont: TLogFont = (lfHeight:0; 2619 lfWidth:0; 2620 lfEscapement:0; 2621 lfOrientation:0; 2622 lfWeight:0; 2623 lfItalic:0; 2624 lfUnderline:0; 2625 lfStrikeOut:0; 2626 lfCharSet:0; 2627 lfOutPrecision:0; 2628 lfClipPrecision:0; 2629 lfQuality:0; 2630 lfPitchAndFamily:0; 2631 lfFaceName:'default'; 2632 ); 2633 2634type 2635 PMsg = ^TMsg; 2636 tagMSG = record 2637 hwnd: HWND; 2638 message: LongWord; 2639 wParam: WPARAM; 2640 lParam: LPARAM; 2641 time: DWORD; 2642 pt: TPoint; 2643 end; 2644 TMsg = tagMSG; 2645 _MSG = tagMSG; 2646 2647 2648type 2649 // Moved from Controls to avoid circles 2650 // Since it is part of the interface now 2651 TCreateParams = record 2652 Caption: PChar; 2653 Style: Cardinal; 2654 ExStyle: Cardinal; 2655 X, Y: Integer; 2656 Width, Height: Integer; 2657 WndParent: HWnd; 2658 Param: Pointer; 2659 WindowClass: TWndClass; 2660 WinClassName: array[0..63] of Char; 2661 end; 2662 2663type 2664{$ifdef windows} 2665 TIconInfo = Windows.TICONINFO; 2666 PIconInfo = Windows.PICONINFO; 2667{$else windows} 2668 TIconInfo = record 2669 fIcon: BOOL; 2670 xHotspot: DWORD; 2671 yHotspot: DWORD; 2672 hbmMask: HBITMAP; 2673 hbmColor: HBITMAP; 2674 end; 2675 PIconInfo = ^TIconInfo; 2676{$endif windows} 2677 2678 2679//------------------------------------------------------------------------------ 2680//timer 2681type 2682 TTimerProc = procedure(hWnd: HWND; uMsg: UINT; idEvent: UINT_PTR; dwTime: DWORD); stdcall; 2683 2684 TLMTimer = record 2685 Msg: Cardinal; 2686 TimerID: PtrUInt; 2687 TimerProc: TFarProc; 2688 Result: LRESULT; 2689 end; 2690 2691 // delphi 2692 TFNTimerProc = TFarProc; 2693 2694 2695//------------------------------------------------------------------------------ 2696// clipboard 2697type 2698 TClipboardFormat = PtrUInt; 2699 PClipboardFormat = ^TClipboardFormat; 2700 2701 TClipboardRequestEvent = procedure(const RequestedFormatID: TClipboardFormat; 2702 Data: TStream) of object; 2703 2704 TClipboardType = (ctPrimarySelection, ctSecondarySelection, ctClipboard); 2705 2706const 2707 ClipboardTypeName : array[TClipboardType] of string = ( 2708 'primary selection', 'secondary selection', 'clipboard' 2709 ); 2710 2711type 2712 TPredefinedClipboardFormat = ( 2713 pcfText, 2714 pcfBitmap, 2715 pcfPixmap, 2716 pcfIcon, 2717 pcfPicture, 2718 pcfMetaFilePict, 2719 pcfObject, 2720 pcfComponent, 2721 pcfCustomData 2722 ); 2723 2724const 2725 PredefinedClipboardMimeTypes : array[TPredefinedClipboardFormat] of string = ( 2726 'text/plain', 2727 'image/bmp', 2728 'image/xpm', 2729 'image/lcl.icon', 2730 'image/lcl.picture', 2731 'image/lcl.metafilepict', 2732 'application/lcl.object', 2733 'application/lcl.component', 2734 'application/lcl.customdata' 2735 ); 2736 2737 2738type 2739 TListChangeEvent = procedure(Ptr: Pointer; AnAction: TListNotification) of object; 2740 2741 { TListWithEvent } 2742 2743 TListWithEvent = class(TList) 2744 private 2745 FOnChange: TListChangeEvent; 2746 protected 2747 procedure Notify(Ptr: Pointer; AnAction: TListNotification); override; 2748 public 2749 property OnChange: TListChangeEvent read FOnChange write FOnChange; 2750 end; 2751 2752const 2753 csNone = 0; 2754// csAlignment = 1; 2755// csBox = 2; 2756 csButton = 3; 2757 csComboBox = 4; 2758 csCheckbox = 5; 2759 csEdit = 6; 2760 csForm= 7; 2761 csStaticText = 8; 2762// csgtkTable = 9; 2763 csScrollBar = 10; 2764 csListView = 11; 2765// csMainForm = 12; 2766 csMemo = 13; 2767 csMainMenu = 14; 2768 csMenuBar = 15; 2769 csMenuItem = 16; 2770 csNotebook = 17; 2771 csFileDialog = 18; 2772 csRadioButton = 19; 2773 csScrolledWindow= 20; 2774 csSpinedit = 21; 2775 csStatusBar = 22; 2776// csTable = 23; 2777 csToggleBox = 24; 2778 //csVScrollBar = 25; 2779// csFrame = 26; 2780// csButtonBox = 27; 2781// csCanvas = 28; 2782 csGroupBox = 29; 2783 2784// csFont = 30; 2785// csPen = 31; 2786// csBrush = 32; 2787 //csTimer = 33; 2788 csPage = 34; 2789 2790 csColorDialog = 35; 2791 csListBox = 36; 2792 csFontDialog = 37; 2793 csProgressBar = 38; 2794 csTrackBar = 39; 2795 csWinControl = 40; 2796 csFixed = csWinControl; //TODO remove 2797// csImage = 41; 2798// csToolbar = 42; 2799// csToolButton = 43; 2800 csBitBtn = 44; 2801 csCListBox = 45; 2802// csSpeedButton = 46; 2803 csPopupMenu = 47; 2804 csHintWindow = 48; 2805 2806 csCalendar = 49; 2807 2808 csArrow = 50; 2809 csPanel = 51; 2810 csScrollBox = 52; 2811 2812 csCheckListBox = 53; 2813 csPairSplitter = 54; 2814 csPairSplitterSide = 55; 2815 2816 csOpenFileDialog = 56; 2817 csSaveFileDialog = 57; 2818 csSelectDirectoryDialog = 58; 2819 csPreviewFileControl = 59; 2820 csPreviewFileDialog = 60; 2821 2822 csNonLCL = 61; // for non LCL controls, that create their own handles 2823 2824 2825const 2826 // Mouse message key states 2827 MK_LBUTTON = 1; 2828 MK_RBUTTON = 2; 2829 MK_SHIFT = 4; 2830 MK_CONTROL = 8; 2831 MK_MBUTTON = $10; 2832 MK_XBUTTON1 = $20; 2833 MK_XBUTTON2 = $40; 2834 // following are "virtual" key states 2835 MK_DOUBLECLICK = $80; 2836 MK_TRIPLECLICK = $100; 2837 MK_QUADCLICK = $200; 2838 MK_ALT = $20000000; 2839 2840//============================================== 2841// Constants from commctrl 2842//============================================== 2843 2844//------------- 2845// Common 2846//------------- 2847 2848const 2849 //all controls 2850 NM_FIRST = 0; 2851 NM_OUTOFMEMORY = NM_FIRST - 1; 2852 NM_CLICK = NM_FIRST - 2; 2853 NM_DBLCLK = NM_FIRST - 3; 2854 NM_RETURN = NM_FIRST - 4; 2855 NM_RCLICK = NM_FIRST - 5; 2856 NM_RDBLCLK = NM_FIRST - 6; 2857 NM_SETFOCUS = NM_FIRST - 7; 2858 NM_KILLFOCUS = NM_FIRST - 8; 2859 NM_CUSTOMDRAW = NM_FIRST - 12; 2860 NM_HOVER = NM_FIRST - 13; 2861 NM_NCHITTEST = NM_FIRST - 14; 2862 NM_KEYDOWN = NM_FIRST - 15; 2863 NM_RELEASEDCAPTURE = NM_FIRST - 16; 2864 NM_SETCURSOR = NM_FIRST - 17; 2865 NM_CHAR = NM_FIRST - 18; 2866 2867 NM_LAST = NM_FIRST - 99; 2868 2869 //listview 2870 LVN_FIRST = -100; 2871 LVN_LAST = -199; 2872 2873 //header 2874 HDN_FIRST = -300; 2875 HDN_LAST = -399; 2876 2877 //treeview 2878 TVN_FIRST = -400; 2879 TVN_LAST = -499; 2880 2881 //tooltips 2882 TTN_FIRST = -520; 2883 TTN_LAST = -549; 2884 2885 //tab control 2886 TCN_FIRST = -550; 2887 TCN_LAST = -580; 2888 2889 // toolbar 2890 TBN_First = -700; 2891 TBN_Last = -720; 2892 2893const 2894 CCS_TOP = $00000001; 2895 CCS_NOMOVEY = $00000002; 2896 CCS_BOTTOM = $00000003; 2897 CCS_NORESIZE = $00000004; 2898 CCS_NOPARENTALIGN = $00000008; 2899 CCS_ADJUSTABLE = $00000020; 2900 CCS_NODIVIDER = $00000040; 2901 CCS_VERT = $00000080; 2902 CCS_LEFT = (CCS_VERT or CCS_TOP); 2903 CCS_RIGHT = (CCS_VERT or CCS_BOTTOM); 2904 CCS_NOMOVEX = (CCS_VERT or CCS_NOMOVEY); 2905 2906//------------- 2907// Listview 2908//------------- 2909const 2910 LVN_ITEMCHANGING = LVN_FIRST - 0; 2911 LVN_ITEMCHANGED = LVN_FIRST - 1; 2912 LVN_INSERTITEM = LVN_FIRST - 2; 2913 LVN_DELETEITEM = LVN_FIRST - 3; 2914 LVN_DELETEALLITEMS = LVN_FIRST - 4; 2915 LVN_COLUMNCLICK = LVN_FIRST - 8; 2916 LVN_BEGINDRAG = LVN_FIRST - 9; 2917 LVN_BEGINRDRAG = LVN_FIRST - 11; 2918 LVN_ODCACHEHINT = LVN_FIRST - 13; 2919 LVN_ITEMACTIVATE = LVN_FIRST - 14; 2920 LVN_ODSTATECHANGED = LVN_FIRST - 15; 2921 LVN_HOTTRACK = LVN_FIRST - 21; 2922 LVN_KEYDOWN = LVN_FIRST - 55; 2923 LVN_MARQUEEBEGIN = LVN_FIRST - 56; 2924 LVN_GETINFOTIP = LVN_FIRST - 58; 2925 LVN_INCREMENTALSEARCH = LVN_FIRST - 63; 2926 LVN_BEGINLABELEDIT = LVN_FIRST - 75; 2927 LVN_ENDLABELEDIT = LVN_FIRST - 76; 2928 LVN_GETDISPINFO = LVN_FIRST - 77; 2929 LVN_SETDISPINFO = LVN_FIRST - 78; 2930 LVN_ODFINDITEM = LVN_FIRST - 79; 2931 LVN_BEGINSCROLL = LVN_FIRST - 80; 2932 LVN_ENDSCROLL = LVN_FIRST - 81; 2933 2934const 2935 LVIF_TEXT = $0001; 2936 LVIF_IMAGE = $0002; 2937 LVIF_PARAM = $0004; 2938 LVIF_STATE = $0008; 2939 LVIF_INDENT = $0010; 2940 LVIF_NORECOMPUTE = $0800; 2941 2942 LVIS_FOCUSED = $0001; 2943 LVIS_SELECTED = $0002; 2944 LVIS_CUT = $0004; 2945 LVIS_DROPHILITED = $0008; 2946 LVIS_ACTIVATING = $0020; 2947 2948 LVIS_OVERLAYMASK = $0F00; 2949 LVIS_STATEIMAGEMASK = $F000; 2950 2951type 2952 PNMListView = ^TNMListView; 2953 TNMListView = packed record 2954 hdr: TNMHDR; 2955 iItem: Integer; 2956 iSubItem: Integer; 2957 uNewState: UINT; 2958 uOldState: UINT; 2959 uChanged: UINT; 2960 ptAction: TPoint; 2961 lParam: LPARAM; 2962 end; 2963 _NM_LISTVIEW = TNMListView; 2964 NM_LISTVIEW = TNMListView; 2965 tagNMLISTVIEW = TNMListView; 2966 2967 // enum to use with InitStockFont 2968 TStockFont = ( 2969 sfSystem, // stock system font 2970 sfHint, // stock hint font 2971 sfIcon, // stock icon font 2972 sfMenu // stock menu font 2973 ); 2974 2975function CS_To_String(CompStyle: Integer): String; 2976// key mapping 2977 2978function HiWord(i: integer): word; 2979function LoWord(i: integer): word; 2980function Char2VK(C : Char) : Word; 2981function VK2Char(AVK: Word): Char; 2982function MathRound(AValue: ValReal): Int64; 2983function MulDiv(nNumber, nNumerator, nDenominator: Integer): Integer; 2984function KeyToShortCut(const Key: Word; const Shift: TShiftState): TShortCut; 2985function CharSetToString(const Charset: Integer): String; 2986function StringToCharset(Charset: string): byte; 2987 2988 2989implementation 2990 2991 2992function HiWord(i: integer): word; 2993begin 2994 Result:=Hi(i); 2995end; 2996 2997function LoWord(i: integer): word; 2998begin 2999 Result:=Lo(i); 3000end; 3001 3002function Char2VK(C : Char) : Word; 3003begin 3004 Case C of 3005 '0'..'9' :Result := VK_0 + Ord(C) - Ord('0'); 3006 'a'..'z' :Result := VK_A + Ord(C) - Ord('a'); 3007 'A'..'Z' :Result := VK_A + Ord(C) - Ord('A'); 3008 else 3009 Result:=0; 3010 end; 3011end; 3012 3013function VK2Char(AVK: Word): Char; 3014begin 3015 case AVK of 3016 VK_0..VK_9: Result := chr(ord('0')+AVK-VK_0); 3017 VK_A..VK_Z: Result := chr(ord('a')+AVK-VK_A); 3018 else 3019 Result:='?'; 3020 end; 3021end; 3022 3023function MathRound(AValue: ValReal): Int64; inline; 3024begin 3025 if AValue >= 0 then 3026 Result := Trunc(AValue + 0.5) 3027 else 3028 Result := Trunc(AValue - 0.5); 3029end; 3030 3031function MulDiv(nNumber, nNumerator, nDenominator: Integer): Integer; 3032begin 3033 if nDenominator = 0 then 3034 Result := -1 3035 else 3036 if nNumerator = nDenominator then 3037 Result := nNumber 3038 else 3039 Result := MathRound(int64(nNumber) * int64(nNumerator) / nDenominator); 3040end; 3041 3042function KeyToShortCut(const Key: Word; const Shift: TShiftState): TShortCut; 3043begin 3044 if (Key and $FF00) <> 0 then exit(0); 3045 Result := Key; 3046 if ssShift in Shift then Inc(Result,scShift); 3047 if ssCtrl in Shift then Inc(Result,scCtrl); 3048 if ssAlt in Shift then Inc(Result,scAlt); 3049 if ssMeta in Shift then Inc(Result,scMeta); 3050end; 3051 3052{------------------------------------------------------------------------------ 3053 Function: CS_To_String 3054 Params: CompStyle - Component Style 3055 Returns: The component style name 3056 3057 Converts a component style identIfier into the correct component style name 3058 ------------------------------------------------------------------------------} 3059function CS_To_String(CompStyle: Integer): String; 3060begin 3061 case CompStyle of 3062 csNone: 3063 Result := 'csNone'; 3064{ csAlignment: 3065 Result := 'csAlignment'; 3066 csBox: 3067 Result := 'csBox'; 3068} 3069 csButton: 3070 Result := 'csButton'; 3071 csComboBox: 3072 Result := 'csComboBox'; 3073 csCheckbox: 3074 Result := 'csCheckbox'; 3075 csEdit: 3076 Result := 'csEdit'; 3077 csForm: 3078 Result := 'csForm'; 3079 csStaticText: 3080 Result := 'csStaticText'; 3081// csGTKTable: 3082// Result := 'csGTKTable'; 3083 csScrollBar: 3084 Result := 'csScrollBar'; 3085 csListView: 3086 Result := 'csListView'; 3087// csMainForm: 3088// Result := 'csMainForm'; 3089 csMemo: 3090 Result := 'csMemo'; 3091 csMainMenu: 3092 Result := 'csMainMenu'; 3093 csMenuBar: 3094 Result := 'csMenuBar'; 3095 csMenuItem: 3096 Result := 'csMenuItem'; 3097 csNotebook: 3098 Result := 'csNotebook'; 3099 csFileDialog: 3100 Result := 'csFileDialog'; 3101 csOpenFileDialog: 3102 Result := 'csOpenFileDialog'; 3103 csSaveFileDialog: 3104 Result := 'csSaveFileDialog'; 3105 csSelectDirectoryDialog: 3106 Result := 'csSelectDirectoryDialog'; 3107 csRadioButton: 3108 Result := 'csRadioButton'; 3109 csScrolledWinDow: 3110 Result := 'csScrolledWinDow'; 3111 csSpinEdit: 3112 Result := 'csSpinEdit'; 3113 csStatusBar: 3114 Result := 'csStatusBar'; 3115// csTable: 3116// Result := 'csTable'; 3117 csToggleBox: 3118 Result := 'csToggleBox'; 3119// 25: //csVScrollBar 3120// Result := 'csVScrollBar'; 3121// csFrame: 3122// Result := 'csFrame'; 3123// csButtonBox: 3124// Result := 'csButtonBox'; 3125// csCanvas: 3126// Result := 'csCanvas'; 3127 csGroupBox: 3128 Result := 'csGroupBox'; 3129// csFont: 3130// Result := 'csFont'; 3131// csPen: 3132// Result := 'csPen'; 3133// csBrush: 3134// Result := 'csBrush'; 3135// 33: //csTimer 3136// Result := 'csTimer'; 3137 csPage: 3138 Result := 'csPage'; 3139 csColorDialog: 3140 Result := 'csColorDialog'; 3141 csListBox: 3142 Result := 'csListBox'; 3143 csFontDialog: 3144 Result := 'csFontDialog'; 3145 csProgressBar: 3146 Result := 'csProgressBar'; 3147 csTrackBar: 3148 Result := 'csTrackBar'; 3149 csFixed: 3150 Result := 'csFixed'; 3151{ csImage: 3152 Result := 'csImage'; 3153 csToolbar: 3154 Result := 'csToolbar'; 3155 csToolButton: 3156 Result := 'csToolButton';} 3157 csBitBtn: 3158 Result := 'csBitBtn'; 3159 csCListBox: 3160 Result := 'csCListBox'; 3161{ csSpeedButton: 3162 Result := 'csSpeedButton';} 3163 csPopupMenu: 3164 Result := 'csPopupMenu'; 3165 csHintWinDow: 3166 Result := 'csHintWinDow'; 3167 csCalendar: 3168 Result := 'csCalendar'; 3169 csArrow: 3170 Result := 'csArrow'; 3171 csPanel: 3172 Result := 'csPanel'; 3173 csScrollBox: 3174 Result := 'csScrollBox'; 3175 csCheckListBox: 3176 Result := 'csCheckListBox'; 3177 csPairSplitter: 3178 Result := 'csPairSplitter'; 3179 csPairSplitterSide: 3180 Result := 'csPairSplitterSide'; 3181 csPreviewFileControl: 3182 Result := 'csPreviewFileControl'; 3183 csPreviewFileDialog: 3184 Result := 'csPreviewFileDialog'; 3185 csNonLCL: 3186 Result := 'csNonLCL'; 3187 else 3188 Result := Format('Unknown component style %D', [CompStyle]); 3189 end; {case} 3190End; 3191 3192function CharSetToString(const Charset: Integer): String; 3193begin 3194 case Charset of 3195 ANSI_CHARSET: result := 'ANSI_CHARSET'; 3196 DEFAULT_CHARSET: result := 'DEFAULT_CHARSET'; 3197 SYMBOL_CHARSET: result := 'SYMBOL_CHARSET'; 3198 MAC_CHARSET: result := 'MAC_CHARSET'; 3199 SHIFTJIS_CHARSET: result := 'SHIFTJIS_CHARSET'; 3200 HANGEUL_CHARSET: result := 'HANGEUL_CHARSET'; 3201 JOHAB_CHARSET: result := 'JOHAB_CHARSET'; 3202 GB2312_CHARSET: result := 'GB2312_CHARSET'; 3203 CHINESEBIG5_CHARSET: result := 'CHINESEBIG5_CHARSET'; 3204 GREEK_CHARSET: result := 'GREEK_CHARSET'; 3205 TURKISH_CHARSET: result := 'TURKISH_CHARSET'; 3206 VIETNAMESE_CHARSET: result := 'VIETNAMESE_CHARSET'; 3207 HEBREW_CHARSET: result := 'HEBREW_CHARSET'; 3208 ARABIC_CHARSET: result := 'ARABIC_CHARSET'; 3209 BALTIC_CHARSET: result := 'BALTIC_CHARSET'; 3210 RUSSIAN_CHARSET: result := 'RUSSIAN_CHARSET'; 3211 THAI_CHARSET: result := 'THAI_CHARSET'; 3212 EASTEUROPE_CHARSET: result := 'EASTEUROPE_CHARSET'; 3213 OEM_CHARSET: result := 'OEM_CHARSET'; 3214 FCS_ISO_10646_1: result := 'UNICODE'; 3215 FCS_ISO_8859_1: result := 'FCS_ISO_8859_1'; 3216 FCS_ISO_8859_2: result := 'FCS_ISO_8859_2'; 3217 FCS_ISO_8859_3: result := 'FCS_ISO_8859_3'; 3218 FCS_ISO_8859_4: result := 'FCS_ISO_8859_4'; 3219 FCS_ISO_8859_5: result := 'FCS_ISO_8859_5'; 3220 FCS_ISO_8859_6: result := 'FCS_ISO_8859_6'; 3221 FCS_ISO_8859_7: result := 'FCS_ISO_8859_7'; 3222 FCS_ISO_8859_8: result := 'FCS_ISO_8859_8'; 3223 FCS_ISO_8859_9: result := 'FCS_ISO_8859_9'; 3224 FCS_ISO_8859_10: result := 'FCS_ISO_8859_10'; 3225 FCS_ISO_8859_15: result := 'FCS_ISO_8859_15'; 3226 else result := ''; 3227 end; 3228end; 3229 3230function StringToCharset(Charset: string): Byte; 3231begin 3232 Charset := uppercase(charset); 3233 if Charset = 'ANSI_CHARSET' then result := ANSI_CHARSET else 3234 if Charset = 'DEFAULT_CHARSET' then result := DEFAULT_CHARSET else 3235 if Charset = 'SYMBOL_CHARSET' then result := SYMBOL_CHARSET else 3236 if Charset = 'MAC_CHARSET' then result := MAC_CHARSET else 3237 if Charset = 'SHIFTJIS_CHARSET' then result := SHIFTJIS_CHARSET else 3238 if Charset = 'HANGEUL_CHARSET' then result := SHIFTJIS_CHARSET else 3239 if Charset = 'JOHAB_CHARSET' then result := JOHAB_CHARSET else 3240 if Charset = 'GB2312_CHARSET' then result := GB2312_CHARSET else 3241 if Charset = 'CHINESEBIG5_CHARSET' then result := CHINESEBIG5_CHARSET else 3242 if Charset = 'GREEK_CHARSET' then result := GREEK_CHARSET else 3243 if Charset = 'TURKISH_CHARSET' then result := TURKISH_CHARSET else 3244 if Charset = 'VIETNAMESE_CHARSET' then result := VIETNAMESE_CHARSET else 3245 if Charset = 'HEBREW_CHARSET' then result := HEBREW_CHARSET else 3246 if Charset = 'ARABIC_CHARSET' then result := ARABIC_CHARSET else 3247 if Charset = 'BALTIC_CHARSET' then result := BALTIC_CHARSET else 3248 if Charset = 'RUSSIAN_CHARSET' then result := RUSSIAN_CHARSET else 3249 if Charset = 'THAI_CHARSET' then result := THAI_CHARSET else 3250 if Charset = 'EASTEUROPE_CHARSET' then result := EASTEUROPE_CHARSET else 3251 if Charset = 'OEM_CHARSET' then result := OEM_CHARSET else 3252 if Charset = 'UNICODE' then result := FCS_ISO_10646_1 else 3253 if Charset = 'FCS_ISO_8859_1' then result := FCS_ISO_8859_1 else 3254 if Charset = 'FCS_ISO_8859_2' then result := FCS_ISO_8859_2 else 3255 if Charset = 'FCS_ISO_8859_3' then result := FCS_ISO_8859_3 else 3256 if Charset = 'FCS_ISO_8859_4' then result := FCS_ISO_8859_4 else 3257 if Charset = 'FCS_ISO_8859_5' then result := FCS_ISO_8859_5 else 3258 if Charset = 'FCS_ISO_8859_6' then result := FCS_ISO_8859_6 else 3259 if Charset = 'FCS_ISO_8859_7' then result := FCS_ISO_8859_7 else 3260 if Charset = 'FCS_ISO_8859_8' then result := FCS_ISO_8859_8 else 3261 if Charset = 'FCS_ISO_8859_9' then result := FCS_ISO_8859_9 else 3262 if Charset = 'FCS_ISO_8859_10' then result := FCS_ISO_8859_10 else 3263 if Charset = 'FCS_ISO_8859_15' then result := FCS_ISO_8859_15 3264 else 3265 result := DEFAULT_CHARSET; 3266 3267end; 3268 3269{ TListWithEvent } 3270 3271procedure TListWithEvent.Notify(Ptr: Pointer; AnAction: TListNotification); 3272begin 3273 inherited Notify(Ptr, AnAction); 3274 if Assigned(OnChange) then OnChange(Ptr,AnAction); 3275end; 3276 3277end. 3278