Mercurial > dwindows
diff win/dw.c @ 40:88c9c7410c22
Lots of fixes and new functions on all platforms.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 22 Oct 2001 22:32:58 +0000 |
parents | 3aa9ef0b3996 |
children | 90aa71b3298a |
line wrap: on
line diff
--- a/win/dw.c Fri Oct 19 14:16:50 2001 +0000 +++ b/win/dw.c Mon Oct 22 22:32:58 2001 +0000 @@ -1505,6 +1505,42 @@ return CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); } +void _click_default(HWND handle) +{ + char tmpbuf[100]; + + GetClassName(handle, tmpbuf, 99); + + /* These are the window classes which can + * obtain input focus. + */ + if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME))==0) + { + /* Generate click on default item */ + SignalHandler *tmp = Root; + + /* Find any callbacks for this function */ + while(tmp) + { + if(tmp->message == WM_COMMAND) + { + int (*clickfunc)(HWND, void *) = tmp->signalfunction; + + /* Make sure it's the right window, and the right ID */ + if(tmp->window == handle) + { + clickfunc(tmp->window, tmp->data); + tmp = NULL; + } + } + if(tmp) + tmp= tmp->next; + } + } + else + SetFocus(handle); +} + BOOL CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) { ColorInfo *cinfo; @@ -1534,6 +1570,13 @@ _shift_focus(hWnd); return FALSE; } + else if(LOWORD(mp1) == '\r') + { + if(cinfo->clickdefault) + _click_default(cinfo->clickdefault); + + } + /* Tell the spinner control that a keypress has * occured and to update it's internal value. */ @@ -2538,6 +2581,26 @@ } /* + * Makes the window topmost. + * Parameters: + * handle: The window handle to make topmost. + */ +int dw_window_raise(HWND handle) +{ + return SetWindowPos(handle, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); +} + +/* + * Makes the window bottommost. + * Parameters: + * handle: The window handle to make bottommost. + */ +int dw_window_lower(HWND handle) +{ + return SetWindowPos(handle, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); +} + +/* * Makes the window visible. * Parameters: * handle: The window handle to make visible. @@ -3773,7 +3836,7 @@ */ void dw_window_set_pos(HWND handle, ULONG x, ULONG y) { - SetWindowPos(handle, (HWND)NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(handle, (HWND)NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); } /* @@ -3787,7 +3850,7 @@ */ void dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height) { - SetWindowPos(handle, (HWND)NULL, x, y, width, height, SWP_NOZORDER | SWP_SHOWWINDOW); + SetWindowPos(handle, (HWND)NULL, x, y, width, height, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE); } /* @@ -5744,6 +5807,20 @@ } /* + * Sets window to click the default dialog item when an ENTER is pressed. + * Parameters: + * window: Window (widget) to look for the ENTER press. + * next: Window (widget) to move to next (or click) + */ +void dw_window_click_default(HWND window, HWND next) +{ + ColorInfo *cinfo = (ColorInfo *)GetWindowLong(window, GWL_USERDATA); + + if(cinfo) + cinfo->clickdefault = next; +} + +/* * Returns some information about the current operating environment. * Parameters: * env: Pointer to a DWEnv struct.