This implements GetTitleBarInfo Index: dlls/user/user32.spec =================================================================== RCS file: /home/wine/wine/dlls/user/user32.spec,v retrieving revision 1.81 diff -u -r1.81 user32.spec --- dlls/user/user32.spec 26 Nov 2003 04:09:00 -0000 1.81 +++ dlls/user/user32.spec 3 Dec 2003 02:06:12 -0000 @@ -304,7 +304,7 @@ @ stdcall GetTabbedTextExtentA(long str long long ptr) @ stdcall GetTabbedTextExtentW(long wstr long long ptr) @ stdcall GetThreadDesktop(long) -# @ stub GetTitleBarInfo +@ stdcall GetTitleBarInfo(long ptr) @ stdcall GetTopWindow(long) @ stdcall GetUpdateRect(long ptr long) @ stdcall GetUpdateRgn(long long long) Index: include/winuser.h =================================================================== RCS file: /home/wine/wine/include/winuser.h,v retrieving revision 1.175 diff -u -r1.175 winuser.h --- include/winuser.h 26 Nov 2003 05:22:42 -0000 1.175 +++ include/winuser.h 3 Dec 2003 02:06:14 -0000 @@ -3543,6 +3543,16 @@ WORD wCreatorVersion; } WINDOWINFO, *PWINDOWINFO, *LPWINDOWINFO; +/* used for GetTitleBarInfo() */ + +#define CCHILDREN_TITLEBAR 5 + +typedef struct tagTITLEBARINFO { + DWORD cbSize; + RECT rcTitleBar; + DWORD rgstate[CCHILDREN_TITLEBAR+1]; +} TITLEBARINFO, *PTITLEBARINFO, *LPTITLEBARINFO; + /* SetWinEventHook() flags */ #define WINEVENT_OUTOFCONTEXT 0x0 #define WINEVENT_SKIPOWNTHREAD 0x1 @@ -3662,6 +3672,39 @@ #define ALERT_SYSTEM_CRITICAL 5 #define CALERT_SYSTEM 6 +/* System state flags */ +#define STATE_SYSTEM_UNAVAILABLE 0x00000001 +#define STATE_SYSTEM_SELECTED 0x00000002 +#define STATE_SYSTEM_FOCUSED 0x00000004 +#define STATE_SYSTEM_PRESSED 0x00000008 +#define STATE_SYSTEM_CHECKED 0x00000010 +#define STATE_SYSTEM_MIXED 0x00000020 +#define STATE_SYSTEM_INDETERMINATE STATE_SYSTEM_MIXED +#define STATE_SYSTEM_READONLY 0x00000040 +#define STATE_SYSTEM_HOTTRACKED 0x00000080 +#define STATE_SYSTEM_DEFAULT 0x00000100 +#define STATE_SYSTEM_EXPANDED 0x00000200 +#define STATE_SYSTEM_COLLAPSED 0x00000400 +#define STATE_SYSTEM_BUSY 0x00000800 +#define STATE_SYSTEM_FLOATING 0x00001000 +#define STATE_SYSTEM_MARQUEED 0x00002000 +#define STATE_SYSTEM_ANIMATED 0x00004000 +#define STATE_SYSTEM_INVISIBLE 0x00008000 +#define STATE_SYSTEM_OFFSCREEN 0x00010000 +#define STATE_SYSTEM_SIZEABLE 0x00020000 +#define STATE_SYSTEM_MOVEABLE 0x00040000 +#define STATE_SYSTEM_SELFVOICING 0x00080000 +#define STATE_SYSTEM_FOCUSABLE 0x00100000 +#define STATE_SYSTEM_SELECTABLE 0x00200000 +#define STATE_SYSTEM_LINKED 0x00400000 +#define STATE_SYSTEM_TRAVERSED 0x00800000 +#define STATE_SYSTEM_MULTISELECTABLE 0x01000000 +#define STATE_SYSTEM_EXTSELECTABLE 0x02000000 +#define STATE_SYSTEM_ALERT_LOW 0x04000000 +#define STATE_SYSTEM_ALERT_MEDIUM 0x08000000 +#define STATE_SYSTEM_ALERT_HIGH 0x10000000 +#define STATE_SYSTEM_PROTECTED 0x20000000 +#define STATE_SYSTEM_VALID 0x3FFFFFFF #define EnumTaskWindows(handle,proc,lparam) \ EnumThreadWindows(handle,proc,lparam) @@ -4124,6 +4167,7 @@ DWORD WINAPI GetTabbedTextExtentA(HDC,LPCSTR,INT,INT,const INT*); DWORD WINAPI GetTabbedTextExtentW(HDC,LPCWSTR,INT,INT,const INT*); #define GetTabbedTextExtent WINELIB_NAME_AW(GetTabbedTextExtent) +BOOL WINAPI GetTitleBarInfo(HWND,PTITLEBARINFO); HWND WINAPI GetTopWindow(HWND); BOOL WINAPI GetUpdateRect(HWND,LPRECT,BOOL); INT WINAPI GetUpdateRgn(HWND,HRGN,BOOL); Index: windows/nonclient.c =================================================================== RCS file: /home/wine/wine/windows/nonclient.c,v retrieving revision 1.114 diff -u -r1.114 nonclient.c --- windows/nonclient.c 26 Nov 2003 05:08:48 -0000 1.114 +++ windows/nonclient.c 3 Dec 2003 02:06:15 -0000 @@ -2259,3 +2259,72 @@ return TRUE; } + +/*********************************************************************** + * GetTitleBarInfo (USER32.@) + * TODO: Handle STATE_SYSTEM_PRESSED + */ +BOOL WINAPI GetTitleBarInfo(HWND hwnd, PTITLEBARINFO tbi) { + DWORD dwStyle; + DWORD dwExStyle; + RECT wndRect; + + TRACE("(%p %p)\n", hwnd, tbi); + + if(tbi->cbSize != sizeof(TITLEBARINFO)) { + TRACE("Invalid TITLEBARINFO size: %d\n", tbi->cbSize); + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + dwStyle = GetWindowLongW(hwnd, GWL_STYLE); + dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE); + NC_GetInsideRect(hwnd, &tbi->rcTitleBar); + + GetWindowRect(hwnd, &wndRect); + + tbi->rcTitleBar.top += wndRect.top; + tbi->rcTitleBar.left += wndRect.left; + tbi->rcTitleBar.right += wndRect.left; + + tbi->rcTitleBar.bottom = tbi->rcTitleBar.top; + if(dwExStyle & WS_EX_TOOLWINDOW) + tbi->rcTitleBar.bottom += GetSystemMetrics(SM_CYSMCAPTION); + else { + tbi->rcTitleBar.bottom += GetSystemMetrics(SM_CYCAPTION); + tbi->rcTitleBar.left += GetSystemMetrics(SM_CXSIZE); + } + + ZeroMemory(&tbi->rgstate, sizeof(tbi->rgstate)); + /* Does the title bar always have STATE_SYSTEM_FOCUSABLE? + * Under XP it seems to + */ + tbi->rgstate[0] = STATE_SYSTEM_FOCUSABLE; + if(dwStyle & WS_CAPTION) { + tbi->rgstate[1] = STATE_SYSTEM_INVISIBLE; + if(dwStyle & WS_SYSMENU) { + if(!(dwStyle & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX))) { + tbi->rgstate[2] = STATE_SYSTEM_INVISIBLE; + tbi->rgstate[3] = STATE_SYSTEM_INVISIBLE; + } + else { + if(!(dwStyle & WS_MINIMIZEBOX)) + tbi->rgstate[2] = STATE_SYSTEM_UNAVAILABLE; + if(!(dwStyle & WS_MAXIMIZEBOX)) + tbi->rgstate[3] = STATE_SYSTEM_UNAVAILABLE; + } + if(!(dwExStyle & WS_EX_CONTEXTHELP)) + tbi->rgstate[4] = STATE_SYSTEM_INVISIBLE; + if(GetClassLongW(hwnd, GCL_STYLE) & CS_NOCLOSE) + tbi->rgstate[5] = STATE_SYSTEM_UNAVAILABLE; + } + else { + tbi->rgstate[2] = STATE_SYSTEM_INVISIBLE; + tbi->rgstate[3] = STATE_SYSTEM_INVISIBLE; + tbi->rgstate[4] = STATE_SYSTEM_INVISIBLE; + tbi->rgstate[5] = STATE_SYSTEM_INVISIBLE; + } + } + else + tbi->rgstate[0] |= STATE_SYSTEM_INVISIBLE; + return TRUE; +}