📄 qwindows.pas
字号:
CB_ERR = -1;
{$EXTERNALSYM CB_ERRSPACE}
CB_ERRSPACE = -2;
MAX_COMPUTERNAME_LENGTH = 15;
{ MessageBox() WinFlags }
MB_OK = $0000;
MB_OKCANCEL = $0001;
MB_ABORTRETRYIGNORE = $0002;
MB_YESNOCANCEL = $0003;
MB_YESNO = $0004;
MB_RETRYCANCEL = $0005;
MB_HELP = $4000; { Help Button not supported}
MB_ICONHAND = $0010;
MB_ICONQUESTION = $0020;
MB_ICONEXCLAMATION = $0030;
MB_ICONASTERISK = $0040;
MB_USERICON = $0080;
MB_DEFBUTTON1 = $0000;
MB_DEFBUTTON2 = $0100;
MB_DEFBUTTON3 = $0200;
MB_DEFBUTTON4 = $0300;
MB_ICONWARNING = MB_ICONEXCLAMATION;
MB_ICONERROR = MB_ICONHAND;
MB_ICONINFORMATION = MB_ICONASTERISK;
MB_ICONSTOP = MB_ICONHAND;
{ MouseKeys }
MK_LBUTTON = 1;
MK_RBUTTON = 2;
MK_SHIFT = 4;
MK_CONTROL = 8;
MK_MBUTTON = $10;
{ TDrawItemStruct itemstate }
ODS_DISABLED = 1;
ODS_SELECTED = 2;
ODS_FOCUS = 4;
{ Pen Styles }
PS_NULL = 0; // PenStyle_NoPen
PS_SOLID = 1; // PenStyle_SolidLine
PS_DASH = 2; // PenStyle_DashLine
PS_DOT = 3; // PenStyle_DotLine
PS_DASHDOT = 4; // PenStyle_DashDotLine
PS_DASHDOTDOT = 5; // PenStyle_DashDotDotLine
PS_STYLE_MASK = 15; // PenStyle_MPenStyle
{caps}
PS_ENDCAP_FLAT = 0; // PenCapStyle_FlatCap
PS_ENDCAP_SQUARE = 16; // PenCapStyle_SquareCap
PS_ENDCAP_ROUND = 32; // PenCapStyle_RoundCap
PS_ENDCAP_MASK = 48; // PenCapStyle_MPenCapStyle
{join}
PS_JOIN_MITER = 0; // PenJoinStyle_MiterJoin
PS_JOIN_BEVEL = 64; // PenJoinStyle_BevelJoin
PS_JOIN_ROUND = 128; // PenJoinStyle_RoundJoin
PS_JOIN_MASK = $C0; // PenCapStyle_MPenCapStyle
{ BitBlt/StretchBlt: supported windows dwRop Raster OPerations }
BLACKNESS = $00000042; // RasterOp_ClearROP
DSTINVERT = $00550009; // RasterOp_NotROP
MERGECOPY = $00C000CA; // RasterOp_OrROP
MERGEPAINT = $00BB0226; // RasterOp_NotOrRop
NOTSRCCOPY = $00330008; // RasterOp_NotCopyROP
NOTSRCERASE = $001100A6; // RasterOp_NorROP
SRCAND = $008800C6; // RasterOp_AndROP
SRCCOPY = $00CC0020; // RasterOp_CopyROP
SRCERASE = $00440328; // RasterOp_AndNotROP
SRCINVERT = $00660046; // RasterOp_XorROP
SRCPAINT = $00EE0086; // RasterOp_OrROP;
WHITENESS = $00FF0062; // RasterOp_SetROP
PATCOPY = $00F00021; // dest = pattern
PATPAINT = $00FB0A09; // dest = DPSnoo = PDSnoo
PATINVERT = $005A0049; // dest = pattern XOR dest
ROP_DSPDxax = $00E20746; // dest = ((pattern XOR dest) AND source) XOR Dest
ROP_DSna = $00220326; // RasterOp_NotAndROP
ROP_DSno = MERGEPAINT;
ROP_DPSnoo = PATPAINT;
ROP_D = $00AA0029; // RasterOp_NopROP
ROP_Dn = DSTINVERT; // DSTINVERT
ROP_SDna = SRCERASE; // SRCERASE
ROP_SDno = $00DD0228; // RasterOp_OrNotROP
ROP_DSan = $007700E6; // RasterOp_NandROP
ROP_DSon = $001100A6; // NOTSRCERASE
//ROP_Pn = $000F0001; //
{ SetROP2: windows ROP2 values }
R2_BLACK = 9; // RasterOp_ClearROP: Pixel is always 0.
R2_WHITE = 10; // RasterOp_SetROP:Pixel is always 1.
R2_NOP = 11; // RasterOp_NopROP: Pixel remains unchanged.
R2_NOT = 8; // RasterOp_NotROP: inverse of the screen color.
R2_COPYPEN = 0; // RasterOp_CopyROP: Pixel is the pen color.
R2_NOTCOPYPEN = 4; // RasterOp_NotCopyROP; inverse of the pen color.
R2_MERGEPENNOT = 13; // RasterOp_OrNotROP: combination of the pen color and the inverse of the screen color.
R2_MASKPENNOT = 12; // RasterOp_AndNotROP: combination of the colors common to both the pen and the inverse of the screen.
R2_MERGEPEN = 1; // RasterOp_OrROP: combination of the pen color and the screen color.
R2_NOTMERGEPEN = 15; // RasterOp_NorROP: inverse of the R2_MERGEPEN color.
R2_MASKPEN = 7; // RasterOp_AndROP: combination of the colors common to both the pen and the screen.
R2_NOTMASKPEN = 14; // RasterOp_NandROP: inverse of the R2_MASKPEN color.
R2_XORPEN = 2; // RasterOp_XorROP: combination of the colors in the pen and in the screen, but not in both.
R2_NOTXORPEN = 6; // RasterOp_NotXorROP: inverse of the R2_XORPEN color.
R2_MASKNOTPEN = 3; // RasterOp_NotAndROP: combination of the colors common to both the screen and the inverse of the pen.
R2_MERGENOTPEN = 5; // RasterOp_NotOrROP: combination of the screen color and the inverse of the pen color.
RT_RCDATA = Types.RT_RCDATA;
RT_BITMAP = PChar(2);
{ WM_xSCROLL ScrollCodes }
SB_BOTTOM = 1;
SB_ENDSCROLL = 2;
SB_LINEDOWN = 3;
SB_LINEUP = 4;
SB_PAGEDOWN = 5;
SB_PAGEUP = 6;
SB_THUMBPOSITION = 7;
SB_THUMBTRACK = 8;
SB_TOP = 9;
SB_HORZ = 1;
SB_VERT = 2;
SB_BOTH = SB_HORZ or SB_VERT;
{ semaphores }
STATUS_WAIT_0 = $00000000;
STATUS_ABANDONED_WAIT_0 = $00000080;
STATUS_TIMEOUT = $00000102;
WAIT_FAILED = Longword($FFFFFFFF);
WAIT_OBJECT_0 = STATUS_WAIT_0;
WAIT_ABANDONED = STATUS_ABANDONED_WAIT_0;
WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0;
WAIT_TIMEOUT = STATUS_TIMEOUT;
MAXIMUM_WAIT_OBJECTS = 64;
{ ShowWindow() Commands }
SW_HIDE = 0;
SW_SHOWNORMAL = 1;
SW_NORMAL = 1;
SW_SHOWMINIMIZED = 2;
SW_SHOWMAXIMIZED = 3;
SW_MAXIMIZE = 3;
SW_SHOWNOACTIVATE = 4;
SW_SHOW = 5;
SW_MINIMIZE = 6;
SW_SHOWMINNOACTIVE = 7;
SW_SHOWNA = 8;
SW_RESTORE = 9;
SW_SHOWDEFAULT = 10;
SW_MAX = 10;
{ SetWindowPos Flags }
SWP_NOSIZE = 1;
SWP_NOMOVE = 2;
SWP_NOZORDER = 4;
SWP_NOREDRAW = 8;
SWP_NOACTIVATE = $10;
SWP_FRAMECHANGED = $20; { The frame changed: send WM_NCCALCSIZE }
SWP_SHOWWINDOW = $40;
SWP_HIDEWINDOW = $80;
SWP_NOCOPYBITS = $100; // ignored
SWP_NOOWNERZORDER = $200; { Don't do owner Z ordering }
SWP_NOSENDCHANGING = $400; // ignores
SWP_DRAWFRAME = SWP_FRAMECHANGED;
SWP_NOREPOSITION = SWP_NOOWNERZORDER;
SWP_DEFERERASE = $2000;
SWP_ASYNCWINDOWPOS = $4000; // ignored
TA_LEFT = Integer(AlignmentFlags_AlignLeft);
TA_RIGHT = Integer(AlignmentFlags_AlignRight);
TA_CENTER = Integer(AlignmentFlags_AlignHCenter);
TA_TOP = Integer(AlignmentFlags_AlignTop);
TA_BOTTOM = Integer(AlignmentFlags_AlignBottom);
VTA_CENTER = Integer(AlignmentFlags_AlignVCenter);
TA_NOUPDATECP = 0;
TA_UPDATECP = $8000;
TA_BASELINE = $4000;
VTA_BASELINE = TA_BASELINE;
{$IFDEF LINUX}
{virtual memory handling}
PAGE_NOACCESS = 0;
PAGE_READONLY = PROT_READ;
PAGE_READWRITE = PROT_READ or PROT_WRITE;
//PAGE_WRITECOPY = PROT_ ; // not implemented
PAGE_EXECUTE = PROT_EXEC;
PAGE_EXECUTE_READ = PAGE_EXECUTE or PAGE_READONLY;
PAGE_EXECUTE_READWRITE = PAGE_EXECUTE or PAGE_READWRITE;
//PAGE_EXECUTE_WRITECOPY = PAGE_EXECUTE or PAGE_WRITECOPY;
{$ENDIF LINUX}
{ Windows VK_ keycodes to Qt key }
VK_BACK = Key_Backspace;
VK_TAB = Key_Tab;
VK_RETURN = Key_Enter; //Key_Return = Enter key from keypad
VK_SHIFT = Key_Shift;
VK_CONTROL = Key_Control;
VK_MENU = Key_Alt;
VK_PAUSE = Key_Pause;
VK_CAPITAL = Key_CapsLock;
VK_ESCAPE = 4096;
VK_SPACE = Key_Space;
VK_PRIOR = Key_Prior;
VK_NEXT = Key_Next;
VK_END = Key_End;
VK_HOME = Key_Home;
VK_LEFT = Key_Left;
VK_UP = Key_Up;
VK_RIGHT = Key_Right;
VK_DOWN = Key_Down;
{ VK_SELECT = 41; }
VK_PRINT = Key_Print;
{ VK_EXECUTE = 43; }
VK_SNAPSHOT = Key_Print;
VK_INSERT = Key_Insert;
VK_DELETE = Key_Delete;
VK_HELP = Key_Help;
{ VK_LWIN = 91; }
{ VK_RWIN = 92; }
VK_APPS = Key_Menu;
VK_NUMPAD0 = Key_0;
VK_NUMPAD1 = Key_1;
VK_NUMPAD2 = Key_2;
VK_NUMPAD3 = Key_3;
VK_NUMPAD4 = Key_4;
VK_NUMPAD5 = Key_5;
VK_NUMPAD6 = Key_6;
VK_NUMPAD7 = Key_7;
VK_NUMPAD8 = Key_8;
VK_NUMPAD9 = Key_9;
VK_MULTIPLY = Key_Asterisk;
VK_ADD = Key_Plus;
VK_SUBTRACT = Key_Minus;
VK_DECIMAL = Key_Period;
VK_DIVIDE = Key_Slash;
VK_F1 = Key_F1;
VK_F2 = Key_F2;
VK_F3 = Key_F3;
VK_F4 = Key_F4;
VK_F5 = Key_F5;
VK_F6 = Key_F6;
VK_F7 = Key_F7;
VK_F8 = Key_F8;
VK_F9 = Key_F1;
VK_F10 = Key_F10;
VK_F11 = Key_F11;
VK_F12 = Key_F12;
VK_F13 = Key_F13;
VK_F14 = Key_F14;
VK_F15 = Key_F15;
VK_F16 = Key_F16;
VK_F17 = Key_F17;
VK_F18 = Key_F18;
VK_F19 = Key_F19;
VK_F20 = Key_F20;
VK_F21 = Key_F21;
VK_F22 = Key_F22;
VK_F23 = Key_F23;
VK_F24 = Key_F24;
VK_NUMLOCK = Key_NumLock;
VK_SCROLL = Key_ScrollLock;
{ VK_L.. & VK_R.. mapping: }
{ Alt, Ctrl and Shift keys produce same keycode }
VK_LSHIFT = Key_Shift;
VK_RSHIFT = Key_Shift;
VK_LCONTROL = Key_Control;
VK_RCONTROL = Key_Control;
VK_LMENU = Key_Alt;
VK_RMENU = Key_Alt;
{ Qt alignment flags, (as used by Canvas.TextRect) }
AlignLeft = $1;
AlignRight = $2;
AlignHCenter = $4;
AlignTop = $8;
AlignBottom = $10;
AlignVCenter = $20;
AlignCenter = $24;
SingleLine = $40;
DontClip = $80;
ExpandTabs = $100;
ShowPrefix = $200;
WordBreak = $400;
BreakAnywhere = $800;
// DontPrint = $1000; not used
{ Additional constanst for Qt text alignments used by DrawText }
QtAlignMask = $FFF;
CalcRect = $10000;
ClipPath = $20000;
ClipName = $40000;
ClipToWord = $100000;
ModifyString = $200000;
pf24bit = pf32bit;
clSystemColor = $FF000000;
clMoneyGreen = TColor($C0DCC0);
clSkyBlue = TColor($F0CAA6);
clCream = TColor($F0FBFF);
clMedGray = TColor($A4A0A0);
clWindowFrame = cl3DDkShadow;
crColorTo = crNoRole;
clColorTo = TColor(-15);
clNormalColorTo = TColor(clColorTo - cloNormal);
clActiveColorTo = TColor(clColorTo - cloActive);
clDisabledColorTo = TColor(clColorTo - cloDisabled);
clNoRole = TColor(-15);
clNormalNoRole = TColor(clNoRole - cloNormal);
clDisabledNoRole = TColor(clNoRole - cloDisabled);
clActiveNoRole = TColor(clNoRole - cloActive);
clDesktop = clDisabledNoRole;
clColor0 = clMask;
clColor1 = clDontMask;
// Windows symbolic colors to mapping VisualCLX symbolic colors
Win2TColor: array [0..COLOR_ENDCOLORS] of TColor = (
clNormalButton, clNormalBackground, clActiveHighlightedText, // 0
clDisabledHighlightedText, clNormalMid, clNormalBase, // 3
clNormalHighlight, clNormalButtonText, clNormalText, // 6
clNormalHighlightedText, clActiveHighlight, clDisabledHighlight, // 9
clNormalMid, clNormalHighlight, clNormalHighlightedText, // 12
clNormalButton, clNormalDark, clDisabledText, // 15
clNormalButtonText, clDisabledHighlightedText, clActiveLight, // 18
clNormalMid, clNormalMidLight, clNormalText, // 21
clInfoBk, clBlack, clActiveHighlight, // 24
clActiveHighLight, clDisabledHighlight // 27
);
{ SendMessage / PostMessage }
QEventType_Message = QEventType(2105);
{ Timer message id}
WM_TIMER = $0113; { 275 }
type
TAppEventHook = class(TComponent)
private
FHook: QApplication_hookH;
protected
function EventFilter(Receiver: QObjectH; Event: QEventH): Boolean; cdecl;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
TMsg = packed record
hwnd: QWidgetH;
message: Integer;
wParam: Integer;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -