comparison win/dw.c @ 1839:22225eb286e5

Fixes for building with MINGW64 (specifically http://tdm-gcc.tdragon.net/). Currently a few things are missing, themes and HTML rendering but it builds in both 32bit and 64bit mode. There are also warnings generated by gcc every time the source calls a Windows API macro. (unused result warning).
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 19 Nov 2012 19:52:36 +0000
parents ca304f28de3b
children 123d1a900f54
comparison
equal deleted inserted replaced
1838:ca304f28de3b 1839:22225eb286e5
1485 } 1485 }
1486 else if(_tcsncmp(tmpbuf, SplitbarClassName, _tcslen(SplitbarClassName)+1)==0) 1486 else if(_tcsncmp(tmpbuf, SplitbarClassName, _tcslen(SplitbarClassName)+1)==0)
1487 { 1487 {
1488 /* Then try the bottom or right box */ 1488 /* Then try the bottom or right box */
1489 float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); 1489 float *percent = (float *)dw_window_get_data(handle, "_dw_percent");
1490 int type = (int)dw_window_get_data(handle, "_dw_type"); 1490 int type = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_type"));
1491 1491
1492 MoveWindow(handle, currentx + pad, currenty + pad, 1492 MoveWindow(handle, currentx + pad, currenty + pad,
1493 width, height, FALSE); 1493 width, height, FALSE);
1494 1494
1495 if(percent && width > 0 && height > 0) 1495 if(percent && width > 0 && height > 0)
1679 static void _dw_toggle_checkable_menu_item( HWND window, int id ) 1679 static void _dw_toggle_checkable_menu_item( HWND window, int id )
1680 { 1680 {
1681 char buffer[40]; 1681 char buffer[40];
1682 int checkable; 1682 int checkable;
1683 sprintf( buffer, "_dw_checkable%d", id ); 1683 sprintf( buffer, "_dw_checkable%d", id );
1684 checkable = (int)dw_window_get_data(DW_HWND_OBJECT, buffer); 1684 checkable = DW_POINTER_TO_INT(dw_window_get_data(DW_HWND_OBJECT, buffer));
1685 if ( checkable ) 1685 if ( checkable )
1686 { 1686 {
1687 int is_checked; 1687 int is_checked;
1688 sprintf( buffer, "_dw_ischecked%d", id ); 1688 sprintf( buffer, "_dw_ischecked%d", id );
1689 is_checked = (int)dw_window_get_data(DW_HWND_OBJECT, buffer); 1689 is_checked = DW_POINTER_TO_INT(dw_window_get_data(DW_HWND_OBJECT, buffer));
1690 is_checked = (is_checked) ? DW_MIS_UNCHECKED : DW_MIS_CHECKED; 1690 is_checked = (is_checked) ? DW_MIS_UNCHECKED : DW_MIS_CHECKED;
1691 dw_menu_item_set_state( window, id, is_checked ); 1691 dw_menu_item_set_state( window, id, is_checked );
1692 } 1692 }
1693 } 1693 }
1694 1694
2060 case WM_COMMAND: 2060 case WM_COMMAND:
2061 { 2061 {
2062 int (*clickfunc)(HWND, void *) = tmp->signalfunction; 2062 int (*clickfunc)(HWND, void *) = tmp->signalfunction;
2063 HWND command; 2063 HWND command;
2064 ULONG passthru = (ULONG)LOWORD(mp1); 2064 ULONG passthru = (ULONG)LOWORD(mp1);
2065 ULONG message = HIWORD(mp1); 2065 ULONG message = (ULONG)HIWORD(mp1);
2066 2066
2067 command = (HWND)passthru; 2067 command = (HWND)(uintptr_t)passthru;
2068 2068
2069 if (message == LBN_SELCHANGE || message == CBN_SELCHANGE) 2069 if (message == LBN_SELCHANGE || message == CBN_SELCHANGE)
2070 { 2070 {
2071 int (*listboxselectfunc)(HWND, int, void *) = tmp->signalfunction; 2071 int (*listboxselectfunc)(HWND, int, void *) = tmp->signalfunction;
2072 2072
2099 { 2099 {
2100 _dw_toggle_checkable_menu_item( tmp->window, tmp->id ); 2100 _dw_toggle_checkable_menu_item( tmp->window, tmp->id );
2101 /* 2101 /*
2102 * Call the user supplied callback 2102 * Call the user supplied callback
2103 */ 2103 */
2104 result = clickfunc((HWND)tmp->id, tmp->data); 2104 result = clickfunc((HWND)(uintptr_t)tmp->id, tmp->data);
2105 tmp = NULL; 2105 tmp = NULL;
2106 } 2106 }
2107 } /* this fires for checkable menu items */ 2107 } /* this fires for checkable menu items */
2108 else if ( tmp->window < (HWND)65536 && command == tmp->window && tmp->message != WM_TIMER ) 2108 else if ( tmp->window < (HWND)65536 && command == tmp->window && tmp->message != WM_TIMER )
2109 { 2109 {
2110 _dw_toggle_checkable_menu_item( popup ? popup : tmp->window, (int)tmp->data ); 2110 _dw_toggle_checkable_menu_item( popup ? popup : tmp->window, DW_POINTER_TO_INT(tmp->data) );
2111 result = clickfunc(popup ? popup : tmp->window, tmp->data); 2111 result = clickfunc(popup ? popup : tmp->window, tmp->data);
2112 tmp = NULL; 2112 tmp = NULL;
2113 } 2113 }
2114 } 2114 }
2115 break; 2115 break;
2813 HBRUSH hbr = GetSysColorBrush(COLOR_3DFACE); 2813 HBRUSH hbr = GetSysColorBrush(COLOR_3DFACE);
2814 2814
2815 SetBkColor((HDC)mp1, GetSysColor(COLOR_3DFACE)); 2815 SetBkColor((HDC)mp1, GetSysColor(COLOR_3DFACE));
2816 2816
2817 SelectObject((HDC)mp1, hbr); 2817 SelectObject((HDC)mp1, hbr);
2818 return (LONG)hbr; 2818 return (LONG)(intptr_t)hbr;
2819 } 2819 }
2820 else if(thisback != -1 && thisback != DW_RGB_TRANSPARENT) 2820 else if(thisback != -1 && thisback != DW_RGB_TRANSPARENT)
2821 { 2821 {
2822 int back = _internal_color(thisback); 2822 int back = _internal_color(thisback);
2823 2823
2828 DeleteObject(thiscinfo->hbrush); 2828 DeleteObject(thiscinfo->hbrush);
2829 thiscinfo->hbrush = CreateSolidBrush(RGB(DW_RED_VALUE(back), 2829 thiscinfo->hbrush = CreateSolidBrush(RGB(DW_RED_VALUE(back),
2830 DW_GREEN_VALUE(back), 2830 DW_GREEN_VALUE(back),
2831 DW_BLUE_VALUE(back))); 2831 DW_BLUE_VALUE(back)));
2832 SelectObject((HDC)mp1, thiscinfo->hbrush); 2832 SelectObject((HDC)mp1, thiscinfo->hbrush);
2833 return (LONG)thiscinfo->hbrush; 2833 return (LONG)(intptr_t)thiscinfo->hbrush;
2834 } 2834 }
2835 } 2835 }
2836 #ifdef AEROGLASS 2836 #ifdef AEROGLASS
2837 switch(msg) 2837 switch(msg)
2838 { 2838 {
3111 newx = x - newx - SPLITBAR_WIDTH; 3111 newx = x - newx - SPLITBAR_WIDTH;
3112 3112
3113 MoveWindow(handle2, x - newx, 0, newx, y, FALSE); 3113 MoveWindow(handle2, x - newx, 0, newx, y, FALSE);
3114 _do_resize(tmp, newx - 1, y - 1); 3114 _do_resize(tmp, newx - 1, y - 1);
3115 3115
3116 dw_window_set_data(hwnd, "_dw_start", (void *)newx); 3116 dw_window_set_data(hwnd, "_dw_start", DW_INT_TO_POINTER(newx));
3117 } 3117 }
3118 else 3118 else
3119 { 3119 {
3120 int newy = y; 3120 int newy = y;
3121 float ratio = (float)(100.0-percent)/(float)100.0; 3121 float ratio = (float)(100.0-percent)/(float)100.0;
3131 newy = y - newy - SPLITBAR_WIDTH; 3131 newy = y - newy - SPLITBAR_WIDTH;
3132 3132
3133 MoveWindow(handle1, 0, 0, x, newy, FALSE); 3133 MoveWindow(handle1, 0, 0, x, newy, FALSE);
3134 _do_resize(tmp, x - 1, newy - 1); 3134 _do_resize(tmp, x - 1, newy - 1);
3135 3135
3136 dw_window_set_data(hwnd, "_dw_start", (void *)newy); 3136 dw_window_set_data(hwnd, "_dw_start", DW_INT_TO_POINTER(newy));
3137 } 3137 }
3138 3138
3139 ShowWindow(handle1, SW_SHOW); 3139 ShowWindow(handle1, SW_SHOW);
3140 ShowWindow(handle2, SW_SHOW); 3140 ShowWindow(handle2, SW_SHOW);
3141 } 3141 }
3219 3219
3220 case WM_PAINT: 3220 case WM_PAINT:
3221 { 3221 {
3222 PAINTSTRUCT ps; 3222 PAINTSTRUCT ps;
3223 HDC hdcPaint; 3223 HDC hdcPaint;
3224 int type = (int)dw_window_get_data(hwnd, "_dw_type"); 3224 int type = DW_POINTER_TO_INT(dw_window_get_data(hwnd, "_dw_type"));
3225 int start = (int)dw_window_get_data(hwnd, "_dw_start"); 3225 int start = DW_POINTER_TO_INT(dw_window_get_data(hwnd, "_dw_start"));
3226 3226
3227 BeginPaint(hwnd, &ps); 3227 BeginPaint(hwnd, &ps);
3228 3228
3229 if((hdcPaint = GetDC(hwnd)) != NULL) 3229 if((hdcPaint = GetDC(hwnd)) != NULL)
3230 { 3230 {
3258 } 3258 }
3259 break; 3259 break;
3260 case WM_MOUSEMOVE: 3260 case WM_MOUSEMOVE:
3261 { 3261 {
3262 float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent"); 3262 float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent");
3263 int type = (int)dw_window_get_data(hwnd, "_dw_type"); 3263 int type = DW_POINTER_TO_INT(dw_window_get_data(hwnd, "_dw_type"));
3264 int start; 3264 int start;
3265 3265
3266 if(type == DW_HORZ) 3266 if(type == DW_HORZ)
3267 SetCursor(LoadCursor(NULL, IDC_SIZEWE)); 3267 SetCursor(LoadCursor(NULL, IDC_SIZEWE));
3268 else 3268 else
3744 GpPen *pen; 3744 GpPen *pen;
3745 3745
3746 GdipCreatePen1(gpfore, 1.0, UnitPixel, &pen); 3746 GdipCreatePen1(gpfore, 1.0, UnitPixel, &pen);
3747 TlsSetValue(_gpPen, (LPVOID)pen); 3747 TlsSetValue(_gpPen, (LPVOID)pen);
3748 GdipCreateSolidFill(gpfore, &brush); 3748 GdipCreateSolidFill(gpfore, &brush);
3749 TlsSetValue(_gpBrush, (LPVOID)brush); 3749 TlsSetValue(_gpBrush, brush);
3750 #endif 3750 #endif
3751 TlsSetValue(_foreground, (LPVOID)foreground); 3751 TlsSetValue(_foreground, DW_UINT_TO_POINTER(foreground));
3752 TlsSetValue(_background, (LPVOID)background); 3752 TlsSetValue(_background, DW_UINT_TO_POINTER(background));
3753 TlsSetValue(_hPen, CreatePen(PS_SOLID, 1, foreground)); 3753 TlsSetValue(_hPen, CreatePen(PS_SOLID, 1, foreground));
3754 TlsSetValue(_hBrush, CreateSolidBrush(foreground)); 3754 TlsSetValue(_hBrush, CreateSolidBrush(foreground));
3755 } 3755 }
3756 3756
3757 /* 3757 /*
4264 4264
4265 /* Handle special case for menu handle */ 4265 /* Handle special case for menu handle */
4266 if(handle < (HWND)65536) 4266 if(handle < (HWND)65536)
4267 { 4267 {
4268 char buffer[31] = {0}; 4268 char buffer[31] = {0};
4269 ULONG id = (ULONG)handle; 4269 ULONG id = (ULONG)(uintptr_t)handle;
4270 4270
4271 _snprintf(buffer, 30, "_dw_id%ld", id); 4271 _snprintf(buffer, 30, "_dw_id%ld", id);
4272 menu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer); 4272 menu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer);
4273 4273
4274 if(menu && IsMenu(menu)) 4274 if(menu && IsMenu(menu))
4998 * handle: Handle to widget for which to change. 4998 * handle: Handle to widget for which to change.
4999 * cursortype: ID of the pointer you want. 4999 * cursortype: ID of the pointer you want.
5000 */ 5000 */
5001 void API dw_window_set_pointer(HWND handle, int pointertype) 5001 void API dw_window_set_pointer(HWND handle, int pointertype)
5002 { 5002 {
5003 HCURSOR cursor = pointertype < 65536 ? LoadCursor(NULL, MAKEINTRESOURCE(pointertype)) : (HCURSOR)pointertype; 5003 HCURSOR cursor = pointertype < 65536 ? LoadCursor(NULL, MAKEINTRESOURCE(pointertype)) : (HCURSOR)(intptr_t)pointertype;
5004 5004
5005 if(!pointertype) 5005 if(!pointertype)
5006 dw_window_set_data(handle, "_dw_cursor", 0); 5006 dw_window_set_data(handle, "_dw_cursor", 0);
5007 else 5007 else
5008 { 5008 {
5009 dw_window_set_data(handle, "_dw_cursor", (void *)cursor); 5009 dw_window_set_data(handle, "_dw_cursor", DW_POINTER(cursor));
5010 SetCursor(cursor); 5010 SetCursor(cursor);
5011 } 5011 }
5012 } 5012 }
5013 5013
5014 /* 5014 /*
5241 hwndframe = CreateWindow(TEXT("MDICLIENT"), 5241 hwndframe = CreateWindow(TEXT("MDICLIENT"),
5242 NULL, 5242 NULL,
5243 WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS, 5243 WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS,
5244 0,0,0,0, 5244 0,0,0,0,
5245 DW_HWND_OBJECT, 5245 DW_HWND_OBJECT,
5246 (HMENU)id, 5246 (HMENU)(uintptr_t)id,
5247 DWInstance, 5247 DWInstance,
5248 &ccs); 5248 &ccs);
5249 return hwndframe; 5249 return hwndframe;
5250 } 5250 }
5251 5251
5260 return CreateWindow(BrowserClassName, 5260 return CreateWindow(BrowserClassName,
5261 NULL, 5261 NULL,
5262 WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS, 5262 WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS,
5263 0,0,0,0, 5263 0,0,0,0,
5264 DW_HWND_OBJECT, 5264 DW_HWND_OBJECT,
5265 (HMENU)id, 5265 (HMENU)(uintptr_t)id,
5266 DWInstance, 5266 DWInstance,
5267 NULL); 5267 NULL);
5268 #else 5268 #else
5269 dw_debug("HTML widget not available; Support not enabled in this build.\n"); 5269 dw_debug("HTML widget not available; Support not enabled in this build.\n");
5270 return 0; 5270 return 0;
5337 NULL, 5337 NULL,
5338 SS_BITMAP | SS_CENTERIMAGE | WS_VISIBLE | 5338 SS_BITMAP | SS_CENTERIMAGE | WS_VISIBLE |
5339 WS_CHILD | WS_CLIPCHILDREN, 5339 WS_CHILD | WS_CLIPCHILDREN,
5340 0,0,0,0, 5340 0,0,0,0,
5341 DW_HWND_OBJECT, 5341 DW_HWND_OBJECT,
5342 (HMENU)id, 5342 (HMENU)(uintptr_t)id,
5343 DWInstance, 5343 DWInstance,
5344 NULL); 5344 NULL);
5345 } 5345 }
5346 5346
5347 /* 5347 /*
5363 tmp = CreateWindow(WC_TABCONTROL, 5363 tmp = CreateWindow(WC_TABCONTROL,
5364 NULL, 5364 NULL,
5365 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | flags, 5365 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | flags,
5366 0,0,0,0, 5366 0,0,0,0,
5367 DW_HWND_OBJECT, 5367 DW_HWND_OBJECT,
5368 (HMENU)id, 5368 (HMENU)(uintptr_t)id,
5369 DWInstance, 5369 DWInstance,
5370 NULL); 5370 NULL);
5371 cinfo->fore = cinfo->back = -1; 5371 cinfo->fore = cinfo->back = -1;
5372 cinfo->pOldProc = SubclassWindow(tmp, _simplewndproc); 5372 cinfo->pOldProc = SubclassWindow(tmp, _simplewndproc);
5373 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 5373 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
5545 mii.cch = (UINT)_tcslen(mii.dwTypeData); 5545 mii.cch = (UINT)_tcslen(mii.dwTypeData);
5546 5546
5547 InsertMenuItem(mymenu, 65535, TRUE, &mii); 5547 InsertMenuItem(mymenu, 65535, TRUE, &mii);
5548 5548
5549 _snprintf(buffer, 30, "_dw_id%ld", id); 5549 _snprintf(buffer, 30, "_dw_id%ld", id);
5550 dw_window_set_data( DW_HWND_OBJECT, buffer, (void *)mymenu ); 5550 dw_window_set_data( DW_HWND_OBJECT, buffer, DW_POINTER(mymenu) );
5551 _snprintf(buffer, 30, "_dw_checkable%ld", id); 5551 _snprintf(buffer, 30, "_dw_checkable%ld", id);
5552 dw_window_set_data( DW_HWND_OBJECT, buffer, (void *)check ); 5552 dw_window_set_data( DW_HWND_OBJECT, buffer, DW_INT_TO_POINTER(check) );
5553 _snprintf(buffer, 30, "_dw_ischecked%ld", id); 5553 _snprintf(buffer, 30, "_dw_ischecked%ld", id);
5554 dw_window_set_data( DW_HWND_OBJECT, buffer, (void *)is_checked ); 5554 dw_window_set_data( DW_HWND_OBJECT, buffer, DW_INT_TO_POINTER(is_checked) );
5555 _snprintf(buffer, 30, "_dw_isdisabled%ld", id); 5555 _snprintf(buffer, 30, "_dw_isdisabled%ld", id);
5556 dw_window_set_data( DW_HWND_OBJECT, buffer, (void *)is_disabled ); 5556 dw_window_set_data( DW_HWND_OBJECT, buffer, DW_INT_TO_POINTER(is_disabled) );
5557 5557
5558 if (submenu) 5558 if (submenu)
5559 { 5559 {
5560 MENUINFO mi; 5560 MENUINFO mi;
5561 5561
5566 SetMenuInfo( (HMENU)submenu, &mi ); 5566 SetMenuInfo( (HMENU)submenu, &mi );
5567 } 5567 }
5568 5568
5569 if (IsWindow(menux) && !IsMenu((HMENU)menux)) 5569 if (IsWindow(menux) && !IsMenu((HMENU)menux))
5570 DrawMenuBar(menux); 5570 DrawMenuBar(menux);
5571 return (HWND)id; 5571 return (HWND)(uintptr_t)id;
5572 } 5572 }
5573 5573
5574 /* 5574 /*
5575 * Sets the state of a menu item check. 5575 * Sets the state of a menu item check.
5576 * Deprecated: use dw_menu_item_set_state() 5576 * Deprecated: use dw_menu_item_set_state()
5603 SetMenuItemInfo( mymenu, id, FALSE, &mii ); 5603 SetMenuItemInfo( mymenu, id, FALSE, &mii );
5604 /* 5604 /*
5605 * Keep our internal state consistent 5605 * Keep our internal state consistent
5606 */ 5606 */
5607 _snprintf( buffer, 30, "_dw_ischecked%ld", id ); 5607 _snprintf( buffer, 30, "_dw_ischecked%ld", id );
5608 dw_window_set_data( DW_HWND_OBJECT, buffer, (void *)check ); 5608 dw_window_set_data( DW_HWND_OBJECT, buffer, DW_INT_TO_POINTER(check) );
5609 } 5609 }
5610 5610
5611 /* 5611 /*
5612 * Sets the state of a menu item. 5612 * Sets the state of a menu item.
5613 * Parameters: 5613 * Parameters:
5626 5626
5627 if (IsWindow(menux) && !IsMenu(mymenu)) 5627 if (IsWindow(menux) && !IsMenu(mymenu))
5628 mymenu = (HMENU)dw_window_get_data(menux, "_dw_menu"); 5628 mymenu = (HMENU)dw_window_get_data(menux, "_dw_menu");
5629 5629
5630 _snprintf( buffer1, 30, "_dw_ischecked%ld", id ); 5630 _snprintf( buffer1, 30, "_dw_ischecked%ld", id );
5631 check = (int)dw_window_get_data( DW_HWND_OBJECT, buffer1 ); 5631 check = DW_POINTER_TO_INT(dw_window_get_data( DW_HWND_OBJECT, buffer1 ));
5632 _snprintf( buffer2, 30, "_dw_isdisabled%ld", id ); 5632 _snprintf( buffer2, 30, "_dw_isdisabled%ld", id );
5633 disabled = (int)dw_window_get_data( DW_HWND_OBJECT, buffer2 ); 5633 disabled = DW_POINTER_TO_INT(dw_window_get_data( DW_HWND_OBJECT, buffer2 ));
5634 5634
5635 memset( &mii, 0, sizeof(mii) ); 5635 memset( &mii, 0, sizeof(mii) );
5636 5636
5637 mii.cbSize = sizeof(MENUITEMINFO); 5637 mii.cbSize = sizeof(MENUITEMINFO);
5638 mii.fMask = MIIM_STATE | MIIM_CHECKMARKS; 5638 mii.fMask = MIIM_STATE | MIIM_CHECKMARKS;
5695 } 5695 }
5696 SetMenuItemInfo( mymenu, id, FALSE, &mii ); 5696 SetMenuItemInfo( mymenu, id, FALSE, &mii );
5697 /* 5697 /*
5698 * Keep our internal checked state consistent 5698 * Keep our internal checked state consistent
5699 */ 5699 */
5700 dw_window_set_data( DW_HWND_OBJECT, buffer1, (void *)check ); 5700 dw_window_set_data( DW_HWND_OBJECT, buffer1, DW_INT_TO_POINTER(check) );
5701 dw_window_set_data( DW_HWND_OBJECT, buffer2, (void *)disabled ); 5701 dw_window_set_data( DW_HWND_OBJECT, buffer2, DW_INT_TO_POINTER(disabled) );
5702 } 5702 }
5703 5703
5704 /* 5704 /*
5705 * Deletes the menu item specified 5705 * Deletes the menu item specified
5706 * Parameters: 5706 * Parameters:
5719 if ( mymenu == 0 || DeleteMenu(mymenu, id, MF_BYCOMMAND) == 0 ) 5719 if ( mymenu == 0 || DeleteMenu(mymenu, id, MF_BYCOMMAND) == 0 )
5720 return DW_ERROR_UNKNOWN; 5720 return DW_ERROR_UNKNOWN;
5721 5721
5722 /* If the ID was autogenerated it is safe to remove it */ 5722 /* If the ID was autogenerated it is safe to remove it */
5723 if(id >= 30000) 5723 if(id >= 30000)
5724 dw_signal_disconnect_by_window((HWND)id); 5724 dw_signal_disconnect_by_window((HWND)(uintptr_t)id);
5725 5725
5726 /* Make sure the menu is redrawn if needed */ 5726 /* Make sure the menu is redrawn if needed */
5727 if( (HMENU)menux != mymenu ) 5727 if( (HMENU)menux != mymenu )
5728 DrawMenuBar(menux); 5728 DrawMenuBar(menux);
5729 return DW_ERROR_NONE; 5729 return DW_ERROR_NONE;
5768 LVS_REPORT | LVS_SHOWSELALWAYS | 5768 LVS_REPORT | LVS_SHOWSELALWAYS |
5769 LVS_SHAREIMAGELISTS | WS_BORDER | 5769 LVS_SHAREIMAGELISTS | WS_BORDER |
5770 WS_CLIPCHILDREN, 5770 WS_CLIPCHILDREN,
5771 0,0,0,0, 5771 0,0,0,0,
5772 DW_HWND_OBJECT, 5772 DW_HWND_OBJECT,
5773 (HMENU)id, 5773 (HMENU)(uintptr_t)id,
5774 DWInstance, 5774 DWInstance,
5775 NULL); 5775 NULL);
5776 ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo)); 5776 ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo));
5777 5777
5778 if(!cinfo) 5778 if(!cinfo)
5810 TVS_HASLINES | TVS_SHOWSELALWAYS | 5810 TVS_HASLINES | TVS_SHOWSELALWAYS |
5811 TVS_HASBUTTONS | TVS_LINESATROOT | 5811 TVS_HASBUTTONS | TVS_LINESATROOT |
5812 WS_BORDER | WS_CLIPCHILDREN, 5812 WS_BORDER | WS_CLIPCHILDREN,
5813 0,0,0,0, 5813 0,0,0,0,
5814 DW_HWND_OBJECT, 5814 DW_HWND_OBJECT,
5815 (HMENU)id, 5815 (HMENU)(uintptr_t)id,
5816 DWInstance, 5816 DWInstance,
5817 NULL); 5817 NULL);
5818 ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo)); 5818 ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo));
5819 TreeView_SetItemHeight(tmp, 16); 5819 TreeView_SetItemHeight(tmp, 16);
5820 5820
5874 UTF8toWide(text), 5874 UTF8toWide(text),
5875 SS_NOPREFIX | SS_NOTIFY | SS_LEFTNOWORDWRAP | 5875 SS_NOPREFIX | SS_NOTIFY | SS_LEFTNOWORDWRAP |
5876 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, 5876 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN,
5877 0,0,0,0, 5877 0,0,0,0,
5878 DW_HWND_OBJECT, 5878 DW_HWND_OBJECT,
5879 (HMENU)id, 5879 (HMENU)(uintptr_t)id,
5880 DWInstance, 5880 DWInstance,
5881 NULL); 5881 NULL);
5882 #ifdef AEROGLASS 5882 #ifdef AEROGLASS
5883 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); 5883 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo));
5884 5884
5903 HWND tmp = CreateWindow(StatusbarClassName, 5903 HWND tmp = CreateWindow(StatusbarClassName,
5904 UTF8toWide(text), 5904 UTF8toWide(text),
5905 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, 5905 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN,
5906 0,0,0,0, 5906 0,0,0,0,
5907 DW_HWND_OBJECT, 5907 DW_HWND_OBJECT,
5908 (HMENU)id, 5908 (HMENU)(uintptr_t)id,
5909 DWInstance, 5909 DWInstance,
5910 NULL); 5910 NULL);
5911 dw_window_set_font(tmp, DefaultFont); 5911 dw_window_set_font(tmp, DefaultFont);
5912 return tmp; 5912 return tmp;
5913 } 5913 }
5927 WS_VSCROLL | ES_MULTILINE | 5927 WS_VSCROLL | ES_MULTILINE |
5928 ES_WANTRETURN | WS_CHILD | 5928 ES_WANTRETURN | WS_CHILD |
5929 WS_CLIPCHILDREN, 5929 WS_CLIPCHILDREN,
5930 0,0,0,0, 5930 0,0,0,0,
5931 DW_HWND_OBJECT, 5931 DW_HWND_OBJECT,
5932 (HMENU)id, 5932 (HMENU)(uintptr_t)id,
5933 DWInstance, 5933 DWInstance,
5934 NULL); 5934 NULL);
5935 ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo)); 5935 ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo));
5936 5936
5937 if(!cinfo) 5937 if(!cinfo)
5963 ES_WANTRETURN | WS_CHILD | 5963 ES_WANTRETURN | WS_CHILD |
5964 WS_BORDER | ES_AUTOHSCROLL | 5964 WS_BORDER | ES_AUTOHSCROLL |
5965 WS_VISIBLE | WS_CLIPCHILDREN, 5965 WS_VISIBLE | WS_CLIPCHILDREN,
5966 0,0,0,0, 5966 0,0,0,0,
5967 DW_HWND_OBJECT, 5967 DW_HWND_OBJECT,
5968 (HMENU)id, 5968 (HMENU)(uintptr_t)id,
5969 DWInstance, 5969 DWInstance,
5970 NULL); 5970 NULL);
5971 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); 5971 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo));
5972 5972
5973 cinfo->back = cinfo->fore = -1; 5973 cinfo->back = cinfo->fore = -1;
5992 ES_WANTRETURN | WS_CHILD | 5992 ES_WANTRETURN | WS_CHILD |
5993 ES_PASSWORD | WS_BORDER | WS_VISIBLE | 5993 ES_PASSWORD | WS_BORDER | WS_VISIBLE |
5994 ES_AUTOHSCROLL | WS_CLIPCHILDREN, 5994 ES_AUTOHSCROLL | WS_CLIPCHILDREN,
5995 0,0,0,0, 5995 0,0,0,0,
5996 DW_HWND_OBJECT, 5996 DW_HWND_OBJECT,
5997 (HMENU)id, 5997 (HMENU)(uintptr_t)id,
5998 DWInstance, 5998 DWInstance,
5999 NULL); 5999 NULL);
6000 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); 6000 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo));
6001 6001
6002 cinfo->back = cinfo->fore = -1; 6002 cinfo->back = cinfo->fore = -1;
6032 UTF8toWide(text), 6032 UTF8toWide(text),
6033 WS_CHILD | CBS_DROPDOWN | WS_VSCROLL | 6033 WS_CHILD | CBS_DROPDOWN | WS_VSCROLL |
6034 WS_CLIPCHILDREN | CBS_AUTOHSCROLL | WS_VISIBLE, 6034 WS_CLIPCHILDREN | CBS_AUTOHSCROLL | WS_VISIBLE,
6035 0,0,0,0, 6035 0,0,0,0,
6036 DW_HWND_OBJECT, 6036 DW_HWND_OBJECT,
6037 (HMENU)id, 6037 (HMENU)(uintptr_t)id,
6038 DWInstance, 6038 DWInstance,
6039 NULL); 6039 NULL);
6040 ColorInfo *cinfo = (ColorInfo *)calloc(1, sizeof(ColorInfo)); 6040 ColorInfo *cinfo = (ColorInfo *)calloc(1, sizeof(ColorInfo));
6041 ColorInfo *cinfo2 = (ColorInfo *)calloc(1, sizeof(ColorInfo)); 6041 ColorInfo *cinfo2 = (ColorInfo *)calloc(1, sizeof(ColorInfo));
6042 6042
6076 UTF8toWide(text), 6076 UTF8toWide(text),
6077 WS_CHILD | BS_PUSHBUTTON | 6077 WS_CHILD | BS_PUSHBUTTON |
6078 WS_VISIBLE | WS_CLIPCHILDREN, 6078 WS_VISIBLE | WS_CLIPCHILDREN,
6079 0,0,0,0, 6079 0,0,0,0,
6080 DW_HWND_OBJECT, 6080 DW_HWND_OBJECT,
6081 (HMENU)id, 6081 (HMENU)(uintptr_t)id,
6082 DWInstance, 6082 DWInstance,
6083 NULL); 6083 NULL);
6084 cinfo->fore = cinfo->back = -1; 6084 cinfo->fore = cinfo->back = -1;
6085 cinfo->pOldProc = SubclassWindow(tmp, _BtProc); 6085 cinfo->pOldProc = SubclassWindow(tmp, _BtProc);
6086 6086
6154 else 6154 else
6155 return 0; 6155 return 0;
6156 6156
6157 /* Create the toolbar */ 6157 /* Create the toolbar */
6158 tmp = CreateWindowEx(0L, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | TBSTYLE_AUTOSIZE | CCS_NORESIZE | 6158 tmp = CreateWindowEx(0L, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | TBSTYLE_AUTOSIZE | CCS_NORESIZE |
6159 CCS_NOPARENTALIGN | CCS_NODIVIDER, 0, 0, 100, 30, DW_HWND_OBJECT, (HMENU)id, DWInstance, NULL); 6159 CCS_NOPARENTALIGN | CCS_NODIVIDER, 0, 0, 100, 30, DW_HWND_OBJECT, (HMENU)(uintptr_t)id, DWInstance, NULL);
6160 6160
6161 /* Disable visual styles by default */ 6161 /* Disable visual styles by default */
6162 if(_SetWindowTheme) 6162 if(_SetWindowTheme)
6163 _SetWindowTheme(tmp, L"", L""); 6163 _SetWindowTheme(tmp, L"", L"");
6164 6164
6202 WS_CHILD | BS_PUSHBUTTON | 6202 WS_CHILD | BS_PUSHBUTTON |
6203 WS_VISIBLE | WS_CLIPCHILDREN | 6203 WS_VISIBLE | WS_CLIPCHILDREN |
6204 (icon ? BS_ICON : BS_BITMAP), 6204 (icon ? BS_ICON : BS_BITMAP),
6205 0,0,0,0, 6205 0,0,0,0,
6206 DW_HWND_OBJECT, 6206 DW_HWND_OBJECT,
6207 (HMENU)id, 6207 (HMENU)(uintptr_t)id,
6208 DWInstance, 6208 DWInstance,
6209 NULL); 6209 NULL);
6210 6210
6211 cinfo->fore = cinfo->back = -1; 6211 cinfo->fore = cinfo->back = -1;
6212 cinfo->pOldProc = SubclassWindow(tmp, _BtProc); 6212 cinfo->pOldProc = SubclassWindow(tmp, _BtProc);
6270 tmp = CreateWindow( BUTTONCLASSNAME, 6270 tmp = CreateWindow( BUTTONCLASSNAME,
6271 NULL, 6271 NULL,
6272 windowtype | WS_CHILD | BS_PUSHBUTTON | WS_CLIPCHILDREN | WS_VISIBLE, 6272 windowtype | WS_CHILD | BS_PUSHBUTTON | WS_CLIPCHILDREN | WS_VISIBLE,
6273 0,0,0,0, 6273 0,0,0,0,
6274 DW_HWND_OBJECT, 6274 DW_HWND_OBJECT,
6275 (HMENU)id, 6275 (HMENU)(uintptr_t)id,
6276 DWInstance, 6276 DWInstance,
6277 NULL); 6277 NULL);
6278 6278
6279 cinfo->fore = cinfo->back = -1; 6279 cinfo->fore = cinfo->back = -1;
6280 cinfo->pOldProc = SubclassWindow(tmp, _BtProc); 6280 cinfo->pOldProc = SubclassWindow(tmp, _BtProc);
6363 WS_CHILD | BS_PUSHBUTTON | 6363 WS_CHILD | BS_PUSHBUTTON |
6364 windowtype | WS_CLIPCHILDREN | 6364 windowtype | WS_CLIPCHILDREN |
6365 WS_VISIBLE, 6365 WS_VISIBLE,
6366 0,0,0,0, 6366 0,0,0,0,
6367 DW_HWND_OBJECT, 6367 DW_HWND_OBJECT,
6368 (HMENU)id, 6368 (HMENU)(uintptr_t)id,
6369 DWInstance, 6369 DWInstance,
6370 NULL ); 6370 NULL );
6371 6371
6372 cinfo->fore = cinfo->back = -1; 6372 cinfo->fore = cinfo->back = -1;
6373 cinfo->pOldProc = SubclassWindow( tmp, _BtProc ); 6373 cinfo->pOldProc = SubclassWindow( tmp, _BtProc );
6411 WS_CHILD | UDS_ALIGNRIGHT | WS_BORDER | 6411 WS_CHILD | UDS_ALIGNRIGHT | WS_BORDER |
6412 UDS_ARROWKEYS | UDS_SETBUDDYINT | 6412 UDS_ARROWKEYS | UDS_SETBUDDYINT |
6413 UDS_WRAP | UDS_NOTHOUSANDS | WS_VISIBLE, 6413 UDS_WRAP | UDS_NOTHOUSANDS | WS_VISIBLE,
6414 0,0,0,0, 6414 0,0,0,0,
6415 DW_HWND_OBJECT, 6415 DW_HWND_OBJECT,
6416 (HMENU)id, 6416 (HMENU)(uintptr_t)id,
6417 DWInstance, 6417 DWInstance,
6418 NULL); 6418 NULL);
6419 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); 6419 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo));
6420 6420
6421 SendMessage(tmp, UDM_SETRANGE32, (WPARAM)-65536,(LPARAM)65536); 6421 SendMessage(tmp, UDM_SETRANGE32, (WPARAM)-65536,(LPARAM)65536);
6454 UTF8toWide(text), 6454 UTF8toWide(text),
6455 WS_CHILD | BS_AUTORADIOBUTTON | 6455 WS_CHILD | BS_AUTORADIOBUTTON |
6456 WS_CLIPCHILDREN | WS_VISIBLE, 6456 WS_CLIPCHILDREN | WS_VISIBLE,
6457 0,0,0,0, 6457 0,0,0,0,
6458 DW_HWND_OBJECT, 6458 DW_HWND_OBJECT,
6459 (HMENU)id, 6459 (HMENU)(uintptr_t)id,
6460 DWInstance, 6460 DWInstance,
6461 NULL); 6461 NULL);
6462 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); 6462 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo));
6463 cinfo->fore = cinfo->back = -1; 6463 cinfo->fore = cinfo->back = -1;
6464 cinfo->pOldProc = SubclassWindow(tmp, _BtProc); 6464 cinfo->pOldProc = SubclassWindow(tmp, _BtProc);
6482 NULL, 6482 NULL,
6483 WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | 6483 WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE |
6484 (vertical ? TBS_VERT : TBS_HORZ), 6484 (vertical ? TBS_VERT : TBS_HORZ),
6485 0,0,0,0, 6485 0,0,0,0,
6486 DW_HWND_OBJECT, 6486 DW_HWND_OBJECT,
6487 (HMENU)id, 6487 (HMENU)(uintptr_t)id,
6488 DWInstance, 6488 DWInstance,
6489 NULL); 6489 NULL);
6490 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); 6490 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo));
6491 6491
6492 cinfo->back = cinfo->fore = -1; 6492 cinfo->back = cinfo->fore = -1;
6510 NULL, 6510 NULL,
6511 WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | 6511 WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE |
6512 (vertical ? SBS_VERT : SBS_HORZ), 6512 (vertical ? SBS_VERT : SBS_HORZ),
6513 0,0,0,0, 6513 0,0,0,0,
6514 DW_HWND_OBJECT, 6514 DW_HWND_OBJECT,
6515 (HMENU)id, 6515 (HMENU)(uintptr_t)id,
6516 DWInstance, 6516 DWInstance,
6517 NULL); 6517 NULL);
6518 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); 6518 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo));
6519 6519
6520 cinfo->back = cinfo->fore = -1; 6520 cinfo->back = cinfo->fore = -1;
6535 return CreateWindow(PROGRESS_CLASS, 6535 return CreateWindow(PROGRESS_CLASS,
6536 NULL, 6536 NULL,
6537 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, 6537 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN,
6538 0,0,0,0, 6538 0,0,0,0,
6539 DW_HWND_OBJECT, 6539 DW_HWND_OBJECT,
6540 (HMENU)id, 6540 (HMENU)(uintptr_t)id,
6541 DWInstance, 6541 DWInstance,
6542 NULL); 6542 NULL);
6543 } 6543 }
6544 6544
6545 /* 6545 /*
6555 UTF8toWide(text), 6555 UTF8toWide(text),
6556 WS_CHILD | BS_AUTOCHECKBOX | 6556 WS_CHILD | BS_AUTOCHECKBOX |
6557 BS_TEXT | WS_CLIPCHILDREN | WS_VISIBLE, 6557 BS_TEXT | WS_CLIPCHILDREN | WS_VISIBLE,
6558 0,0,0,0, 6558 0,0,0,0,
6559 DW_HWND_OBJECT, 6559 DW_HWND_OBJECT,
6560 (HMENU)id, 6560 (HMENU)(uintptr_t)id,
6561 DWInstance, 6561 DWInstance,
6562 NULL); 6562 NULL);
6563 cinfo->pOldProc = SubclassWindow(tmp, _BtProc); 6563 cinfo->pOldProc = SubclassWindow(tmp, _BtProc);
6564 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 6564 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
6565 dw_window_set_data(tmp, "_dw_checkbox", DW_INT_TO_POINTER(1)); 6565 dw_window_set_data(tmp, "_dw_checkbox", DW_INT_TO_POINTER(1));
6583 WS_CHILD | LBS_HASSTRINGS | 6583 WS_CHILD | LBS_HASSTRINGS |
6584 LBS_NOTIFY | WS_BORDER | WS_CLIPCHILDREN | 6584 LBS_NOTIFY | WS_BORDER | WS_CLIPCHILDREN |
6585 WS_VSCROLL | (multi ? LBS_MULTIPLESEL : 0) , 6585 WS_VSCROLL | (multi ? LBS_MULTIPLESEL : 0) ,
6586 0,0,0,0, 6586 0,0,0,0,
6587 DW_HWND_OBJECT, 6587 DW_HWND_OBJECT,
6588 (HMENU)id, 6588 (HMENU)(uintptr_t)id,
6589 DWInstance, 6589 DWInstance,
6590 NULL); 6590 NULL);
6591 ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo)); 6591 ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo));
6592 6592
6593 if(!cinfo) 6593 if(!cinfo)
6611 * handle: Handle to the window. 6611 * handle: Handle to the window.
6612 * id: An ID to be used to specify the icon. 6612 * id: An ID to be used to specify the icon.
6613 */ 6613 */
6614 void API dw_window_set_icon(HWND handle, HICN icon) 6614 void API dw_window_set_icon(HWND handle, HICN icon)
6615 { 6615 {
6616 int iicon = (int)icon; 6616 int iicon = DW_POINTER_TO_INT(icon);
6617 HICON hicon = iicon < 65536 ? LoadIcon(DWInstance, MAKEINTRESOURCE(iicon)) : (HICON)icon; 6617 HICON hicon = iicon < 65536 ? LoadIcon(DWInstance, MAKEINTRESOURCE(iicon)) : (HICON)icon;
6618 6618
6619 SendMessage(handle, WM_SETICON, 6619 SendMessage(handle, WM_SETICON,
6620 (WPARAM) IMAGE_ICON, 6620 (WPARAM) IMAGE_ICON,
6621 (LPARAM) hicon); 6621 (LPARAM) hicon);
6913 { 6913 {
6914 if(handle < (HWND)65536) 6914 if(handle < (HWND)65536)
6915 { 6915 {
6916 char buffer[31] = {0}; 6916 char buffer[31] = {0};
6917 HMENU mymenu; 6917 HMENU mymenu;
6918 ULONG id = (ULONG)handle; 6918 ULONG id = (ULONG)(uintptr_t)handle;
6919 6919
6920 _snprintf(buffer, 30, "_dw_id%ld", id); 6920 _snprintf(buffer, 30, "_dw_id%ld", id);
6921 mymenu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer); 6921 mymenu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer);
6922 6922
6923 if(mymenu && IsMenu(mymenu)) 6923 if(mymenu && IsMenu(mymenu))
6936 { 6936 {
6937 if(handle < (HWND)65536) 6937 if(handle < (HWND)65536)
6938 { 6938 {
6939 char buffer[31] = {0}; 6939 char buffer[31] = {0};
6940 HMENU mymenu; 6940 HMENU mymenu;
6941 ULONG id = (ULONG)handle; 6941 ULONG id = (ULONG)(uintptr_t)handle;
6942 6942
6943 _snprintf(buffer, 30, "_dw_id%ld", id); 6943 _snprintf(buffer, 30, "_dw_id%ld", id);
6944 mymenu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer); 6944 mymenu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer);
6945 6945
6946 if(mymenu && IsMenu(mymenu)) 6946 if(mymenu && IsMenu(mymenu))
7567 7567
7568 if(handle < (HWND)65536) 7568 if(handle < (HWND)65536)
7569 { 7569 {
7570 char buffer[31] = {0}; 7570 char buffer[31] = {0};
7571 HMENU mymenu; 7571 HMENU mymenu;
7572 ULONG id = (ULONG)handle; 7572 ULONG id = (ULONG)(uintptr_t)handle;
7573 7573
7574 _snprintf(buffer, 30, "_dw_id%ld", id); 7574 _snprintf(buffer, 30, "_dw_id%ld", id);
7575 mymenu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer); 7575 mymenu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer);
7576 7576
7577 if(mymenu && IsMenu(mymenu)) 7577 if(mymenu && IsMenu(mymenu))
7638 } 7638 }
7639 #endif 7639 #endif
7640 } 7640 }
7641 else if(_tcsnicmp(tmpbuf, STATICCLASSNAME, _tcslen(STATICCLASSNAME)+1)==0) 7641 else if(_tcsnicmp(tmpbuf, STATICCLASSNAME, _tcslen(STATICCLASSNAME)+1)==0)
7642 { 7642 {
7643 static ULONG halign = (SS_LEFTNOWORDWRAP | SS_RIGHT | SS_CENTER);
7644 ULONG thismask = mask & ~(DW_DT_VCENTER | DW_DT_WORDBREAK); 7643 ULONG thismask = mask & ~(DW_DT_VCENTER | DW_DT_WORDBREAK);
7645 ULONG thisstyle = style & ~(DW_DT_VCENTER | DW_DT_WORDBREAK); 7644 ULONG thisstyle = style & ~(DW_DT_VCENTER | DW_DT_WORDBREAK);
7646 ULONG type = style & mask & 0xFL; 7645 ULONG type = style & mask & 0xFL;
7647 7646
7648 /* Need to filter out bits that shouldn't be set */ 7647 /* Need to filter out bits that shouldn't be set */
8553 * handle: Handle to the scrollbar to be set. 8552 * handle: Handle to the scrollbar to be set.
8554 * position: Position of the scrollbar withing the range. 8553 * position: Position of the scrollbar withing the range.
8555 */ 8554 */
8556 void API dw_scrollbar_set_pos(HWND handle, unsigned int position) 8555 void API dw_scrollbar_set_pos(HWND handle, unsigned int position)
8557 { 8556 {
8558 dw_window_set_data(handle, "_dw_scrollbar_value", (void *)position); 8557 dw_window_set_data(handle, "_dw_scrollbar_value", DW_UINT_TO_POINTER(position));
8559 SendMessage(handle, SBM_SETPOS, (WPARAM)position, (LPARAM)TRUE); 8558 SendMessage(handle, SBM_SETPOS, (WPARAM)position, (LPARAM)TRUE);
8560 } 8559 }
8561 8560
8562 /* 8561 /*
8563 * Sets the scrollbar range. 8562 * Sets the scrollbar range.
9162 9161
9163 ShowWindow(handle, SW_HIDE); 9162 ShowWindow(handle, SW_HIDE);
9164 item = ListView_InsertItem(handle, &lvi); 9163 item = ListView_InsertItem(handle, &lvi);
9165 for(z=1;z<rowcount;z++) 9164 for(z=1;z<rowcount;z++)
9166 ListView_InsertItem(handle, &lvi); 9165 ListView_InsertItem(handle, &lvi);
9167 dw_window_set_data(handle, "_dw_insertitem", (void *)item); 9166 dw_window_set_data(handle, "_dw_insertitem", DW_INT_TO_POINTER(item));
9168 return (void *)handle; 9167 return (void *)handle;
9169 } 9168 }
9170 9169
9171 /* Finds a icon in the table, otherwise it adds it to the table 9170 /* Finds a icon in the table, otherwise it adds it to the table
9172 * and returns the index in the table. 9171 * and returns the index in the table.
9241 LV_ITEM lvi; 9240 LV_ITEM lvi;
9242 int item = 0; 9241 int item = 0;
9243 9242
9244 if(pointer) 9243 if(pointer)
9245 { 9244 {
9246 item = (int)dw_window_get_data(handle, "_dw_insertitem"); 9245 item = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_insertitem"));
9247 } 9246 }
9248 9247
9249 lvi.iItem = row + item; 9248 lvi.iItem = row + item;
9250 lvi.iSubItem = 0; 9249 lvi.iSubItem = 0;
9251 lvi.mask = LVIF_DI_SETITEM | LVIF_IMAGE | LVIF_TEXT; 9250 lvi.mask = LVIF_DI_SETITEM | LVIF_IMAGE | LVIF_TEXT;
9287 TCHAR textbuffer[101] = {0}; 9286 TCHAR textbuffer[101] = {0};
9288 int item = 0; 9287 int item = 0;
9289 9288
9290 if(pointer) 9289 if(pointer)
9291 { 9290 {
9292 item = (int)dw_window_get_data(handle, "_dw_insertitem"); 9291 item = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_insertitem"));
9293 } 9292 }
9294 9293
9295 if(!cinfo || !cinfo->flags) 9294 if(!cinfo || !cinfo->flags)
9296 return; 9295 return;
9297 9296
9506 LV_ITEM lvi; 9505 LV_ITEM lvi;
9507 int item = 0; 9506 int item = 0;
9508 9507
9509 if(pointer) 9508 if(pointer)
9510 { 9509 {
9511 item = (int)dw_window_get_data(handle, "_dw_insertitem"); 9510 item = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_insertitem"));
9512 } 9511 }
9513 9512
9514 lvi.iItem = row + item; 9513 lvi.iItem = row + item;
9515 lvi.iSubItem = 0; 9514 lvi.iSubItem = 0;
9516 lvi.mask = LVIF_PARAM; 9515 lvi.mask = LVIF_PARAM;
9574 * handle: Handle to the window (widget) to be deleted from. 9573 * handle: Handle to the window (widget) to be deleted from.
9575 * rowcount: The number of rows to be deleted. 9574 * rowcount: The number of rows to be deleted.
9576 */ 9575 */
9577 void API dw_container_delete(HWND handle, int rowcount) 9576 void API dw_container_delete(HWND handle, int rowcount)
9578 { 9577 {
9579 int z, _index = (int)dw_window_get_data(handle, "_dw_index"); 9578 int z, _index = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_index"));
9580 9579
9581 for(z=0;z<rowcount;z++) 9580 for(z=0;z<rowcount;z++)
9582 { 9581 {
9583 ListView_DeleteItem(handle, 0); 9582 ListView_DeleteItem(handle, 0);
9584 } 9583 }
9585 if(rowcount > _index) 9584 if(rowcount > _index)
9586 dw_window_set_data(handle, "_dw_index", 0); 9585 dw_window_set_data(handle, "_dw_index", 0);
9587 else 9586 else
9588 dw_window_set_data(handle, "_dw_index", (void *)(_index - rowcount)); 9587 dw_window_set_data(handle, "_dw_index", DW_INT_TO_POINTER((_index - rowcount)));
9589 } 9588 }
9590 9589
9591 /* 9590 /*
9592 * Scrolls container up or down. 9591 * Scrolls container up or down.
9593 * Parameters: 9592 * Parameters:
9630 lvi.iItem = _index; 9629 lvi.iItem = _index;
9631 lvi.mask = LVIF_PARAM; 9630 lvi.mask = LVIF_PARAM;
9632 9631
9633 ListView_GetItem(handle, &lvi); 9632 ListView_GetItem(handle, &lvi);
9634 9633
9635 dw_window_set_data(handle, "_dw_index", (void *)_index); 9634 dw_window_set_data(handle, "_dw_index", DW_INT_TO_POINTER(_index));
9636 return (char *)lvi.lParam; 9635 return (char *)lvi.lParam;
9637 } 9636 }
9638 9637
9639 /* 9638 /*
9640 * Continues an existing query of a container. 9639 * Continues an existing query of a container.
9645 * it will return all records in the container. 9644 * it will return all records in the container.
9646 */ 9645 */
9647 char * API dw_container_query_next(HWND handle, unsigned long flags) 9646 char * API dw_container_query_next(HWND handle, unsigned long flags)
9648 { 9647 {
9649 LV_ITEM lvi; 9648 LV_ITEM lvi;
9650 int _index = (int)dw_window_get_data(handle, "_dw_index"); 9649 int _index = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_index"));
9651 9650
9652 _index = ListView_GetNextItem(handle, _index, flags); 9651 _index = ListView_GetNextItem(handle, _index, flags);
9653 9652
9654 if(_index == -1) 9653 if(_index == -1)
9655 return NULL; 9654 return NULL;
9659 lvi.iItem = _index; 9658 lvi.iItem = _index;
9660 lvi.mask = LVIF_PARAM; 9659 lvi.mask = LVIF_PARAM;
9661 9660
9662 ListView_GetItem(handle, &lvi); 9661 ListView_GetItem(handle, &lvi);
9663 9662
9664 dw_window_set_data(handle, "_dw_index", (void *)_index); 9663 dw_window_set_data(handle, "_dw_index", DW_INT_TO_POINTER(_index));
9665 return (char *)lvi.lParam; 9664 return (char *)lvi.lParam;
9666 } 9665 }
9667 9666
9668 /* 9667 /*
9669 * Cursors the item with the text speficied, and scrolls to that item. 9668 * Cursors the item with the text speficied, and scrolls to that item.
9725 9724
9726 ListView_GetItem(handle, &lvi); 9725 ListView_GetItem(handle, &lvi);
9727 9726
9728 if ( (textcomp && lvi.lParam && strcmp( (char *)lvi.lParam, text ) == 0) || (!textcomp && (char *)lvi.lParam == text) ) 9727 if ( (textcomp && lvi.lParam && strcmp( (char *)lvi.lParam, text ) == 0) || (!textcomp && (char *)lvi.lParam == text) )
9729 { 9728 {
9730 int _index = (int)dw_window_get_data(handle, "_dw_index"); 9729 int _index = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_index"));
9731 9730
9732 if(index < _index) 9731 if(index < _index)
9733 dw_window_set_data(handle, "_dw_index", (void *)(_index - 1)); 9732 dw_window_set_data(handle, "_dw_index", DW_INT_TO_POINTER((_index - 1)));
9734 9733
9735 ListView_DeleteItem(handle, index); 9734 ListView_DeleteItem(handle, index);
9736 return; 9735 return;
9737 } 9736 }
9738 9737
9826 { 9825 {
9827 NOTIFYICONDATA tnid; 9826 NOTIFYICONDATA tnid;
9828 9827
9829 tnid.cbSize = sizeof(NOTIFYICONDATA); 9828 tnid.cbSize = sizeof(NOTIFYICONDATA);
9830 tnid.hWnd = handle; 9829 tnid.hWnd = handle;
9831 tnid.uID = (UINT)icon; 9830 tnid.uID = (UINT)(uintptr_t)icon;
9832 tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; 9831 tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
9833 tnid.uCallbackMessage = WM_USER+2; 9832 tnid.uCallbackMessage = WM_USER+2;
9834 tnid.hIcon = (HICON)icon; 9833 tnid.hIcon = (HICON)icon;
9835 if(bubbletext) 9834 if(bubbletext)
9836 _tcsncpy(tnid.szTip, UTF8toWide(bubbletext), sizeof(tnid.szTip)); 9835 _tcsncpy(tnid.szTip, UTF8toWide(bubbletext), sizeof(tnid.szTip));
9850 { 9849 {
9851 NOTIFYICONDATA tnid; 9850 NOTIFYICONDATA tnid;
9852 9851
9853 tnid.cbSize = sizeof(NOTIFYICONDATA); 9852 tnid.cbSize = sizeof(NOTIFYICONDATA);
9854 tnid.hWnd = handle; 9853 tnid.hWnd = handle;
9855 tnid.uID = (UINT)icon; 9854 tnid.uID = (UINT)(uintptr_t)icon;
9856 9855
9857 Shell_NotifyIcon(NIM_DELETE, &tnid); 9856 Shell_NotifyIcon(NIM_DELETE, &tnid);
9858 } 9857 }
9859 9858
9860 /* 9859 /*
9870 HWND tmp = CreateWindow(ObjectClassName, 9869 HWND tmp = CreateWindow(ObjectClassName,
9871 NULL, 9870 NULL,
9872 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, 9871 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN,
9873 0,0,0,0, 9872 0,0,0,0,
9874 DW_HWND_OBJECT, 9873 DW_HWND_OBJECT,
9875 (HMENU)id, 9874 (HMENU)(uintptr_t)id,
9876 DWInstance, 9875 DWInstance,
9877 NULL); 9876 NULL);
9878 newbox->pad = 0; 9877 newbox->pad = 0;
9879 newbox->type = 0; 9878 newbox->type = 0;
9880 newbox->count = 0; 9879 newbox->count = 0;
9913 GdipSetSolidFillColor(brush, gpfore); 9912 GdipSetSolidFillColor(brush, gpfore);
9914 #endif 9913 #endif
9915 9914
9916 DeleteObject(hPen); 9915 DeleteObject(hPen);
9917 DeleteObject(hBrush); 9916 DeleteObject(hBrush);
9918 TlsSetValue(_foreground, (LPVOID)foreground); 9917 TlsSetValue(_foreground, (LPVOID)(uintptr_t)foreground);
9919 TlsSetValue(_hPen, CreatePen(PS_SOLID, 1, foreground)); 9918 TlsSetValue(_hPen, CreatePen(PS_SOLID, 1, foreground));
9920 TlsSetValue(_hBrush, CreateSolidBrush(foreground)); 9919 TlsSetValue(_hBrush, CreateSolidBrush(foreground));
9921 } 9920 }
9922 9921
9923 /* Sets the current background drawing color. 9922 /* Sets the current background drawing color.
9934 background = RGB(DW_RED_VALUE(value), DW_GREEN_VALUE(value), DW_BLUE_VALUE(value)); 9933 background = RGB(DW_RED_VALUE(value), DW_GREEN_VALUE(value), DW_BLUE_VALUE(value));
9935 9934
9936 if(value == DW_RGB_TRANSPARENT) 9935 if(value == DW_RGB_TRANSPARENT)
9937 TlsSetValue(_background, (LPVOID)DW_RGB_TRANSPARENT); 9936 TlsSetValue(_background, (LPVOID)DW_RGB_TRANSPARENT);
9938 else 9937 else
9939 TlsSetValue(_background, (LPVOID)background); 9938 TlsSetValue(_background, (LPVOID)(uintptr_t)background);
9940 } 9939 }
9941 9940
9942 /* Allows the user to choose a color using the system's color chooser dialog. 9941 /* Allows the user to choose a color using the system's color chooser dialog.
9943 * Parameters: 9942 * Parameters:
9944 * value: current color 9943 * value: current color
10376 { 10375 {
10377 hFont = _acquire_font(handle, cinfo->fontname); 10376 hFont = _acquire_font(handle, cinfo->fontname);
10378 mustdelete = 1; 10377 mustdelete = 1;
10379 } 10378 }
10380 10379
10381 background = (COLORREF)TlsGetValue(_background); 10380 background = (COLORREF)(uintptr_t)TlsGetValue(_background);
10382 if(hFont) 10381 if(hFont)
10383 oldFont = SelectObject(hdc, hFont); 10382 oldFont = SelectObject(hdc, hFont);
10384 SetTextColor(hdc, (COLORREF)TlsGetValue(_foreground)); 10383 SetTextColor(hdc, (COLORREF)(uintptr_t)TlsGetValue(_foreground));
10385 if(background == DW_RGB_TRANSPARENT) 10384 if(background == DW_RGB_TRANSPARENT)
10386 SetBkMode(hdc, TRANSPARENT); 10385 SetBkMode(hdc, TRANSPARENT);
10387 else 10386 else
10388 { 10387 {
10389 SetBkMode(hdc, OPAQUE); 10388 SetBkMode(hdc, OPAQUE);
11358 HWND tmp = CreateWindow(SplitbarClassName, 11357 HWND tmp = CreateWindow(SplitbarClassName,
11359 NULL, 11358 NULL,
11360 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, 11359 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN,
11361 0,0,0,0, 11360 0,0,0,0,
11362 DW_HWND_OBJECT, 11361 DW_HWND_OBJECT,
11363 (HMENU)id, 11362 (HMENU)(uintptr_t)id,
11364 DWInstance, 11363 DWInstance,
11365 NULL); 11364 NULL);
11366 11365
11367 if(tmp) 11366 if(tmp)
11368 { 11367 {
11369 HWND tmpbox = dw_box_new(DW_VERT, 0); 11368 HWND tmpbox = dw_box_new(DW_VERT, 0);
11370 float *percent = (float *)malloc(sizeof(float)); 11369 float *percent = (float *)malloc(sizeof(float));
11371 11370
11372 dw_box_pack_start(tmpbox, topleft, 1, 1, TRUE, TRUE, 0); 11371 dw_box_pack_start(tmpbox, topleft, 1, 1, TRUE, TRUE, 0);
11373 SetParent(tmpbox, tmp); 11372 SetParent(tmpbox, tmp);
11374 dw_window_set_data(tmp, "_dw_topleft", (void *)tmpbox); 11373 dw_window_set_data(tmp, "_dw_topleft", DW_POINTER(tmpbox));
11375 11374
11376 tmpbox = dw_box_new(DW_VERT, 0); 11375 tmpbox = dw_box_new(DW_VERT, 0);
11377 dw_box_pack_start(tmpbox, bottomright, 1, 1, TRUE, TRUE, 0); 11376 dw_box_pack_start(tmpbox, bottomright, 1, 1, TRUE, TRUE, 0);
11378 SetParent(tmpbox, tmp); 11377 SetParent(tmpbox, tmp);
11379 dw_window_set_data(tmp, "_dw_bottomright", (void *)tmpbox); 11378 dw_window_set_data(tmp, "_dw_bottomright", DW_POINTER(tmpbox));
11380 *percent = 50.0; 11379 *percent = 50.0;
11381 dw_window_set_data(tmp, "_dw_percent", (void *)percent); 11380 dw_window_set_data(tmp, "_dw_percent", DW_POINTER(percent));
11382 dw_window_set_data(tmp, "_dw_type", (void *)type); 11381 dw_window_set_data(tmp, "_dw_type", DW_INT_TO_POINTER(type));
11383 } 11382 }
11384 return tmp; 11383 return tmp;
11385 } 11384 }
11386 11385
11387 /* 11386 /*
11390 * handle: The handle to the splitbar returned by dw_splitbar_new(). 11389 * handle: The handle to the splitbar returned by dw_splitbar_new().
11391 */ 11390 */
11392 void API dw_splitbar_set(HWND handle, float percent) 11391 void API dw_splitbar_set(HWND handle, float percent)
11393 { 11392 {
11394 float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent"); 11393 float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent");
11395 int type = (int)dw_window_get_data(handle, "_dw_type"); 11394 int type = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_type"));
11396 unsigned long width, height; 11395 unsigned long width, height;
11397 11396
11398 if(mypercent) 11397 if(mypercent)
11399 *mypercent = percent; 11398 *mypercent = percent;
11400 11399
11401 dw_window_get_pos_size(handle, NULL, NULL, &width, &height); 11400 dw_window_get_pos_size(handle, NULL, NULL, &width, &height);
11436 MONTHCAL_CLASS, 11435 MONTHCAL_CLASS,
11437 NULL, 11436 NULL,
11438 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | MCS_DAYSTATE, 11437 WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | MCS_DAYSTATE,
11439 0,0,0,0, 11438 0,0,0,0,
11440 DW_HWND_OBJECT, 11439 DW_HWND_OBJECT,
11441 (HMENU)id, 11440 (HMENU)(uintptr_t)id,
11442 DWInstance, 11441 DWInstance,
11443 NULL); 11442 NULL);
11444 if ( tmp ) 11443 if ( tmp )
11445 { 11444 {
11446 // Get the size required to show an entire month. 11445 // Get the size required to show an entire month.
11900 if(browseurl[z] == '/') 11899 if(browseurl[z] == '/')
11901 browseurl[z] = '\\'; 11900 browseurl[z] = '\\';
11902 } 11901 }
11903 } 11902 }
11904 11903
11905 retcode = (int)ShellExecute(NULL, TEXT("open"), UTF8toWide(browseurl), NULL, NULL, SW_SHOWNORMAL); 11904 retcode = DW_POINTER_TO_INT(ShellExecute(NULL, TEXT("open"), UTF8toWide(browseurl), NULL, NULL, SW_SHOWNORMAL));
11906 if(retcode<33 && retcode != 2) 11905 if(retcode<33 && retcode != 2)
11907 return DW_ERROR_UNKNOWN; 11906 return DW_ERROR_UNKNOWN;
11908 return DW_ERROR_NONE; 11907 return DW_ERROR_NONE;
11909 } 11908 }
11910 11909
12320 if (message == WM_COMMAND && window < (HWND)65536) 12319 if (message == WM_COMMAND && window < (HWND)65536)
12321 { 12320 {
12322 char buffer[16]; 12321 char buffer[16];
12323 HWND owner; 12322 HWND owner;
12324 12323
12325 _snprintf(buffer, 15, "_dw_id%d", (int)window); 12324 _snprintf(buffer, 15, "_dw_id%d", (int)(intptr_t)window);
12326 owner = (HWND)dw_window_get_data(DW_HWND_OBJECT, buffer); 12325 owner = (HWND)dw_window_get_data(DW_HWND_OBJECT, buffer);
12327 12326
12328 /* Make sure there are no dupes from popups */ 12327 /* Make sure there are no dupes from popups */
12329 dw_signal_disconnect_by_window(window); 12328 dw_signal_disconnect_by_window(window);
12330 12329
12331 if (owner) 12330 if (owner)
12332 { 12331 {
12333 id = (ULONG)window; 12332 id = (ULONG)(uintptr_t)window;
12334 window = owner; 12333 window = owner;
12335 } 12334 }
12336 } 12335 }
12337 _new_signal(message, window, id, sigfunc, data); 12336 _new_signal(message, window, id, sigfunc, data);
12338 } 12337 }
12352 if(!window || !signame || (message = _findsigmessage(signame)) == 0) 12351 if(!window || !signame || (message = _findsigmessage(signame)) == 0)
12353 return; 12352 return;
12354 12353
12355 while(tmp) 12354 while(tmp)
12356 { 12355 {
12357 if(((window < (HWND)65536 && (int)window == tmp->id) || tmp->window == window) && tmp->message == message) 12356 if(((window < (HWND)65536 && (int)(intptr_t)window == tmp->id) || tmp->window == window) && tmp->message == message)
12358 { 12357 {
12359 if(prev) 12358 if(prev)
12360 { 12359 {
12361 prev->next = tmp->next; 12360 prev->next = tmp->next;
12362 free(tmp); 12361 free(tmp);
12386 { 12385 {
12387 SignalHandler *prev = NULL, *tmp = Root; 12386 SignalHandler *prev = NULL, *tmp = Root;
12388 12387
12389 while(tmp) 12388 while(tmp)
12390 { 12389 {
12391 if((window < (HWND)65536 && (int)window == tmp->id) || tmp->window == window) 12390 if((window < (HWND)65536 && (int)(intptr_t)window == tmp->id) || tmp->window == window)
12392 { 12391 {
12393 if(prev) 12392 if(prev)
12394 { 12393 {
12395 prev->next = tmp->next; 12394 prev->next = tmp->next;
12396 free(tmp); 12395 free(tmp);
12421 { 12420 {
12422 SignalHandler *prev = NULL, *tmp = Root; 12421 SignalHandler *prev = NULL, *tmp = Root;
12423 12422
12424 while(tmp) 12423 while(tmp)
12425 { 12424 {
12426 if(((window < (HWND)65536 && (int)window == tmp->id) || tmp->window == window) && tmp->data == data) 12425 if(((window < (HWND)65536 && (int)(intptr_t)window == tmp->id) || tmp->window == window) && tmp->data == data)
12427 { 12426 {
12428 if(prev) 12427 if(prev)
12429 { 12428 {
12430 prev->next = tmp->next; 12429 prev->next = tmp->next;
12431 free(tmp); 12430 free(tmp);