Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
39:3aa9ef0b3996 | 40:88c9c7410c22 |
---|---|
1503 if(!cinfo || !cinfo->pOldProc) | 1503 if(!cinfo || !cinfo->pOldProc) |
1504 return DefWindowProc(hWnd, msg, mp1, mp2); | 1504 return DefWindowProc(hWnd, msg, mp1, mp2); |
1505 return CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); | 1505 return CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); |
1506 } | 1506 } |
1507 | 1507 |
1508 void _click_default(HWND handle) | |
1509 { | |
1510 char tmpbuf[100]; | |
1511 | |
1512 GetClassName(handle, tmpbuf, 99); | |
1513 | |
1514 /* These are the window classes which can | |
1515 * obtain input focus. | |
1516 */ | |
1517 if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME))==0) | |
1518 { | |
1519 /* Generate click on default item */ | |
1520 SignalHandler *tmp = Root; | |
1521 | |
1522 /* Find any callbacks for this function */ | |
1523 while(tmp) | |
1524 { | |
1525 if(tmp->message == WM_COMMAND) | |
1526 { | |
1527 int (*clickfunc)(HWND, void *) = tmp->signalfunction; | |
1528 | |
1529 /* Make sure it's the right window, and the right ID */ | |
1530 if(tmp->window == handle) | |
1531 { | |
1532 clickfunc(tmp->window, tmp->data); | |
1533 tmp = NULL; | |
1534 } | |
1535 } | |
1536 if(tmp) | |
1537 tmp= tmp->next; | |
1538 } | |
1539 } | |
1540 else | |
1541 SetFocus(handle); | |
1542 } | |
1543 | |
1508 BOOL CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) | 1544 BOOL CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
1509 { | 1545 { |
1510 ColorInfo *cinfo; | 1546 ColorInfo *cinfo; |
1511 char tmpbuf[100]; | 1547 char tmpbuf[100]; |
1512 | 1548 |
1532 _shift_focus(cinfo->buddy); | 1568 _shift_focus(cinfo->buddy); |
1533 else | 1569 else |
1534 _shift_focus(hWnd); | 1570 _shift_focus(hWnd); |
1535 return FALSE; | 1571 return FALSE; |
1536 } | 1572 } |
1573 else if(LOWORD(mp1) == '\r') | |
1574 { | |
1575 if(cinfo->clickdefault) | |
1576 _click_default(cinfo->clickdefault); | |
1577 | |
1578 } | |
1579 | |
1537 /* Tell the spinner control that a keypress has | 1580 /* Tell the spinner control that a keypress has |
1538 * occured and to update it's internal value. | 1581 * occured and to update it's internal value. |
1539 */ | 1582 */ |
1540 if(cinfo->buddy && !cinfo->combo) | 1583 if(cinfo->buddy && !cinfo->combo) |
1541 SendMessage(cinfo->buddy, WM_USER+10, 0, 0); | 1584 SendMessage(cinfo->buddy, WM_USER+10, 0, 0); |
2536 { | 2579 { |
2537 return ShowWindow(handle, SW_MINIMIZE); | 2580 return ShowWindow(handle, SW_MINIMIZE); |
2538 } | 2581 } |
2539 | 2582 |
2540 /* | 2583 /* |
2584 * Makes the window topmost. | |
2585 * Parameters: | |
2586 * handle: The window handle to make topmost. | |
2587 */ | |
2588 int dw_window_raise(HWND handle) | |
2589 { | |
2590 return SetWindowPos(handle, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); | |
2591 } | |
2592 | |
2593 /* | |
2594 * Makes the window bottommost. | |
2595 * Parameters: | |
2596 * handle: The window handle to make bottommost. | |
2597 */ | |
2598 int dw_window_lower(HWND handle) | |
2599 { | |
2600 return SetWindowPos(handle, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); | |
2601 } | |
2602 | |
2603 /* | |
2541 * Makes the window visible. | 2604 * Makes the window visible. |
2542 * Parameters: | 2605 * Parameters: |
2543 * handle: The window handle to make visible. | 2606 * handle: The window handle to make visible. |
2544 */ | 2607 */ |
2545 int dw_window_show(HWND handle) | 2608 int dw_window_show(HWND handle) |
3771 * x: X location from the bottom left. | 3834 * x: X location from the bottom left. |
3772 * y: Y location from the bottom left. | 3835 * y: Y location from the bottom left. |
3773 */ | 3836 */ |
3774 void dw_window_set_pos(HWND handle, ULONG x, ULONG y) | 3837 void dw_window_set_pos(HWND handle, ULONG x, ULONG y) |
3775 { | 3838 { |
3776 SetWindowPos(handle, (HWND)NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER); | 3839 SetWindowPos(handle, (HWND)NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); |
3777 } | 3840 } |
3778 | 3841 |
3779 /* | 3842 /* |
3780 * Sets the position and size of a given window (widget). | 3843 * Sets the position and size of a given window (widget). |
3781 * Parameters: | 3844 * Parameters: |
3785 * width: Width of the widget. | 3848 * width: Width of the widget. |
3786 * height: Height of the widget. | 3849 * height: Height of the widget. |
3787 */ | 3850 */ |
3788 void dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height) | 3851 void dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height) |
3789 { | 3852 { |
3790 SetWindowPos(handle, (HWND)NULL, x, y, width, height, SWP_NOZORDER | SWP_SHOWWINDOW); | 3853 SetWindowPos(handle, (HWND)NULL, x, y, width, height, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE); |
3791 } | 3854 } |
3792 | 3855 |
3793 /* | 3856 /* |
3794 * Gets the position and size of a given window (widget). | 3857 * Gets the position and size of a given window (widget). |
3795 * Parameters: | 3858 * Parameters: |
5739 { | 5802 { |
5740 Box *thisbox = (Box *)GetWindowLong(window, GWL_USERDATA); | 5803 Box *thisbox = (Box *)GetWindowLong(window, GWL_USERDATA); |
5741 | 5804 |
5742 if(thisbox) | 5805 if(thisbox) |
5743 thisbox->defaultitem = defaultitem; | 5806 thisbox->defaultitem = defaultitem; |
5807 } | |
5808 | |
5809 /* | |
5810 * Sets window to click the default dialog item when an ENTER is pressed. | |
5811 * Parameters: | |
5812 * window: Window (widget) to look for the ENTER press. | |
5813 * next: Window (widget) to move to next (or click) | |
5814 */ | |
5815 void dw_window_click_default(HWND window, HWND next) | |
5816 { | |
5817 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(window, GWL_USERDATA); | |
5818 | |
5819 if(cinfo) | |
5820 cinfo->clickdefault = next; | |
5744 } | 5821 } |
5745 | 5822 |
5746 /* | 5823 /* |
5747 * Returns some information about the current operating environment. | 5824 * Returns some information about the current operating environment. |
5748 * Parameters: | 5825 * Parameters: |