mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
54c2711ff6
Sun Mar 29 15:18:57 1998 Uwe Bonnes <elektron.ikp.physik.tu-darmstadt.de> * [msdos/int21.c] More verbose Trace messages Sun Mar 29 15:03:30 1998 Alexandre Julliard <julliard@lrc.epfl.ch> * [loader/ne_image.c] Terminate relocation chains on 0 offset. Sun Mar 29 02:35:45 1998 James Juran <jrj120@psu.edu> * [windows/caret.c] [windows/class.c] [windows/clipboard.c] Fixed more USER32 ordinal numbers in function documentation. Sat Mar 28 22:40:23 1997 Andreas Mohr <100.30936@germany.net> * [controls/desktop.c] Return 1 for WM_NCCREATE in DesktopWndProc. * [controls/menu.c] Fixed crash when destroying a top popup win that was only created but not shown. * [ole/typelib.c] [if1632/typelib.spec] Implemented OABuildVersion. * [windows/win.c] Finally fixed ugly bug in GetParent32 that affected window placement: Didn't return 0 for windows that have neither WS_POPUP nor WS_CHILD set. Now it acts exactly like Windows (at least I hope so ;) Sat Mar 28 02:26:43 1998 Dimitrie O. Paun <dimi@mail.cs.toronto.edu> * [DEVELOPERS-HINTS] [documentation/debug-msgs] Updated documentation on debug messages * [include/button.h] [controls/button.c] [include/windows.h] [include/combo.h] [controls/combo.c] [controls/commctrl.c] [controls/icontitle.c] [controls/listbox.c] [controls/menu.c] [controls/scroll.c] [controls/widgets.c] Changed some 16-bit code to 32-bit code. I am positive this will not break anything. * [controls/uitools.c] Renamed the prefix of some functions from UITOOLS_ to UITOOLS95_ to reflect the fact that they implement Win95 look. Maybe we will have a UITOOLS31_ in the future. Anyhow, the change is completely internal to this file. * [*/*.c] Changed a lot of [f]printf into appropriate debug messages. Fri Mar 27 19:56:12 1998 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [documentation/status/] Added directdraw and directsound status. * [if1632/thunk.c][ole/*.c][win32/kernel32.c] Added some documentation. Moved FUNC004 to thunk.c since it seems to be a 16->32 thunk (calling conventions and the like still unknown). Fri Mar 27 09:59:32 1998 Morten Eriksen <mortene@pvv.org> * [loader/resource.c][windows/keyboard.c] Implemented CopyAcceleratorTable() and CreateAcceleratorTable(). * [include/compobj.h][ole/compobj.c][relay32/ole32.spec] Added implementation of StringFromGUID2(). Tue Mar 26 23:12:05 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de> * [misc/imagelist.c][relay32/comctl32.spec] Implemented new debugging interface. Added missing functions (some are empty stubs). Changed ordinals in comctl32.spec (now dll version 4.72 comatible). * [objects/oembitmaps.c][include/windows.h] [include/bitmaps/*] Added missing restore bitmaps for Win95 look. Added missing Win95 cursors. Thu Mar 26 10:18:20 1998 Douglas Ridgway <ridgway@winehq.com> * [programs/view/Makefile.in] [programs/view/view.c] Fix compilation, Aldus placeable metafile loading. * [graphics/metafiledrv/init.c] [relay32/gdi32.spec] [objects/metafile.c] Implemented various 32 bit versions of regular metafile API. * [objects/enhmetafile.c] Implemented rendering of a couple of dozen records. Tue Mar 24 20:06:39 1998 Matthew Becker <mbecker@glasscity.net> * [memory/*.c] Updated documentation for API manpages. Mon Mar 23 09:09:00 1998 Alex Korobka <alex@pharm.sunysb.edu> * [misc/winsock.c] Fixed 32-bit DNS lookup. Mon Mar 23 23:54:47 1998 Luiz Otavio L. Zorzella <zorzella@nr.conexware.com> * [multimedia/init.c] New code for the initialization and gathering of information about the MIDI devices, for future use. Thu Mar 19 00:59:29 1998 Jim Peterson <jspeter@nospam.birch.ee.vt.edu> * [windows/win.c] Eliminated inaccurate setting of cs->hMenu in WIN_CreateWindowEx, along with superfluous SetMenu32 call. Mon Mar 16 17:40:53 1998 Petter Reinholdtsen <pere@td.org.uit.no> * [debugger/dbg.y] [debugger/Makefile.in] [Makefile.in] Install wine.sym in $(exec_prefix)/lib and make sure the debugger finds it. Sun Mar 15 22:36:35 1998 Michael Veksler <mveksler@tx.technion.ac.il> * [dummy.c] [if1632/gdi.spec] Fixed stub declaration of GDI_532, so Hebrew-Word2 kind of works.
244 lines
6.2 KiB
C
244 lines
6.2 KiB
C
/*
|
|
* Icontitle window class.
|
|
*
|
|
* Copyright 1997 Alex Korobka
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include "windows.h"
|
|
#include "sysmetrics.h"
|
|
#include "win.h"
|
|
#include "desktop.h"
|
|
#include "graphics.h"
|
|
#include "heap.h"
|
|
|
|
static LPCSTR emptyTitleText = "<...>";
|
|
|
|
BOOL32 bMultiLineTitle;
|
|
HFONT32 hIconTitleFont;
|
|
|
|
/***********************************************************************
|
|
* ICONTITLE_Init
|
|
*/
|
|
BOOL32 ICONTITLE_Init(void)
|
|
{
|
|
LOGFONT32A logFont;
|
|
|
|
SystemParametersInfo32A( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
|
|
SystemParametersInfo32A( SPI_GETICONTITLEWRAP, 0, &bMultiLineTitle, 0 );
|
|
hIconTitleFont = CreateFontIndirect32A( &logFont );
|
|
return (hIconTitleFont) ? TRUE : FALSE;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* ICONTITLE_Create
|
|
*/
|
|
HWND32 ICONTITLE_Create( WND* wnd )
|
|
{
|
|
WND* wndPtr;
|
|
HWND32 hWnd;
|
|
|
|
if( wnd->dwStyle & WS_CHILD )
|
|
hWnd = CreateWindowEx32A( 0, ICONTITLE_CLASS_ATOM, NULL,
|
|
WS_CHILD | WS_CLIPSIBLINGS, 0, 0, 1, 1,
|
|
wnd->parent->hwndSelf, 0, wnd->hInstance, NULL );
|
|
else
|
|
hWnd = CreateWindowEx32A( 0, ICONTITLE_CLASS_ATOM, NULL,
|
|
WS_CLIPSIBLINGS, 0, 0, 1, 1,
|
|
wnd->hwndSelf, 0, wnd->hInstance, NULL );
|
|
wndPtr = WIN_FindWndPtr( hWnd );
|
|
if( wndPtr )
|
|
{
|
|
wndPtr->owner = wnd; /* MDI depends on this */
|
|
wndPtr->dwStyle &= ~(WS_CAPTION | WS_BORDER);
|
|
if( wnd->dwStyle & WS_DISABLED ) wndPtr->dwStyle |= WS_DISABLED;
|
|
return hWnd;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* ICONTITLE_GetTitlePos
|
|
*/
|
|
static BOOL32 ICONTITLE_GetTitlePos( WND* wnd, LPRECT32 lpRect )
|
|
{
|
|
LPSTR str;
|
|
int length = lstrlen32A( wnd->owner->text );
|
|
|
|
if( length )
|
|
{
|
|
str = HeapAlloc( GetProcessHeap(), 0, length + 1 );
|
|
lstrcpy32A( str, wnd->owner->text );
|
|
while( str[length - 1] == ' ' ) /* remove trailing spaces */
|
|
{
|
|
str[--length] = '\0';
|
|
if( !length )
|
|
{
|
|
HeapFree( GetProcessHeap(), 0, str );
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if( !length )
|
|
{
|
|
str = (LPSTR)emptyTitleText;
|
|
length = lstrlen32A( str );
|
|
}
|
|
|
|
if( str )
|
|
{
|
|
HDC32 hDC = GetDC32( wnd->hwndSelf );
|
|
if( hDC )
|
|
{
|
|
HFONT32 hPrevFont = SelectObject32( hDC, hIconTitleFont );
|
|
|
|
SetRect32( lpRect, 0, 0, sysMetrics[SM_CXICONSPACING] -
|
|
SYSMETRICS_CXBORDER * 2, SYSMETRICS_CYBORDER * 2 );
|
|
|
|
DrawText32A( hDC, str, length, lpRect, DT_CALCRECT |
|
|
DT_CENTER | DT_NOPREFIX | DT_WORDBREAK |
|
|
(( bMultiLineTitle ) ? 0 : DT_SINGLELINE) );
|
|
|
|
SelectObject32( hDC, hPrevFont );
|
|
ReleaseDC32( wnd->hwndSelf, hDC );
|
|
|
|
lpRect->right += 4 * SYSMETRICS_CXBORDER - lpRect->left;
|
|
lpRect->left = wnd->owner->rectWindow.left + SYSMETRICS_CXICON / 2 -
|
|
(lpRect->right - lpRect->left) / 2;
|
|
lpRect->bottom -= lpRect->top;
|
|
lpRect->top = wnd->owner->rectWindow.top + SYSMETRICS_CYICON;
|
|
}
|
|
if( str != emptyTitleText ) HeapFree( GetProcessHeap(), 0, str );
|
|
return ( hDC ) ? TRUE : FALSE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* ICONTITLE_Paint
|
|
*/
|
|
static BOOL32 ICONTITLE_Paint( WND* wnd, HDC32 hDC, BOOL32 bActive )
|
|
{
|
|
HFONT32 hPrevFont;
|
|
HBRUSH32 hBrush = 0;
|
|
COLORREF textColor = 0;
|
|
|
|
if( bActive )
|
|
{
|
|
hBrush = GetSysColorBrush32(COLOR_ACTIVECAPTION);
|
|
textColor = GetSysColor32(COLOR_CAPTIONTEXT);
|
|
}
|
|
else
|
|
{
|
|
if( wnd->dwStyle & WS_CHILD )
|
|
{
|
|
hBrush = wnd->parent->class->hbrBackground;
|
|
if( hBrush )
|
|
{
|
|
INT32 level;
|
|
LOGBRUSH32 logBrush;
|
|
GetObject32A( hBrush, sizeof(logBrush), &logBrush );
|
|
level = GetRValue(logBrush.lbColor) +
|
|
GetGValue(logBrush.lbColor) +
|
|
GetBValue(logBrush.lbColor);
|
|
if( level < (0x7F * 3) )
|
|
textColor = RGB( 0xFF, 0xFF, 0xFF );
|
|
}
|
|
else
|
|
hBrush = GetStockObject32( WHITE_BRUSH );
|
|
}
|
|
else
|
|
{
|
|
hBrush = GetStockObject32( BLACK_BRUSH );
|
|
textColor = RGB( 0xFF, 0xFF, 0xFF );
|
|
}
|
|
}
|
|
|
|
FillWindow( wnd->parent->hwndSelf, wnd->hwndSelf, hDC, hBrush );
|
|
|
|
hPrevFont = SelectObject32( hDC, hIconTitleFont );
|
|
if( hPrevFont )
|
|
{
|
|
RECT32 rect;
|
|
INT32 length;
|
|
char buffer[80];
|
|
|
|
rect.left = rect.top = 0;
|
|
rect.right = wnd->rectWindow.right - wnd->rectWindow.left;
|
|
rect.bottom = wnd->rectWindow.bottom - wnd->rectWindow.top;
|
|
|
|
length = GetWindowText32A( wnd->owner->hwndSelf, buffer, 80 );
|
|
SetTextColor32( hDC, textColor );
|
|
SetBkMode32( hDC, TRANSPARENT );
|
|
|
|
DrawText32A( hDC, buffer, length, &rect, DT_CENTER | DT_NOPREFIX |
|
|
DT_WORDBREAK | ((bMultiLineTitle) ? 0 : DT_SINGLELINE) );
|
|
|
|
SelectObject32( hDC, hPrevFont );
|
|
}
|
|
return ( hPrevFont ) ? TRUE : FALSE;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* IconTitleWndProc
|
|
*/
|
|
LRESULT WINAPI IconTitleWndProc( HWND32 hWnd, UINT32 msg,
|
|
WPARAM32 wParam, LPARAM lParam )
|
|
{
|
|
WND *wnd = WIN_FindWndPtr( hWnd );
|
|
|
|
switch( msg )
|
|
{
|
|
case WM_NCHITTEST:
|
|
return HTCAPTION;
|
|
|
|
case WM_NCMOUSEMOVE:
|
|
case WM_NCLBUTTONDBLCLK:
|
|
return SendMessage32A( wnd->owner->hwndSelf, msg, wParam, lParam );
|
|
|
|
case WM_ACTIVATE:
|
|
if( wParam ) SetActiveWindow32( wnd->owner->hwndSelf );
|
|
/* fall through */
|
|
|
|
case WM_CLOSE:
|
|
return 0;
|
|
|
|
case WM_SHOWWINDOW:
|
|
if( wnd && wParam )
|
|
{
|
|
RECT32 titleRect;
|
|
|
|
ICONTITLE_GetTitlePos( wnd, &titleRect );
|
|
if( wnd->owner->next != wnd ) /* keep icon title behind the owner */
|
|
SetWindowPos32( hWnd, wnd->owner->hwndSelf,
|
|
titleRect.left, titleRect.top,
|
|
titleRect.right, titleRect.bottom, SWP_NOACTIVATE );
|
|
else
|
|
SetWindowPos32( hWnd, 0, titleRect.left, titleRect.top,
|
|
titleRect.right, titleRect.bottom,
|
|
SWP_NOACTIVATE | SWP_NOZORDER );
|
|
}
|
|
return 0;
|
|
|
|
case WM_ERASEBKGND:
|
|
if( wnd )
|
|
{
|
|
WND* iconWnd = wnd->owner;
|
|
|
|
if( iconWnd->dwStyle & WS_CHILD )
|
|
lParam = SendMessage32A( iconWnd->hwndSelf, WM_ISACTIVEICON, 0, 0 );
|
|
else
|
|
lParam = (iconWnd->hwndSelf == GetActiveWindow16());
|
|
|
|
if( ICONTITLE_Paint( wnd, (HDC32)wParam, (BOOL32)lParam ) )
|
|
ValidateRect32( hWnd, NULL );
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
return DefWindowProc32A( hWnd, msg, wParam, lParam );
|
|
}
|
|
|
|
|