Mercurial > dwindows
comparison win/dw.c @ 444:faaeec0dba1d
Changed from GetWindowLong() and SetWindowLong() to GetWindowLongPtr() and
SetWindowLongPtr() for 64-bit Windows support.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 02 Jun 2003 06:08:21 +0000 |
parents | 9af47c551a56 |
children | 5a0779561d0f |
comparison
equal
deleted
inserted
replaced
443:e99cd6e45c0b | 444:faaeec0dba1d |
---|---|
325 /* This function removes and handlers on windows and frees | 325 /* This function removes and handlers on windows and frees |
326 * the user memory allocated to it. | 326 * the user memory allocated to it. |
327 */ | 327 */ |
328 BOOL CALLBACK _free_window_memory(HWND handle, LPARAM lParam) | 328 BOOL CALLBACK _free_window_memory(HWND handle, LPARAM lParam) |
329 { | 329 { |
330 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); | 330 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
331 HFONT oldfont = (HFONT)SendMessage(handle, WM_GETFONT, 0, 0); | 331 HFONT oldfont = (HFONT)SendMessage(handle, WM_GETFONT, 0, 0); |
332 HICON oldicon = (HICON)SendMessage(handle, WM_GETICON, 0, 0); | 332 HICON oldicon = (HICON)SendMessage(handle, WM_GETICON, 0, 0); |
333 char tmpbuf[100]; | 333 char tmpbuf[100]; |
334 | 334 |
335 /* Delete font, icon and bitmap GDI objects in use */ | 335 /* Delete font, icon and bitmap GDI objects in use */ |
406 | 406 |
407 /* Free user data linked list memory */ | 407 /* Free user data linked list memory */ |
408 if(thiscinfo->root) | 408 if(thiscinfo->root) |
409 dw_window_set_data(handle, NULL, NULL); | 409 dw_window_set_data(handle, NULL, NULL); |
410 | 410 |
411 SetWindowLong(handle, GWL_USERDATA, 0); | 411 SetWindowLongPtr(handle, GWLP_USERDATA, 0); |
412 free(thiscinfo); | 412 free(thiscinfo); |
413 } | 413 } |
414 return TRUE; | 414 return TRUE; |
415 } | 415 } |
416 | 416 |
459 char tmpbuf[100] = ""; | 459 char tmpbuf[100] = ""; |
460 | 460 |
461 GetClassName(handle, tmpbuf, 99); | 461 GetClassName(handle, tmpbuf, 99); |
462 if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS))==0) /* Spinner */ | 462 if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS))==0) /* Spinner */ |
463 { | 463 { |
464 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); | 464 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
465 | 465 |
466 if(cinfo && cinfo->buddy) | 466 if(cinfo && cinfo->buddy) |
467 return cinfo->buddy; | 467 return cinfo->buddy; |
468 } | 468 } |
469 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME))==0) /* Combobox */ | 469 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME))==0) /* Combobox */ |
470 { | 470 { |
471 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); | 471 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
472 | 472 |
473 if(cinfo && cinfo->buddy) | 473 if(cinfo && cinfo->buddy) |
474 return cinfo->buddy; | 474 return cinfo->buddy; |
475 } | 475 } |
476 return handle; | 476 return handle; |
506 | 506 |
507 for(z=box->count-1;z>-1;z--) | 507 for(z=box->count-1;z>-1;z--) |
508 { | 508 { |
509 if(box->items[z].type == TYPEBOX) | 509 if(box->items[z].type == TYPEBOX) |
510 { | 510 { |
511 Box *thisbox = (Box *)GetWindowLong(box->items[z].hwnd, GWL_USERDATA); | 511 Box *thisbox = (Box *)GetWindowLongPtr(box->items[z].hwnd, GWLP_USERDATA); |
512 | 512 |
513 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) | 513 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
514 return 1; | 514 return 1; |
515 } | 515 } |
516 else | 516 else |
560 /* Then try the bottom or right box */ | 560 /* Then try the bottom or right box */ |
561 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); | 561 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); |
562 | 562 |
563 if(mybox) | 563 if(mybox) |
564 { | 564 { |
565 Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); | 565 Box *splitbox = (Box *)GetWindowLongPtr(mybox, GWLP_USERDATA); |
566 | 566 |
567 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) | 567 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
568 return 1; | 568 return 1; |
569 } | 569 } |
570 | 570 |
571 /* Try the top or left box */ | 571 /* Try the top or left box */ |
572 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); | 572 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); |
573 | 573 |
574 if(mybox) | 574 if(mybox) |
575 { | 575 { |
576 Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); | 576 Box *splitbox = (Box *)GetWindowLongPtr(mybox, GWLP_USERDATA); |
577 | 577 |
578 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) | 578 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
579 return 1; | 579 return 1; |
580 } | 580 } |
581 } | 581 } |
588 { | 588 { |
589 Box *notebox; | 589 Box *notebox; |
590 | 590 |
591 if(array[pageid]->hwnd) | 591 if(array[pageid]->hwnd) |
592 { | 592 { |
593 notebox = (Box *)GetWindowLong(array[pageid]->hwnd, GWL_USERDATA); | 593 notebox = (Box *)GetWindowLongPtr(array[pageid]->hwnd, GWLP_USERDATA); |
594 | 594 |
595 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem)) | 595 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem)) |
596 return 1; | 596 return 1; |
597 } | 597 } |
598 } | 598 } |
633 | 633 |
634 for(z=0;z<box->count;z++) | 634 for(z=0;z<box->count;z++) |
635 { | 635 { |
636 if(box->items[z].type == TYPEBOX) | 636 if(box->items[z].type == TYPEBOX) |
637 { | 637 { |
638 Box *thisbox = (Box *)GetWindowLong(box->items[z].hwnd, GWL_USERDATA); | 638 Box *thisbox = (Box *)GetWindowLongPtr(box->items[z].hwnd, GWLP_USERDATA); |
639 | 639 |
640 if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) | 640 if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
641 return 1; | 641 return 1; |
642 } | 642 } |
643 else | 643 else |
687 /* Try the top or left box */ | 687 /* Try the top or left box */ |
688 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); | 688 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); |
689 | 689 |
690 if(mybox) | 690 if(mybox) |
691 { | 691 { |
692 Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); | 692 Box *splitbox = (Box *)GetWindowLongPtr(mybox, GWLP_USERDATA); |
693 | 693 |
694 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) | 694 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
695 return 1; | 695 return 1; |
696 } | 696 } |
697 | 697 |
698 /* Then try the bottom or right box */ | 698 /* Then try the bottom or right box */ |
699 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); | 699 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); |
700 | 700 |
701 if(mybox) | 701 if(mybox) |
702 { | 702 { |
703 Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); | 703 Box *splitbox = (Box *)GetWindowLongPtr(mybox, GWLP_USERDATA); |
704 | 704 |
705 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) | 705 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
706 return 1; | 706 return 1; |
707 } | 707 } |
708 } | 708 } |
715 { | 715 { |
716 Box *notebox; | 716 Box *notebox; |
717 | 717 |
718 if(array[pageid]->hwnd) | 718 if(array[pageid]->hwnd) |
719 { | 719 { |
720 notebox = (Box *)GetWindowLong(array[pageid]->hwnd, GWL_USERDATA); | 720 notebox = (Box *)GetWindowLongPtr(array[pageid]->hwnd, GWLP_USERDATA); |
721 | 721 |
722 if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem)) | 722 if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem)) |
723 return 1; | 723 return 1; |
724 } | 724 } |
725 } | 725 } |
746 if(strnicmp(tmpbuf, ClassName, strlen(ClassName))!=0) | 746 if(strnicmp(tmpbuf, ClassName, strlen(ClassName))!=0) |
747 return; | 747 return; |
748 | 748 |
749 | 749 |
750 if(handle) | 750 if(handle) |
751 thisbox = (Box *)GetWindowLong(handle, GWL_USERDATA); | 751 thisbox = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA); |
752 | 752 |
753 if(thisbox) | 753 if(thisbox) |
754 { | 754 { |
755 _focus_check_box(thisbox, handle, 3, thisbox->defaultitem); | 755 _focus_check_box(thisbox, handle, 3, thisbox->defaultitem); |
756 } | 756 } |
783 while((box = GetParent(lastbox))) | 783 while((box = GetParent(lastbox))) |
784 { | 784 { |
785 lastbox = box; | 785 lastbox = box; |
786 } | 786 } |
787 | 787 |
788 thisbox = (Box *)GetWindowLong(lastbox, GWL_USERDATA); | 788 thisbox = (Box *)GetWindowLongPtr(lastbox, GWLP_USERDATA); |
789 if(thisbox) | 789 if(thisbox) |
790 { | 790 { |
791 if(_focus_check_box(thisbox, handle, 1, 0) == 0) | 791 if(_focus_check_box(thisbox, handle, 1, 0) == 0) |
792 _focus_check_box(thisbox, handle, 2, 0); | 792 _focus_check_box(thisbox, handle, 2, 0); |
793 } | 793 } |
806 while((box = GetParent(lastbox))) | 806 while((box = GetParent(lastbox))) |
807 { | 807 { |
808 lastbox = box; | 808 lastbox = box; |
809 } | 809 } |
810 | 810 |
811 thisbox = (Box *)GetWindowLong(lastbox, GWL_USERDATA); | 811 thisbox = (Box *)GetWindowLongPtr(lastbox, GWLP_USERDATA); |
812 if(thisbox) | 812 if(thisbox) |
813 { | 813 { |
814 if(_focus_check_box_back(thisbox, handle, 1, 0) == 0) | 814 if(_focus_check_box_back(thisbox, handle, 1, 0) == 0) |
815 _focus_check_box_back(thisbox, handle, 2, 0); | 815 _focus_check_box_back(thisbox, handle, 2, 0); |
816 } | 816 } |
865 for(z=0;z<thisbox->count;z++) | 865 for(z=0;z<thisbox->count;z++) |
866 { | 866 { |
867 if(thisbox->items[z].type == TYPEBOX) | 867 if(thisbox->items[z].type == TYPEBOX) |
868 { | 868 { |
869 int initialx, initialy; | 869 int initialx, initialy; |
870 Box *tmp = (Box *)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA); | 870 Box *tmp = (Box *)GetWindowLongPtr(thisbox->items[z].hwnd, GWLP_USERDATA); |
871 | 871 |
872 initialx = x - (*usedx); | 872 initialx = x - (*usedx); |
873 initialy = y - (*usedy); | 873 initialy = y - (*usedy); |
874 | 874 |
875 if(tmp) | 875 if(tmp) |
976 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-thisbox->upy))/((float)(thisbox->minheight-thisbox->upy)); | 976 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-thisbox->upy))/((float)(thisbox->minheight-thisbox->upy)); |
977 } | 977 } |
978 | 978 |
979 if(thisbox->items[z].type == TYPEBOX) | 979 if(thisbox->items[z].type == TYPEBOX) |
980 { | 980 { |
981 Box *tmp = (Box *)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA); | 981 Box *tmp = (Box *)GetWindowLongPtr(thisbox->items[z].hwnd, GWLP_USERDATA); |
982 | 982 |
983 if(tmp) | 983 if(tmp) |
984 { | 984 { |
985 tmp->parentxratio = thisbox->items[z].xratio; | 985 tmp->parentxratio = thisbox->items[z].xratio; |
986 tmp->parentyratio = thisbox->items[z].yratio; | 986 tmp->parentyratio = thisbox->items[z].yratio; |
1082 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == DW_HORZ) | 1082 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == DW_HORZ) |
1083 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2); | 1083 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2); |
1084 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */ | 1084 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */ |
1085 if(thisbox->items[z].type == TYPEBOX) | 1085 if(thisbox->items[z].type == TYPEBOX) |
1086 { | 1086 { |
1087 Box *tmp = (Box *)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA); | 1087 Box *tmp = (Box *)GetWindowLongPtr(thisbox->items[z].hwnd, GWLP_USERDATA); |
1088 | 1088 |
1089 if(tmp) | 1089 if(tmp) |
1090 { | 1090 { |
1091 if(*depth > 0) | 1091 if(*depth > 0) |
1092 { | 1092 { |
1159 width + vectorx, (height + vectory) + 400, FALSE); | 1159 width + vectorx, (height + vectory) + 400, FALSE); |
1160 } | 1160 } |
1161 else if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0) | 1161 else if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0) |
1162 { | 1162 { |
1163 /* Handle special case Spinbutton */ | 1163 /* Handle special case Spinbutton */ |
1164 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); | 1164 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
1165 | 1165 |
1166 MoveWindow(handle, currentx + pad + ((width + vectorx) - 20), currenty + pad, | 1166 MoveWindow(handle, currentx + pad + ((width + vectorx) - 20), currenty + pad, |
1167 20, height + vectory, FALSE); | 1167 20, height + vectory, FALSE); |
1168 | 1168 |
1169 if(cinfo) | 1169 if(cinfo) |
1187 _handle_splitbar_resize(handle, *percent, type, cx, cy); | 1187 _handle_splitbar_resize(handle, *percent, type, cx, cy); |
1188 } | 1188 } |
1189 else if(strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1)==0) | 1189 else if(strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1)==0) |
1190 { | 1190 { |
1191 /* Handle special case Vertically Center static text */ | 1191 /* Handle special case Vertically Center static text */ |
1192 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); | 1192 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
1193 | 1193 |
1194 if(cinfo && cinfo->vcenter) | 1194 if(cinfo && cinfo->vcenter) |
1195 { | 1195 { |
1196 /* We are centered so calculate a new position */ | 1196 /* We are centered so calculate a new position */ |
1197 char tmpbuf[1024]; | 1197 char tmpbuf[1024]; |
1218 /* Everything else */ | 1218 /* Everything else */ |
1219 MoveWindow(handle, currentx + pad, currenty + pad, | 1219 MoveWindow(handle, currentx + pad, currenty + pad, |
1220 width + vectorx, height + vectory, FALSE); | 1220 width + vectorx, height + vectory, FALSE); |
1221 if(thisbox->items[z].type == TYPEBOX) | 1221 if(thisbox->items[z].type == TYPEBOX) |
1222 { | 1222 { |
1223 Box *boxinfo = (Box *)GetWindowLong(handle, GWL_USERDATA); | 1223 Box *boxinfo = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA); |
1224 | 1224 |
1225 if(boxinfo && boxinfo->grouphwnd) | 1225 if(boxinfo && boxinfo->grouphwnd) |
1226 MoveWindow(boxinfo->grouphwnd, 0, 0, | 1226 MoveWindow(boxinfo->grouphwnd, 0, 0, |
1227 width + vectorx, height + vectory, FALSE); | 1227 width + vectorx, height + vectory, FALSE); |
1228 | 1228 |
1715 static int lastx = -1, lasty = -1; | 1715 static int lastx = -1, lasty = -1; |
1716 static HWND lasthwnd = 0; | 1716 static HWND lasthwnd = 0; |
1717 | 1717 |
1718 if(lastx != LOWORD(mp2) || lasty != HIWORD(mp2) || lasthwnd != hWnd) | 1718 if(lastx != LOWORD(mp2) || lasty != HIWORD(mp2) || lasthwnd != hWnd) |
1719 { | 1719 { |
1720 Box *mybox = (Box *)GetWindowLong(hWnd, GWL_USERDATA); | 1720 Box *mybox = (Box *)GetWindowLongPtr(hWnd, GWLP_USERDATA); |
1721 | 1721 |
1722 if(mybox && mybox->count) | 1722 if(mybox && mybox->count) |
1723 { | 1723 { |
1724 lastx = LOWORD(mp2); | 1724 lastx = LOWORD(mp2); |
1725 lasty = HIWORD(mp2); | 1725 lasty = HIWORD(mp2); |
1807 case WM_CTLCOLOREDIT: | 1807 case WM_CTLCOLOREDIT: |
1808 case WM_CTLCOLORMSGBOX: | 1808 case WM_CTLCOLORMSGBOX: |
1809 case WM_CTLCOLORSCROLLBAR: | 1809 case WM_CTLCOLORSCROLLBAR: |
1810 case WM_CTLCOLORDLG: | 1810 case WM_CTLCOLORDLG: |
1811 { | 1811 { |
1812 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLong((HWND)mp2, GWL_USERDATA); | 1812 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLongPtr((HWND)mp2, GWLP_USERDATA); |
1813 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) | 1813 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) |
1814 { | 1814 { |
1815 /* Handle foreground */ | 1815 /* Handle foreground */ |
1816 if(thiscinfo->fore > -1 && thiscinfo->fore < 18) | 1816 if(thiscinfo->fore > -1 && thiscinfo->fore < 18) |
1817 { | 1817 { |
1891 _wndproc(hWnd, msg, mp1, mp2); | 1891 _wndproc(hWnd, msg, mp1, mp2); |
1892 break; | 1892 break; |
1893 #if 0 | 1893 #if 0 |
1894 case WM_ERASEBKGND: | 1894 case WM_ERASEBKGND: |
1895 { | 1895 { |
1896 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLong(hWnd, GWL_USERDATA); | 1896 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); |
1897 | 1897 |
1898 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) | 1898 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) |
1899 return FALSE; | 1899 return FALSE; |
1900 } | 1900 } |
1901 break; | 1901 break; |
1902 #endif | 1902 #endif |
1903 case WM_PAINT: | 1903 case WM_PAINT: |
1904 { | 1904 { |
1905 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLong(hWnd, GWL_USERDATA); | 1905 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); |
1906 | 1906 |
1907 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) | 1907 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) |
1908 { | 1908 { |
1909 PAINTSTRUCT ps; | 1909 PAINTSTRUCT ps; |
1910 HDC hdcPaint = BeginPaint(hWnd, &ps); | 1910 HDC hdcPaint = BeginPaint(hWnd, &ps); |
2000 | 2000 |
2001 BOOL CALLBACK _spinnerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) | 2001 BOOL CALLBACK _spinnerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
2002 { | 2002 { |
2003 ColorInfo *cinfo; | 2003 ColorInfo *cinfo; |
2004 | 2004 |
2005 cinfo = (ColorInfo *)GetWindowLong(hWnd, GWL_USERDATA); | 2005 cinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); |
2006 | 2006 |
2007 if(cinfo) | 2007 if(cinfo) |
2008 { | 2008 { |
2009 switch( msg ) | 2009 switch( msg ) |
2010 { | 2010 { |
2141 { | 2141 { |
2142 ColorInfo *cinfo; | 2142 ColorInfo *cinfo; |
2143 char tmpbuf[100]; | 2143 char tmpbuf[100]; |
2144 WNDPROC pOldProc = 0; | 2144 WNDPROC pOldProc = 0; |
2145 | 2145 |
2146 cinfo = (ColorInfo *)GetWindowLong(hWnd, GWL_USERDATA); | 2146 cinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); |
2147 | 2147 |
2148 GetClassName(hWnd, tmpbuf, 99); | 2148 GetClassName(hWnd, tmpbuf, 99); |
2149 if(strcmp(tmpbuf, FRAMECLASSNAME) == 0) | 2149 if(strcmp(tmpbuf, FRAMECLASSNAME) == 0) |
2150 cinfo = &(((Box *)cinfo)->cinfo); | 2150 cinfo = &(((Box *)cinfo)->cinfo); |
2151 | 2151 |
2275 case WM_CTLCOLOREDIT: | 2275 case WM_CTLCOLOREDIT: |
2276 case WM_CTLCOLORMSGBOX: | 2276 case WM_CTLCOLORMSGBOX: |
2277 case WM_CTLCOLORSCROLLBAR: | 2277 case WM_CTLCOLORSCROLLBAR: |
2278 case WM_CTLCOLORDLG: | 2278 case WM_CTLCOLORDLG: |
2279 { | 2279 { |
2280 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLong((HWND)mp2, GWL_USERDATA); | 2280 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLongPtr((HWND)mp2, GWLP_USERDATA); |
2281 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) | 2281 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) |
2282 { | 2282 { |
2283 /* Handle foreground */ | 2283 /* Handle foreground */ |
2284 if(thiscinfo->fore > -1 && thiscinfo->fore < 18) | 2284 if(thiscinfo->fore > -1 && thiscinfo->fore < 18) |
2285 { | 2285 { |
2350 | 2350 |
2351 BOOL CALLBACK _containerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) | 2351 BOOL CALLBACK _containerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
2352 { | 2352 { |
2353 ContainerInfo *cinfo; | 2353 ContainerInfo *cinfo; |
2354 | 2354 |
2355 cinfo = (ContainerInfo *)GetWindowLong(hWnd, GWL_USERDATA); | 2355 cinfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); |
2356 | 2356 |
2357 switch( msg ) | 2357 switch( msg ) |
2358 { | 2358 { |
2359 case WM_COMMAND: | 2359 case WM_COMMAND: |
2360 case WM_NOTIFY: | 2360 case WM_NOTIFY: |
2467 | 2467 |
2468 BOOL CALLBACK _treewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) | 2468 BOOL CALLBACK _treewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
2469 { | 2469 { |
2470 ContainerInfo *cinfo; | 2470 ContainerInfo *cinfo; |
2471 | 2471 |
2472 cinfo = (ContainerInfo *)GetWindowLong(hWnd, GWL_USERDATA); | 2472 cinfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); |
2473 | 2473 |
2474 switch( msg ) | 2474 switch( msg ) |
2475 { | 2475 { |
2476 case WM_CHAR: | 2476 case WM_CHAR: |
2477 if(LOWORD(mp1) == '\t') | 2477 if(LOWORD(mp1) == '\t') |
2496 | 2496 |
2497 for(z=0;z<thisbox->count;z++) | 2497 for(z=0;z<thisbox->count;z++) |
2498 { | 2498 { |
2499 if(thisbox->items[z].type == TYPEBOX) | 2499 if(thisbox->items[z].type == TYPEBOX) |
2500 { | 2500 { |
2501 Box *tmp = (Box*)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA); | 2501 Box *tmp = (Box*)GetWindowLongPtr(thisbox->items[z].hwnd, GWLP_USERDATA); |
2502 _changebox(tmp, percent, type); | 2502 _changebox(tmp, percent, type); |
2503 } | 2503 } |
2504 else | 2504 else |
2505 { | 2505 { |
2506 if(type == DW_HORZ) | 2506 if(type == DW_HORZ) |
2523 { | 2523 { |
2524 int newx = x; | 2524 int newx = x; |
2525 float ratio = (float)percent/(float)100.0; | 2525 float ratio = (float)percent/(float)100.0; |
2526 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); | 2526 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
2527 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); | 2527 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); |
2528 Box *tmp = (Box *)GetWindowLong(handle1, GWL_USERDATA); | 2528 Box *tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); |
2529 | 2529 |
2530 newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2); | 2530 newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2); |
2531 | 2531 |
2532 ShowWindow(handle1, SW_HIDE); | 2532 ShowWindow(handle1, SW_HIDE); |
2533 ShowWindow(handle2, SW_HIDE); | 2533 ShowWindow(handle2, SW_HIDE); |
2534 | 2534 |
2535 MoveWindow(handle1, 0, 0, newx, y, FALSE); | 2535 MoveWindow(handle1, 0, 0, newx, y, FALSE); |
2536 _do_resize(tmp, newx - 1, y - 1); | 2536 _do_resize(tmp, newx - 1, y - 1); |
2537 | 2537 |
2538 tmp = (Box *)GetWindowLong(handle2, GWL_USERDATA); | 2538 tmp = (Box *)GetWindowLongPtr(handle2, GWLP_USERDATA); |
2539 | 2539 |
2540 newx = x - newx - SPLITBAR_WIDTH; | 2540 newx = x - newx - SPLITBAR_WIDTH; |
2541 | 2541 |
2542 MoveWindow(handle2, x - newx, 0, newx, y, FALSE); | 2542 MoveWindow(handle2, x - newx, 0, newx, y, FALSE); |
2543 _do_resize(tmp, newx - 1, y - 1); | 2543 _do_resize(tmp, newx - 1, y - 1); |
2551 { | 2551 { |
2552 int newy = y; | 2552 int newy = y; |
2553 float ratio = (float)(100.0-percent)/(float)100.0; | 2553 float ratio = (float)(100.0-percent)/(float)100.0; |
2554 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); | 2554 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); |
2555 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); | 2555 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
2556 Box *tmp = (Box *)GetWindowLong(handle1, GWL_USERDATA); | 2556 Box *tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); |
2557 | 2557 |
2558 newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2); | 2558 newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2); |
2559 | 2559 |
2560 ShowWindow(handle1, SW_HIDE); | 2560 ShowWindow(handle1, SW_HIDE); |
2561 ShowWindow(handle2, SW_HIDE); | 2561 ShowWindow(handle2, SW_HIDE); |
2562 | 2562 |
2563 MoveWindow(handle1, 0, y - newy, x, newy, FALSE); | 2563 MoveWindow(handle1, 0, y - newy, x, newy, FALSE); |
2564 _do_resize(tmp, x - 1, newy - 1); | 2564 _do_resize(tmp, x - 1, newy - 1); |
2565 | 2565 |
2566 tmp = (Box *)GetWindowLong(handle2, GWL_USERDATA); | 2566 tmp = (Box *)GetWindowLongPtr(handle2, GWLP_USERDATA); |
2567 | 2567 |
2568 newy = y - newy - SPLITBAR_WIDTH; | 2568 newy = y - newy - SPLITBAR_WIDTH; |
2569 | 2569 |
2570 MoveWindow(handle2, 0, 0, x, newy, FALSE); | 2570 MoveWindow(handle2, 0, 0, x, newy, FALSE); |
2571 _do_resize(tmp, x - 1, newy - 1); | 2571 _do_resize(tmp, x - 1, newy - 1); |
2693 PAINTSTRUCT ps; | 2693 PAINTSTRUCT ps; |
2694 RECT rc; | 2694 RECT rc; |
2695 unsigned long cx, cy; | 2695 unsigned long cx, cy; |
2696 int threadid = dw_thread_id(); | 2696 int threadid = dw_thread_id(); |
2697 char tempbuf[1024] = ""; | 2697 char tempbuf[1024] = ""; |
2698 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(hwnd, GWL_USERDATA); | 2698 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA); |
2699 HFONT hfont = _acquire_font(hwnd, cinfo ? cinfo->fontname : NULL); | 2699 HFONT hfont = _acquire_font(hwnd, cinfo ? cinfo->fontname : NULL); |
2700 HFONT oldfont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); | 2700 HFONT oldfont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); |
2701 | 2701 |
2702 dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy); | 2702 dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy); |
2703 GetWindowText(hwnd, tempbuf, 1024); | 2703 GetWindowText(hwnd, tempbuf, 1024); |
2730 static int bMouseOver = 0; | 2730 static int bMouseOver = 0; |
2731 POINT point; | 2731 POINT point; |
2732 RECT rect; | 2732 RECT rect; |
2733 WNDPROC pOldProc; | 2733 WNDPROC pOldProc; |
2734 | 2734 |
2735 bubble = (BubbleButton *)GetWindowLong(hwnd, GWL_USERDATA); | 2735 bubble = (BubbleButton *)GetWindowLongPtr(hwnd, GWLP_USERDATA); |
2736 | 2736 |
2737 if(!bubble) | 2737 if(!bubble) |
2738 return DefWindowProc(hwnd, msg, mp1, mp2); | 2738 return DefWindowProc(hwnd, msg, mp1, mp2); |
2739 | 2739 |
2740 /* We must save a pointer to the old | 2740 /* We must save a pointer to the old |
2970 RECT rect; | 2970 RECT rect; |
2971 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array"); | 2971 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array"); |
2972 | 2972 |
2973 if(array && array[pageid]) | 2973 if(array && array[pageid]) |
2974 { | 2974 { |
2975 Box *box = (Box *)GetWindowLong(array[pageid]->hwnd, GWL_USERDATA); | 2975 Box *box = (Box *)GetWindowLongPtr(array[pageid]->hwnd, GWLP_USERDATA); |
2976 | 2976 |
2977 GetClientRect(handle,&rect); | 2977 GetClientRect(handle,&rect); |
2978 TabCtrl_AdjustRect(handle,FALSE,&rect); | 2978 TabCtrl_AdjustRect(handle,FALSE,&rect); |
2979 MoveWindow(array[pageid]->hwnd, rect.left, rect.top, | 2979 MoveWindow(array[pageid]->hwnd, rect.left, rect.top, |
2980 rect.right - rect.left, rect.bottom-rect.top, TRUE); | 2980 rect.right - rect.left, rect.bottom-rect.top, TRUE); |
3315 * handle: The window handle to destroy. | 3315 * handle: The window handle to destroy. |
3316 */ | 3316 */ |
3317 int API dw_window_destroy(HWND handle) | 3317 int API dw_window_destroy(HWND handle) |
3318 { | 3318 { |
3319 HWND parent = GetParent(handle); | 3319 HWND parent = GetParent(handle); |
3320 Box *thisbox = (Box *)GetWindowLong(parent, GWL_USERDATA); | 3320 Box *thisbox = (Box *)GetWindowLongPtr(parent, GWLP_USERDATA); |
3321 | 3321 |
3322 if(parent != HWND_DESKTOP && thisbox && thisbox->count) | 3322 if(parent != HWND_DESKTOP && thisbox && thisbox->count) |
3323 { | 3323 { |
3324 int z, index = -1; | 3324 int z, index = -1; |
3325 Item *tmpitem, *thisitem = thisbox->items; | 3325 Item *tmpitem, *thisitem = thisbox->items; |
3358 * Parameters: | 3358 * Parameters: |
3359 * handle: Toplevel window handle to be redrawn. | 3359 * handle: Toplevel window handle to be redrawn. |
3360 */ | 3360 */ |
3361 void API dw_window_redraw(HWND handle) | 3361 void API dw_window_redraw(HWND handle) |
3362 { | 3362 { |
3363 Box *mybox = (Box *)GetWindowLong(handle, GWL_USERDATA); | 3363 Box *mybox = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA); |
3364 | 3364 |
3365 if(mybox) | 3365 if(mybox) |
3366 { | 3366 { |
3367 RECT rect; | 3367 RECT rect; |
3368 int istoplevel = (GetParent(handle) == HWND_DESKTOP); | 3368 int istoplevel = (GetParent(handle) == HWND_DESKTOP); |
3469 { | 3469 { |
3470 HFONT oldfont = (HFONT)SendMessage(handle, WM_GETFONT, 0, 0); | 3470 HFONT oldfont = (HFONT)SendMessage(handle, WM_GETFONT, 0, 0); |
3471 HFONT hfont = _acquire_font(handle, fontname); | 3471 HFONT hfont = _acquire_font(handle, fontname); |
3472 ColorInfo *cinfo; | 3472 ColorInfo *cinfo; |
3473 | 3473 |
3474 cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); | 3474 cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
3475 | 3475 |
3476 if(fontname) | 3476 if(fontname) |
3477 { | 3477 { |
3478 if(cinfo) | 3478 if(cinfo) |
3479 { | 3479 { |
3485 cinfo->fore = cinfo->back = -1; | 3485 cinfo->fore = cinfo->back = -1; |
3486 | 3486 |
3487 strcpy(cinfo->fontname, fontname); | 3487 strcpy(cinfo->fontname, fontname); |
3488 | 3488 |
3489 cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); | 3489 cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); |
3490 SetWindowLong(handle, GWL_USERDATA, (ULONG)cinfo); | 3490 SetWindowLongPtr(handle, GWLP_USERDATA, (LONG_PTR)cinfo); |
3491 } | 3491 } |
3492 } | 3492 } |
3493 SendMessage(handle, WM_SETFONT, (WPARAM)hfont, (LPARAM)TRUE); | 3493 SendMessage(handle, WM_SETFONT, (WPARAM)hfont, (LPARAM)TRUE); |
3494 if(oldfont) | 3494 if(oldfont) |
3495 DeleteObject(oldfont); | 3495 DeleteObject(oldfont); |
3506 int API dw_window_set_color(HWND handle, ULONG fore, ULONG back) | 3506 int API dw_window_set_color(HWND handle, ULONG fore, ULONG back) |
3507 { | 3507 { |
3508 ColorInfo *cinfo; | 3508 ColorInfo *cinfo; |
3509 char tmpbuf[100]; | 3509 char tmpbuf[100]; |
3510 | 3510 |
3511 cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); | 3511 cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
3512 | 3512 |
3513 GetClassName(handle, tmpbuf, 99); | 3513 GetClassName(handle, tmpbuf, 99); |
3514 | 3514 |
3515 if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW))==0) | 3515 if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW))==0) |
3516 { | 3516 { |
3541 | 3541 |
3542 cinfo->fore = fore; | 3542 cinfo->fore = fore; |
3543 cinfo->back = back; | 3543 cinfo->back = back; |
3544 | 3544 |
3545 cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); | 3545 cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); |
3546 SetWindowLong(handle, GWL_USERDATA, (ULONG)cinfo); | 3546 SetWindowLongPtr(handle, GWLP_USERDATA, (LONG_PTR)cinfo); |
3547 } | 3547 } |
3548 InvalidateRgn(handle, NULL, TRUE); | 3548 InvalidateRgn(handle, NULL, TRUE); |
3549 return TRUE; | 3549 return TRUE; |
3550 } | 3550 } |
3551 | 3551 |
3632 flStyleEx |= WS_EX_TOOLWINDOW; | 3632 flStyleEx |= WS_EX_TOOLWINDOW; |
3633 | 3633 |
3634 hwndframe = CreateWindowEx(flStyleEx, ClassName, title, flStyle | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, | 3634 hwndframe = CreateWindowEx(flStyleEx, ClassName, title, flStyle | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, |
3635 CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner, NULL, DWInstance, NULL); | 3635 CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner, NULL, DWInstance, NULL); |
3636 } | 3636 } |
3637 SetWindowLong(hwndframe, GWL_USERDATA, (ULONG)newbox); | 3637 SetWindowLongPtr(hwndframe, GWLP_USERDATA, (LONG_PTR)newbox); |
3638 | 3638 |
3639 #if 0 | 3639 #if 0 |
3640 if(hwndOwner) | 3640 if(hwndOwner) |
3641 SetParent(hwndframe, hwndOwner); | 3641 SetParent(hwndframe, hwndOwner); |
3642 #endif | 3642 #endif |
3671 NULL); | 3671 NULL); |
3672 | 3672 |
3673 newbox->cinfo.pOldProc = SubclassWindow(hwndframe, _colorwndproc); | 3673 newbox->cinfo.pOldProc = SubclassWindow(hwndframe, _colorwndproc); |
3674 newbox->cinfo.fore = newbox->cinfo.back = -1; | 3674 newbox->cinfo.fore = newbox->cinfo.back = -1; |
3675 | 3675 |
3676 SetWindowLong(hwndframe, GWL_USERDATA, (ULONG)newbox); | 3676 SetWindowLongPtr(hwndframe, GWLP_USERDATA, (LONG_PTR)newbox); |
3677 return hwndframe; | 3677 return hwndframe; |
3678 } | 3678 } |
3679 | 3679 |
3680 /* | 3680 /* |
3681 * Create a new Group Box to be packed. | 3681 * Create a new Group Box to be packed. |
3711 hwndframe, | 3711 hwndframe, |
3712 NULL, | 3712 NULL, |
3713 DWInstance, | 3713 DWInstance, |
3714 NULL); | 3714 NULL); |
3715 | 3715 |
3716 SetWindowLong(hwndframe, GWL_USERDATA, (ULONG)newbox); | 3716 SetWindowLongPtr(hwndframe, GWLP_USERDATA, (LONG_PTR)newbox); |
3717 dw_window_set_font(newbox->grouphwnd, DefaultFont); | 3717 dw_window_set_font(newbox->grouphwnd, DefaultFont); |
3718 return hwndframe; | 3718 return hwndframe; |
3719 } | 3719 } |
3720 | 3720 |
3721 /* | 3721 /* |
3965 } | 3965 } |
3966 | 3966 |
3967 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _containerwndproc); | 3967 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _containerwndproc); |
3968 cinfo->cinfo.fore = cinfo->cinfo.back = -1; | 3968 cinfo->cinfo.fore = cinfo->cinfo.back = -1; |
3969 | 3969 |
3970 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); | 3970 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); |
3971 dw_window_set_font(tmp, DefaultFont); | 3971 dw_window_set_font(tmp, DefaultFont); |
3972 return tmp; | 3972 return tmp; |
3973 } | 3973 } |
3974 | 3974 |
3975 /* | 3975 /* |
4001 } | 4001 } |
4002 | 4002 |
4003 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _treewndproc); | 4003 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _treewndproc); |
4004 cinfo->cinfo.fore = cinfo->cinfo.back = -1; | 4004 cinfo->cinfo.fore = cinfo->cinfo.back = -1; |
4005 | 4005 |
4006 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); | 4006 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); |
4007 dw_window_set_font(tmp, DefaultFont); | 4007 dw_window_set_font(tmp, DefaultFont); |
4008 return tmp; | 4008 return tmp; |
4009 } | 4009 } |
4010 | 4010 |
4011 /* | 4011 /* |
4109 } | 4109 } |
4110 | 4110 |
4111 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _treewndproc); | 4111 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _treewndproc); |
4112 cinfo->cinfo.fore = cinfo->cinfo.back = -1; | 4112 cinfo->cinfo.fore = cinfo->cinfo.back = -1; |
4113 | 4113 |
4114 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); | 4114 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); |
4115 dw_window_set_font(tmp, DefaultFont); | 4115 dw_window_set_font(tmp, DefaultFont); |
4116 return tmp; | 4116 return tmp; |
4117 } | 4117 } |
4118 | 4118 |
4119 /* | 4119 /* |
4138 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); | 4138 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); |
4139 | 4139 |
4140 cinfo->back = cinfo->fore = -1; | 4140 cinfo->back = cinfo->fore = -1; |
4141 | 4141 |
4142 cinfo->pOldProc = SubclassWindow(tmp, _colorwndproc); | 4142 cinfo->pOldProc = SubclassWindow(tmp, _colorwndproc); |
4143 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); | 4143 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); |
4144 dw_window_set_font(tmp, DefaultFont); | 4144 dw_window_set_font(tmp, DefaultFont); |
4145 return tmp; | 4145 return tmp; |
4146 } | 4146 } |
4147 | 4147 |
4148 /* | 4148 /* |
4167 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); | 4167 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); |
4168 | 4168 |
4169 cinfo->back = cinfo->fore = -1; | 4169 cinfo->back = cinfo->fore = -1; |
4170 | 4170 |
4171 cinfo->pOldProc = SubclassWindow(tmp, _colorwndproc); | 4171 cinfo->pOldProc = SubclassWindow(tmp, _colorwndproc); |
4172 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); | 4172 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); |
4173 dw_window_set_font(tmp, DefaultFont); | 4173 dw_window_set_font(tmp, DefaultFont); |
4174 return tmp; | 4174 return tmp; |
4175 } | 4175 } |
4176 | 4176 |
4177 BOOL CALLBACK _subclass_child(HWND handle, LPARAM lp) | 4177 BOOL CALLBACK _subclass_child(HWND handle, LPARAM lp) |
4180 | 4180 |
4181 if(cinfo) | 4181 if(cinfo) |
4182 { | 4182 { |
4183 cinfo->buddy = handle; | 4183 cinfo->buddy = handle; |
4184 cinfo->pOldProc = (WNDPROC)SubclassWindow(handle, _colorwndproc); | 4184 cinfo->pOldProc = (WNDPROC)SubclassWindow(handle, _colorwndproc); |
4185 SetWindowLong(handle, GWL_USERDATA, (ULONG)cinfo); | 4185 SetWindowLongPtr(handle, GWLP_USERDATA, (LONG_PTR)cinfo); |
4186 } | 4186 } |
4187 return FALSE; | 4187 return FALSE; |
4188 } | 4188 } |
4189 | 4189 |
4190 /* | 4190 /* |
4220 cinfo2->fore = cinfo->fore = -1; | 4220 cinfo2->fore = cinfo->fore = -1; |
4221 cinfo2->back = cinfo->back = -1; | 4221 cinfo2->back = cinfo->back = -1; |
4222 cinfo2->combo = cinfo->combo = tmp; | 4222 cinfo2->combo = cinfo->combo = tmp; |
4223 EnumChildWindows(tmp, _subclass_child, (LPARAM)cinfo2); | 4223 EnumChildWindows(tmp, _subclass_child, (LPARAM)cinfo2); |
4224 | 4224 |
4225 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); | 4225 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); |
4226 dw_window_set_font(tmp, DefaultFont); | 4226 dw_window_set_font(tmp, DefaultFont); |
4227 return tmp; | 4227 return tmp; |
4228 } | 4228 } |
4229 | 4229 |
4230 /* | 4230 /* |
4249 | 4249 |
4250 bubble->id = id; | 4250 bubble->id = id; |
4251 bubble->bubbletext[0] = '\0'; | 4251 bubble->bubbletext[0] = '\0'; |
4252 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); | 4252 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); |
4253 | 4253 |
4254 SetWindowLong(tmp, GWL_USERDATA, (ULONG)bubble); | 4254 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)bubble); |
4255 dw_window_set_font(tmp, DefaultFont); | 4255 dw_window_set_font(tmp, DefaultFont); |
4256 return tmp; | 4256 return tmp; |
4257 } | 4257 } |
4258 | 4258 |
4259 /* | 4259 /* |
4282 bubble->id = id; | 4282 bubble->id = id; |
4283 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); | 4283 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); |
4284 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; | 4284 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; |
4285 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); | 4285 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); |
4286 | 4286 |
4287 SetWindowLong(tmp, GWL_USERDATA, (ULONG)bubble); | 4287 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)bubble); |
4288 | 4288 |
4289 SendMessage(tmp, BM_SETIMAGE, | 4289 SendMessage(tmp, BM_SETIMAGE, |
4290 (WPARAM) IMAGE_BITMAP, | 4290 (WPARAM) IMAGE_BITMAP, |
4291 (LPARAM) hbitmap); | 4291 (LPARAM) hbitmap); |
4292 return tmp; | 4292 return tmp; |
4329 bubble->id = id; | 4329 bubble->id = id; |
4330 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); | 4330 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); |
4331 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; | 4331 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; |
4332 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); | 4332 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); |
4333 | 4333 |
4334 SetWindowLong(tmp, GWL_USERDATA, (ULONG)bubble); | 4334 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)bubble); |
4335 | 4335 |
4336 strcpy(file, filename); | 4336 strcpy(file, filename); |
4337 | 4337 |
4338 /* check if we can read from this file (it exists and read permission) */ | 4338 /* check if we can read from this file (it exists and read permission) */ |
4339 if(access(file, 04) == 0) | 4339 if(access(file, 04) == 0) |
4390 SendMessage(tmp, UDM_SETBUDDY, (WPARAM)buddy, 0); | 4390 SendMessage(tmp, UDM_SETBUDDY, (WPARAM)buddy, 0); |
4391 cinfo->back = cinfo->fore = -1; | 4391 cinfo->back = cinfo->fore = -1; |
4392 cinfo->buddy = tmp; | 4392 cinfo->buddy = tmp; |
4393 | 4393 |
4394 cinfo->pOldProc = SubclassWindow(buddy, _colorwndproc); | 4394 cinfo->pOldProc = SubclassWindow(buddy, _colorwndproc); |
4395 SetWindowLong(buddy, GWL_USERDATA, (ULONG)cinfo); | 4395 SetWindowLongPtr(buddy, GWLP_USERDATA, (LONG_PTR)cinfo); |
4396 | 4396 |
4397 cinfo = calloc(1, sizeof(ColorInfo)); | 4397 cinfo = calloc(1, sizeof(ColorInfo)); |
4398 cinfo->buddy = buddy; | 4398 cinfo->buddy = buddy; |
4399 cinfo->pOldProc = SubclassWindow(tmp, _spinnerwndproc); | 4399 cinfo->pOldProc = SubclassWindow(tmp, _spinnerwndproc); |
4400 | 4400 |
4401 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); | 4401 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); |
4402 dw_window_set_font(buddy, DefaultFont); | 4402 dw_window_set_font(buddy, DefaultFont); |
4403 return tmp; | 4403 return tmp; |
4404 } | 4404 } |
4405 | 4405 |
4406 /* | 4406 /* |
4423 BubbleButton *bubble = calloc(1, sizeof(BubbleButton)); | 4423 BubbleButton *bubble = calloc(1, sizeof(BubbleButton)); |
4424 bubble->id = id; | 4424 bubble->id = id; |
4425 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); | 4425 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); |
4426 bubble->cinfo.fore = -1; | 4426 bubble->cinfo.fore = -1; |
4427 bubble->cinfo.back = -1; | 4427 bubble->cinfo.back = -1; |
4428 SetWindowLong(tmp, GWL_USERDATA, (ULONG)bubble); | 4428 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)bubble); |
4429 dw_window_set_font(tmp, DefaultFont); | 4429 dw_window_set_font(tmp, DefaultFont); |
4430 return tmp; | 4430 return tmp; |
4431 } | 4431 } |
4432 | 4432 |
4433 | 4433 |
4452 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); | 4452 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); |
4453 | 4453 |
4454 cinfo->back = cinfo->fore = -1; | 4454 cinfo->back = cinfo->fore = -1; |
4455 | 4455 |
4456 cinfo->pOldProc = SubclassWindow(tmp, _colorwndproc); | 4456 cinfo->pOldProc = SubclassWindow(tmp, _colorwndproc); |
4457 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); | 4457 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); |
4458 SendMessage(tmp, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, increments-1)); | 4458 SendMessage(tmp, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, increments-1)); |
4459 return tmp; | 4459 return tmp; |
4460 } | 4460 } |
4461 | 4461 |
4462 /* | 4462 /* |
4480 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); | 4480 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); |
4481 | 4481 |
4482 cinfo->back = cinfo->fore = -1; | 4482 cinfo->back = cinfo->fore = -1; |
4483 | 4483 |
4484 cinfo->pOldProc = SubclassWindow(tmp, _colorwndproc); | 4484 cinfo->pOldProc = SubclassWindow(tmp, _colorwndproc); |
4485 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); | 4485 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); |
4486 dw_window_set_data(tmp, "_dw_scrollbar", (void *)1); | 4486 dw_window_set_data(tmp, "_dw_scrollbar", (void *)1); |
4487 return tmp; | 4487 return tmp; |
4488 } | 4488 } |
4489 | 4489 |
4490 /* | 4490 /* |
4525 bubble->id = id; | 4525 bubble->id = id; |
4526 bubble->checkbox = 1; | 4526 bubble->checkbox = 1; |
4527 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); | 4527 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); |
4528 bubble->cinfo.fore = -1; | 4528 bubble->cinfo.fore = -1; |
4529 bubble->cinfo.back = -1; | 4529 bubble->cinfo.back = -1; |
4530 SetWindowLong(tmp, GWL_USERDATA, (ULONG)bubble); | 4530 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)bubble); |
4531 dw_window_set_font(tmp, DefaultFont); | 4531 dw_window_set_font(tmp, DefaultFont); |
4532 return tmp; | 4532 return tmp; |
4533 } | 4533 } |
4534 | 4534 |
4535 /* | 4535 /* |
4562 | 4562 |
4563 cinfo->cinfo.fore = -1; | 4563 cinfo->cinfo.fore = -1; |
4564 cinfo->cinfo.back = -1; | 4564 cinfo->cinfo.back = -1; |
4565 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _containerwndproc); | 4565 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _containerwndproc); |
4566 | 4566 |
4567 SetWindowLong(tmp, GWL_USERDATA, (ULONG)cinfo); | 4567 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); |
4568 dw_window_set_font(tmp, DefaultFont); | 4568 dw_window_set_font(tmp, DefaultFont); |
4569 return tmp; | 4569 return tmp; |
4570 } | 4570 } |
4571 | 4571 |
4572 /* | 4572 /* |
4730 */ | 4730 */ |
4731 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | 4731 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
4732 { | 4732 { |
4733 Box *thisbox; | 4733 Box *thisbox; |
4734 | 4734 |
4735 thisbox = (Box *)GetWindowLong(box, GWL_USERDATA); | 4735 thisbox = (Box *)GetWindowLongPtr(box, GWLP_USERDATA); |
4736 if(thisbox) | 4736 if(thisbox) |
4737 { | 4737 { |
4738 int z; | 4738 int z; |
4739 Item *tmpitem, *thisitem = thisbox->items; | 4739 Item *tmpitem, *thisitem = thisbox->items; |
4740 char tmpbuf[100]; | 4740 char tmpbuf[100]; |
4787 thisbox->count++; | 4787 thisbox->count++; |
4788 | 4788 |
4789 SetParent(item, box); | 4789 SetParent(item, box); |
4790 if(strncmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0) | 4790 if(strncmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0) |
4791 { | 4791 { |
4792 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(item, GWL_USERDATA); | 4792 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(item, GWLP_USERDATA); |
4793 | 4793 |
4794 if(cinfo) | 4794 if(cinfo) |
4795 { | 4795 { |
4796 SetParent(cinfo->buddy, box); | 4796 SetParent(cinfo->buddy, box); |
4797 ShowWindow(cinfo->buddy, SW_SHOW); | 4797 ShowWindow(cinfo->buddy, SW_SHOW); |
4904 * height: New height in pixels. | 4904 * height: New height in pixels. |
4905 */ | 4905 */ |
4906 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask) | 4906 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask) |
4907 { | 4907 { |
4908 ULONG tmp, currentstyle = GetWindowLong(handle, GWL_STYLE); | 4908 ULONG tmp, currentstyle = GetWindowLong(handle, GWL_STYLE); |
4909 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); | 4909 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
4910 | 4910 |
4911 tmp = currentstyle | mask; | 4911 tmp = currentstyle | mask; |
4912 tmp ^= mask; | 4912 tmp ^= mask; |
4913 tmp |= style; | 4913 tmp |= style; |
4914 | 4914 |
4924 cinfo = calloc(1, sizeof(ColorInfo)); | 4924 cinfo = calloc(1, sizeof(ColorInfo)); |
4925 cinfo->fore = cinfo->back = -1; | 4925 cinfo->fore = cinfo->back = -1; |
4926 cinfo->vcenter = 1; | 4926 cinfo->vcenter = 1; |
4927 | 4927 |
4928 cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); | 4928 cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); |
4929 SetWindowLong(handle, GWL_USERDATA, (ULONG)cinfo); | 4929 SetWindowLongPtr(handle, GWLP_USERDATA, (LONG_PTR)cinfo); |
4930 } | 4930 } |
4931 } | 4931 } |
4932 else if(cinfo) | 4932 else if(cinfo) |
4933 cinfo->vcenter = 0; | 4933 cinfo->vcenter = 0; |
4934 | 4934 |
5761 * position: Current value of the spinbutton. | 5761 * position: Current value of the spinbutton. |
5762 */ | 5762 */ |
5763 void API dw_spinbutton_set_pos(HWND handle, long position) | 5763 void API dw_spinbutton_set_pos(HWND handle, long position) |
5764 { | 5764 { |
5765 char tmpbuf[100]; | 5765 char tmpbuf[100]; |
5766 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); | 5766 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
5767 | 5767 |
5768 sprintf(tmpbuf, "%d", position); | 5768 sprintf(tmpbuf, "%d", position); |
5769 | 5769 |
5770 if(cinfo && cinfo->buddy) | 5770 if(cinfo && cinfo->buddy) |
5771 SetWindowText(cinfo->buddy, tmpbuf); | 5771 SetWindowText(cinfo->buddy, tmpbuf); |
5835 | 5835 |
5836 GetClassName(handle, tmpbuf, 99); | 5836 GetClassName(handle, tmpbuf, 99); |
5837 | 5837 |
5838 if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0) | 5838 if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0) |
5839 { | 5839 { |
5840 BubbleButton *bubble= (BubbleButton *)GetWindowLong(handle, GWL_USERDATA); | 5840 BubbleButton *bubble= (BubbleButton *)GetWindowLongPtr(handle, GWLP_USERDATA); |
5841 | 5841 |
5842 if(bubble && !bubble->checkbox) | 5842 if(bubble && !bubble->checkbox) |
5843 SendMessage(handle, BM_SETCHECK, 0, 0); | 5843 SendMessage(handle, BM_SETCHECK, 0, 0); |
5844 } | 5844 } |
5845 return TRUE; | 5845 return TRUE; |
5850 * handle: Handle to the checkbox to be queried. | 5850 * handle: Handle to the checkbox to be queried. |
5851 * value: TRUE for checked, FALSE for unchecked. | 5851 * value: TRUE for checked, FALSE for unchecked. |
5852 */ | 5852 */ |
5853 void API dw_checkbox_set(HWND handle, int value) | 5853 void API dw_checkbox_set(HWND handle, int value) |
5854 { | 5854 { |
5855 BubbleButton *bubble= (BubbleButton *)GetWindowLong(handle, GWL_USERDATA); | 5855 BubbleButton *bubble= (BubbleButton *)GetWindowLongPtr(handle, GWLP_USERDATA); |
5856 | 5856 |
5857 if(bubble && !bubble->checkbox) | 5857 if(bubble && !bubble->checkbox) |
5858 { | 5858 { |
5859 HWND parent = GetParent(handle); | 5859 HWND parent = GetParent(handle); |
5860 | 5860 |
6117 * separator: The column number that contains the main separator. | 6117 * separator: The column number that contains the main separator. |
6118 * (only used on OS/2 but must be >= 0 on all) | 6118 * (only used on OS/2 but must be >= 0 on all) |
6119 */ | 6119 */ |
6120 int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) | 6120 int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) |
6121 { | 6121 { |
6122 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLong(handle, GWL_USERDATA); | 6122 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
6123 int z, l = 0; | 6123 int z, l = 0; |
6124 unsigned long *tempflags = calloc(sizeof(unsigned long), count + 2); | 6124 unsigned long *tempflags = calloc(sizeof(unsigned long), count + 2); |
6125 LVCOLUMN lvc; | 6125 LVCOLUMN lvc; |
6126 | 6126 |
6127 if(separator == -1) | 6127 if(separator == -1) |
6365 * row: Zero based row of data being set. | 6365 * row: Zero based row of data being set. |
6366 * data: Pointer to the data to be added. | 6366 * data: Pointer to the data to be added. |
6367 */ | 6367 */ |
6368 void API dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) | 6368 void API dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) |
6369 { | 6369 { |
6370 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLong(handle, GWL_USERDATA); | 6370 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
6371 ULONG *flags; | 6371 ULONG *flags; |
6372 LV_ITEM lvi; | 6372 LV_ITEM lvi; |
6373 char textbuffer[100], *destptr = textbuffer; | 6373 char textbuffer[100], *destptr = textbuffer; |
6374 | 6374 |
6375 if(!cinfo || !cinfo->flags || !data) | 6375 if(!cinfo || !cinfo->flags || !data) |
6674 * Parameters: | 6674 * Parameters: |
6675 * handle: Handle to the window (widget) to be optimized. | 6675 * handle: Handle to the window (widget) to be optimized. |
6676 */ | 6676 */ |
6677 void API dw_container_optimize(HWND handle) | 6677 void API dw_container_optimize(HWND handle) |
6678 { | 6678 { |
6679 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLong(handle, GWL_USERDATA); | 6679 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
6680 ULONG *flags; | 6680 ULONG *flags; |
6681 LV_ITEM lvi; | 6681 LV_ITEM lvi; |
6682 | 6682 |
6683 if(cinfo && cinfo->columns == 1) | 6683 if(cinfo && cinfo->columns == 1) |
6684 { | 6684 { |
6776 newbox->count = 0; | 6776 newbox->count = 0; |
6777 newbox->grouphwnd = (HWND)NULL; | 6777 newbox->grouphwnd = (HWND)NULL; |
6778 newbox->cinfo.pOldProc = SubclassWindow(tmp, _rendwndproc); | 6778 newbox->cinfo.pOldProc = SubclassWindow(tmp, _rendwndproc); |
6779 newbox->cinfo.fore = newbox->cinfo.back = -1; | 6779 newbox->cinfo.fore = newbox->cinfo.back = -1; |
6780 | 6780 |
6781 SetWindowLong(tmp, GWL_USERDATA, (ULONG)newbox); | 6781 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)newbox); |
6782 return tmp; | 6782 return tmp; |
6783 } | 6783 } |
6784 | 6784 |
6785 /* Sets the current foreground drawing color. | 6785 /* Sets the current foreground drawing color. |
6786 * Parameters: | 6786 * Parameters: |
6952 | 6952 |
6953 { | 6953 { |
6954 ColorInfo *cinfo; | 6954 ColorInfo *cinfo; |
6955 | 6955 |
6956 if(handle) | 6956 if(handle) |
6957 cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); | 6957 cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
6958 else | 6958 else |
6959 cinfo = (ColorInfo *)GetWindowLong(pixmap->handle, GWL_USERDATA); | 6959 cinfo = (ColorInfo *)GetWindowLongPtr(pixmap->handle, GWLP_USERDATA); |
6960 | 6960 |
6961 if(cinfo) | 6961 if(cinfo) |
6962 { | 6962 { |
6963 hFont = _acquire_font(handle, cinfo->fontname); | 6963 hFont = _acquire_font(handle, cinfo->fontname); |
6964 mustdelete = 1; | 6964 mustdelete = 1; |
7005 | 7005 |
7006 { | 7006 { |
7007 ColorInfo *cinfo; | 7007 ColorInfo *cinfo; |
7008 | 7008 |
7009 if(handle) | 7009 if(handle) |
7010 cinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); | 7010 cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
7011 else | 7011 else |
7012 cinfo = (ColorInfo *)GetWindowLong(pixmap->handle, GWL_USERDATA); | 7012 cinfo = (ColorInfo *)GetWindowLongPtr(pixmap->handle, GWLP_USERDATA); |
7013 | 7013 |
7014 if(cinfo) | 7014 if(cinfo) |
7015 { | 7015 { |
7016 hFont = _acquire_font(handle, cinfo->fontname); | 7016 hFont = _acquire_font(handle, cinfo->fontname); |
7017 mustdelete = 1; | 7017 mustdelete = 1; |
7529 */ | 7529 */ |
7530 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | 7530 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
7531 { | 7531 { |
7532 Box *thisbox; | 7532 Box *thisbox; |
7533 | 7533 |
7534 thisbox = (Box *)GetWindowLong(box, GWL_USERDATA); | 7534 thisbox = (Box *)GetWindowLongPtr(box, GWLP_USERDATA); |
7535 if(thisbox) | 7535 if(thisbox) |
7536 { | 7536 { |
7537 int z; | 7537 int z; |
7538 Item *tmpitem, *thisitem = thisbox->items; | 7538 Item *tmpitem, *thisitem = thisbox->items; |
7539 char tmpbuf[100]; | 7539 char tmpbuf[100]; |
7586 thisbox->count++; | 7586 thisbox->count++; |
7587 | 7587 |
7588 SetParent(item, box); | 7588 SetParent(item, box); |
7589 if(strncmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0) | 7589 if(strncmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0) |
7590 { | 7590 { |
7591 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(item, GWL_USERDATA); | 7591 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(item, GWLP_USERDATA); |
7592 | 7592 |
7593 if(cinfo) | 7593 if(cinfo) |
7594 { | 7594 { |
7595 SetParent(cinfo->buddy, box); | 7595 SetParent(cinfo->buddy, box); |
7596 ShowWindow(cinfo->buddy, SW_SHOW); | 7596 ShowWindow(cinfo->buddy, SW_SHOW); |
7606 * window: Toplevel window or dialog. | 7606 * window: Toplevel window or dialog. |
7607 * defaultitem: Handle to the dialog item to be default. | 7607 * defaultitem: Handle to the dialog item to be default. |
7608 */ | 7608 */ |
7609 void API dw_window_default(HWND window, HWND defaultitem) | 7609 void API dw_window_default(HWND window, HWND defaultitem) |
7610 { | 7610 { |
7611 Box *thisbox = (Box *)GetWindowLong(window, GWL_USERDATA); | 7611 Box *thisbox = (Box *)GetWindowLongPtr(window, GWLP_USERDATA); |
7612 | 7612 |
7613 if(thisbox) | 7613 if(thisbox) |
7614 thisbox->defaultitem = defaultitem; | 7614 thisbox->defaultitem = defaultitem; |
7615 } | 7615 } |
7616 | 7616 |
7620 * window: Window (widget) to look for the ENTER press. | 7620 * window: Window (widget) to look for the ENTER press. |
7621 * next: Window (widget) to move to next (or click) | 7621 * next: Window (widget) to move to next (or click) |
7622 */ | 7622 */ |
7623 void API dw_window_click_default(HWND window, HWND next) | 7623 void API dw_window_click_default(HWND window, HWND next) |
7624 { | 7624 { |
7625 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(window, GWL_USERDATA); | 7625 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(window, GWLP_USERDATA); |
7626 | 7626 |
7627 if(cinfo) | 7627 if(cinfo) |
7628 cinfo->clickdefault = next; | 7628 cinfo->clickdefault = next; |
7629 } | 7629 } |
7630 | 7630 |
7926 * dataname: A string pointer identifying which signal to be hooked. | 7926 * dataname: A string pointer identifying which signal to be hooked. |
7927 * data: User data to be passed to the handler function. | 7927 * data: User data to be passed to the handler function. |
7928 */ | 7928 */ |
7929 void API dw_window_set_data(HWND window, char *dataname, void *data) | 7929 void API dw_window_set_data(HWND window, char *dataname, void *data) |
7930 { | 7930 { |
7931 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(window, GWL_USERDATA); | 7931 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(window, GWLP_USERDATA); |
7932 | 7932 |
7933 if(!cinfo) | 7933 if(!cinfo) |
7934 { | 7934 { |
7935 if(!dataname) | 7935 if(!dataname) |
7936 return; | 7936 return; |
7937 | 7937 |
7938 cinfo = calloc(1, sizeof(ColorInfo)); | 7938 cinfo = calloc(1, sizeof(ColorInfo)); |
7939 cinfo->fore = cinfo->back = -1; | 7939 cinfo->fore = cinfo->back = -1; |
7940 SetWindowLong(window, GWL_USERDATA, (LONG)cinfo); | 7940 SetWindowLongPtr(window, GWLP_USERDATA, (LONG_PTR)cinfo); |
7941 } | 7941 } |
7942 | 7942 |
7943 if(cinfo) | 7943 if(cinfo) |
7944 { | 7944 { |
7945 if(data) | 7945 if(data) |
7961 * dataname: A string pointer identifying which signal to be hooked. | 7961 * dataname: A string pointer identifying which signal to be hooked. |
7962 * data: User data to be passed to the handler function. | 7962 * data: User data to be passed to the handler function. |
7963 */ | 7963 */ |
7964 void * API dw_window_get_data(HWND window, char *dataname) | 7964 void * API dw_window_get_data(HWND window, char *dataname) |
7965 { | 7965 { |
7966 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(window, GWL_USERDATA); | 7966 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(window, GWLP_USERDATA); |
7967 | 7967 |
7968 if(cinfo && cinfo->root && dataname) | 7968 if(cinfo && cinfo->root && dataname) |
7969 { | 7969 { |
7970 UserData *ud = _find_userdata(&(cinfo->root), dataname); | 7970 UserData *ud = _find_userdata(&(cinfo->root), dataname); |
7971 if(ud) | 7971 if(ud) |