Mercurial > dwindows
comparison win/dw.c @ 55:b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
stuff.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 21 Nov 2001 22:31:55 +0000 |
parents | c4e1139d9872 |
children | 1ed95c8ec2ff |
comparison
equal
deleted
inserted
replaced
54:c4e1139d9872 | 55:b6948eac375a |
---|---|
97 char name[30]; | 97 char name[30]; |
98 | 98 |
99 } SignalList; | 99 } SignalList; |
100 | 100 |
101 /* List of signals and their equivilent Win32 message */ | 101 /* List of signals and their equivilent Win32 message */ |
102 #define SIGNALMAX 13 | 102 #define SIGNALMAX 14 |
103 | 103 |
104 SignalList SignalTranslate[SIGNALMAX] = { | 104 SignalList SignalTranslate[SIGNALMAX] = { |
105 { WM_SIZE, "configure_event" }, | 105 { WM_SIZE, "configure_event" }, |
106 { WM_CHAR, "key_press_event" }, | 106 { WM_CHAR, "key_press_event" }, |
107 { WM_LBUTTONDOWN, "button_press_event" }, | 107 { WM_LBUTTONDOWN, "button_press_event" }, |
112 { WM_COMMAND, "clicked" }, | 112 { WM_COMMAND, "clicked" }, |
113 { NM_DBLCLK, "container-select" }, | 113 { NM_DBLCLK, "container-select" }, |
114 { NM_RCLICK, "container-context" }, | 114 { NM_RCLICK, "container-context" }, |
115 { LBN_SELCHANGE, "item-select" }, | 115 { LBN_SELCHANGE, "item-select" }, |
116 { TVN_SELCHANGED, "tree-select" }, | 116 { TVN_SELCHANGED, "tree-select" }, |
117 { WM_SETFOCUS, "set-focus" } | 117 { WM_SETFOCUS, "set-focus" }, |
118 { WM_USER+1, "lose-focus" } | |
118 }; | 119 }; |
119 | 120 |
120 #ifdef BUILD_DLL | 121 #ifdef BUILD_DLL |
121 void Win32_Set_Instance(HINSTANCE hInstance) | 122 void Win32_Set_Instance(HINSTANCE hInstance) |
122 { | 123 { |
239 /* This function adds a signal handler callback into the linked list. | 240 /* This function adds a signal handler callback into the linked list. |
240 */ | 241 */ |
241 void _new_signal(ULONG message, HWND window, void *signalfunction, void *data) | 242 void _new_signal(ULONG message, HWND window, void *signalfunction, void *data) |
242 { | 243 { |
243 SignalHandler *new = malloc(sizeof(SignalHandler)); | 244 SignalHandler *new = malloc(sizeof(SignalHandler)); |
245 | |
246 #ifndef NO_SIGNALS | |
247 if(message == WM_COMMAND) | |
248 dw_signal_disconnect_by_window(window); | |
249 #endif | |
244 | 250 |
245 new->message = message; | 251 new->message = message; |
246 new->window = window; | 252 new->window = window; |
247 new->signalfunction = signalfunction; | 253 new->signalfunction = signalfunction; |
248 new->data = data; | 254 new->data = data; |
455 * layout and moves the current focus to it. | 461 * layout and moves the current focus to it. |
456 */ | 462 */ |
457 void _initial_focus(HWND handle) | 463 void _initial_focus(HWND handle) |
458 { | 464 { |
459 Box *thisbox; | 465 Box *thisbox; |
466 char tmpbuf[100]; | |
467 | |
468 if(!handle) | |
469 return; | |
470 | |
471 GetClassName(handle, tmpbuf, 99); | |
472 | |
473 if(strnicmp(tmpbuf, ClassName, strlen(ClassName))!=0) | |
474 return; | |
475 | |
460 | 476 |
461 if(handle) | 477 if(handle) |
462 thisbox = (Box *)GetWindowLong(handle, GWL_USERDATA); | 478 thisbox = (Box *)GetWindowLong(handle, GWL_USERDATA); |
463 | 479 |
464 if(thisbox) | 480 if(thisbox) |
1011 command_active = 1; | 1027 command_active = 1; |
1012 | 1028 |
1013 /* Find any callbacks for this function */ | 1029 /* Find any callbacks for this function */ |
1014 while(tmp) | 1030 while(tmp) |
1015 { | 1031 { |
1016 if(tmp->message == msg || msg == WM_COMMAND || msg == WM_NOTIFY) | 1032 if(tmp->message == msg || msg == WM_COMMAND || msg == WM_NOTIFY || tmp->message == WM_USER+1) |
1017 { | 1033 { |
1018 switch(msg) | 1034 switch(msg) |
1019 { | 1035 { |
1020 case WM_SETFOCUS: | 1036 case WM_SETFOCUS: |
1021 { | 1037 { |
1590 | 1606 |
1591 BOOL CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) | 1607 BOOL CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
1592 { | 1608 { |
1593 ColorInfo *cinfo; | 1609 ColorInfo *cinfo; |
1594 char tmpbuf[100]; | 1610 char tmpbuf[100]; |
1611 WNDPROC pOldProc = 0; | |
1595 | 1612 |
1596 cinfo = (ColorInfo *)GetWindowLong(hWnd, GWL_USERDATA); | 1613 cinfo = (ColorInfo *)GetWindowLong(hWnd, GWL_USERDATA); |
1597 | 1614 |
1598 GetClassName(hWnd, tmpbuf, 99); | 1615 GetClassName(hWnd, tmpbuf, 99); |
1599 if(strcmp(tmpbuf, FRAMECLASSNAME) == 0) | 1616 if(strcmp(tmpbuf, FRAMECLASSNAME) == 0) |
1600 cinfo = &(((Box *)cinfo)->cinfo); | 1617 cinfo = &(((Box *)cinfo)->cinfo); |
1601 | 1618 |
1602 if(cinfo) | 1619 if(cinfo) |
1603 { | 1620 { |
1621 pOldProc = cinfo->pOldProc; | |
1622 | |
1604 switch( msg ) | 1623 switch( msg ) |
1605 { | 1624 { |
1606 case WM_SETFOCUS: | 1625 case WM_SETFOCUS: |
1607 if(cinfo->combo) | 1626 if(cinfo->combo) |
1608 _wndproc(cinfo->combo, msg, mp1, mp2); | 1627 _wndproc(cinfo->combo, msg, mp1, mp2); |
1718 } | 1737 } |
1719 break; | 1738 break; |
1720 } | 1739 } |
1721 } | 1740 } |
1722 | 1741 |
1723 if(!cinfo || !cinfo->pOldProc) | 1742 if(!pOldProc) |
1724 return DefWindowProc(hWnd, msg, mp1, mp2); | 1743 return DefWindowProc(hWnd, msg, mp1, mp2); |
1725 return CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); | 1744 return CallWindowProc(pOldProc, hWnd, msg, mp1, mp2); |
1726 } | 1745 } |
1727 | 1746 |
1728 BOOL CALLBACK _containerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) | 1747 BOOL CALLBACK _containerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
1729 { | 1748 { |
1730 ContainerInfo *cinfo; | 1749 ContainerInfo *cinfo; |