comparison os2/dw.c @ 39:3aa9ef0b3996

Added focus fixes and set-focus fixes on all three platforms.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 19 Oct 2001 14:16:50 +0000
parents 538db2a48bac
children 88c9c7410c22
comparison
equal deleted inserted replaced
38:538db2a48bac 39:3aa9ef0b3996
1253 { 1253 {
1254 _shift_focus(hWnd); 1254 _shift_focus(hWnd);
1255 return FALSE; 1255 return FALSE;
1256 } 1256 }
1257 break; 1257 break;
1258 case WM_BUTTON1DOWN:
1259 case WM_BUTTON2DOWN:
1260 case WM_BUTTON3DOWN:
1261 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE);
1262 break;
1263 case WM_SETFOCUS:
1264 _run_event(hWnd, msg, mp1, mp2);
1265 break;
1258 case WM_PAINT: 1266 case WM_PAINT:
1259 { 1267 {
1260 HWND parent = WinQueryWindow(hWnd, QW_PARENT); 1268 HWND parent = WinQueryWindow(hWnd, QW_PARENT);
1261 ULONG bcol, av[32]; 1269 ULONG bcol, av[32];
1262 HPS hpsPaint; 1270 HPS hpsPaint;
1566 case LN_SELECT: 1574 case LN_SELECT:
1567 { 1575 {
1568 int (*listboxselectfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction; 1576 int (*listboxselectfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction;
1569 int id = SHORT1FROMMP(mp1); 1577 int id = SHORT1FROMMP(mp1);
1570 HWND conthwnd = dw_window_from_id(hWnd, id); 1578 HWND conthwnd = dw_window_from_id(hWnd, id);
1571 1579 static int _recursing = 0;
1572 if(tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2)) 1580
1581 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2)))
1573 { 1582 {
1574 char buf1[500], classbuf[100]; 1583 char buf1[500], classbuf[100];
1575 unsigned int index = dw_listbox_selected(tmp->window); 1584 unsigned int index = dw_listbox_selected(tmp->window);
1576 1585
1577 dw_listbox_query_text(tmp->window, index, buf1, 500); 1586 dw_listbox_query_text(tmp->window, index, buf1, 500);
1578 1587
1579 WinQueryClassName(tmp->window, 99, classbuf); 1588 WinQueryClassName(tmp->window, 99, classbuf);
1589
1590 _recursing = 1;
1580 1591
1581 if(id && strncmp(classbuf, "#2", 3)==0) 1592 if(id && strncmp(classbuf, "#2", 3)==0)
1582 { 1593 {
1583 char *buf2; 1594 char *buf2;
1584 1595
1594 free(buf2); 1605 free(buf2);
1595 } 1606 }
1596 else 1607 else
1597 result = listboxselectfunc(tmp->window, index, tmp->data); 1608 result = listboxselectfunc(tmp->window, index, tmp->data);
1598 1609
1610 _recursing = 0;
1599 tmp = NULL; 1611 tmp = NULL;
1600 } 1612 }
1601 } 1613 }
1602 break; 1614 break;
1603 } 1615 }
1732 1744
1733 if(mybox && (swp->fl & SWP_MINIMIZE)) 1745 if(mybox && (swp->fl & SWP_MINIMIZE))
1734 mybox->flags = DW_MINIMIZED; 1746 mybox->flags = DW_MINIMIZED;
1735 1747
1736 if(mybox && (swp->fl & SWP_RESTORE)) 1748 if(mybox && (swp->fl & SWP_RESTORE))
1749 {
1750 if(!mybox->titlebar && mybox->hwndtitle)
1751 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE);
1737 mybox->flags = 0; 1752 mybox->flags = 0;
1753 }
1738 1754
1739 if(mybox && (swp->fl & SWP_MAXIMIZE)) 1755 if(mybox && (swp->fl & SWP_MAXIMIZE))
1740 { 1756 {
1741 int z; 1757 int z;
1742 SWP swp2; 1758 SWP swp2;
2182 2198
2183 switch(msg) 2199 switch(msg)
2184 { 2200 {
2185 #ifndef NO_SIGNALS 2201 #ifndef NO_SIGNALS
2186 case WM_SETFOCUS: 2202 case WM_SETFOCUS:
2187 _wndproc(hwnd, msg, mp1, mp2); 2203 if(mp2)
2204 _run_event(hwnd, msg, mp1, mp2);
2205 else
2206 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0);
2188 break; 2207 break;
2189 case WM_BUTTON1UP: 2208 case WM_BUTTON1UP:
2190 { 2209 {
2191 SignalHandler *tmp = Root; 2210 SignalHandler *tmp = Root;
2192 2211
2258 } 2277 }
2259 #endif 2278 #endif
2260 if(SHORT1FROMMP(mp2) == '\t') 2279 if(SHORT1FROMMP(mp2) == '\t')
2261 { 2280 {
2262 _shift_focus(hwnd); 2281 _shift_focus(hwnd);
2282 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0);
2263 return FALSE; 2283 return FALSE;
2264 } 2284 }
2265 } 2285 }
2266 break; 2286 break;
2267 case 0x041f: 2287 case 0x041f:
2613 * Parameters: 2633 * Parameters:
2614 * handle: The window handle to minimize. 2634 * handle: The window handle to minimize.
2615 */ 2635 */
2616 int dw_window_minimize(HWND handle) 2636 int dw_window_minimize(HWND handle)
2617 { 2637 {
2638 HWND hwndclient = WinWindowFromID(handle, FID_CLIENT);
2639
2640 if(hwndclient)
2641 {
2642 Box *box = (Box *)WinQueryWindowPtr(hwndclient, QWP_USER);
2643
2644 if(box)
2645 {
2646 if(!box->titlebar && box->hwndtitle)
2647 WinSetParent(box->hwndtitle, handle, FALSE);
2648 }
2649 }
2650
2618 return WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_MINIMIZE); 2651 return WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_MINIMIZE);
2619 } 2652 }
2620 2653
2621 /* 2654 /*
2622 * Makes the window invisible. 2655 * Makes the window invisible.
2794 newbox->type = BOXVERT; 2827 newbox->type = BOXVERT;
2795 newbox->count = 0; 2828 newbox->count = 0;
2796 2829
2797 flStyle |= FCF_NOBYTEALIGN; 2830 flStyle |= FCF_NOBYTEALIGN;
2798 2831
2832 if(flStyle & DW_FCF_TITLEBAR)
2833 newbox->titlebar = 1;
2834 else
2835 flStyle |= FCF_TITLEBAR;
2836
2799 hwndframe = WinCreateStdWindow(hwndOwner, 0L, &flStyle, ClassName, title, 0L, NULLHANDLE, 0L, &hwndclient); 2837 hwndframe = WinCreateStdWindow(hwndOwner, 0L, &flStyle, ClassName, title, 0L, NULLHANDLE, 0L, &hwndclient);
2838 newbox->hwndtitle = WinWindowFromID(hwndframe, FID_TITLEBAR);
2839 if(!newbox->titlebar && newbox->hwndtitle)
2840 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE);
2800 *blah = WinSubclassWindow(hwndframe, _sizeproc); 2841 *blah = WinSubclassWindow(hwndframe, _sizeproc);
2801 WinSetWindowPtr(hwndframe, QWP_USER, blah); 2842 WinSetWindowPtr(hwndframe, QWP_USER, blah);
2802 WinSetWindowPtr(hwndclient, QWP_USER, newbox); 2843 WinSetWindowPtr(hwndclient, QWP_USER, newbox);
2803 2844
2804 return hwndframe; 2845 return hwndframe;