xref: /reactos/win32ss/user/ntuser/window.h (revision 3e1f4074)
1 #pragma once
2 
3 extern ATOM AtomMessage;
4 extern ATOM AtomWndObj; /* WNDOBJ list */
5 extern ATOM AtomLayer;
6 extern ATOM AtomFlashWndState;
7 
8 #define HAS_DLGFRAME(Style, ExStyle) \
9             (((ExStyle) & WS_EX_DLGMODALFRAME) || \
10             (((Style) & WS_DLGFRAME) && (!((Style) & WS_THICKFRAME))))
11 
12 #define HAS_THICKFRAME(Style, ExStyle) \
13             (((Style) & WS_THICKFRAME) && \
14             (!(((Style) & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)))
15 
16 #define HAS_THINFRAME(Style, ExStyle) \
17             (((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP))))
18 
19 #define HAS_CLIENTFRAME(Style, ExStyle) \
20             (((ExStyle) & WS_EX_CLIENTEDGE) || (!((Style) & (WS_CHILD | WS_POPUP))))
21 
22 #define HAS_MENU(pWnd,style)  ((((style) & (WS_CHILD | WS_POPUP)) != WS_CHILD) && (pWnd->IDMenu) && IntIsMenu(UlongToHandle(pWnd->IDMenu)))
23 
24 #define IntIsDesktopWindow(WndObj) \
25   (WndObj->spwndParent == NULL)
26 
27 #define IntIsBroadcastHwnd(hWnd) \
28   (hWnd == HWND_BROADCAST || hWnd == HWND_TOPMOST)
29 
30 
31 #define IntWndBelongsToThread(WndObj, W32Thread) \
32   ((WndObj->head.pti) && (WndObj->head.pti == W32Thread))
33 
34 #define IntGetWndThreadId(WndObj) \
35   PsGetThreadId(WndObj->head.pti->pEThread)
36 
37 #define IntGetWndProcessId(WndObj) \
38   PsGetProcessId(WndObj->head.pti->ppi->peProcess)
39 
40 PWND FASTCALL ValidateHwndNoErr(HWND);
41 BOOL FASTCALL UserUpdateUiState(PWND Wnd, WPARAM wParam);
42 BOOL FASTCALL IntIsWindow(HWND hWnd);
43 HWND* FASTCALL IntWinListChildren(PWND Window);
44 HWND* FASTCALL IntWinListOwnedPopups(PWND Window);
45 VOID FASTCALL IntGetClientRect (PWND WindowObject, RECTL *Rect);
46 INT FASTCALL  IntMapWindowPoints(PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints);
47 BOOL FASTCALL IntIsChildWindow (PWND Parent, PWND Child);
48 VOID FASTCALL IntUnlinkWindow(PWND Wnd);
49 VOID FASTCALL IntLinkHwnd(PWND Wnd, HWND hWndPrev);
50 PWND FASTCALL IntGetParent(PWND Wnd);
51 VOID FASTCALL IntGetWindowBorderMeasures(PWND WindowObject, UINT *cx, UINT *cy);
52 BOOL FASTCALL IntShowOwnedPopups( PWND owner, BOOL fShow );
53 LRESULT FASTCALL IntDefWindowProc( PWND Window, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi);
54 VOID FASTCALL IntNotifyWinEvent(DWORD, PWND, LONG, LONG, DWORD);
55 #define WINVER_WIN2K  _WIN32_WINNT_WIN2K
56 #define WINVER_WINNT4 _WIN32_WINNT_NT4
57 #define WINVER_WIN31  0x30A
58 PWND FASTCALL IntCreateWindow(CREATESTRUCTW* Cs,
59                                         PLARGE_STRING WindowName,
60                                         PCLS Class,
61                                         PWND ParentWindow,
62                                         PWND OwnerWindow,
63                                         PVOID acbiBuffer,
64                                         PDESKTOP pdeskCreated,
65                                         DWORD dwVer );
66 PWND FASTCALL co_UserCreateWindowEx(CREATESTRUCTW* Cs,
67                                     PUNICODE_STRING ClassName,
68                                     PLARGE_STRING WindowName,
69                                     PVOID acbiBuffer,
70                                     DWORD dwVer );
71 BOOL FASTCALL IntEnableWindow(HWND,BOOL);
72 BOOL FASTCALL IntIsWindowVisible(PWND);
73 DWORD FASTCALL GetNCHitEx(PWND,POINT);
74 ULONG FASTCALL IntSetStyle(PWND,ULONG,ULONG);
75 PWND FASTCALL VerifyWnd(PWND);
76 PWND FASTCALL IntGetNonChildAncestor(PWND);
77 LONG FASTCALL co_UserSetWindowLong(HWND,DWORD,LONG,BOOL);
78 LONG_PTR FASTCALL co_UserSetWindowLongPtr(HWND, DWORD, LONG_PTR, BOOL);
79 HWND FASTCALL IntGetWindow(HWND,UINT);
80 LRESULT co_UserFreeWindow(PWND,PPROCESSINFO,PTHREADINFO,BOOLEAN);
81 
82 #define HWND_TERMINATOR ((HWND)(ULONG_PTR)1)
83 
84 typedef struct tagWINDOWLIST
85 {
86     struct tagWINDOWLIST *pNextList;
87     HWND *phwndLast;
88     HWND *phwndEnd;
89     PTHREADINFO pti;
90     HWND ahwnd[ANYSIZE_ARRAY]; /* Terminated by HWND_TERMINATOR */
91 } WINDOWLIST, *PWINDOWLIST;
92 
93 extern PWINDOWLIST gpwlList;
94 extern PWINDOWLIST gpwlCache;
95 
96 #define WL_IS_BAD(pwl)   ((pwl)->phwndEnd <= (pwl)->phwndLast)
97 #define WL_CAPACITY(pwl) ((pwl)->phwndEnd - &((pwl)->ahwnd[0]))
98 
99 PWINDOWLIST FASTCALL IntBuildHwndList(PWND pwnd, DWORD dwFlags, PTHREADINFO pti);
100 VOID FASTCALL IntFreeHwndList(PWINDOWLIST pwlTarget);
101 HWND FASTCALL IntFindWindow(PWND Parent, PWND ChildAfter, RTL_ATOM ClassAtom,
102                             PUNICODE_STRING WindowName);
103 
104 /* Undocumented dwFlags for IntBuildHwndList */
105 #define IACE_LIST  0x0002
106 
107 #define IS_WND_CHILD(pWnd) ((pWnd)->style & WS_CHILD)
108 #define IS_WND_MENU(pWnd) ((pWnd)->pcls->atomClassName == gpsi->atomSysClass[ICLS_MENU])
109 
110 // The IME-like windows are the IME windows and the IME UI windows.
111 // The IME window's class name is "IME".
112 // The IME UI window behaves the User Interface of IME for the user.
113 #define IS_WND_IMELIKE(pWnd) \
114     (((pWnd)->pcls->style & CS_IME) || \
115      ((pWnd)->pcls->atomClassName == gpsi->atomSysClass[ICLS_IME]))
116 
117 extern BOOL gfIMEShowStatus;
118 
119 BOOL FASTCALL IntWantImeWindow(PWND pwndTarget);
120 PWND FASTCALL co_IntCreateDefaultImeWindow(PWND pwndTarget, HINSTANCE hInst);
121 BOOL FASTCALL IntImeCanDestroyDefIMEforChild(PWND pImeWnd, PWND pwndTarget);
122 BOOL FASTCALL IntImeCanDestroyDefIME(PWND pImeWnd, PWND pwndTarget);
123 BOOL FASTCALL IntBroadcastImeShowStatusChange(PWND pImeWnd, BOOL bShow);
124 VOID FASTCALL IntNotifyImeShowStatus(PWND pImeWnd);
125 
126 /* EOF */
127