wine/windows/caret.c
Alexandre Julliard 5819953c2a Release 940420
Wed Apr 20 14:53:35 1994  Bob Amstadt  (bob@pooh)

	* [tools/build.c] [if1632/call.S] [if1632/Imakefile]
	Fixed bug for non-Linux systems.

Apr 18, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)

	* [windows/win.c]
	Bug fixed in CreateWindowEx() : Now use SetMenu() for menubar setup.
	New empty stub for function SetSysModalWindow().

	* [misc/exec.c]
	New empty stub for function ExitWindows().

	* [objects/font.c]
	New empty stub for function EnumFonts().

	* New file [misc/property.c]
	New functions RemoveProp(), GetProp(), SetProp() & EnumProps().

	* New file [misc/shell.c]
	New empty stubs for function RegisterShellProc(), 
			ShellExecute() & ShellProc().

	* New files [loader/task.c] & [include/task.h]
	Move functions GetWindowTask(), GetNumTask(), EnumTaskWindows()
		from 'loader/library.c'.

	* [if1632/user.c] [if1632/kernel.c]
	Put Atoms functions entries.

	* [controls/combo.c]
	New functions DirDlgSelectComboBox() & DirDlgListComboBox().

	* [controls/listbox.c]
	New functions DirDlgSelect() & DirDlgList().

Sun Apr 17 20:57:59 1994  Erik Bos (erik@trashcan.hacktic.nl)

	* [objects/test.c]
	GrayString() added.

	* [if1632/callback.c]
	CallGrayStringProc() added.

	* [if1632/relay.c] [if1632/mmsystem.spec]
	Added.

	* [if1632/kernel.spec] [if1632/user.spec]
	Added forgotten specs for atom functions.

Tue Apr 12 00:05:31 1994  Bob Amstadt  (bob@pooh)

	* misc/spy.c (SpyInit): Added more message types

	* [windows/mdi.c] [include/mdi.h]
	Maximizing and restoring child windows.
	Tiling of child windows.

Mon Apr 11 20:48:28 1994  Alexandre Julliard  (julliard@lamisun.epfl.ch)

	* [windows/winpos.c]
	Revert focus and activation to previous window when hiding a window.

	* [windows/syscolor.c]
	Implemented system color objects (brushes and pens created at
	SetSysColor() time for better performance).

	* [windows/graphics.c] [windows/nonclient.c] [controls/button.c]
	Changed painting code to use system color objects.

	* [windows/message.c]
	New function MSG_InternalGetMessage() for internal messages
	loops (e.g. for dialogs or menus).

	* [windows/hook.c] [include/hook.h]  (New files)
	Beginning of the window hooks implementation.

	* [windows/dialog.c]
	Use new function MSG_InternalGetMessage() in DialogBox().

	* [if1632/callback.c]
	Added function CallHookProc().

Apr 11, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)

	* [windows/event.c]
	Bug fix : WM_CHARs are sent to focused window like WM_KEY???.

	* [misc/exec.c]
	Nothing much more than a stub for LoadModule(), I saw there a lot
		to be done in that corner, I will come back later ...

	* [loader/library.c]
	New functions GetWindowTask(), GetNumTask(), EnumTaskWindows() 
			and associated modules & tasks linked-lists.
	(it's only an 'emerging bud', more to come next weeks).

	* [loader/wine.c]
	Use LoadLibrary() instead of LoadImage() for 'sysres.dll'.

	* [control/menu.c]
	You can now click outside menu region without problem.
	Keyboard navig more smootly, even if a child has the focus.
	Bug fix in InsertItem(), (bad linklist when insert point not found).
	change Realloc for Free & Alloc in ModifyItem().
	MF_STRING now set BLACK_PEN to fix bug of bad color of the underscores 
		done by DrawText(), (maybe it should done in DrawText() itself ?).

Sun Apr 10 14:06:08 1994  Erik Bos (erik@trashcan.hacktic.nl)

	* [misc/profile.c]
	.INI files will now be stored in / loaded from the windows dir
	if no path is supplied.

	* [if1632/kernel.spec]
	Fixed GetDriveType's prototype.

	* [if1632/winsock.spec] [include/winsock.h] [misc/winsocket.c]
	Fixed prototypes: winsock uses a word as socket handle not an int.

	* [misc/winsocket.c]
	Added heap allocation for returned structures.
	Added non-blocking WSAAsyncGetXbyY() functions as blocking ones.

	* [loader/wine.c]
	Added IsDLLLoaded(), used in LoadImage() to prevent loading
	a dll multiple times.
	Directory is added to wine's path when a fullpath is supplied when
	starting wine.
	LoadImage(): DLL filename used instead DLL's own internal name,
	fixes 'Bad DLL name' errors.

Sat Apr  9 08:26:03 1994  David Metcalfe <david@prism.demon.co.uk>

	* [controls/edit.c] [controls/widgets.c]
	First release of edit control.
1994-04-21 01:20:00 +00:00

261 lines
5.4 KiB
C

/*
* Caret functions
*
* Copyright 1993 David Metcalfe
*/
static char Copyright[] = "Copyright David Metcalfe, 1993";
#include "windows.h"
typedef struct
{
HWND hwnd;
short hidden;
BOOL on;
short x;
short y;
short width;
short height;
COLORREF color;
HBITMAP bitmap;
WORD timeout;
WORD timerid;
} CARET;
static CARET Caret;
static BOOL LockCaret;
static WORD CARET_Callback(HWND hwnd, WORD msg, WORD timerid, LONG ctime);
static void CARET_HideCaret();
/*****************************************************************
* CARET_Callback
*/
static WORD CARET_Callback(HWND hwnd, WORD msg, WORD timerid, LONG ctime)
{
HDC hdc;
HBRUSH hBrush;
HRGN rgn;
#ifdef DEBUG_CARET
printf("CARET_Callback: id=%d: LockCaret=%d, hidden=%d, on=%d\n",
timerid, LockCaret, Caret.hidden, Caret.on);
#endif
if (!LockCaret && (!Caret.hidden || Caret.on))
{
Caret.on = (Caret.on ? FALSE : TRUE);
hdc = GetDC(Caret.hwnd);
if (Caret.bitmap == 0 || Caret.bitmap == 1)
hBrush = CreateSolidBrush(Caret.color);
else
hBrush = CreatePatternBrush(Caret.bitmap);
SelectObject(hdc, (HANDLE)hBrush);
SetROP2(hdc, R2_XORPEN);
rgn = CreateRectRgn(Caret.x, Caret.y,
Caret.x + Caret.width,
Caret.y + Caret.height);
FillRgn(hdc, rgn, hBrush);
DeleteObject((HANDLE)rgn);
DeleteObject((HANDLE)hBrush);
ReleaseDC(Caret.hwnd, hdc);
}
return 0;
}
/*****************************************************************
* CARET_HideCaret
*/
static void CARET_HideCaret()
{
HDC hdc;
HBRUSH hBrush;
HRGN rgn;
Caret.on = FALSE;
hdc = GetDC(Caret.hwnd);
if (Caret.bitmap == 0 || Caret.bitmap == 1)
hBrush = CreateSolidBrush(Caret.color);
else
hBrush = CreatePatternBrush(Caret.bitmap);
SelectObject(hdc, (HANDLE)hBrush);
SetROP2(hdc, R2_XORPEN);
rgn = CreateRectRgn(Caret.x, Caret.y,
Caret.x + Caret.width,
Caret.y + Caret.height);
FillRgn(hdc, rgn, hBrush);
DeleteObject((HANDLE)rgn);
DeleteObject((HANDLE)hBrush);
ReleaseDC(Caret.hwnd, hdc);
}
/*****************************************************************
* CreateCaret (USER.163)
*/
void CreateCaret(HWND hwnd, HBITMAP bitmap, short width, short height)
{
if (!hwnd) return;
/* if cursor already exists, destroy it */
/* if (Caret.hwnd)
DestroyCaret();
*/
if (bitmap && bitmap != 1)
Caret.bitmap = bitmap;
if (width)
Caret.width = width;
else
Caret.width = GetSystemMetrics(SM_CXBORDER);
if (height)
Caret.height = height;
else
Caret.height = GetSystemMetrics(SM_CYBORDER);
Caret.hwnd = hwnd;
Caret.hidden = 1;
Caret.on = FALSE;
Caret.x = 0;
Caret.y = 0;
if (bitmap == 1)
Caret.color = GetSysColor(COLOR_GRAYTEXT);
else
Caret.color = GetSysColor(COLOR_WINDOWTEXT);
Caret.timeout = 750;
LockCaret = FALSE;
Caret.timerid = SetSystemTimer(NULL, 0, Caret.timeout, CARET_Callback);
#ifdef DEBUG_CARET
printf("CreateCaret: hwnd=%d, timerid=%d\n", hwnd, Caret.timerid);
#endif
}
/*****************************************************************
* DestroyCaret (USER.164)
*/
void DestroyCaret()
{
/* if (!Caret.hwnd) return;
*/
#ifdef DEBUG_CARET
printf("DestroyCaret: timerid=%d\n", Caret.timerid);
#endif
KillSystemTimer(NULL, Caret.timerid);
if (Caret.on)
CARET_HideCaret();
Caret.hwnd = 0; /* cursor marked as not existing */
}
/*****************************************************************
* SetCaretPos (USER.165)
*/
void SetCaretPos(short x, short y)
{
HDC hdc;
HBRUSH hBrush;
HRGN rgn;
if (!Caret.hwnd) return;
#ifdef DEBUG_CARET
printf("SetCaretPos: x=%d, y=%d\n", x, y);
#endif
LockCaret = TRUE;
if (Caret.on)
CARET_HideCaret();
Caret.x = x;
Caret.y = y;
LockCaret = FALSE;
}
/*****************************************************************
* HideCaret (USER.166)
*/
void HideCaret(HWND hwnd)
{
if (!Caret.hwnd) return;
if (hwnd && (Caret.hwnd != hwnd)) return;
LockCaret = TRUE;
if (Caret.on)
CARET_HideCaret();
++Caret.hidden;
LockCaret = FALSE;
}
/*****************************************************************
* ShowCaret (USER.167)
*/
void ShowCaret(HWND hwnd)
{
if (!Caret.hwnd) return;
if (hwnd && (Caret.hwnd != hwnd)) return;
#ifdef DEBUG_CARET
printf("ShowCaret: hidden=%d\n", Caret.hidden);
#endif
if (Caret.hidden)
--Caret.hidden;
}
/*****************************************************************
* SetCaretBlinkTime (USER.168)
*/
void SetCaretBlinkTime(WORD msecs)
{
if (!Caret.hwnd) return;
KillSystemTimer(NULL, Caret.timerid);
Caret.timeout = msecs;
Caret.timerid = SetSystemTimer(NULL, 0, Caret.timeout, CARET_Callback);
}
/*****************************************************************
* GetCaretBlinkTime (USER.169)
*/
WORD GetCaretBlinkTime()
{
if (!Caret.hwnd) return;
return Caret.timeout;
}
/*****************************************************************
* GetCaretPos (USER.183)
*/
void GetCaretPos(LPPOINT pt)
{
if (!Caret.hwnd || !pt) return;
pt->x = Caret.x;
pt->y = Caret.y;
}