Description | Hierarchy | Fields | Methods | Properties |
type unaWinWindow = class(unaObject)
This class encapsulates Windows window object.
f_isCommonDC: bool; |
constructor create(const params: unaWinCreateParams); overload; |
|
constructor create(wndClass: unaWinClass = nil; font: unaWinFont = nil; const caption: string = ''; parent: hWnd = 0; style: unsigned = WS_OVERLAPPEDWINDOW or WS_VISIBLE; exStyle: unsigned = 0; x: int = int(CW_USEDEFAULT); y: int = int(CW_USEDEFAULT); w: int = int(CW_USEDEFAULT); h: int = int(CW_USEDEFAULT); menu: hMenu = 0; instance: hModule = 0; icon: hIcon = 0); overload; |
|
constructor createStdWnd(const className: string; const caption: string = ''; parent: unaWinWindow = nil; style: unsigned = 0; exStyle: unsigned = 0; x: int = 2; y: int = 2; w: int = 20; h: int = 20; id: unsigned = 0); |
|
destructor Destroy(); override; |
|
function createWindow(): hWnd; |
|
function enable(doEnable: bool = true): unaWinWindow; |
|
function endModal(modalResult: int = -1): unaWinWindow; |
|
function enter(timeout: tTimeout = 10000): bool; |
|
function getCreateParams(): punaWinCreateParams; |
|
function getDC(clipRgn: hRGN = 0; flags: unsigned = DCX_WINDOW; wnd: int = -1): hDC; |
|
function getHandle(): hWnd; |
|
function getText(): string; |
|
function getTextLength(): int; |
|
function messageBox(const text: string; const caption: string = ''; flags: unsigned = MB_OK): unsigned; |
|
function postMessage(message: unsigned; wParam: int = 0; lParam: int = 0): bool; |
|
function processMessages(): unaWinWindow; |
|
function redraw(): unaWinWindow; |
|
function releaseDC(dc: hDC = 0): int; |
|
function sendMessage(message: unsigned; wParam: int = 0; lParam: int = 0): int; |
|
function setAnchors(anchors: unsigned = unawinAnchor_LEFT or unawinAnchor_TOP): unaWinWindow; |
|
function setFocus(firstChild: bool = false): unaWinWindow; |
|
function setFont(font: unaWinFont): unaWinWindow; |
|
function setText(const text: string): unaWinWindow; |
|
function show(cmd: unsigned = SW_SHOW): unaWinWindow; |
|
function showModal(cmd: unsigned = SW_SHOW): int; |
|
function textOut(const text: string; x: int = 0; y: int = 0; dc: hDC = 0): bool; |
|
function update(): unaWinWindow; |
|
function doCreateWindow(): hWnd; virtual; |
|
function initWindow(): bool; virtual; |
|
function notifyActivate(isActivate: bool): bool; virtual; |
|
function notifyCreate(cs: pCREATESTRUCT): bool; virtual; |
|
function notifyDestroy(): bool; virtual; |
|
function onActivate(wayOfActivate: unsigned; window: hWnd): bool; virtual; |
|
function onActivateApp(isActivate: bool; activeThreadId: unsigned): bool; virtual; |
|
function onClick(button: Word; x, y: word): bool; virtual; |
|
function onClose(): bool; virtual; |
|
function onCommand(cmd: int; wnd: int): bool; virtual; |
|
function onCreate(cs: pCREATESTRUCT): int; virtual; |
|
function onDestroy(): bool; virtual; |
|
function onEnterSizeMove(): bool; virtual; |
|
function onGetDlgCode(): LRESULT; virtual; |
|
function onGetMinMaxInfo(infO: pMINMAXINFO): bool; |
|
function onGetText(buf: paChar; maxSize: unsigned): int; virtual; |
|
function onKeyDown(vkCode: unsigned; keyData: int): bool; virtual; |
|
function onMove(x, y: int): bool; virtual; |
|
function onPaint(param: int): bool; virtual; |
|
function onPosChange(pos: pWINDOWPOS): bool; virtual; |
|
function onShow(isShow: bool; reason: unsigned): bool; virtual; |
|
function onSize(action: unsigned; height, width: unsigned): bool; virtual; |
|
function parentResize(dw, dh: int): unaWinWindow; virtual; |
|
function wndProc(message, wParam, lParam: int): int; virtual; |
|
procedure addChild(child: unaWinWindow); |
|
procedure destroyWindow(); |
|
procedure leave(); |
|
procedure idle(); virtual; |
property anchors: unsigned read f_anchors write setFAnchors; |
|
property deviceContext: hDC read f_dc; |
|
property font: unaWinFont read getFont write setFFont; |
|
property height: int read getHeight write setHeight; |
|
property isCommonDC: bool read f_isCommonDC; |
|
property isDisabled: bool index WS_DISABLED read hasStyle; |
|
property isMaximized: bool index WS_MAXIMIZE read hasStyle; |
|
property isMinimized: bool index WS_MINIMIZE read hasStyle; |
|
property isOverlapped: bool index WS_OVERLAPPED read hasStyle; |
|
property isVisible: bool index WS_VISIBLE read hasStyle; |
|
property left: int read getLeft write setLeft; |
|
property minHeight: int read f_minHeight write setMinHeight; |
|
property minWidth: int read f_minWidth write setMinWidth; |
|
property rect: tRECT read f_rect; |
|
property top: int read getTop write setTop; |
|
property unaParent: unaWinWindow read getUnaParent; |
|
property width: int read getWidth write setWidth; |
|
property winClass: unaWinClass read getWndClass; |
|
property wmCommand: tmessageEvent read f_wmCommand write f_wmCommand; |
|
property wnd: hWnd read f_handle; |
f_isCommonDC: bool; |
|
constructor create(const params: unaWinCreateParams); overload; |
|
Creates new Windows window. |
constructor create(wndClass: unaWinClass = nil; font: unaWinFont = nil; const caption: string = ''; parent: hWnd = 0; style: unsigned = WS_OVERLAPPEDWINDOW or WS_VISIBLE; exStyle: unsigned = 0; x: int = int(CW_USEDEFAULT); y: int = int(CW_USEDEFAULT); w: int = int(CW_USEDEFAULT); h: int = int(CW_USEDEFAULT); menu: hMenu = 0; instance: hModule = 0; icon: hIcon = 0); overload; |
|
Creates new Windows window. |
constructor createStdWnd(const className: string; const caption: string = ''; parent: unaWinWindow = nil; style: unsigned = 0; exStyle: unsigned = 0; x: int = 2; y: int = 2; w: int = 20; h: int = 20; id: unsigned = 0); |
|
Creates new "standard" Windows window (such as BUTTON, EDIT and so on). |
destructor Destroy(); override; |
|
Destroys Windows window. If this window has child windows, they will be also destroyed. |
function createWindow(): hWnd; |
|
Creates Windows window. Returns handle on new created window. If window is already created does nothing and returns handle on previously created window. |
function enable(doEnable: bool = true): unaWinWindow; |
|
Enables or disables the window. |
function endModal(modalResult: int = -1): unaWinWindow; |
|
function enter(timeout: tTimeout = 10000): bool; |
|
Enters TM-safe lock state, if possible. Returns False if locking was impossible during given time interval. |
function getCreateParams(): punaWinCreateParams; |
|
Returns pointer on unaWinCreateParams structure. |
function getDC(clipRgn: hRGN = 0; flags: unsigned = DCX_WINDOW; wnd: int = -1): hDC; |
|
Default value -1 for wnd means window handle will be used instead. You can specify 0 as wnd to retrieve the entire screen DC. Make sure you call releaseDC() as soon as possible. |
function getHandle(): hWnd; |
|
Returns handle on window. Creates window if necessary. |
function getText(): string; |
|
Returns text associated with window. |
function getTextLength(): int; |
|
Returns length of text associated with window. |
function messageBox(const text: string; const caption: string = ''; flags: unsigned = MB_OK): unsigned; |
|
Displays message box with specified text. |
function postMessage(message: unsigned; wParam: int = 0; lParam: int = 0): bool; |
|
Posts a message for window. |
function processMessages(): unaWinWindow; |
|
Process all messages waiting in window message queue. |
function redraw(): unaWinWindow; |
|
Redraws the window contents. |
function releaseDC(dc: hDC = 0): int; |
|
Default value 0 means last DC returned by getDC() method will be used Class and private DCs (i.e. when isCommonDC property is false) will not be released, and it is safe to call this function for that class styles. |
function sendMessage(message: unsigned; wParam: int = 0; lParam: int = 0): int; |
|
Sends a message to window. |
function setAnchors(anchors: unsigned = unawinAnchor_LEFT or unawinAnchor_TOP): unaWinWindow; |
|
Sets anchors for window. Default anchors are [unawinAnchor_LEFT or unawinAnchor_TOP]. |
function setFocus(firstChild: bool = false): unaWinWindow; |
|
Sets the focus on window. If firstChild = true sets the focus on first child window. |
function setFont(font: unaWinFont): unaWinWindow; |
|
Sets new font for window. |
function setText(const text: string): unaWinWindow; |
|
Sets text to be associated with window. |
function show(cmd: unsigned = SW_SHOW): unaWinWindow; |
|
Show (SW_SHOW) or hides (SW_HIDE) the window. |
function showModal(cmd: unsigned = SW_SHOW): int; |
|
function textOut(const text: string; x: int = 0; y: int = 0; dc: hDC = 0): bool; |
|
For non-common DCs if dc = 0, it will create and release a DC, so use this method carefully (performance issue) |
function update(): unaWinWindow; |
|
Updates the window contents. |
function doCreateWindow(): hWnd; virtual; |
|
function initWindow(): bool; virtual; |
|
function notifyActivate(isActivate: bool): bool; virtual; |
|
WM_NCACTIVATE message handler. |
function notifyCreate(cs: pCREATESTRUCT): bool; virtual; |
|
WM_NCCREATE message handler. |
function notifyDestroy(): bool; virtual; |
|
WM_NCDESTROY message handler. |
function onActivate(wayOfActivate: unsigned; window: hWnd): bool; virtual; |
|
WM_ACTIVATE message handler. |
function onActivateApp(isActivate: bool; activeThreadId: unsigned): bool; virtual; |
|
WM_ACTIVATEAPP message handler. |
function onClick(button: Word; x, y: word): bool; virtual; |
|
function onClose(): bool; virtual; |
|
WM_CLOSE message handler. Returns true, if window should be closed and destroyed. Our handler simply hides the window, not destroying it. |
function onCommand(cmd: int; wnd: int): bool; virtual; |
|
WM_COMMAND message handler. |
function onCreate(cs: pCREATESTRUCT): int; virtual; |
|
WM_CREATE message handler. |
function onDestroy(): bool; virtual; |
|
WM_DESTROY message handler. |
function onEnterSizeMove(): bool; virtual; |
|
WM_ENTERSIZEMOVE message handler. |
function onGetDlgCode(): LRESULT; virtual; |
|
function onGetMinMaxInfo(infO: pMINMAXINFO): bool; |
|
WM_GETMINMAXINFO message handler. |
function onGetText(buf: paChar; maxSize: unsigned): int; virtual; |
|
WM_GETTEXT message handler. |
function onKeyDown(vkCode: unsigned; keyData: int): bool; virtual; |
|
function onMove(x, y: int): bool; virtual; |
|
WM_MOVE message handler. |
function onPaint(param: int): bool; virtual; |
|
WM_PAINT message handler. |
function onPosChange(pos: pWINDOWPOS): bool; virtual; |
|
WM_WINDOWPOSCHANGING message handler. |
function onShow(isShow: bool; reason: unsigned): bool; virtual; |
|
WM_SHOW message handler. |
function onSize(action: unsigned; height, width: unsigned): bool; virtual; |
|
WM_SIZE message handler. |
function parentResize(dw, dh: int): unaWinWindow; virtual; |
|
function wndProc(message, wParam, lParam: int): int; virtual; |
|
This is Windows WndProc routine. |
procedure addChild(child: unaWinWindow); |
|
creates window if necessary |
procedure destroyWindow(); |
|
Destroys Windows window. Child windows (if any) will NOT be destroyed. |
procedure leave(); |
|
Frees the window from TM-safe lock state. |
procedure idle(); virtual; |
|
This method is called periodically when there are no pending messages in window queue and window is application or is in modal state. |
property anchors: unsigned read f_anchors write setFAnchors; |
|
Window anchors. |
property deviceContext: hDC read f_dc; |
|
This property is valid only if isCommonDC is false. Use getDC()/releaseDC() methods otherwise. |
property font: unaWinFont read getFont write setFFont; |
|
Window font. |
property height: int read getHeight write setHeight; |
|
Height of the window. |
property isCommonDC: bool read f_isCommonDC; |
|
false if this window belongs to class with CS_CLASSDC, CS_OWNDC or CS_PARENTDC style set. true otherwise |
property isDisabled: bool index WS_DISABLED read hasStyle; |
|
Returns true if window has WS_DISABLED style. |
property isMaximized: bool index WS_MAXIMIZE read hasStyle; |
|
Returns true if window has WS_MAXIMIZE style. |
property isMinimized: bool index WS_MINIMIZE read hasStyle; |
|
Returns true if window has WS_MINIMIZE style. |
property isOverlapped: bool index WS_OVERLAPPED read hasStyle; |
|
Returns true if window has WS_OVERLAPPED style. |
property isVisible: bool index WS_VISIBLE read hasStyle; |
|
Returns true if window has WS_VISIBLE style. |
property left: int read getLeft write setLeft; |
|
X coordinate of top-left window corner (in relative coordinates). |
property minHeight: int read f_minHeight write setMinHeight; |
|
Minimum value for window height. |
property minWidth: int read f_minWidth write setMinWidth; |
|
Minimum value for window width. |
property rect: tRECT read f_rect; |
|
property top: int read getTop write setTop; |
|
Y coordinate of top-left window corner (in relative coordinates). |
property unaParent: unaWinWindow read getUnaParent; |
|
property width: int read getWidth write setWidth; |
|
Width of the window. |
property winClass: unaWinClass read getWndClass; |
|
Window class. |
property wmCommand: tmessageEvent read f_wmCommand write f_wmCommand; |
|
Command event. (Handles WM_COMMAND messages). |
property wnd: hWnd read f_handle; |
|
Window handle. |
(c) 2012 Lake of Soft