comparison win/dw.c @ 1532:6c55d68fd08a

Fixed some warnings building with MinGW.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 07 Jan 2012 22:59:39 +0000
parents 783a464afab2
children 2913bb58f439
comparison
equal deleted inserted replaced
1531:783a464afab2 1532:6c55d68fd08a
660 660
661 dw_signal_disconnect_by_window(handle); 661 dw_signal_disconnect_by_window(handle);
662 662
663 if(thiscinfo) 663 if(thiscinfo)
664 { 664 {
665 SubclassWindow(handle, thiscinfo->pOldProc); 665 if(thiscinfo->pOldProc)
666 SetWindowLongPtr(handle, GWLP_WNDPROC, (LPARAM)(WNDPROC)thiscinfo->pOldProc);
666 667
667 /* Delete the brush so as not to leak GDI objects */ 668 /* Delete the brush so as not to leak GDI objects */
668 if(thiscinfo->hbrush) 669 if(thiscinfo->hbrush)
669 DeleteObject(thiscinfo->hbrush); 670 DeleteObject(thiscinfo->hbrush);
670 671
778 779
779 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem) 780 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem)
780 { 781 {
781 int z; 782 int z;
782 static HWND lasthwnd, firsthwnd; 783 static HWND lasthwnd, firsthwnd;
783 static int finish_searching; 784 static int finish_searching;
784 785
785 /* Start is 2 when we have cycled completely and 786 /* Start is 2 when we have cycled completely and
786 * need to set the focus to the last widget we found 787 * need to set the focus to the last widget we found
787 * that was valid. 788 * that was valid.
788 */ 789 */
913 914
914 int _focus_check_box_back(Box *box, HWND handle, int start, HWND defaultitem) 915 int _focus_check_box_back(Box *box, HWND handle, int start, HWND defaultitem)
915 { 916 {
916 int z; 917 int z;
917 static HWND lasthwnd, firsthwnd; 918 static HWND lasthwnd, firsthwnd;
918 static int finish_searching; 919 static int finish_searching;
919 920
920 /* Start is 2 when we have cycled completely and 921 /* Start is 2 when we have cycled completely and
921 * need to set the focus to the last widget we found 922 * need to set the focus to the last widget we found
922 * that was valid. 923 * that was valid.
923 */ 924 */
5380 { 5381 {
5381 DestroyWindow(tmp); 5382 DestroyWindow(tmp);
5382 return NULL; 5383 return NULL;
5383 } 5384 }
5384 5385
5385 cinfo->cinfo.pOldProc = (WNDPROC)SubclassWindow(tmp, _containerwndproc); 5386 cinfo->cinfo.pOldProc = SubclassWindow(tmp, _containerwndproc);
5386 cinfo->cinfo.fore = cinfo->cinfo.back = -1; 5387 cinfo->cinfo.fore = cinfo->cinfo.back = -1;
5387 cinfo->odd = cinfo->even = DW_RGB_TRANSPARENT; 5388 cinfo->odd = cinfo->even = DW_RGB_TRANSPARENT;
5388 5389
5389 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 5390 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
5390 dw_window_set_font(tmp, DefaultFont); 5391 dw_window_set_font(tmp, DefaultFont);
5423 { 5424 {
5424 DestroyWindow(tmp); 5425 DestroyWindow(tmp);
5425 return NULL; 5426 return NULL;
5426 } 5427 }
5427 5428
5428 cinfo->cinfo.pOldProc = (WNDPROC)SubclassWindow(tmp, _treewndproc); 5429 cinfo->cinfo.pOldProc = SubclassWindow(tmp, _treewndproc);
5429 cinfo->cinfo.fore = cinfo->cinfo.back = -1; 5430 cinfo->cinfo.fore = cinfo->cinfo.back = -1;
5430 cinfo->odd = cinfo->even = DW_RGB_TRANSPARENT; 5431 cinfo->odd = cinfo->even = DW_RGB_TRANSPARENT;
5431 5432
5432 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 5433 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
5433 dw_window_set_font(tmp, DefaultFont); 5434 dw_window_set_font(tmp, DefaultFont);
5533 { 5534 {
5534 DestroyWindow(tmp); 5535 DestroyWindow(tmp);
5535 return NULL; 5536 return NULL;
5536 } 5537 }
5537 5538
5538 cinfo->cinfo.pOldProc = (WNDPROC)SubclassWindow(tmp, _treewndproc); 5539 cinfo->cinfo.pOldProc = SubclassWindow(tmp, _treewndproc);
5539 cinfo->cinfo.fore = cinfo->cinfo.back = -1; 5540 cinfo->cinfo.fore = cinfo->cinfo.back = -1;
5540 cinfo->odd = cinfo->even = DW_RGB_TRANSPARENT; 5541 cinfo->odd = cinfo->even = DW_RGB_TRANSPARENT;
5541 5542
5542 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 5543 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
5543 dw_window_set_font(tmp, DefaultFont); 5544 dw_window_set_font(tmp, DefaultFont);
5607 ColorInfo *cinfo = (ColorInfo *)lp; 5608 ColorInfo *cinfo = (ColorInfo *)lp;
5608 5609
5609 if(cinfo) 5610 if(cinfo)
5610 { 5611 {
5611 cinfo->buddy = handle; 5612 cinfo->buddy = handle;
5612 cinfo->pOldProc = (WNDPROC)SubclassWindow(handle, _colorwndproc); 5613 cinfo->pOldProc = SubclassWindow(handle, _colorwndproc);
5613 SetWindowLongPtr(handle, GWLP_USERDATA, (LONG_PTR)cinfo); 5614 SetWindowLongPtr(handle, GWLP_USERDATA, (LONG_PTR)cinfo);
5614 } 5615 }
5615 return FALSE; 5616 return FALSE;
5616 } 5617 }
5617 5618
5675 DW_HWND_OBJECT, 5676 DW_HWND_OBJECT,
5676 (HMENU)id, 5677 (HMENU)id,
5677 DWInstance, 5678 DWInstance,
5678 NULL); 5679 NULL);
5679 cinfo->fore = cinfo->back = -1; 5680 cinfo->fore = cinfo->back = -1;
5680 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); 5681 cinfo->pOldProc = SubclassWindow(tmp, _BtProc);
5681 5682
5682 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 5683 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
5683 dw_window_set_font(tmp, DefaultFont); 5684 dw_window_set_font(tmp, DefaultFont);
5684 return tmp; 5685 return tmp;
5685 } 5686 }
5707 (HMENU)id, 5708 (HMENU)id,
5708 DWInstance, 5709 DWInstance,
5709 NULL); 5710 NULL);
5710 5711
5711 cinfo->fore = cinfo->back = -1; 5712 cinfo->fore = cinfo->back = -1;
5712 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); 5713 cinfo->pOldProc = SubclassWindow(tmp, _BtProc);
5713 5714
5714 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 5715 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
5715 5716
5716 _create_tooltip(tmp, text); 5717 _create_tooltip(tmp, text);
5717 5718
5766 (HMENU)id, 5767 (HMENU)id,
5767 DWInstance, 5768 DWInstance,
5768 NULL); 5769 NULL);
5769 5770
5770 cinfo->fore = cinfo->back = -1; 5771 cinfo->fore = cinfo->back = -1;
5771 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); 5772 cinfo->pOldProc = SubclassWindow(tmp, _BtProc);
5772 5773
5773 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 5774 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
5774 5775
5775 _create_tooltip(tmp, text); 5776 _create_tooltip(tmp, text);
5776 5777
5850 (HMENU)id, 5851 (HMENU)id,
5851 DWInstance, 5852 DWInstance,
5852 NULL ); 5853 NULL );
5853 5854
5854 cinfo->fore = cinfo->back = -1; 5855 cinfo->fore = cinfo->back = -1;
5855 cinfo->pOldProc = (WNDPROC)SubclassWindow( tmp, _BtProc ); 5856 cinfo->pOldProc = SubclassWindow( tmp, _BtProc );
5856 5857
5857 SetWindowLongPtr( tmp, GWLP_USERDATA, (LONG_PTR)cinfo ); 5858 SetWindowLongPtr( tmp, GWLP_USERDATA, (LONG_PTR)cinfo );
5858 5859
5859 _create_tooltip(tmp, text); 5860 _create_tooltip(tmp, text);
5860 5861
5941 (HMENU)id, 5942 (HMENU)id,
5942 DWInstance, 5943 DWInstance,
5943 NULL); 5944 NULL);
5944 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); 5945 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo));
5945 cinfo->fore = cinfo->back = -1; 5946 cinfo->fore = cinfo->back = -1;
5946 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); 5947 cinfo->pOldProc = SubclassWindow(tmp, _BtProc);
5947 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 5948 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
5948 dw_window_set_font(tmp, DefaultFont); 5949 dw_window_set_font(tmp, DefaultFont);
5949 dw_window_set_color(tmp, DW_CLR_DEFAULT, DW_RGB_TRANSPARENT); 5950 dw_window_set_color(tmp, DW_CLR_DEFAULT, DW_RGB_TRANSPARENT);
5950 return tmp; 5951 return tmp;
5951 } 5952 }
6040 0,0,0,0, 6041 0,0,0,0,
6041 DW_HWND_OBJECT, 6042 DW_HWND_OBJECT,
6042 (HMENU)id, 6043 (HMENU)id,
6043 DWInstance, 6044 DWInstance,
6044 NULL); 6045 NULL);
6045 cinfo->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); 6046 cinfo->pOldProc = SubclassWindow(tmp, _BtProc);
6046 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 6047 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
6047 dw_window_set_data(tmp, "_dw_checkbox", DW_INT_TO_POINTER(1)); 6048 dw_window_set_data(tmp, "_dw_checkbox", DW_INT_TO_POINTER(1));
6048 dw_window_set_font(tmp, DefaultFont); 6049 dw_window_set_font(tmp, DefaultFont);
6049 dw_window_set_color(tmp, DW_CLR_DEFAULT, DW_RGB_TRANSPARENT); 6050 dw_window_set_color(tmp, DW_CLR_DEFAULT, DW_RGB_TRANSPARENT);
6050 return tmp; 6051 return tmp;
6078 return NULL; 6079 return NULL;
6079 } 6080 }
6080 6081
6081 cinfo->cinfo.fore = cinfo->cinfo.back = -1; 6082 cinfo->cinfo.fore = cinfo->cinfo.back = -1;
6082 cinfo->odd = cinfo->even = DW_RGB_TRANSPARENT; 6083 cinfo->odd = cinfo->even = DW_RGB_TRANSPARENT;
6083 cinfo->cinfo.pOldProc = (WNDPROC)SubclassWindow(tmp, _containerwndproc); 6084 cinfo->cinfo.pOldProc = SubclassWindow(tmp, _containerwndproc);
6084 6085
6085 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 6086 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
6086 dw_window_set_font(tmp, DefaultFont); 6087 dw_window_set_font(tmp, DefaultFont);
6087 return tmp; 6088 return tmp;
6088 } 6089 }
8376 */ 8377 */
8377 int _lookup_icon(HWND handle, HICON hicon, int type) 8378 int _lookup_icon(HWND handle, HICON hicon, int type)
8378 { 8379 {
8379 int z; 8380 int z;
8380 static HWND lasthwnd = NULL; 8381 static HWND lasthwnd = NULL;
8382 HIMAGELIST himl;
8381 8383
8382 /* We can't add an invalid handle */ 8384 /* We can't add an invalid handle */
8383 if(!hicon) 8385 if(!hicon)
8384 return -1; 8386 return -1;
8385 8387
8395 lookup[z] = hicon; 8397 lookup[z] = hicon;
8396 ImageList_AddIcon(hSmall, hicon); 8398 ImageList_AddIcon(hSmall, hicon);
8397 ImageList_AddIcon(hLarge, hicon); 8399 ImageList_AddIcon(hLarge, hicon);
8398 if(type) 8400 if(type)
8399 { 8401 {
8400 TreeView_SetImageList(handle, hSmall, TVSIL_NORMAL); 8402 himl = TreeView_SetImageList(handle, hSmall, TVSIL_NORMAL);
8401 } 8403 }
8402 else 8404 else
8403 { 8405 {
8404 ListView_SetImageList(handle, hSmall, LVSIL_SMALL); 8406 himl = ListView_SetImageList(handle, hSmall, LVSIL_SMALL);
8405 ListView_SetImageList(handle, hLarge, LVSIL_NORMAL); 8407 himl = ListView_SetImageList(handle, hLarge, LVSIL_NORMAL);
8406 } 8408 }
8407 lasthwnd = handle; 8409 lasthwnd = handle;
8408 return z; 8410 return z;
8409 } 8411 }
8410 8412
8412 { 8414 {
8413 if(lasthwnd != handle) 8415 if(lasthwnd != handle)
8414 { 8416 {
8415 if(type) 8417 if(type)
8416 { 8418 {
8417 TreeView_SetImageList(handle, hSmall, TVSIL_NORMAL); 8419 himl = TreeView_SetImageList(handle, hSmall, TVSIL_NORMAL);
8418 } 8420 }
8419 else 8421 else
8420 { 8422 {
8421 ListView_SetImageList(handle, hSmall, LVSIL_SMALL); 8423 himl = ListView_SetImageList(handle, hSmall, LVSIL_SMALL);
8422 ListView_SetImageList(handle, hLarge, LVSIL_NORMAL); 8424 himl = ListView_SetImageList(handle, hLarge, LVSIL_NORMAL);
8423 } 8425 }
8424 lasthwnd = handle; 8426 lasthwnd = handle;
8425 } 8427 }
8426 return z; 8428 return z;
8427 } 8429 }
8428 } 8430 }
8429 return -1; 8431 return -1;