ReactOS 0.4.17-dev-1321-g5c122a9
mdi.c File Reference
#include <user32.h>
Include dependency graph for mdi.c:

Go to the source code of this file.

Classes

struct  MDICLIENTINFO
 

Macros

#define MDI_MAXTITLELENGTH   0xa1
 
#define WM_MDICALCCHILDSCROLL   0x003f /* this is exactly what Windows uses */
 
#define MDI_MOREWINDOWSLIMIT
 
#define MDI_IDC_LISTBOX   100
 
#define IDS_MDI_MOREWINDOWS   13
 
#define MDIF_NEEDUPDATE   0x0001
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (mdi)
 
static void MDI_UpdateFrameText (HWND, HWND, BOOL, LPCWSTR)
 
static BOOL MDI_AugmentFrameMenu (HWND, HWND)
 
static BOOL MDI_RestoreFrameMenu (HWND, HWND, HBITMAP)
 
static LONG MDI_ChildActivate (HWND, HWND)
 
static LRESULT MDI_RefreshMenu (MDICLIENTINFO *)
 
static HWND MDI_MoreWindowsDialog (HWND)
 
HWND * WIN_ListChildren (HWND hWndparent)
 
static HWND MDI_GetChildByID (HWND hwnd, UINT id, MDICLIENTINFO *ci)
 
static void MDI_PostUpdate (HWND hwnd, MDICLIENTINFO *ci, WORD recalc)
 
static MDICLIENTINFO * get_client_info (HWND client)
 
static BOOL is_close_enabled (HWND hwnd, HMENU hSysMenu)
 
static HWND MDI_GetWindow (MDICLIENTINFO *clientInfo, HWND hWnd, BOOL bNext, DWORD dwStyleMask)
 
void MDI_CalcDefaultChildPos (HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id)
 
static LRESULT MDISetMenu (HWND hwnd, HMENU hmenuFrame, HMENU hmenuWindow)
 
static void MDI_ChildGetMinMaxInfo (HWND client, HWND hwnd, MINMAXINFO *lpMinMax)
 
static void MDI_SwitchActiveChild (MDICLIENTINFO *ci, HWND hwndTo, BOOL activate)
 
static LRESULT MDIDestroyChild (HWND client, MDICLIENTINFO *ci, HWND child, BOOL flagDestroy)
 
static HBITMAP CreateMDIMenuBitmap (void)
 
static LONG MDICascade (HWND client, MDICLIENTINFO *ci)
 
static void MDITile (HWND client, MDICLIENTINFO *ci, WPARAM wParam)
 
LRESULT WINAPI MDIClientWndProc_common (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode)
 
LRESULT WINAPI MDIClientWndProcA (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI MDIClientWndProcW (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI DefFrameProcA (HWND hwnd, HWND hwndMDIClient, UINT message, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI DefFrameProcW (HWND hwnd, HWND hwndMDIClient, UINT message, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI DefMDIChildProcA (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI DefMDIChildProcW (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
HWND WINAPI CreateMDIWindowA (LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, INT X, INT Y, INT nWidth, INT nHeight, HWND hWndParent, HINSTANCE hInstance, LPARAM lParam)
 
HWND WINAPI CreateMDIWindowW (LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, INT X, INT Y, INT nWidth, INT nHeight, HWND hWndParent, HINSTANCE hInstance, LPARAM lParam)
 
BOOL WINAPI TranslateMDISysAccel (HWND hwndClient, LPMSG msg)
 
void WINAPI CalcChildScroll (HWND hwnd, INT scroll)
 
void WINAPI ScrollChildren (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR WINAPI MDI_MoreWindowsDlgProc (HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
 

Macro Definition Documentation

◆ IDS_MDI_MOREWINDOWS

#define IDS_MDI_MOREWINDOWS   13

Definition at line 95 of file mdi.c.

◆ MDI_IDC_LISTBOX

#define MDI_IDC_LISTBOX   100

Definition at line 94 of file mdi.c.

◆ MDI_MAXTITLELENGTH

#define MDI_MAXTITLELENGTH   0xa1

Definition at line 88 of file mdi.c.

◆ MDI_MOREWINDOWSLIMIT

#define MDI_MOREWINDOWSLIMIT
Value:
9 /* after this number of windows, a "More Windows..."
option will appear under the Windows menu */

Definition at line 93 of file mdi.c.

◆ MDIF_NEEDUPDATE

#define MDIF_NEEDUPDATE   0x0001

Definition at line 97 of file mdi.c.

◆ WM_MDICALCCHILDSCROLL

#define WM_MDICALCCHILDSCROLL   0x003f /* this is exactly what Windows uses */

Definition at line 90 of file mdi.c.

Function Documentation

◆ CalcChildScroll()

void WINAPI CalcChildScroll ( HWND  hwnd,
INT  scroll 
)

Definition at line 1774 of file mdi.c.

1776{
1777#ifndef __REACTOS__ /* not implemented */
1779#endif
1781 RECT childRect, clientRect;
1782 HWND *list;
1783 DWORD style;
1784#ifdef __REACTOS__
1785 WINDOWINFO WindowInfo;
1786#endif
1787
1788#ifndef __REACTOS__ /* not implemented */
1789 context = SetThreadDpiAwarenessContext( GetWindowDpiAwarenessContext( hwnd ));
1790#endif
1791
1792 GetClientRect( hwnd, &clientRect );
1793 SetRectEmpty( &childRect );
1794
1795#ifdef __REACTOS__
1796 /* The rectangle returned by GetClientRect always has 0,0 as top left
1797 * because it is in client coordinates. The rectangles returned by
1798 * GetWindowRect are in screen coordinates to make this complicated.
1799 *
1800 * Apparently (in ReactOS at least) the rcClient returned by GetWindowInfo
1801 * is in screen coordinates too.
1802 */
1803 WindowInfo.cbSize = sizeof(WindowInfo);
1804 if (!GetWindowInfo(hwnd, &WindowInfo))
1805 {
1806 ERR("Can't get window info\n");
1807 return;
1808 }
1809#endif
1810
1811 TRACE("CalcChildScroll 1\n");
1812 if ((list = WIN_ListChildren( hwnd )))
1813 {
1814 int i;
1815 for (i = 0; list[i]; i++)
1816 {
1818 if (style & WS_MAXIMIZE)
1819 {
1820 HeapFree( GetProcessHeap(), 0, list );
1822 ERR("CalcChildScroll 2\n");
1823 goto done;
1824 }
1825 if (style & WS_VISIBLE)
1826 {
1827 RECT rect;
1828#ifdef __REACTOS__
1829 GetWindowRect( list[i], &rect );
1830 OffsetRect(&rect, -WindowInfo.rcClient.left,
1831 -WindowInfo.rcClient.top);
1832#else
1833 NtUserGetChildRect( list[i], &rect );
1834#endif
1835 UnionRect( &childRect, &rect, &childRect );
1836 }
1837 }
1838 HeapFree( GetProcessHeap(), 0, list );
1839 }
1840 UnionRect( &childRect, &clientRect, &childRect );
1841 TRACE("CalcChildScroll 3\n");
1842 /* set common info values */
1843 info.cbSize = sizeof(info);
1844 info.fMask = SIF_POS | SIF_RANGE | SIF_PAGE;
1845 info.nPos = 0;
1846
1847 /* set the specific values and apply but only if window style allows */
1848 /* Note how we set nPos to 0 because we scroll the clients instead of
1849 * the window, and we set nPage to 1 bigger than the clientRect because
1850 * otherwise the scrollbar never disables. This causes a somewhat ugly
1851 * effect though while scrolling.
1852 */
1854 switch( scroll )
1855 {
1856 case SB_BOTH:
1857 case SB_HORZ:
1858 if (style & (WS_HSCROLL | WS_VSCROLL))
1859 {
1860 info.nMin = childRect.left;
1861#ifdef __REACTOS__
1862 info.nMax = childRect.right;
1863 info.nPage = 1 + clientRect.right - clientRect.left;
1865#else
1866 info.nMax = childRect.right - clientRect.right;
1867 info.nPos = clientRect.left - childRect.left;
1869#endif
1870 }
1871 if (scroll == SB_HORZ) break;
1872 /* fall through */
1873 case SB_VERT:
1874 if (style & (WS_HSCROLL | WS_VSCROLL))
1875 {
1876 info.nMin = childRect.top;
1877#ifdef __REACTOS__
1878 info.nMax = childRect.bottom;
1879 info.nPage = 1 + clientRect.bottom - clientRect.top;
1881#else
1882 info.nMax = childRect.bottom - clientRect.bottom;
1883 info.nPos = clientRect.top - childRect.top;
1885#endif
1886 }
1887 break;
1888 }
1889
1890done:
1891#ifndef __REACTOS__ /* not implemented */
1892 SetThreadDpiAwarenessContext( context );
1893#else
1894 return;
1895#endif
#define ERR(fmt,...)
Definition: precomp.h:57
Definition: list.h:39
RECT rect
Definition: combotst.c:67
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD NTAPI NtUserSetScrollInfo(HWND hwnd, int fnBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
Definition: scrollbar.c:1344
DWORD NTAPI NtUserShowScrollBar(HWND hWnd, int wBar, DWORD bShow)
Definition: scrollbar.c:1383
static DPI_AWARENESS_CONTEXT
Definition: sysparams.c:52
#define WS_MAXIMIZE
Definition: pedump.c:623
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_HSCROLL
Definition: pedump.c:628
#define GetWindowLongPtrW
Definition: winuser.h:4983
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SIF_RANGE
Definition: winuser.h:1246
BOOL WINAPI GetWindowInfo(_In_ HWND, _Inout_ PWINDOWINFO)
#define SB_VERT
Definition: winuser.h:553
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define SIF_PAGE
Definition: winuser.h:1244
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SB_BOTH
Definition: winuser.h:555
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define SIF_POS
Definition: winuser.h:1245
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
int WINAPI SetScrollInfo(_In_ HWND, _In_ int, _In_ LPCSCROLLINFO, _In_ BOOL)
BOOL WINAPI UnionRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define GWL_STYLE
Definition: winuser.h:863
#define SB_HORZ
Definition: winuser.h:552
#define list
Definition: rosglue.h:35
#define TRACE(s)
Definition: solgame.cpp:4
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
Definition: http.c:7783
Definition: style.c:91
RECT rcClient
Definition: winuser.h:3876
DWORD cbSize
Definition: winuser.h:3874
HWND * WIN_ListChildren(HWND hWndparent)
Definition: mdi.c:139
DPI_AWARENESS_CONTEXT WINAPI GetWindowDpiAwarenessContext(HWND hwnd)
Definition: win.c:630
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by MDIClientWndProc_common(), and ScrollChildren().

◆ CreateMDIMenuBitmap()

static HBITMAP CreateMDIMenuBitmap ( void  )
static

Definition at line 673 of file mdi.c.

675{
676 HDC hDCSrc = CreateCompatibleDC(0);
677 HDC hDCDest = CreateCompatibleDC(hDCSrc);
678 HBITMAP hbClose = LoadBitmapW(0, MAKEINTRESOURCEW(OBM_OLD_CLOSE) );
679 HBITMAP hbCopy;
680 HBITMAP hobjSrc, hobjDest;
681
682 hobjSrc = SelectObject(hDCSrc, hbClose);
684 hobjDest = SelectObject(hDCDest, hbCopy);
685
687 hDCSrc, GetSystemMetrics(SM_CXSIZE), 0, SRCCOPY);
688
689 SelectObject(hDCSrc, hobjSrc);
690 DeleteObject(hbClose);
691 DeleteDC(hDCSrc);
692
693 hobjSrc = SelectObject( hDCDest, GetStockObject(BLACK_PEN) );
694
695 MoveToEx( hDCDest, GetSystemMetrics(SM_CXSIZE) - 1, 0, NULL );
697
698 SelectObject(hDCDest, hobjSrc );
699 SelectObject(hDCDest, hobjDest);
700 DeleteDC(hDCDest);
701
702 return hbCopy;
#define NULL
Definition: types.h:112
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Height *Stride) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Stride)
Definition: common.c:42
pKey DeleteObject()
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
#define SM_CYSIZE
Definition: winuser.h:1003
#define SM_CXSIZE
Definition: winuser.h:1002
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2532
int WINAPI GetSystemMetrics(_In_ int)
HGDIOBJ WINAPI GetStockObject(_In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define SRCCOPY
Definition: wingdi.h:333
#define BLACK_PEN
Definition: wingdi.h:903
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)

Referenced by MDIClientWndProc_common().

◆ CreateMDIWindowA()

HWND WINAPI CreateMDIWindowA ( LPCSTR  lpClassName,
LPCSTR  lpWindowName,
DWORD  dwStyle,
INT  X,
INT  Y,
INT  nWidth,
INT  nHeight,
HWND  hWndParent,
HINSTANCE  hInstance,
LPARAM  lParam 
)

Definition at line 1681 of file mdi.c.

1693{
1694 TRACE("(%s,%s,%08lx,%d,%d,%d,%d,%p,%p,%08Ix)\n",
1695 debugstr_a(lpClassName),debugstr_a(lpWindowName),dwStyle,X,Y,
1696 nWidth,nHeight,hWndParent,hInstance,lParam);
1697
1698 return CreateWindowExA(WS_EX_MDICHILD, lpClassName, lpWindowName,
1699 dwStyle, X, Y, nWidth, nHeight, hWndParent,
1700 0, hInstance, (LPVOID)lParam);
HINSTANCE hInstance
Definition: charmap.c:19
LPARAM lParam
Definition: combotst.c:139
#define Y(I)
#define debugstr_a
Definition: kernel32.h:31
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define WS_EX_MDICHILD
Definition: winuser.h:394

◆ CreateMDIWindowW()

HWND WINAPI CreateMDIWindowW ( LPCWSTR  lpClassName,
LPCWSTR  lpWindowName,
DWORD  dwStyle,
INT  X,
INT  Y,
INT  nWidth,
INT  nHeight,
HWND  hWndParent,
HINSTANCE  hInstance,
LPARAM  lParam 
)

Definition at line 1709 of file mdi.c.

1721{
1722 TRACE("(%s,%s,%08lx,%d,%d,%d,%d,%p,%p,%08Ix)\n",
1723 debugstr_w(lpClassName), debugstr_w(lpWindowName), dwStyle, X, Y,
1724 nWidth, nHeight, hWndParent, hInstance, lParam);
1725
1726 return CreateWindowExW(WS_EX_MDICHILD, lpClassName, lpWindowName,
1727 dwStyle, X, Y, nWidth, nHeight, hWndParent,
1728 0, hInstance, (LPVOID)lParam);
#define debugstr_w
Definition: kernel32.h:32
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)

◆ DefFrameProcA()

LRESULT WINAPI DefFrameProcA ( HWND  hwnd,
HWND  hwndMDIClient,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1350 of file mdi.c.

1353{
1354 if (hwndMDIClient)
1355 {
1356 switch (message)
1357 {
1358 case WM_SETTEXT:
1359 {
1361 LPWSTR text = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
1362 if (text == NULL)
1363 return 0;
1366 HeapFree( GetProcessHeap(), 0, text );
1367 }
1368 return 1; /* success. FIXME: check text length */
1369
1370 case WM_COMMAND:
1371 case WM_NCACTIVATE:
1372 case WM_NEXTMENU:
1373 case WM_SETFOCUS:
1374 case WM_SIZE:
1376 }
1377 }
HWND hwndMDIClient
Definition: mmc.c:26
WPARAM wParam
Definition: combotst.c:138
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define MultiByteToWideChar
Definition: compat.h:110
const WCHAR * text
Definition: package.c:1826
GLenum GLsizei len
Definition: glext.h:6722
short WCHAR
Definition: pedump.c:58
#define WM_NEXTMENU
Definition: winuser.h:1834
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SIZE
Definition: winuser.h:1639
#define WM_COMMAND
Definition: winuser.h:1768
#define WM_SETFOCUS
Definition: winuser.h:1641
#define WM_SETTEXT
Definition: winuser.h:1645
#define WM_NCACTIVATE
Definition: winuser.h:1716
Definition: tftpd.h:60
uint16_t * LPWSTR
Definition: typedefs.h:56
char * LPSTR
Definition: typedefs.h:51
static void MDI_UpdateFrameText(HWND, HWND, BOOL, LPCWSTR)
Definition: mdi.c:1016
LRESULT WINAPI DefFrameProcW(HWND hwnd, HWND hwndMDIClient, UINT message, WPARAM wParam, LPARAM lParam)
Definition: mdi.c:1384

◆ DefFrameProcW()

LRESULT WINAPI DefFrameProcW ( HWND  hwnd,
HWND  hwndMDIClient,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1384 of file mdi.c.

1387{
1389
1390 TRACE("%p %p %04x (%s) %08Ix %08Ix\n", hwnd, hwndMDIClient, message, SPY_GetMsgName(message, hwnd), wParam, lParam);
1391
1392 if (ci)
1393 {
1394 switch (message)
1395 {
1396 case WM_COMMAND:
1397 {
1398 WORD id = LOWORD(wParam);
1399 /* check for possible syscommands for maximized MDI child */
1400 if (id < ci->idFirstChild || id >= ci->idFirstChild + ci->nActiveChildren)
1401 {
1402 if( (id - 0xf000) & 0xf00f ) break;
1403 if( !ci->hwndChildMaximized ) break;
1404 switch( id )
1405 {
1406 case SC_CLOSE:
1407 if (!is_close_enabled(ci->hwndActiveChild, 0)) break;
1408 case SC_SIZE:
1409 case SC_MOVE:
1410 case SC_MINIMIZE:
1411 case SC_MAXIMIZE:
1412 case SC_NEXTWINDOW:
1413 case SC_PREVWINDOW:
1414 case SC_RESTORE:
1416 wParam, lParam);
1417 }
1418 }
1419 else
1420 {
1421 HWND childHwnd;
1422 if (id - ci->idFirstChild == MDI_MOREWINDOWSLIMIT)
1423 /* User chose "More Windows..." */
1425 else
1426 /* User chose one of the windows listed in the "Windows" menu */
1427 childHwnd = MDI_GetChildByID(hwndMDIClient, id, ci);
1428
1429 if( childHwnd )
1431 }
1432 }
1433 break;
1434
1435 case WM_NCACTIVATE:
1437 break;
1438
1439 case WM_SETTEXT:
1441 return 1; /* success. FIXME: check text length */
1442
1443 case WM_SETFOCUS:
1445 break;
1446
1447 case WM_SIZE:
1449 break;
1450
1451 case WM_NEXTMENU:
1452 {
1453 MDINEXTMENU *next_menu = (MDINEXTMENU *)lParam;
1454
1456 {
1457 /* control menu is between the frame system menu and
1458 * the first entry of menu bar */
1459 if ((wParam == VK_LEFT && GetMenu(hwnd) == next_menu->hmenuIn) ||
1460 (wParam == VK_RIGHT && NtUserGetWindowSysSubMenu( hwnd ) == next_menu->hmenuIn))
1461 {
1463 next_menu->hwndNext = ci->hwndActiveChild;
1464 }
1465 }
1466 return 0;
1467 }
1468 }
1469 }
1470
unsigned short WORD
Definition: ntddk_ex.h:93
HWND NTAPI NtUserSetFocus(HWND hWnd)
Definition: focus.c:1717
BOOL NTAPI NtUserMoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint)
Definition: winpos.c:3536
UINT_PTR WPARAM
Definition: minwindef.h:174
#define LOWORD(l)
Definition: pedump.c:82
#define WM_SYSCOMMAND
Definition: winuser.h:1769
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SC_PREVWINDOW
Definition: winuser.h:2627
#define WM_MDIACTIVATE
Definition: winuser.h:1842
BOOL WINAPI IsIconic(_In_ HWND)
#define SC_SIZE
Definition: winuser.h:2620
BOOL WINAPI IsZoomed(_In_ HWND)
#define SC_MINIMIZE
Definition: winuser.h:2622
#define SC_NEXTWINDOW
Definition: winuser.h:2626
#define SC_CLOSE
Definition: winuser.h:2628
#define SC_MOVE
Definition: winuser.h:2621
#define VK_LEFT
Definition: winuser.h:2260
#define VK_RIGHT
Definition: winuser.h:2262
#define SC_RESTORE
Definition: winuser.h:2634
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HMENU WINAPI GetMenu(_In_ HWND)
#define SC_MAXIMIZE
Definition: winuser.h:2624
HWND hwndChildMaximized
Definition: mdi.c:115
UINT idFirstChild
Definition: mdi.c:120
HWND hwndActiveChild
Definition: mdi.c:116
UINT nActiveChildren
Definition: mdi.c:114
HMENU hmenuNext
Definition: winuser.h:3744
HMENU hmenuIn
Definition: winuser.h:3743
#define HIWORD(l)
Definition: typedefs.h:247
const char * SPY_GetMsgName(UINT msg, HWND hWnd)
Definition: spy.c:2232
#define NtUserGetWindowSysSubMenu(HWND)
Definition: user_x.h:128
#define MDI_MOREWINDOWSLIMIT
Definition: mdi.c:93
static HWND MDI_GetChildByID(HWND hwnd, UINT id, MDICLIENTINFO *ci)
Definition: mdi.c:182
static MDICLIENTINFO * get_client_info(HWND client)
Definition: mdi.c:220
static HWND MDI_MoreWindowsDialog(HWND)
Definition: mdi.c:2504
static BOOL is_close_enabled(HWND hwnd, HMENU hSysMenu)
Definition: mdi.c:225

Referenced by DefFrameProcA().

◆ DefMDIChildProcA()

LRESULT WINAPI DefMDIChildProcA ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1476 of file mdi.c.

1479{
1482
1483 TRACE("%p %04x (%s) %08Ix %08Ix\n", hwnd, message, SPY_GetMsgName(message, hwnd), wParam, lParam);
1484
1486 if (!ci) return DefWindowProcA( hwnd, message, wParam, lParam );
1487
1488 switch (message)
1489 {
1490 case WM_SETTEXT:
1492 if( ci->hwndChildMaximized == hwnd )
1494 MDI_RefreshMenu( ci );
1495 return 1; /* success. FIXME: check text length */
1496
1497 case WM_GETMINMAXINFO:
1498 case WM_MENUCHAR:
1499 case WM_CLOSE:
1500 case WM_SETFOCUS:
1501 case WM_CHILDACTIVATE:
1502 case WM_SYSCOMMAND:
1503 case WM_SHOWWINDOW:
1504 case WM_SETVISIBLE:
1505 case WM_SIZE:
1506 case WM_NEXTMENU:
1507 case WM_SYSCHAR:
1508 case WM_DESTROY:
1510 }
#define WM_CLOSE
Definition: winuser.h:1649
#define WM_CHILDACTIVATE
Definition: winuser.h:1666
#define WM_SHOWWINDOW
Definition: winuser.h:1656
#define WM_SYSCHAR
Definition: winuser.h:1749
#define WM_GETMINMAXINFO
Definition: winuser.h:1668
#define WM_MENUCHAR
Definition: winuser.h:1776
HWND WINAPI GetParent(_In_ HWND)
#define WM_DESTROY
Definition: winuser.h:1637
static FILE * client
Definition: client.c:37
#define WM_SETVISIBLE
Definition: undocuser.h:33
#define WIN_GetFullHandle(h)
Definition: user_x.h:108
static LRESULT MDI_RefreshMenu(MDICLIENTINFO *)
Definition: mdi.c:392
LRESULT WINAPI DefMDIChildProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: mdi.c:1517

◆ DefMDIChildProcW()

LRESULT WINAPI DefMDIChildProcW ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1517 of file mdi.c.

1520{
1523
1524 TRACE("%p %04x (%s) %08Ix %08Ix\n", hwnd, message, SPY_GetMsgName(message, hwnd), wParam, lParam);
1525
1527 if (!ci) return DefWindowProcW( hwnd, message, wParam, lParam );
1528
1529 switch (message)
1530 {
1531 case WM_SETTEXT:
1533 if( ci->hwndChildMaximized == hwnd )
1535 MDI_RefreshMenu( ci );
1536 return 1; /* success. FIXME: check text length */
1537
1538 case WM_GETMINMAXINFO:
1540 return 0;
1541
1542 case WM_MENUCHAR:
1543 return MAKELRESULT( 0, MNC_CLOSE ); /* MDI children don't have menu bars */
1544
1545 case WM_CLOSE:
1547 return 0;
1548
1549 case WM_SETFOCUS:
1550 if (ci->hwndActiveChild != hwnd)
1552 break;
1553
1554 case WM_CHILDACTIVATE:
1555 if (IsWindowEnabled( hwnd ))
1557 return 0;
1558
1559 case WM_SYSCOMMAND:
1560 switch (wParam & 0xfff0)
1561 {
1562 case SC_MOVE:
1563 if( ci->hwndChildMaximized == hwnd )
1564 return 0;
1565 break;
1566 case SC_RESTORE:
1567 case SC_MINIMIZE:
1568 break;
1569 case SC_MAXIMIZE:
1570 if (ci->hwndChildMaximized == hwnd)
1572 break;
1573 case SC_NEXTWINDOW:
1575 return 0;
1576 case SC_PREVWINDOW:
1578 return 0;
1579 }
1580 break;
1581
1582 case WM_SHOWWINDOW:
1583 case WM_SETVISIBLE:
1585 /*if (ci->hwndChildMaximized) ci->mdiFlags &= ~MDIF_NEEDUPDATE;
1586 else*/ MDI_PostUpdate(client, ci, SB_BOTH+1);
1587 break;
1588
1589 case WM_SIZE:
1590 /* This is the only place where we switch to/from maximized state */
1591 /* do not change */
1592 TRACE("current active %p, maximized %p\n", ci->hwndActiveChild, ci->hwndChildMaximized);
1593
1594 if( ci->hwndChildMaximized == hwnd && wParam != SIZE_MAXIMIZED )
1595 {
1596 HWND frame;
1597
1598 ci->hwndChildMaximized = 0;
1599
1600 frame = GetParent(client);
1601 MDI_RestoreFrameMenu( frame, hwnd, ci->hBmpClose );
1602 MDI_UpdateFrameText( frame, client, TRUE, NULL );
1603 }
1604
1605 if( wParam == SIZE_MAXIMIZED )
1606 {
1607 HWND frame, hMaxChild = ci->hwndChildMaximized;
1608
1609 if( hMaxChild == hwnd ) break;
1610
1611 if( hMaxChild)
1612 {
1613 SendMessageW( hMaxChild, WM_SETREDRAW, FALSE, 0 );
1614
1615 MDI_RestoreFrameMenu( GetParent(client), hMaxChild, ci->hBmpClose );
1616 NtUserShowWindow( hMaxChild, SW_SHOWNOACTIVATE );
1617
1618 SendMessageW( hMaxChild, WM_SETREDRAW, TRUE, 0 );
1619 }
1620
1621 TRACE("maximizing child %p\n", hwnd );
1622
1623 /* keep track of the maximized window. */
1624 ci->hwndChildMaximized = hwnd; /* !!! */
1625
1626 frame = GetParent(client);
1627 MDI_AugmentFrameMenu( frame, hwnd );
1628 MDI_UpdateFrameText( frame, client, TRUE, NULL );
1629 }
1630
1631 if( wParam == SIZE_MINIMIZED )
1632 {
1633 HWND switchTo = MDI_GetWindow( ci, hwnd, TRUE, WS_MINIMIZE );
1634
1635 if (!switchTo) switchTo = hwnd;
1636 SendMessageW( switchTo, WM_CHILDACTIVATE, 0, 0 );
1637 }
1638
1640 break;
1641
1642 case WM_NEXTMENU:
1643 {
1644 MDINEXTMENU *next_menu = (MDINEXTMENU *)lParam;
1646
1647 if( wParam == VK_LEFT ) /* switch to frame system menu */
1648 {
1650 }
1651 if( wParam == VK_RIGHT ) /* to frame menu bar */
1652 {
1653 next_menu->hmenuNext = GetMenu(parent);
1654 }
1655 next_menu->hwndNext = parent;
1656 return 0;
1657 }
1658
1659 case WM_SYSCHAR:
1660 if (wParam == '-')
1661 {
1663 return 0;
1664 }
1665 break;
1666
1667 case WM_DESTROY:
1668 /* Remove itself from the Window menu */
1669 MDI_RefreshMenu(ci);
1670 break;
1671 }
r parent
Definition: btrfs.c:3010
BOOL NTAPI NtUserShowWindow(HWND hWnd, LONG nCmdShow)
Definition: winpos.c:3861
#define WS_MINIMIZE
Definition: pedump.c:622
#define SC_KEYMENU
Definition: winuser.h:2632
#define VK_SPACE
Definition: winuser.h:2255
#define SW_SHOWNOACTIVATE
Definition: winuser.h:785
#define WM_MDINEXT
Definition: winuser.h:1844
#define SIZE_MINIMIZED
Definition: winuser.h:2542
#define MAKELRESULT(l, h)
Definition: winuser.h:4118
#define SIZE_MAXIMIZED
Definition: winuser.h:2543
#define WM_MDIDESTROY
Definition: winuser.h:1841
#define MNC_CLOSE
Definition: winuser.h:2603
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define WM_SETREDRAW
Definition: winuser.h:1644
HBITMAP hBmpClose
Definition: mdi.c:125
static BOOL MDI_RestoreFrameMenu(HWND, HWND, HBITMAP)
Definition: mdi.c:951
static void MDI_PostUpdate(HWND hwnd, MDICLIENTINFO *ci, WORD recalc)
Definition: mdi.c:194
static LONG MDI_ChildActivate(HWND, HWND)
Definition: mdi.c:624
static BOOL MDI_AugmentFrameMenu(HWND, HWND)
Definition: mdi.c:854
static void MDI_ChildGetMinMaxInfo(HWND client, HWND hwnd, MINMAXINFO *lpMinMax)
Definition: mdi.c:495
static HWND MDI_GetWindow(MDICLIENTINFO *clientInfo, HWND hWnd, BOOL bNext, DWORD dwStyleMask)
Definition: mdi.c:244

Referenced by DefMDIChildProcA().

◆ get_client_info()

◆ is_close_enabled()

static BOOL is_close_enabled ( HWND  hwnd,
HMENU  hSysMenu 
)
static

Definition at line 225 of file mdi.c.

227{
229
230 if (!hSysMenu) hSysMenu = NtUserGetSystemMenu( hwnd, FALSE );
231 if (hSysMenu)
232 {
234 if (state == 0xFFFFFFFF || (state & (MF_DISABLED | MF_GRAYED)))
235 return FALSE;
236 }
237 return TRUE;
static int state
Definition: maze.c:121
unsigned int UINT
Definition: sysinfo.c:13
HMENU NTAPI NtUserGetSystemMenu(HWND hWnd, BOOL bRevert)
Definition: menu.c:5685
#define MF_BYCOMMAND
Definition: winuser.h:202
UINT WINAPI GetMenuState(_In_ HMENU, _In_ UINT, _In_ UINT)
#define GetClassLongPtrW
Definition: winuser.h:4718
#define CS_NOCLOSE
Definition: winuser.h:662
#define GCL_STYLE
Definition: winuser.h:678
#define MF_GRAYED
Definition: winuser.h:129
#define MF_DISABLED
Definition: winuser.h:130

Referenced by DefFrameProcW(), MDI_AugmentFrameMenu(), and TranslateMDISysAccel().

◆ MDI_AugmentFrameMenu()

static BOOL MDI_AugmentFrameMenu ( HWND  frame,
HWND  hChild 
)
static

Definition at line 854 of file mdi.c.

856{
857 HMENU menu = GetMenu( frame );
858 HMENU hSysPopup;
859 HBITMAP hSysMenuBitmap = 0;
860 HICON hIcon;
861 INT nItems;
862 UINT iId;
863
864 TRACE("frame %p,child %p\n",frame,hChild);
865
866 if( !menu ) return FALSE;
868 /* if the system buttons already exist do not add them again */
870 iId = GetMenuItemID(menu,nItems) ;
871 if (iId == SC_RESTORE || iId == SC_CLOSE)
872 {
873 ERR("system buttons already exist\n");
874 return FALSE;
875 }
877 /* create a copy of sysmenu popup and insert it into frame menu bar */
878 if (!(hSysPopup = NtUserGetSystemMenu( hChild, FALSE )))
879 {
880 TRACE("child %p doesn't have a system menu\n", hChild);
881 return FALSE;
882 }
883
885 SC_CLOSE, is_close_enabled(hChild, hSysPopup) ?
891
892 /* The system menu is replaced by the child icon */
893 hIcon = (HICON)SendMessageW(hChild, WM_GETICON, ICON_SMALL, 0);
894 if (!hIcon)
896 if (!hIcon)
897 hIcon = (HICON)SendMessageW(hChild, WM_GETICON, ICON_BIG, 0);
898 if (!hIcon)
900 if (!hIcon)
903 if (hIcon)
904 {
905 HDC hMemDC;
906 HBITMAP hBitmap, hOldBitmap;
908
909 if (hdc)
910 {
911 int cx, cy;
914 hMemDC = CreateCompatibleDC(hdc);
916 hOldBitmap = SelectObject(hMemDC, hBitmap);
917 SetMapMode(hMemDC, MM_TEXT);
918#ifdef __REACTOS__
919 NtUserDrawIconEx(hMemDC, 0, 0, hIcon, cx, cy, 0, GetSysColorBrush(COLOR_MENU), DI_NORMAL, 0, 0);
920#else
922#endif
923 SelectObject (hMemDC, hOldBitmap);
924 DeleteDC(hMemDC);
926 hSysMenuBitmap = hBitmap;
927 }
928 }
929
931 (UINT_PTR)hSysPopup, (LPSTR)hSysMenuBitmap))
932 {
933 TRACE("not inserted\n");
934 NtUserDestroyMenu( hSysPopup );
935 return FALSE;
936 }
937
942
943 /* redraw menu */
944 NtUserDrawMenuBar(frame);
945
946 return TRUE;
int nItems
Definition: appswitch.c:55
static HBITMAP hBitmap
Definition: timezone.c:26
BOOL NTAPI NtUserDrawIconEx(HDC hdc, int xLeft, int yTop, HICON hIcon, int cxWidth, int cyWidth, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags, BOOL bMetaHDC, PVOID pDIXData)
Definition: cursoricon.c:2086
BOOL NTAPI NtUserSetMenuDefaultItem(HMENU hMenu, UINT uItem, UINT fByPos)
Definition: menu.c:6492
UINT NTAPI NtUserEnableMenuItem(HMENU hMenu, UINT uIDEnableItem, UINT uEnable)
Definition: menu.c:5872
BOOL NTAPI NtUserDestroyMenu(HMENU hMenu)
Definition: menu.c:5842
HDC NTAPI NtUserGetDC(HWND hWnd)
Definition: windc.c:1014
HDC hdc
Definition: main.c:9
static HICON
Definition: imagelist.c:80
static HTREEITEM hChild
Definition: treeview.c:383
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define menu
Definition: input.c:3282
HICON hIcon
Definition: msconfig.c:44
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
#define GCLP_HICONSM
Definition: winuser.h:683
#define HBMMENU_MBAR_RESTORE
Definition: winuser.h:2674
#define COLOR_MENU
Definition: winuser.h:928
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
#define IMAGE_ICON
Definition: winuser.h:212
#define GCLP_HICON
Definition: winuser.h:682
#define HBMMENU_MBAR_MINIMIZE
Definition: winuser.h:2675
HBRUSH WINAPI GetSysColorBrush(_In_ int)
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2572
#define SM_CYSMICON
Definition: winuser.h:1024
UINT WINAPI GetMenuItemID(_In_ HMENU, _In_ int)
BOOL WINAPI InsertMenuA(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCSTR)
#define MF_POPUP
Definition: winuser.h:136
#define IDI_WINLOGO
Definition: winuser.h:717
#define SM_CXSMICON
Definition: winuser.h:1023
#define MF_BYPOSITION
Definition: winuser.h:203
#define MF_BITMAP
Definition: winuser.h:131
#define LR_SHARED
Definition: winuser.h:1111
#define HBMMENU_MBAR_CLOSE
Definition: winuser.h:2676
#define LR_DEFAULTCOLOR
Definition: winuser.h:1098
#define HBMMENU_MBAR_CLOSE_D
Definition: winuser.h:2677
#define MF_HELP
Definition: winuser.h:142
BOOL WINAPI AppendMenuW(_In_ HMENU, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
const uint16_t * LPCWSTR
Definition: typedefs.h:57
int32_t INT
Definition: typedefs.h:58
#define NtUserDrawMenuBar(HWND)
Definition: user_x.h:126
#define NtUserReleaseDC(HWND, HDC)
Definition: user_x.h:120
int WINAPI SetMapMode(_In_ HDC, _In_ int)
#define DI_NORMAL
Definition: wingdi.h:72
#define MM_TEXT
Definition: wingdi.h:873

Referenced by DefMDIChildProcW(), and MDISetMenu().

◆ MDI_CalcDefaultChildPos()

void MDI_CalcDefaultChildPos ( HWND  hwndClient,
INT  total,
LPPOINT  lpPos,
INT  delta,
UINT *  id 
)

Definition at line 285 of file mdi.c.

287{
288 INT nstagger;
289 RECT rect;
291
292 if (total < 0) /* we are called from CreateWindow */
293 {
294 MDICLIENTINFO *ci = get_client_info(hwndClient);
295 total = ci ? ci->nTotalCreated : 0; // Do not portsync wine
296 *id = ci ? ci->idFirstChild + ci->nActiveChildren : 0; // Do not portsync wine
297 TRACE("MDI child id %04x\n", *id);
298 }
299
300 GetClientRect( hwndClient, &rect );
301 if( rect.bottom - rect.top - delta >= spacing )
302 rect.bottom -= delta;
303
304 nstagger = (rect.bottom - rect.top)/(3 * spacing);
305 lpPos[1].x = (rect.right - rect.left - nstagger * spacing);
306 lpPos[1].y = (rect.bottom - rect.top - nstagger * spacing);
307 lpPos[0].x = lpPos[0].y = spacing * (total%(nstagger+1));
size_t total
#define SM_CYFRAME
Definition: winuser.h:1007
#define SM_CYCAPTION
Definition: winuser.h:974
UINT nTotalCreated
Definition: mdi.c:122
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48

Referenced by CreateWindowExA(), CreateWindowExW(), MDICascade(), and WIN_CreateWindowEx().

◆ MDI_ChildActivate()

static LONG MDI_ChildActivate ( HWND  client,
HWND  child 
)
static

Definition at line 624 of file mdi.c.

626{
627 MDICLIENTINFO *clientInfo;
628 HWND prevActiveWnd, frame;
629 BOOL isActiveFrameWnd;
630
631 clientInfo = get_client_info( client );
632
633 if (clientInfo->hwndActiveChild == child) return 0;
634
635 TRACE("%p\n", child);
636
637 frame = GetParent(client);
638 isActiveFrameWnd = (GetActiveWindow() == frame);
639 prevActiveWnd = clientInfo->hwndActiveChild;
640
641 /* deactivate prev. active child */
642 if(prevActiveWnd)
643 {
644 SendMessageW( prevActiveWnd, WM_NCACTIVATE, FALSE, 0L );
645 SendMessageW( prevActiveWnd, WM_MDIACTIVATE, (WPARAM)prevActiveWnd, (LPARAM)child);
646 }
647
648 MDI_SwitchActiveChild( clientInfo, child, FALSE );
649 clientInfo->hwndActiveChild = child;
650
651 MDI_RefreshMenu(clientInfo);
652
653 if( isActiveFrameWnd )
654 {
656 /* Let the client window manage focus for children, but if the focus
657 * is already on the client (for instance this is the 1st child) then
658 * SetFocus won't work. It appears that Windows sends WM_SETFOCUS
659 * manually in this case.
660 */
663 }
664
665 SendMessageW( child, WM_MDIACTIVATE, (WPARAM)prevActiveWnd, (LPARAM)child );
666 return TRUE;
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG_PTR LPARAM
Definition: minwindef.h:175
static HWND child
Definition: cursoricon.c:298
HWND WINAPI GetActiveWindow(void)
Definition: winpos.c:138
static void MDI_SwitchActiveChild(MDICLIENTINFO *ci, HWND hwndTo, BOOL activate)
Definition: mdi.c:518

Referenced by DefMDIChildProcW(), and MDIDestroyChild().

◆ MDI_ChildGetMinMaxInfo()

static void MDI_ChildGetMinMaxInfo ( HWND  client,
HWND  hwnd,
MINMAXINFO *  lpMinMax 
)
static

Definition at line 495 of file mdi.c.

497{
498 RECT rect;
499
503
504 lpMinMax->ptMaxSize.x = rect.right -= rect.left;
505 lpMinMax->ptMaxSize.y = rect.bottom -= rect.top;
506
507 lpMinMax->ptMaxPosition.x = rect.left;
508 lpMinMax->ptMaxPosition.y = rect.top;
509
510 TRACE("max rect %s\n", wine_dbgstr_rect(&rect));
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
#define GWL_EXSTYLE
Definition: winuser.h:862
long y
Definition: dcommon.idl:24
long x
Definition: dcommon.idl:24
POINT ptMaxPosition
Definition: winuser.h:3737
POINT ptMaxSize
Definition: winuser.h:3736

Referenced by DefMDIChildProcW().

◆ MDI_GetChildByID()

static HWND MDI_GetChildByID ( HWND  hwnd,
UINT  id,
MDICLIENTINFO *  ci 
)
static

Definition at line 182 of file mdi.c.

184{
185 int i;
186
187 for (i = 0; ci->nActiveChildren; i++)
188 {
189 if (GetWindowLongPtrW( ci->child[i], GWLP_ID ) == id)
190 return ci->child[i];
191 }
192 return 0;
#define GWLP_ID
Definition: winuser.h:871
HWND * child
Definition: mdi.c:117

Referenced by DefFrameProcW().

◆ MDI_GetWindow()

static HWND MDI_GetWindow ( MDICLIENTINFO *  clientInfo,
HWND  hWnd,
BOOL  bNext,
DWORD  dwStyleMask 
)
static

Definition at line 244 of file mdi.c.

247{
248 int i;
249 HWND *list;
250 HWND last = 0;
251
252 dwStyleMask |= WS_DISABLED | WS_VISIBLE;
253 if( !hWnd ) hWnd = clientInfo->hwndActiveChild;
254
255 if (!(list = WIN_ListChildren( GetParent(hWnd) ))) return 0;
256 i = 0;
257 /* start from next after hWnd */
258 while (list[i] && list[i] != hWnd) i++;
259 if (list[i]) i++;
260
261 for ( ; list[i]; i++)
262 {
263 if (GetWindow( list[i], GW_OWNER )) continue;
264 if ((GetWindowLongPtrW( list[i], GWL_STYLE ) & dwStyleMask) != WS_VISIBLE) continue;
265 last = list[i];
266 if (bNext) goto found;
267 }
268 /* now restart from the beginning */
269 for (i = 0; list[i] && list[i] != hWnd; i++)
270 {
271 if (GetWindow( list[i], GW_OWNER )) continue;
272 if ((GetWindowLongPtrW( list[i], GWL_STYLE ) & dwStyleMask) != WS_VISIBLE) continue;
273 last = list[i];
274 if (bNext) goto found;
275 }
276 found:
278 return last;
HWND hWnd
Definition: settings.c:17
static const LARGE_INTEGER *static const HANDLE const LARGE_INTEGER *static PSLIST_ENTRY PSLIST_ENTRY last
Definition: sync.c:64
#define WS_DISABLED
Definition: pedump.c:621
#define GW_OWNER
Definition: winuser.h:777
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)

Referenced by DefMDIChildProcW(), MDIClientWndProc_common(), and MDIDestroyChild().

◆ MDI_MoreWindowsDialog()

static HWND MDI_MoreWindowsDialog ( HWND  hwnd)
static

Definition at line 2504 of file mdi.c.

2506{
2507 LPCVOID template;
2508 HRSRC hRes;
2509 HANDLE hDlgTmpl;
2510
2511 hRes = FindResourceA(User32Instance, "MDI_MOREWINDOWS", (LPSTR)RT_DIALOG);
2512
2513 if (hRes == 0)
2514 return 0;
2515
2516 hDlgTmpl = LoadResource(User32Instance, hRes );
2517
2518 if (hDlgTmpl == 0)
2519 return 0;
2520
2521 template = LockResource( hDlgTmpl );
2522
2523 if (template == 0)
2524 return 0;
2525
2526 return (HWND) DialogBoxIndirectParamA(User32Instance, template, hwnd,
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
CONST void * LPCVOID
Definition: minwindef.h:164
#define RT_DIALOG
Definition: pedump.c:367
INT_PTR WINAPI DialogBoxIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
HINSTANCE User32Instance
Definition: dllmain.c:27
static INT_PTR WINAPI MDI_MoreWindowsDlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: mdi.c:2435

Referenced by DefFrameProcW().

◆ MDI_MoreWindowsDlgProc()

static INT_PTR WINAPI MDI_MoreWindowsDlgProc ( HWND  hDlg,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2435 of file mdi.c.

2437{
2438 switch (iMsg)
2439 {
2440 case WM_INITDIALOG:
2441 {
2442 UINT widest = 0;
2443 UINT length;
2444 UINT i;
2447
2448 for (i = 0; i < ci->nActiveChildren; i++)
2449 {
2451
2453 continue;
2456 length = lstrlenW(buffer); /* FIXME: should use GetTextExtentPoint */
2457 if (length > widest)
2458 widest = length;
2459 }
2460 /* Make sure the horizontal scrollbar scrolls ok */
2462
2463 /* Set the current selection */
2465 return TRUE;
2466 }
2467
2468 case WM_COMMAND:
2469 switch (LOWORD(wParam))
2470 {
2471 default:
2472 if (HIWORD(wParam) != LBN_DBLCLK) break;
2473 /* fall through */
2474 case IDOK:
2475 {
2476 /* windows are sorted by menu ID, so we must return the
2477 * window associated to the given id
2478 */
2482 EndDialog(hDlg, res);
2483 return TRUE;
2484 }
2485 case IDCANCEL:
2486 EndDialog(hDlg, 0);
2487 return TRUE;
2488 }
2489 break;
2490 }
2491 return FALSE;
#define ARRAY_SIZE(A)
Definition: main.h:20
#define lstrlenW
Definition: compat.h:750
HWND hListBox
Definition: enumfonts.cpp:27
GLuint buffer
Definition: glext.h:5915
GLuint res
Definition: glext.h:9613
GLuint index
Definition: glext.h:6031
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
INT NTAPI NtUserInternalGetWindowText(HWND hWnd, LPWSTR lpString, INT nMaxCount)
Definition: window.c:4592
LONG_PTR LRESULT
Definition: minwindef.h:176
#define LB_GETITEMDATA
Definition: winuser.h:2070
#define LB_SETHORIZONTALEXTENT
Definition: winuser.h:2100
#define IDCANCEL
Definition: winuser.h:842
#define LBN_DBLCLK
Definition: winuser.h:2107
#define WM_INITDIALOG
Definition: winuser.h:1767
#define LB_ADDSTRING
Definition: winuser.h:2060
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
#define LB_SETITEMDATA
Definition: winuser.h:2101
#define LB_SETCURSEL
Definition: winuser.h:2099
#define LB_GETCURSEL
Definition: winuser.h:2068
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define MDI_IDC_LISTBOX
Definition: mdi.c:94
#define MDI_MAXTITLELENGTH
Definition: mdi.c:88

Referenced by MDI_MoreWindowsDialog().

◆ MDI_PostUpdate()

static void MDI_PostUpdate ( HWND  hwnd,
MDICLIENTINFO *  ci,
WORD  recalc 
)
static

Definition at line 194 of file mdi.c.

196{
197 if( !(ci->mdiFlags & MDIF_NEEDUPDATE) )
198 {
201 }
202 ci->sbRecalc = recalc;
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT mdiFlags
Definition: mdi.c:123
UINT sbRecalc
Definition: mdi.c:124
#define MDIF_NEEDUPDATE
Definition: mdi.c:97
#define WM_MDICALCCHILDSCROLL
Definition: mdi.c:90

Referenced by DefMDIChildProcW(), MDIClientWndProc_common(), and MDIDestroyChild().

◆ MDI_RefreshMenu()

static LRESULT MDI_RefreshMenu ( MDICLIENTINFO *  ci)
static

Definition at line 392 of file mdi.c.

394{
395 UINT i, count, visible, id;
397
398 TRACE("children %u, window menu %p\n", ci->nActiveChildren, ci->hWindowMenu);
399
400 if (!ci->hWindowMenu)
401 return 0;
402
403 if (!IsMenu(ci->hWindowMenu))
404 {
405 WARN("Window menu handle %p is no longer valid\n", ci->hWindowMenu);
406 return 0;
407 }
408
409 /* Windows finds the last separator in the menu, and if after it
410 * there is a menu item with MDI magic ID removes all existing
411 * menu items after it, and then adds visible MDI children.
412 */
414 for (i = 0; i < count; i++)
415 {
416 MENUITEMINFOW mii;
417
418 memset(&mii, 0, sizeof(mii));
419 mii.cbSize = sizeof(mii);
420 mii.fMask = MIIM_TYPE;
421 if (GetMenuItemInfoW(ci->hWindowMenu, i, TRUE, &mii))
422 {
423 if (mii.fType & MF_SEPARATOR)
424 {
425 /* Windows checks only ID of the menu item */
426 memset(&mii, 0, sizeof(mii));
427 mii.cbSize = sizeof(mii);
428 mii.fMask = MIIM_ID;
429 if (GetMenuItemInfoW(ci->hWindowMenu, i + 1, TRUE, &mii))
430 {
431 if (mii.wID == ci->idFirstChild)
432 {
433 TRACE("removing %u items including separator\n", count - i);
435 /* nothing */;
436
437 break;
438 }
439 }
440 }
441 }
442 }
443
444 visible = 0;
445 for (i = 0; i < ci->nActiveChildren; i++)
446 {
448 {
449 id = ci->idFirstChild + visible;
450
451 if (visible == MDI_MOREWINDOWSLIMIT)
452 {
455 break;
456 }
457
458 if (!visible)
459 /* Visio expects that separator has id 0 */
461
462 visible++;
463
464 SetWindowLongPtrW(ci->child[i], GWLP_ID, id);
465
466 buf[0] = '&';
467 buf[1] = '0' + visible;
468 buf[2] = ' ';
470 TRACE("Adding %p, id %u %s\n", ci->child[i], id, debugstr_w(buf));
472
473 if (ci->child[i] == ci->hwndActiveChild)
474#ifdef __REACTOS__
476#else
478#endif
479 }
480 else
481 TRACE("MDI child %p is not visible, skipping\n", ci->child[i]);
482 }
483
484 return (LRESULT)ci->hFrameMenu;
#define WARN(fmt,...)
Definition: precomp.h:61
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint id
Definition: glext.h:5910
DWORD NTAPI NtUserCheckMenuItem(HMENU hmenu, UINT uIDCheckItem, UINT uCheck)
Definition: menu.c:5609
BOOL NTAPI NtUserRemoveMenu(HMENU hMenu, UINT uPosition, UINT uFlags)
Definition: menu.c:6398
#define MIIM_ID
Definition: winuser.h:733
#define MF_STRING
Definition: winuser.h:138
#define MF_CHECKED
Definition: winuser.h:132
BOOL WINAPI IsMenu(_In_ HMENU)
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MF_SEPARATOR
Definition: winuser.h:137
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define SetWindowLongPtrW
Definition: winuser.h:5512
#define MIIM_TYPE
Definition: winuser.h:736
#define LoadStringW
Definition: utils.h:64
#define memset(x, y, z)
Definition: compat.h:39
HMENU hWindowMenu
Definition: mdi.c:119
HMENU hFrameMenu
Definition: mdi.c:118
#define IDS_MDI_MOREWINDOWS
Definition: mdi.c:95

Referenced by DefMDIChildProcA(), DefMDIChildProcW(), MDI_ChildActivate(), MDIClientWndProc_common(), and MDISetMenu().

◆ MDI_RestoreFrameMenu()

static BOOL MDI_RestoreFrameMenu ( HWND  frame,
HWND  hChild,
HBITMAP  hBmpClose 
)
static

Definition at line 951 of file mdi.c.

953{
954 MENUITEMINFOW menuInfo;
955 HMENU menu = GetMenu( frame );
956 INT nItems;
957 UINT iId;
958
959 TRACE("frame %p,child %p\n",frame, hChild);
960
961 if (!menu) return FALSE;
962
963 /* if there is no system buttons then nothing to do */
965 iId = GetMenuItemID(menu, nItems);
966 if ( !(iId == SC_RESTORE || iId == SC_CLOSE) )
967 {
968 ERR("no system buttons then nothing to do\n");
969 return FALSE;
970 }
971
972 /*
973 * Remove the system menu, If that menu is the icon of the window
974 * as it is in win95, we have to delete the bitmap.
975 */
976 memset(&menuInfo, 0, sizeof(menuInfo));
977 menuInfo.cbSize = sizeof(menuInfo);
978 menuInfo.fMask = MIIM_DATA | MIIM_TYPE | MIIM_BITMAP;
979
981 0,
982 TRUE,
983 &menuInfo);
984
986
987 if ( (menuInfo.fType & MFT_BITMAP) &&
988 (menuInfo.dwTypeData != 0) &&
989 (menuInfo.dwTypeData != (LPWSTR)hBmpClose) )
990 {
991 DeleteObject(menuInfo.dwTypeData);
992 }
993
994 if ( menuInfo.hbmpItem != 0 )
995 DeleteObject(menuInfo.hbmpItem);
996
997 /* close */
999 /* restore */
1001 /* minimize */
1003
1004 NtUserDrawMenuBar(frame);
1005
1006 return TRUE;
BOOL NTAPI NtUserDeleteMenu(HMENU hMenu, UINT uPosition, UINT uFlags)
Definition: menu.c:5635
#define MIIM_BITMAP
Definition: winuser.h:739
#define MFT_BITMAP
Definition: winuser.h:749
#define MIIM_DATA
Definition: winuser.h:737
LPWSTR dwTypeData
Definition: winuser.h:3377

Referenced by DefMDIChildProcW(), MDIClientWndProc_common(), MDIDestroyChild(), and MDISetMenu().

◆ MDI_SwitchActiveChild()

static void MDI_SwitchActiveChild ( MDICLIENTINFO *  ci,
HWND  hwndTo,
BOOL  activate 
)
static

Definition at line 518 of file mdi.c.

520{
521 HWND hwndPrev;
522
523 hwndPrev = ci->hwndActiveChild;
524
525 TRACE("from %p, to %p\n", hwndPrev, hwndTo);
526
527 if ( hwndTo != hwndPrev )
528 {
529 BOOL was_zoomed = IsZoomed(hwndPrev);
530
531 if (was_zoomed && (GetWindowLongW( hwndTo, GWL_STYLE ) & WS_MAXIMIZEBOX))
532 {
533 /* restore old MDI child */
534 SendMessageW( hwndPrev, WM_SETREDRAW, FALSE, 0 );
535 NtUserShowWindow( hwndPrev, SW_RESTORE );
536 SendMessageW( hwndPrev, WM_SETREDRAW, TRUE, 0 );
537
538 /* activate new MDI child */
539 NtUserSetWindowPos( hwndTo, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
540 /* maximize new MDI child */
541 NtUserShowWindow( hwndTo, SW_MAXIMIZE );
542 }
543 /* activate new MDI child */
544 NtUserSetWindowPos( hwndTo, HWND_TOP, 0, 0, 0, 0,
545 SWP_NOMOVE | SWP_NOSIZE | (activate ? 0 : SWP_NOACTIVATE) );
546 }
BOOL NTAPI NtUserSetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
Definition: winpos.c:3573
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define SWP_NOACTIVATE
Definition: winuser.h:1253
#define SWP_NOMOVE
Definition: winuser.h:1255
#define SWP_NOSIZE
Definition: winuser.h:1256
#define HWND_TOP
Definition: winuser.h:1218
#define SW_RESTORE
Definition: winuser.h:790
#define SW_MAXIMIZE
Definition: winuser.h:783

Referenced by MDI_ChildActivate(), MDIClientWndProc_common(), and MDIDestroyChild().

◆ MDI_UpdateFrameText()

static void MDI_UpdateFrameText ( HWND  frame,
HWND  hClient,
BOOL  repaint,
LPCWSTR  lpTitle 
)
static

Definition at line 1016 of file mdi.c.

1018{
1020 MDICLIENTINFO *ci = get_client_info( hClient );
1021
1022 TRACE("frameText %s\n", debugstr_w(lpTitle));
1023
1024 if (!ci) return;
1025
1026 if (!lpTitle && !ci->frameTitle) /* first time around, get title from the frame window */
1027 {
1029 lpTitle = lpBuffer;
1030 }
1031
1032 /* store new "default" title if lpTitle is not NULL */
1033 if (lpTitle)
1034 {
1035 HeapFree( GetProcessHeap(), 0, ci->frameTitle );
1036 if ((ci->frameTitle = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(lpTitle)+1)*sizeof(WCHAR))))
1037 lstrcpyW( ci->frameTitle, lpTitle );
1038 }
1039
1040 if (ci->frameTitle)
1041 {
1042 if (ci->hwndChildMaximized)
1043 {
1044 /* combine frame title and child title if possible */
1045 int i_frame_text_length = lstrlenW(ci->frameTitle);
1046
1048
1049 if( i_frame_text_length + 6 < MDI_MAXTITLELENGTH )
1050 {
1051 lstrcatW( lpBuffer, L" - [" );
1052 if (GetWindowTextW( ci->hwndActiveChild, lpBuffer + i_frame_text_length + 4,
1053 MDI_MAXTITLELENGTH - i_frame_text_length - 5 ))
1054 lstrcatW( lpBuffer, L"]" );
1055 else
1056 lpBuffer[i_frame_text_length] = 0; /* remove bracket */
1057 }
1058 }
1059 else
1060 {
1062 }
1063 }
1064 else
1065 lpBuffer[0] = '\0';
1066
1068
1069 if (repaint)
1070 {
1072 NtUserSetWindowPos( frame, 0,0,0,0,0, SWP_FRAMECHANGED |
1074 }
TCHAR lpTitle[80]
Definition: ctm.c:69
#define DC_ACTIVE
Definition: dc21x4.h:120
#define lstrcpyW
Definition: compat.h:749
#define lstrcpynW
Definition: compat.h:738
DWORD_PTR NTAPI NtUserCallTwoParam(DWORD_PTR Param1, DWORD_PTR Param2, DWORD Routine)
Definition: simplecall.c:460
@ TWOPARAM_ROUTINE_REDRAWTITLE
Definition: ntuser.h:1663
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
_Out_ LPWSTR lpBuffer
Definition: netsh.h:68
#define SWP_FRAMECHANGED
Definition: winuser.h:1251
#define SWP_NOZORDER
Definition: winuser.h:1258
LPWSTR frameTitle
Definition: mdi.c:121
uint32_t DWORD_PTR
Definition: typedefs.h:65
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382

Referenced by DefFrameProcA(), DefFrameProcW(), DefMDIChildProcA(), DefMDIChildProcW(), and MDIDestroyChild().

◆ MDICascade()

static LONG MDICascade ( HWND  client,
MDICLIENTINFO *  ci 
)
static

Definition at line 707 of file mdi.c.

709{
710 HWND *win_array;
711 BOOL has_icons = FALSE;
712 int i, total;
713
714 if (ci->hwndChildMaximized)
716
717 if (ci->nActiveChildren == 0) return 0;
718
719 if (!(win_array = WIN_ListChildren( client ))) return 0;
720
721 /* remove all the windows we don't want */
722 for (i = total = 0; win_array[i]; i++)
723 {
724 if (!IsWindowVisible( win_array[i] )) continue;
725 if (GetWindow( win_array[i], GW_OWNER )) continue; /* skip owned windows */
726 if (IsIconic( win_array[i] ))
727 {
728 has_icons = TRUE;
729 continue;
730 }
731 win_array[total++] = win_array[i];
732 }
733 win_array[total] = 0;
734
735 if (total)
736 {
737 INT delta = 0, n = 0, i;
738 POINT pos[2];
740
741 /* walk the list (backwards) and move windows */
742 for (i = total - 1; i >= 0; i--)
743 {
744 LONG style;
746
748 TRACE("move %p to (%ld,%ld) size [%ld,%ld]\n",
749 win_array[i], pos[0].x, pos[0].y, pos[1].x, pos[1].y);
750 style = GetWindowLongW(win_array[i], GWL_STYLE);
751
752 if (!(style & WS_SIZEBOX)) posOptions |= SWP_NOSIZE;
753 NtUserSetWindowPos( win_array[i], 0, pos[0].x, pos[0].y, pos[1].x, pos[1].y, posOptions );
754 }
755 }
756 HeapFree( GetProcessHeap(), 0, win_array );
757
758 if (has_icons) NtUserArrangeIconicWindows( client );
759 return 0;
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble n
Definition: glext.h:7729
#define WS_SIZEBOX
Definition: pedump.c:642
long LONG
Definition: pedump.c:60
#define SWP_DRAWFRAME
Definition: winuser.h:1250
#define SM_CYICONSPACING
Definition: winuser.h:1013
#define SM_CYICON
Definition: winuser.h:984
BOOL WINAPI IsWindowVisible(_In_ HWND)
#define WM_MDIRESTORE
Definition: winuser.h:1843
#define NtUserArrangeIconicWindows(HWND)
Definition: user_x.h:125
void MDI_CalcDefaultChildPos(HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id)
Definition: mdi.c:285

Referenced by MDIClientWndProc_common().

◆ MDIClientWndProc_common()

LRESULT WINAPI MDIClientWndProc_common ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
BOOL  unicode 
)

Definition at line 1083 of file mdi.c.

1085{
1086 MDICLIENTINFO *ci = NULL;
1087
1088 TRACE("%p %04x (%s) %08Ix %08Ix\n", hwnd, message, SPY_GetMsgName(message, hwnd), wParam, lParam);
1089
1091
1092 if (!(ci = get_client_info( hwnd )))
1093 {
1094 if (message == WM_NCCREATE)
1095 {
1096 if (!(ci = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ci) ))) return 0;
1098 }
1099 return unicode ? DefWindowProcW( hwnd, message, wParam, lParam ) :
1101 }
1102
1103 switch (message)
1104 {
1105 case WM_CREATE:
1106 {
1107 /* Since we are using only cs->lpCreateParams, we can safely
1108 * cast to LPCREATESTRUCTA here */
1110 LPCLIENTCREATESTRUCT ccs = (LPCLIENTCREATESTRUCT)cs->lpCreateParams;
1111
1112 ci->hWindowMenu = ccs->hWindowMenu;
1113 ci->idFirstChild = ccs->idFirstChild;
1114 ci->hwndChildMaximized = 0;
1115 ci->child = NULL;
1116 ci->nActiveChildren = 0;
1117 ci->nTotalCreated = 0;
1118 ci->frameTitle = NULL;
1119 ci->mdiFlags = 0;
1120 ci->hFrameMenu = GetMenu(cs->hwndParent);
1121
1122 if (!ci->hBmpClose) ci->hBmpClose = CreateMDIMenuBitmap();
1123
1124 TRACE("Client created: hwnd %p, Window menu %p, idFirst = %04x\n",
1125 hwnd, ci->hWindowMenu, ci->idFirstChild );
1126 return 0;
1127 }
1128
1129 case WM_DESTROY:
1130 {
1131 if( ci->hwndChildMaximized )
1133
1134 ci->nActiveChildren = 0;
1135 MDI_RefreshMenu(ci);
1136
1137 HeapFree( GetProcessHeap(), 0, ci->child );
1138 HeapFree( GetProcessHeap(), 0, ci->frameTitle );
1139 HeapFree( GetProcessHeap(), 0, ci );
1140#ifdef __REACTOS__
1142#endif
1143 return 0;
1144 }
1145
1146#ifdef __REACTOS__
1147 case WM_NCDESTROY:
1148 {
1150 return 0;
1151 }
1152#endif
1153
1154 case WM_MDIACTIVATE:
1155 {
1156 if( ci->hwndActiveChild != (HWND)wParam )
1158 return 0;
1159 }
1160
1161 case WM_MDICASCADE:
1162 return MDICascade(hwnd, ci);
1163
1164 case WM_MDICREATE:
1165 if (lParam)
1166 {
1167 HWND child;
1168
1169 if (unicode)
1170 {
1173 csW->szTitle, csW->style,
1174 csW->x, csW->y, csW->cx, csW->cy,
1175 hwnd, 0, csW->hOwner,
1176 (LPVOID)csW->lParam);
1177 }
1178 else
1179 {
1182 csA->szTitle, csA->style,
1183 csA->x, csA->y, csA->cx, csA->cy,
1184 hwnd, 0, csA->hOwner,
1185 (LPVOID)csA->lParam);
1186 }
1187 return (LRESULT)child;
1188 }
1189 return 0;
1190
1191 case WM_MDIDESTROY:
1192 return MDIDestroyChild( hwnd, ci, (HWND)wParam, TRUE );
1193
1194 case WM_MDIGETACTIVE:
1195 if (lParam) *(BOOL *)lParam = IsZoomed(ci->hwndActiveChild);
1196 return (LRESULT)ci->hwndActiveChild;
1197
1198 case WM_MDIICONARRANGE:
1201 ci->sbRecalc = SB_BOTH+1;
1202#ifdef __REACTOS__
1204#else
1206#endif
1207 return 0;
1208
1209 case WM_MDIMAXIMIZE:
1211 return 0;
1212
1213 case WM_MDINEXT: /* lParam != 0 means previous window */
1214 {
1215 HWND hwnd = wParam ? WIN_GetFullHandle((HWND)wParam) : ci->hwndActiveChild;
1216 HWND next = MDI_GetWindow( ci, hwnd, !lParam, 0 );
1218 if (!lParam)
1220 break;
1221 }
1222
1223 case WM_MDIRESTORE:
1225 return 0;
1226
1227 case WM_MDISETMENU:
1228 return MDISetMenu( hwnd, (HMENU)wParam, (HMENU)lParam );
1229
1230 case WM_MDIREFRESHMENU:
1231 return MDI_RefreshMenu( ci );
1232
1233 case WM_MDITILE:
1236 MDITile( hwnd, ci, wParam );
1237 ci->mdiFlags &= ~MDIF_NEEDUPDATE;
1238 return 0;
1239
1240 case WM_VSCROLL:
1241 case WM_HSCROLL:
1244 ci->mdiFlags &= ~MDIF_NEEDUPDATE;
1245 return 0;
1246
1247 case WM_SETFOCUS:
1248 if (ci->hwndActiveChild && !IsIconic( ci->hwndActiveChild ))
1250 return 0;
1251
1252 case WM_NCACTIVATE:
1253 if( ci->hwndActiveChild )
1255 break;
1256
1257 case WM_PARENTNOTIFY:
1258 switch (LOWORD(wParam))
1259 {
1260 case WM_CREATE:
1262 {
1263 // ReactOS See rev 33503
1264 if (!ci->child)
1265 ci->child = HeapAlloc(GetProcessHeap(), 0, sizeof(HWND));
1266 else
1267 ci->child = HeapReAlloc(GetProcessHeap(), 0, ci->child, sizeof(HWND) * (ci->nActiveChildren + 1));
1268
1269 TRACE("Adding MDI child %p, # of children %d\n",
1271
1272 if (ci->child != NULL)
1273 {
1274 ci->child[ci->nActiveChildren] = (HWND)lParam;
1275 ci->nTotalCreated++;
1276 ci->nActiveChildren++;
1277 }
1278 }
1279 break;
1280
1281 case WM_LBUTTONDOWN:
1282 {
1283 HWND child;
1284 POINT pt;
1285 pt.x = (short)LOWORD(lParam);
1286 pt.y = (short)HIWORD(lParam);
1288
1289 TRACE("notification from %p (%li,%li)\n",child,pt.x,pt.y);
1290
1291 if (child && child != hwnd && child != ci->hwndActiveChild)
1293 break;
1294 }
1295
1296 case WM_DESTROY:
1298 }
1299 return 0;
1300
1301 case WM_SIZE:
1302 if( ci->hwndActiveChild && IsZoomed(ci->hwndActiveChild) )
1303 {
1304 RECT rect;
1305
1306 SetRect(&rect, 0, 0, LOWORD(lParam), HIWORD(lParam));
1310 rect.right - rect.left, rect.bottom - rect.top, 1 );
1311 }
1312 else
1313 MDI_PostUpdate(hwnd, ci, SB_BOTH+1);
1314
1315 break;
1316
1318 if( (ci->mdiFlags & MDIF_NEEDUPDATE) && ci->sbRecalc )
1319 {
1321 ci->sbRecalc = 0;
1322 ci->mdiFlags &= ~MDIF_NEEDUPDATE;
1323 }
1324 return 0;
1325 }
1326 return unicode ? DefWindowProcW( hwnd, message, wParam, lParam ) :
#define HeapReAlloc
Definition: compat.h:734
HANDLE HWND
Definition: compat.h:19
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define pt(x, y)
Definition: drawing.c:79
#define cs
Definition: i386-dis.c:442
#define FNID_DESTROY
Definition: ntuser.h:905
#define GWLP_MDIWND
Definition: ntuser.h:790
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4335
#define SW_SHOWNORMAL
Definition: winuser.h:781
HWND WINAPI ChildWindowFromPoint(_In_ HWND, _In_ POINT)
#define WM_MDITILE
Definition: winuser.h:1846
#define WM_MDISETMENU
Definition: winuser.h:1850
#define WM_HSCROLL
Definition: winuser.h:1771
#define WM_MDICREATE
Definition: winuser.h:1840
#define WM_VSCROLL
Definition: winuser.h:1772
#define WM_MDICASCADE
Definition: winuser.h:1847
#define WM_CREATE
Definition: winuser.h:1636
struct tagCREATESTRUCTA * LPCREATESTRUCTA
#define GetWindowLongPtrA
Definition: winuser.h:4982
#define WM_LBUTTONDOWN
Definition: winuser.h:1804
#define WM_NCCREATE
Definition: winuser.h:1711
#define WM_MDIREFRESHMENU
Definition: winuser.h:1854
#define WM_MDIICONARRANGE
Definition: winuser.h:1848
#define WM_MDIMAXIMIZE
Definition: winuser.h:1845
struct tagCLIENTCREATESTRUCT * LPCLIENTCREATESTRUCT
#define WM_NCDESTROY
Definition: winuser.h:1712
#define WM_MDIGETACTIVE
Definition: winuser.h:1849
#define WM_PARENTNOTIFY
Definition: winuser.h:1831
#define HWND_BOTTOM
Definition: winuser.h:1216
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
PSYMCRYPT_PARALLEL_HASH_OPERATION next
#define NtUserSetMDIClientInfo(HWND, INFO)
Definition: user_x.h:134
#define MAKE_FNID(index)
Definition: user_x.h:143
#define NTUSER_WNDPROC_MDICLIENT
Definition: user_x.h:141
static void MDITile(HWND client, MDICLIENTINFO *ci, WPARAM wParam)
Definition: mdi.c:764
void WINAPI CalcChildScroll(HWND hwnd, INT scroll)
Definition: mdi.c:1774
static LRESULT MDISetMenu(HWND hwnd, HMENU hmenuFrame, HMENU hmenuWindow)
Definition: mdi.c:312
static LRESULT MDIDestroyChild(HWND client, MDICLIENTINFO *ci, HWND child, BOOL flagDestroy)
Definition: mdi.c:552
static HBITMAP CreateMDIMenuBitmap(void)
Definition: mdi.c:673
static LONG MDICascade(HWND client, MDICLIENTINFO *ci)
Definition: mdi.c:707
void WINAPI ScrollChildren(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: mdi.c:1901

Referenced by MDIClientWndProcA(), MDIClientWndProcW(), and RegisterClientPFN().

◆ MDIClientWndProcA()

LRESULT WINAPI MDIClientWndProcA ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1332 of file mdi.c.

1334{
1335 if (!IsWindow(hwnd)) return 0;
BOOL WINAPI IsWindow(_In_opt_ HWND)
LRESULT WINAPI MDIClientWndProc_common(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: mdi.c:1083

Referenced by RegisterClientPFN().

◆ MDIClientWndProcW()

LRESULT WINAPI MDIClientWndProcW ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1341 of file mdi.c.

1343{
1344 if (!IsWindow(hwnd)) return 0;

Referenced by RegisterClientPFN().

◆ MDIDestroyChild()

static LRESULT MDIDestroyChild ( HWND  client,
MDICLIENTINFO *  ci,
HWND  child,
BOOL  flagDestroy 
)
static

Definition at line 552 of file mdi.c.

555{
556 UINT i;
557
558 TRACE("# of managed children %u\n", ci->nActiveChildren);
559
560 if( child == ci->hwndActiveChild )
561 {
562 HWND next = MDI_GetWindow(ci, child, TRUE, 0);
563 if (next)
565 else
566 {
568 if (child == ci->hwndChildMaximized)
569 {
570 HWND frame = GetParent(client);
572 ci->hwndChildMaximized = 0;
574 }
575 if (flagDestroy)
577 }
578 }
579
580 for (i = 0; i < ci->nActiveChildren; i++)
581 {
582 if (ci->child[i] == child)
583 {
584 HWND *new_child = HeapAlloc(GetProcessHeap(), 0, (ci->nActiveChildren - 1) * sizeof(HWND));
585 if (new_child != NULL)
586 {
587 memcpy(new_child, ci->child, i * sizeof(HWND));
588 if (i + 1 < ci->nActiveChildren)
589 memcpy(new_child + i, ci->child + i + 1, (ci->nActiveChildren - i - 1) * sizeof(HWND));
590 HeapFree(GetProcessHeap(), 0, ci->child);
591 ci->child = new_child;
592 }
593 else
594 {
595 UINT c;
596 for (c = i; c < ci->nActiveChildren - 1; c++)
597 {
598 ci->child[c] = ci->child[c+1];
599 }
600 }
601
602 ci->nActiveChildren--;
603 break;
604 }
605 }
606
607 if (flagDestroy)
608 {
612 }
613
614 TRACE("child destroyed - %p\n", child);
615 return 0;
const GLubyte * c
Definition: glext.h:8905
BOOLEAN NTAPI NtUserDestroyWindow(HWND Wnd)
Definition: window.c:3041
#define c
Definition: ke_i.h:80
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define SW_HIDE
Definition: winuser.h:779

Referenced by MDIClientWndProc_common().

◆ MDISetMenu()

static LRESULT MDISetMenu ( HWND  hwnd,
HMENU  hmenuFrame,
HMENU  hmenuWindow 
)
static

Definition at line 312 of file mdi.c.

315{
316 MDICLIENTINFO *ci;
317 HWND hwndFrame = GetParent(hwnd);
318
319 TRACE("%p, frame menu %p, window menu %p\n", hwnd, hmenuFrame, hmenuWindow);
320
321 if (hmenuFrame && !IsMenu(hmenuFrame))
322 {
323 WARN("hmenuFrame is not a menu handle\n");
324 return 0L;
325 }
326
327 if (hmenuWindow && !IsMenu(hmenuWindow))
328 {
329 WARN("hmenuWindow is not a menu handle\n");
330 return 0L;
331 }
332
333 if (!(ci = get_client_info( hwnd ))) return 0;
334
335 TRACE("old frame menu %p, old window menu %p\n", ci->hFrameMenu, ci->hWindowMenu);
336
337 if (hmenuFrame)
338 {
339 if (hmenuFrame == ci->hFrameMenu) return (LRESULT)hmenuFrame;
340
341 if (ci->hwndChildMaximized)
343 }
344
345 if( hmenuWindow && hmenuWindow != ci->hWindowMenu )
346 {
347 /* delete menu items from ci->hWindowMenu
348 * and add them to hmenuWindow */
349 /* Agent newsreader calls this function with ci->hWindowMenu == NULL */
350 if( ci->hWindowMenu && ci->nActiveChildren )
351 {
352 UINT nActiveChildren_old = ci->nActiveChildren;
353
354 /* Remove all items from old Window menu */
355 ci->nActiveChildren = 0;
356 MDI_RefreshMenu(ci);
357
358 ci->hWindowMenu = hmenuWindow;
359
360 ci->nActiveChildren = nActiveChildren_old;
361 }
362 else
363 ci->hWindowMenu = hmenuWindow;
364
365 MDI_RefreshMenu(ci);
366 }
367
368 if (hmenuFrame)
369 {
370#ifdef __REACTOS__
371 NtUserSetMenu(hwndFrame, hmenuFrame, TRUE);
372#else
373 NtUserSetMenu(hwndFrame, hmenuFrame);
374#endif
375 if( hmenuFrame != ci->hFrameMenu )
376 {
377 HMENU oldFrameMenu = ci->hFrameMenu;
378
379 ci->hFrameMenu = hmenuFrame;
380 if (ci->hwndChildMaximized)
382
383 return (LRESULT)oldFrameMenu;
384 }
385 }
386
387 return 0;
BOOL NTAPI NtUserSetMenu(HWND hWnd, HMENU hMenu, BOOL bRepaint)
Definition: menu.c:6424

Referenced by MDIClientWndProc_common().

◆ MDITile()

static void MDITile ( HWND  client,
MDICLIENTINFO *  ci,
WPARAM  wParam 
)
static

Definition at line 764 of file mdi.c.

766{
767 HWND *win_array;
768 int i, total, rows, columns;
769 BOOL has_icons = FALSE;
770
771 if (ci->hwndChildMaximized)
773
774 if (ci->nActiveChildren == 0) return;
775
776 if (!(win_array = WIN_ListChildren( client ))) return;
777
778 /* remove all the windows we don't want */
779 for (i = total = rows = 0; win_array[i]; i++)
780 {
781 if (!IsWindowVisible( win_array[i] )) continue;
782 if (GetWindow( win_array[i], GW_OWNER )) continue; /* skip owned windows (icon titles) */
783 if (IsIconic( win_array[i] ))
784 {
785 has_icons = TRUE;
786 continue;
787 }
788 if ((wParam & MDITILE_SKIPDISABLED) && !IsWindowEnabled( win_array[i] )) continue;
789 if(total == (rows * (rows + 2))) rows++; /* total+1 == (rows+1)*(rows+1) */
790 win_array[total++] = win_array[i];
791 }
792 win_array[total] = 0;
793
794 TRACE("%u windows to tile\n", total);
795
796 if (total)
797 {
798 HWND *pWnd = win_array;
799 RECT rect;
800 int x, y, xsize, ysize;
801 int r, c, i;
802
804 columns = total/rows;
805 //while(total < rows*columns) rows++;
806
807 if( wParam & MDITILE_HORIZONTAL ) /* version >= 3.1 */
808 {
809 i = rows;
810 rows = columns; /* exchange r and c */
811 columns = i;
812 }
813
814 if (has_icons)
815 {
818 }
819
820 ysize = rect.bottom / rows;
821 xsize = rect.right / columns;
822
823 for (x = i = 0, c = 1; c <= columns && *pWnd; c++)
824 {
825 if (c == columns)
826 {
827 rows = total - i;
828 ysize = rect.bottom / rows;
829 }
830
831 y = 0;
832 for (r = 1; r <= rows && *pWnd; r++, i++)
833 {
835 LONG style = GetWindowLongW(win_array[i], GWL_STYLE);
836 if (!(style & WS_SIZEBOX)) posOptions |= SWP_NOSIZE;
837
838 NtUserSetWindowPos( *pWnd, 0, x, y, xsize, ysize, posOptions );
839 y += ysize;
840 pWnd++;
841 }
842 x += xsize;
843 }
844 }
845 HeapFree( GetProcessHeap(), 0, win_array );
846 if (has_icons) NtUserArrangeIconicWindows( client );
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define MDITILE_SKIPDISABLED
Definition: winuser.h:2223
#define MDITILE_HORIZONTAL
Definition: winuser.h:2224

Referenced by MDIClientWndProc_common().

◆ ScrollChildren()

void WINAPI ScrollChildren ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1901 of file mdi.c.

1904{
1905#ifndef __REACTOS__ /* not implemented */
1907#endif
1908 INT newPos = -1;
1909 INT curPos, length, minPos, maxPos, shift;
1910 RECT rect;
1911
1912#ifndef __REACTOS__ /* not implemented */
1913 context = SetThreadDpiAwarenessContext( GetWindowDpiAwarenessContext( hWnd ));
1914#endif
1915 GetClientRect( hWnd, &rect );
1916
1917 switch(uMsg)
1918 {
1919 case WM_HSCROLL:
1920 GetScrollRange(hWnd,SB_HORZ,&minPos,&maxPos);
1921 curPos = GetScrollPos(hWnd,SB_HORZ);
1922 length = (rect.right - rect.left) / 2;
1924 break;
1925 case WM_VSCROLL:
1926 GetScrollRange(hWnd,SB_VERT,&minPos,&maxPos);
1927 curPos = GetScrollPos(hWnd,SB_VERT);
1928 length = (rect.bottom - rect.top) / 2;
1930 break;
1931 default:
1932 goto done;
1933 }
1934
1935 switch( wParam )
1936 {
1937 case SB_LINEUP:
1938 newPos = curPos - shift;
1939 break;
1940 case SB_LINEDOWN:
1941 newPos = curPos + shift;
1942 break;
1943 case SB_PAGEUP:
1944 newPos = curPos - length;
1945 break;
1946 case SB_PAGEDOWN:
1947 newPos = curPos + length;
1948 break;
1949
1950 case SB_THUMBPOSITION:
1951 newPos = LOWORD(lParam);
1952 break;
1953
1954 case SB_THUMBTRACK:
1955 goto done;
1956
1957 case SB_TOP:
1958 newPos = minPos;
1959 break;
1960 case SB_BOTTOM:
1961 newPos = maxPos;
1962 break;
1963 case SB_ENDSCROLL:
1965 goto done;
1966 }
1967
1968 if( newPos > maxPos )
1969 newPos = maxPos;
1970 else
1971 if( newPos < minPos )
1972 newPos = minPos;
1973
1974 SetScrollPos(hWnd, (uMsg == WM_VSCROLL)?SB_VERT:SB_HORZ , newPos, TRUE);
1975
1976 if( uMsg == WM_VSCROLL )
1977 NtUserScrollWindowEx( hWnd ,0 ,curPos - newPos, NULL, NULL, 0, NULL,
1979 else
1980 NtUserScrollWindowEx( hWnd ,curPos - newPos, 0, NULL, NULL, 0, NULL,
1982done:
1983#ifndef __REACTOS__ /* not implemented */
1984 SetThreadDpiAwarenessContext( context );
1985#else
1986 return;
1987#endif
DWORD NTAPI NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *rect, const RECT *clipRect, HRGN hrgnUpdate, LPRECT rcUpdate, UINT flags)
Definition: scrollex.c:571
#define shift
Definition: input.c:3280
#define SB_THUMBTRACK
Definition: winuser.h:573
#define SB_LINEUP
Definition: winuser.h:564
#define SW_SCROLLCHILDREN
Definition: winuser.h:2614
#define SM_CXVSCROLL
Definition: winuser.h:972
#define SB_BOTTOM
Definition: winuser.h:577
#define SW_INVALIDATE
Definition: winuser.h:2615
int WINAPI SetScrollPos(_In_ HWND, _In_ int, _In_ int, _In_ BOOL)
#define SM_CYHSCROLL
Definition: winuser.h:973
BOOL WINAPI GetScrollRange(_In_ HWND, _In_ int, _Out_ LPINT, _Out_ LPINT)
#define SB_PAGEDOWN
Definition: winuser.h:569
#define SB_LINEDOWN
Definition: winuser.h:565
#define SB_TOP
Definition: winuser.h:578
#define SW_ERASE
Definition: winuser.h:2616
#define SB_ENDSCROLL
Definition: winuser.h:574
int WINAPI GetScrollPos(_In_ HWND, _In_ int)
#define SB_PAGEUP
Definition: winuser.h:568
#define SB_THUMBPOSITION
Definition: winuser.h:572

Referenced by MDIClientWndProc_common().

◆ TranslateMDISysAccel()

BOOL WINAPI TranslateMDISysAccel ( HWND  hwndClient,
LPMSG  msg 
)

Definition at line 1733 of file mdi.c.

1735{
1736 if (msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN)
1737 {
1738 MDICLIENTINFO *ci = get_client_info( hwndClient );
1739 WPARAM wParam = 0;
1740
1741 if (!ci || !IsWindowEnabled(ci->hwndActiveChild)) return 0;
1742
1743 /* translate if the Ctrl key is down and Alt not. */
1744
1745 if( (NtUserGetKeyState(VK_CONTROL) & 0x8000) && !(NtUserGetKeyState(VK_MENU) & 0x8000))
1746 {
1747 switch( msg->wParam )
1748 {
1749 case VK_F6:
1750 case VK_TAB:
1752 break;
1753 case VK_F4:
1754 case VK_RBUTTON:
1756 {
1757 wParam = SC_CLOSE;
1758 break;
1759 }
1760 /* fall through */
1761 default:
1762 return FALSE;
1763 }
1764 TRACE("wParam = %04Ix\n", wParam);
1766 return TRUE;
1767 }
1768 }
1769 return FALSE; /* failure */
#define msg(x)
Definition: auth_time.c:54
SHORT NTAPI NtUserGetKeyState(INT VirtKey)
Definition: msgqueue.c:2573
#define VK_TAB
Definition: winuser.h:2235
#define VK_RBUTTON
Definition: winuser.h:2227
#define VK_CONTROL
Definition: winuser.h:2239
#define VK_F6
Definition: winuser.h:2296
#define VK_F4
Definition: winuser.h:2294
#define VK_SHIFT
Definition: winuser.h:2238
#define WM_KEYDOWN
Definition: winuser.h:1743
#define WM_SYSKEYDOWN
Definition: winuser.h:1747
#define VK_MENU
Definition: winuser.h:2240

◆ WIN_ListChildren()

HWND * WIN_ListChildren ( HWND  hWndparent)

Definition at line 139 of file mdi.c.

141{
142
143 DWORD dwCount = 0;
144 HWND* pHwnd = NULL;
145 HANDLE hHeap;
147
148 Status = NtUserBuildHwndList(NULL, hWndparent, FALSE, 0, dwCount, NULL, &dwCount);
149
150 if ( !NT_SUCCESS( Status ) )
151 return 0;
152
153 /* allocate buffer to receive HWND handles */
154 hHeap = GetProcessHeap();
155
156 pHwnd = HeapAlloc ( hHeap, 0, sizeof(HWND)*(dwCount+1) );
157 if ( !pHwnd )
158 {
160 return 0;
161 }
162
163 /* now call kernel again to fill the buffer this time */
164 Status = NtUserBuildHwndList(NULL, hWndparent, FALSE, 0, dwCount, pHwnd, &dwCount);
165
166 if ( !NT_SUCCESS( Status ) )
167 {
168 if ( pHwnd )
169 HeapFree ( hHeap, 0, pHwnd );
170 return 0;
171 }
172
173 pHwnd[dwCount] = (HWND) 0;
174
175 return pHwnd;
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define SetLastError(x)
Definition: compat.h:752
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtUserBuildHwndList(HDESK hDesktop, HWND hwndParent, BOOLEAN bChildren, ULONG dwThreadId, ULONG cHwnd, HWND *phwndList, ULONG *pcHwndNeeded)
Definition: window.c:1515

Referenced by CalcChildScroll(), MDI_GetWindow(), MDICascade(), and MDITile().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( mdi  )