comparison os2/dw.c @ 175:d78d08440246

Use _System/_stdcall for callbacks.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 01 Dec 2002 13:24:17 +0000
parents 75bf3051235f
children 770da0fc4c0d
comparison
equal deleted inserted replaced
174:75bf3051235f 175:d78d08440246
1836 { 1836 {
1837 case WM_SETFOCUS: 1837 case WM_SETFOCUS:
1838 { 1838 {
1839 if((mp2 && tmp->message == WM_SETFOCUS) || (!mp2 && tmp->message == WM_USER+1)) 1839 if((mp2 && tmp->message == WM_SETFOCUS) || (!mp2 && tmp->message == WM_USER+1))
1840 { 1840 {
1841 int (*setfocusfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction; 1841 int (* API setfocusfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction;
1842 1842
1843 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd) 1843 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd)
1844 { 1844 {
1845 result = setfocusfunc(tmp->window, tmp->data); 1845 result = setfocusfunc(tmp->window, tmp->data);
1846 tmp = NULL; 1846 tmp = NULL;
1848 } 1848 }
1849 } 1849 }
1850 break; 1850 break;
1851 case WM_SIZE: 1851 case WM_SIZE:
1852 { 1852 {
1853 int (*sizefunc)(HWND, int, int, void *) = (int (*)(HWND, int, int, void *))tmp->signalfunction; 1853 int (* API sizefunc)(HWND, int, int, void *) = (int (* API)(HWND, int, int, void *))tmp->signalfunction;
1854 1854
1855 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd) 1855 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd)
1856 { 1856 {
1857 result = sizefunc(tmp->window, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), tmp->data); 1857 result = sizefunc(tmp->window, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), tmp->data);
1858 tmp = NULL; 1858 tmp = NULL;
1860 } 1860 }
1861 break; 1861 break;
1862 case WM_BUTTON1DOWN: 1862 case WM_BUTTON1DOWN:
1863 { 1863 {
1864 POINTS pts = (*((POINTS*)&mp1)); 1864 POINTS pts = (*((POINTS*)&mp1));
1865 int (*buttonfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction; 1865 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction;
1866 1866
1867 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) 1867 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
1868 { 1868 {
1869 int button = 0; 1869 int button = 0;
1870 1870
1887 } 1887 }
1888 break; 1888 break;
1889 case WM_BUTTON1UP: 1889 case WM_BUTTON1UP:
1890 { 1890 {
1891 POINTS pts = (*((POINTS*)&mp1)); 1891 POINTS pts = (*((POINTS*)&mp1));
1892 int (*buttonfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction; 1892 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction;
1893 1893
1894 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) 1894 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
1895 { 1895 {
1896 int button = 0; 1896 int button = 0;
1897 1897
1913 } 1913 }
1914 } 1914 }
1915 break; 1915 break;
1916 case WM_MOUSEMOVE: 1916 case WM_MOUSEMOVE:
1917 { 1917 {
1918 int (*motionfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction; 1918 int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction;
1919 1919
1920 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) 1920 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
1921 { 1921 {
1922 int keys = 0; 1922 int keys = 0;
1923 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1); 1923 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1);
1934 } 1934 }
1935 } 1935 }
1936 break; 1936 break;
1937 case WM_CHAR: 1937 case WM_CHAR:
1938 { 1938 {
1939 int (*keypressfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction; 1939 int (* API keypressfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))tmp->signalfunction;
1940 1940
1941 if(hWnd == tmp->window) 1941 if(hWnd == tmp->window)
1942 { 1942 {
1943 result = keypressfunc(tmp->window, SHORT1FROMMP(mp2), tmp->data); 1943 result = keypressfunc(tmp->window, SHORT1FROMMP(mp2), tmp->data);
1944 tmp = NULL; 1944 tmp = NULL;
1945 } 1945 }
1946 } 1946 }
1947 break; 1947 break;
1948 case WM_CLOSE: 1948 case WM_CLOSE:
1949 { 1949 {
1950 int (*closefunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction; 1950 int (* API closefunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction;
1951 1951
1952 if(hWnd == tmp->window || hWnd == WinWindowFromID(tmp->window, FID_CLIENT)) 1952 if(hWnd == tmp->window || hWnd == WinWindowFromID(tmp->window, FID_CLIENT))
1953 { 1953 {
1954 result = closefunc(tmp->window, tmp->data); 1954 result = closefunc(tmp->window, tmp->data);
1955 if(result) 1955 if(result)
1960 break; 1960 break;
1961 case WM_PAINT: 1961 case WM_PAINT:
1962 { 1962 {
1963 HPS hps; 1963 HPS hps;
1964 DWExpose exp; 1964 DWExpose exp;
1965 int (*exposefunc)(HWND, DWExpose *, void *) = (int (*)(HWND, DWExpose *, void *))tmp->signalfunction; 1965 int (* API exposefunc)(HWND, DWExpose *, void *) = (int (* API)(HWND, DWExpose *, void *))tmp->signalfunction;
1966 RECTL rc; 1966 RECTL rc;
1967 1967
1968 if(hWnd == tmp->window) 1968 if(hWnd == tmp->window)
1969 { 1969 {
1970 int height = _get_height(hWnd); 1970 int height = _get_height(hWnd);
1979 } 1979 }
1980 } 1980 }
1981 break; 1981 break;
1982 case WM_COMMAND: 1982 case WM_COMMAND:
1983 { 1983 {
1984 int (*clickfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction; 1984 int (* API clickfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction;
1985 ULONG command = COMMANDMSG(&msg)->cmd; 1985 ULONG command = COMMANDMSG(&msg)->cmd;
1986 1986
1987 if(tmp->window < 65536 && command == tmp->window) 1987 if(tmp->window < 65536 && command == tmp->window)
1988 { 1988 {
1989 result = clickfunc(popup ? popup : tmp->window, tmp->data); 1989 result = clickfunc(popup ? popup : tmp->window, tmp->data);
1996 { 1996 {
1997 switch(SHORT2FROMMP(mp1)) 1997 switch(SHORT2FROMMP(mp1))
1998 { 1998 {
1999 case CN_ENTER: 1999 case CN_ENTER:
2000 { 2000 {
2001 int (*containerselectfunc)(HWND, char *, void *) = (int (*)(HWND, char *, void *))tmp->signalfunction; 2001 int (* API containerselectfunc)(HWND, char *, void *) = (int (* API)(HWND, char *, void *))tmp->signalfunction;
2002 int id = SHORT1FROMMP(mp1); 2002 int id = SHORT1FROMMP(mp1);
2003 HWND conthwnd = dw_window_from_id(hWnd, id); 2003 HWND conthwnd = dw_window_from_id(hWnd, id);
2004 char *text = NULL; 2004 char *text = NULL;
2005 2005
2006 if(mp2) 2006 if(mp2)
2019 } 2019 }
2020 } 2020 }
2021 break; 2021 break;
2022 case CN_CONTEXTMENU: 2022 case CN_CONTEXTMENU:
2023 { 2023 {
2024 int (*containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (*)(HWND, char *, int, int, void *, void *))tmp->signalfunction; 2024 int (* API containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (* API)(HWND, char *, int, int, void *, void *))tmp->signalfunction;
2025 int id = SHORT1FROMMP(mp1); 2025 int id = SHORT1FROMMP(mp1);
2026 HWND conthwnd = dw_window_from_id(hWnd, id); 2026 HWND conthwnd = dw_window_from_id(hWnd, id);
2027 char *text = NULL; 2027 char *text = NULL;
2028 void *user = NULL; 2028 void *user = NULL;
2029 LONG x,y; 2029 LONG x,y;
2075 2075
2076 if(pci && pre->fEmphasisMask & CRA_CURSORED && (pci->rc.flRecordAttr & CRA_CURSORED)) 2076 if(pci && pre->fEmphasisMask & CRA_CURSORED && (pci->rc.flRecordAttr & CRA_CURSORED))
2077 { 2077 {
2078 if(dw_window_get_data(tmp->window, "_dw_container")) 2078 if(dw_window_get_data(tmp->window, "_dw_container"))
2079 { 2079 {
2080 int (*containerselectfunc)(HWND, char *, void *) = (int (*)(HWND, char *, void *))tmp->signalfunction; 2080 int (* API containerselectfunc)(HWND, char *, void *) = (int (* API)(HWND, char *, void *))tmp->signalfunction;
2081 2081
2082 result = containerselectfunc(tmp->window, pci->rc.pszIcon, tmp->data); 2082 result = containerselectfunc(tmp->window, pci->rc.pszIcon, tmp->data);
2083 } 2083 }
2084 else 2084 else
2085 { 2085 {
2086 int (*treeselectfunc)(HWND, HWND, char *, void *, void *) = (int (*)(HWND, HWND, char *, void *, void *))tmp->signalfunction; 2086 int (* API treeselectfunc)(HWND, HWND, char *, void *, void *) = (int (* API)(HWND, HWND, char *, void *, void *))tmp->signalfunction;
2087 2087
2088 if(lasthcnr == tmp->window && lastitem == (HWND)pci) 2088 if(lasthcnr == tmp->window && lastitem == (HWND)pci)
2089 { 2089 {
2090 lasthcnr = 0; 2090 lasthcnr = 0;
2091 lastitem = 0; 2091 lastitem = 0;
2111 2111
2112 WinQueryClassName(tmp->window, 99, classbuf); 2112 WinQueryClassName(tmp->window, 99, classbuf);
2113 2113
2114 if(strncmp(classbuf, "#38", 4) == 0) 2114 if(strncmp(classbuf, "#38", 4) == 0)
2115 { 2115 {
2116 int (*valuechangedfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction; 2116 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))tmp->signalfunction;
2117 2117
2118 if(tmp->window == hWnd || WinQueryWindow(tmp->window, QW_PARENT) == hWnd) 2118 if(tmp->window == hWnd || WinQueryWindow(tmp->window, QW_PARENT) == hWnd)
2119 { 2119 {
2120 static int lastvalue = -1; 2120 static int lastvalue = -1;
2121 static HWND lasthwnd = NULLHANDLE; 2121 static HWND lasthwnd = NULLHANDLE;
2129 tmp = NULL; 2129 tmp = NULL;
2130 } 2130 }
2131 } 2131 }
2132 else 2132 else
2133 { 2133 {
2134 int (*listboxselectfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction; 2134 int (* API listboxselectfunc)(HWND, int, void *) = (int (* API )(HWND, int, void *))tmp->signalfunction;
2135 int id = SHORT1FROMMP(mp1); 2135 int id = SHORT1FROMMP(mp1);
2136 HWND conthwnd = dw_window_from_id(hWnd, id); 2136 HWND conthwnd = dw_window_from_id(hWnd, id);
2137 static int _recursing = 0; 2137 static int _recursing = 0;
2138 2138
2139 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2))) 2139 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2)))
2169 } 2169 }
2170 } 2170 }
2171 break; 2171 break;
2172 case SLN_SLIDERTRACK: 2172 case SLN_SLIDERTRACK:
2173 { 2173 {
2174 int (*valuechangedfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction; 2174 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))tmp->signalfunction;
2175 2175
2176 if(tmp->window == hWnd || WinQueryWindow(tmp->window, QW_PARENT) == hWnd) 2176 if(tmp->window == hWnd || WinQueryWindow(tmp->window, QW_PARENT) == hWnd)
2177 { 2177 {
2178 static int lastvalue = -1; 2178 static int lastvalue = -1;
2179 static HWND lasthwnd = NULLHANDLE; 2179 static HWND lasthwnd = NULLHANDLE;
2704 } 2704 }
2705 break; 2705 break;
2706 case WM_USER: 2706 case WM_USER:
2707 { 2707 {
2708 SignalHandler *tmp = (SignalHandler *)mp1; 2708 SignalHandler *tmp = (SignalHandler *)mp1;
2709 int (*clickfunc)(HWND, void *) = NULL; 2709 int (* API clickfunc)(HWND, void *) = NULL;
2710 2710
2711 if(tmp) 2711 if(tmp)
2712 { 2712 {
2713 clickfunc = (int (*)(HWND, void *))tmp->signalfunction; 2713 clickfunc = (int (* API)(HWND, void *))tmp->signalfunction;
2714 2714
2715 clickfunc(tmp->window, tmp->data); 2715 clickfunc(tmp->window, tmp->data);
2716 } 2716 }
2717 } 2717 }
2718 break; 2718 break;