comparison win/dw.c @ 2740:9be24001d288

Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing. Also convert SIZEEXPAND/STATIC and TYPEBOX/ITEM to the new format based on our new style guidelines. as _DW_SIZE_EXPAND/STATIC and _DW_TYPE_BOX/ITEM.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 19 Dec 2021 15:39:43 +0000
parents b0712a3debe2
children ee1cfa7d645e
comparison
equal deleted inserted replaced
2739:02c53dd5e21d 2740:9be24001d288
1461 firsthwnd = 0; 1461 firsthwnd = 0;
1462 } 1462 }
1463 1463
1464 for(z=beg;_dw_focus_comp(direction, z, end);z+=direction) 1464 for(z=beg;_dw_focus_comp(direction, z, end);z+=direction)
1465 { 1465 {
1466 if(box->items[z].type == TYPEBOX) 1466 if(box->items[z].type == _DW_TYPE_BOX)
1467 { 1467 {
1468 Box *thisbox = (Box *)GetWindowLongPtr(box->items[z].hwnd, GWLP_USERDATA); 1468 Box *thisbox = (Box *)GetWindowLongPtr(box->items[z].hwnd, GWLP_USERDATA);
1469 1469
1470 if(thisbox && _dw_focus_check_box(thisbox, handle, start == 3 ? 3 : 0, direction, defaultitem)) 1470 if(thisbox && _dw_focus_check_box(thisbox, handle, start == 3 ? 3 : 0, direction, defaultitem))
1471 return 1; 1471 return 1;
1692 /* Count up all the space for all items in the box */ 1692 /* Count up all the space for all items in the box */
1693 for(z=0;z<thisbox->count;z++) 1693 for(z=0;z<thisbox->count;z++)
1694 { 1694 {
1695 int itempad, itemwidth, itemheight; 1695 int itempad, itemwidth, itemheight;
1696 1696
1697 if(thisbox->items[z].type == TYPEBOX) 1697 if(thisbox->items[z].type == _DW_TYPE_BOX)
1698 { 1698 {
1699 Box *tmp = (Box *)GetWindowLongPtr(thisbox->items[z].hwnd, GWLP_USERDATA); 1699 Box *tmp = (Box *)GetWindowLongPtr(thisbox->items[z].hwnd, GWLP_USERDATA);
1700 1700
1701 if(tmp) 1701 if(tmp)
1702 { 1702 {
1734 if(thisbox->type == DW_VERT) 1734 if(thisbox->type == DW_VERT)
1735 { 1735 {
1736 if(itemwidth > uxmax) 1736 if(itemwidth > uxmax)
1737 uxmax = itemwidth; 1737 uxmax = itemwidth;
1738 1738
1739 if(thisbox->items[z].hsize != SIZEEXPAND) 1739 if(thisbox->items[z].hsize != _DW_SIZE_EXPAND)
1740 { 1740 {
1741 if(itemwidth > upxmax) 1741 if(itemwidth > upxmax)
1742 upxmax = itemwidth; 1742 upxmax = itemwidth;
1743 } 1743 }
1744 else 1744 else
1745 { 1745 {
1746 if(itempad > upxmax) 1746 if(itempad > upxmax)
1747 upxmax = itempad; 1747 upxmax = itempad;
1748 } 1748 }
1749 thisbox->minheight += itemheight; 1749 thisbox->minheight += itemheight;
1750 if(thisbox->items[z].vsize != SIZEEXPAND) 1750 if(thisbox->items[z].vsize != _DW_SIZE_EXPAND)
1751 thisbox->usedpady += itemheight; 1751 thisbox->usedpady += itemheight;
1752 else 1752 else
1753 thisbox->usedpady += itempad; 1753 thisbox->usedpady += itempad;
1754 } 1754 }
1755 else 1755 else
1756 { 1756 {
1757 if(itemheight > uymax) 1757 if(itemheight > uymax)
1758 uymax = itemheight; 1758 uymax = itemheight;
1759 if(thisbox->items[z].vsize != SIZEEXPAND) 1759 if(thisbox->items[z].vsize != _DW_SIZE_EXPAND)
1760 { 1760 {
1761 if(itemheight > upymax) 1761 if(itemheight > upymax)
1762 upymax = itemheight; 1762 upymax = itemheight;
1763 } 1763 }
1764 else 1764 else
1765 { 1765 {
1766 if(itempad > upymax) 1766 if(itempad > upymax)
1767 upymax = itempad; 1767 upymax = itempad;
1768 } 1768 }
1769 thisbox->minwidth += itemwidth; 1769 thisbox->minwidth += itemwidth;
1770 if(thisbox->items[z].hsize != SIZEEXPAND) 1770 if(thisbox->items[z].hsize != _DW_SIZE_EXPAND)
1771 thisbox->usedpadx += itemwidth; 1771 thisbox->usedpadx += itemwidth;
1772 else 1772 else
1773 thisbox->usedpadx += itempad; 1773 thisbox->usedpadx += itempad;
1774 } 1774 }
1775 } 1775 }
1796 int width = thisbox->items[z].width; 1796 int width = thisbox->items[z].width;
1797 int itempad = thisbox->items[z].pad * 2; 1797 int itempad = thisbox->items[z].pad * 2;
1798 int thispad = thisbox->pad * 2; 1798 int thispad = thisbox->pad * 2;
1799 1799
1800 /* Calculate the new sizes */ 1800 /* Calculate the new sizes */
1801 if(thisbox->items[z].hsize == SIZEEXPAND) 1801 if(thisbox->items[z].hsize == _DW_SIZE_EXPAND)
1802 { 1802 {
1803 if(thisbox->type == DW_HORZ) 1803 if(thisbox->type == DW_HORZ)
1804 { 1804 {
1805 int expandablex = thisbox->minwidth - thisbox->usedpadx; 1805 int expandablex = thisbox->minwidth - thisbox->usedpadx;
1806 1806
1808 width = (int)(((float)width / (float)expandablex) * (float)(x - thisbox->usedpadx)); 1808 width = (int)(((float)width / (float)expandablex) * (float)(x - thisbox->usedpadx));
1809 } 1809 }
1810 else 1810 else
1811 width = x - (itempad + thispad + thisbox->grouppadx); 1811 width = x - (itempad + thispad + thisbox->grouppadx);
1812 } 1812 }
1813 if(thisbox->items[z].vsize == SIZEEXPAND) 1813 if(thisbox->items[z].vsize == _DW_SIZE_EXPAND)
1814 { 1814 {
1815 if(thisbox->type == DW_VERT) 1815 if(thisbox->type == DW_VERT)
1816 { 1816 {
1817 int expandabley = thisbox->minheight - thisbox->usedpady; 1817 int expandabley = thisbox->minheight - thisbox->usedpady;
1818 1818
1971 MoveWindow(handle, currentx + pad + xborder, currenty + pad + yborder, width, height, FALSE); 1971 MoveWindow(handle, currentx + pad + xborder, currenty + pad + yborder, width, height, FALSE);
1972 else /* FIXME: This is a hack to generate WM_PAINT messages for items on the top-level */ 1972 else /* FIXME: This is a hack to generate WM_PAINT messages for items on the top-level */
1973 SetWindowPos(handle, HWND_TOP, currentx + pad + xborder, currenty + pad + yborder, width, height, 0); 1973 SetWindowPos(handle, HWND_TOP, currentx + pad + xborder, currenty + pad + yborder, width, height, 0);
1974 1974
1975 /* After placing a box... place its components */ 1975 /* After placing a box... place its components */
1976 if(thisbox->items[z].type == TYPEBOX) 1976 if(thisbox->items[z].type == _DW_TYPE_BOX)
1977 { 1977 {
1978 Box *boxinfo = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA); 1978 Box *boxinfo = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA);
1979 1979
1980 if(boxinfo) 1980 if(boxinfo)
1981 { 1981 {
3892 { 3892 {
3893 int z; 3893 int z;
3894 3894
3895 for(z=0;z<thisbox->count;z++) 3895 for(z=0;z<thisbox->count;z++)
3896 { 3896 {
3897 if(thisbox->items[z].type == TYPEBOX) 3897 if(thisbox->items[z].type == _DW_TYPE_BOX)
3898 { 3898 {
3899 Box *tmp = (Box*)GetWindowLongPtr(thisbox->items[z].hwnd, GWLP_USERDATA); 3899 Box *tmp = (Box*)GetWindowLongPtr(thisbox->items[z].hwnd, GWLP_USERDATA);
3900 _dw_change_box(tmp, percent, type); 3900 _dw_change_box(tmp, percent, type);
3901 } 3901 }
3902 else 3902 else
3903 { 3903 {
3904 if(type == DW_HORZ) 3904 if(type == DW_HORZ)
3905 { 3905 {
3906 if(thisbox->items[z].hsize == SIZEEXPAND) 3906 if(thisbox->items[z].hsize == _DW_SIZE_EXPAND)
3907 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0))); 3907 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0)));
3908 } 3908 }
3909 else 3909 else
3910 { 3910 {
3911 if(thisbox->items[z].vsize == SIZEEXPAND) 3911 if(thisbox->items[z].vsize == _DW_SIZE_EXPAND)
3912 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0))); 3912 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0)));
3913 } 3913 }
3914 } 3914 }
3915 } 3915 }
3916 } 3916 }
3927 { 3927 {
3928 int newx = x; 3928 int newx = x;
3929 float ratio = (float)percent/(float)100.0; 3929 float ratio = (float)percent/(float)100.0;
3930 Box *tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); 3930 Box *tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA);
3931 3931
3932 newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2); 3932 newx = (int)((float)newx * ratio) - (_DW_SPLITBAR_WIDTH/2);
3933 3933
3934 MoveWindow(handle1, 0, 0, newx, y, FALSE); 3934 MoveWindow(handle1, 0, 0, newx, y, FALSE);
3935 _dw_do_resize(tmp, newx - 1, y - 1, 0, 0); 3935 _dw_do_resize(tmp, newx - 1, y - 1, 0, 0);
3936 3936
3937 tmp = (Box *)GetWindowLongPtr(handle2, GWLP_USERDATA); 3937 tmp = (Box *)GetWindowLongPtr(handle2, GWLP_USERDATA);
3938 3938
3939 newx = x - newx - SPLITBAR_WIDTH; 3939 newx = x - newx - _DW_SPLITBAR_WIDTH;
3940 3940
3941 MoveWindow(handle2, x - newx, 0, newx, y, FALSE); 3941 MoveWindow(handle2, x - newx, 0, newx, y, FALSE);
3942 _dw_do_resize(tmp, newx - 1, y - 1, 0, 0); 3942 _dw_do_resize(tmp, newx - 1, y - 1, 0, 0);
3943 3943
3944 dw_window_set_data(hwnd, "_dw_start", DW_INT_TO_POINTER(newx)); 3944 dw_window_set_data(hwnd, "_dw_start", DW_INT_TO_POINTER(newx));
3947 { 3947 {
3948 int newy = y; 3948 int newy = y;
3949 float ratio = (float)(100.0-percent)/(float)100.0; 3949 float ratio = (float)(100.0-percent)/(float)100.0;
3950 Box *tmp = (Box *)GetWindowLongPtr(handle2, GWLP_USERDATA); 3950 Box *tmp = (Box *)GetWindowLongPtr(handle2, GWLP_USERDATA);
3951 3951
3952 newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2); 3952 newy = (int)((float)newy * ratio) - (_DW_SPLITBAR_WIDTH/2);
3953 3953
3954 MoveWindow(handle2, 0, y - newy, x, newy, FALSE); 3954 MoveWindow(handle2, 0, y - newy, x, newy, FALSE);
3955 _dw_do_resize(tmp, x - 1, newy - 1, 0, 0); 3955 _dw_do_resize(tmp, x - 1, newy - 1, 0, 0);
3956 3956
3957 tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); 3957 tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA);
3958 3958
3959 newy = y - newy - SPLITBAR_WIDTH; 3959 newy = y - newy - _DW_SPLITBAR_WIDTH;
3960 3960
3961 MoveWindow(handle1, 0, 0, x, newy, FALSE); 3961 MoveWindow(handle1, 0, 0, x, newy, FALSE);
3962 _dw_do_resize(tmp, x - 1, newy - 1, 0, 0); 3962 _dw_do_resize(tmp, x - 1, newy - 1, 0, 0);
3963 3963
3964 dw_window_set_data(hwnd, "_dw_start", DW_INT_TO_POINTER(newy)); 3964 dw_window_set_data(hwnd, "_dw_start", DW_INT_TO_POINTER(newy));
4066 HPEN oldPen = SelectObject(hdcPaint, CreatePen(PS_SOLID, 1, _dw_get_syscolor(COLOR_3DFACE))); 4066 HPEN oldPen = SelectObject(hdcPaint, CreatePen(PS_SOLID, 1, _dw_get_syscolor(COLOR_3DFACE)));
4067 4067
4068 dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy); 4068 dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy);
4069 4069
4070 if(type == DW_HORZ) 4070 if(type == DW_HORZ)
4071 Rectangle(hdcPaint, cx - start - SPLITBAR_WIDTH, 0, cx - start, cy); 4071 Rectangle(hdcPaint, cx - start - _DW_SPLITBAR_WIDTH, 0, cx - start, cy);
4072 else 4072 else
4073 Rectangle(hdcPaint, 0, start, cx, start + SPLITBAR_WIDTH); 4073 Rectangle(hdcPaint, 0, start, cx, start + _DW_SPLITBAR_WIDTH);
4074 4074
4075 SelectObject(hdcPaint, oldBrush); 4075 SelectObject(hdcPaint, oldBrush);
4076 DeleteObject(SelectObject(hdcPaint, oldPen)); 4076 DeleteObject(SelectObject(hdcPaint, oldPen));
4077 ReleaseDC(hwnd, hdcPaint); 4077 ReleaseDC(hwnd, hdcPaint);
4078 } 4078 }
4118 int height = (rect.bottom - rect.top); 4118 int height = (rect.bottom - rect.top);
4119 4119
4120 if(type == DW_HORZ) 4120 if(type == DW_HORZ)
4121 { 4121 {
4122 start = point.x - rect.left; 4122 start = point.x - rect.left;
4123 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH) 4123 if(width - _DW_SPLITBAR_WIDTH > 1 && start < width - _DW_SPLITBAR_WIDTH)
4124 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * (float)100.0; 4124 *percent = ((float)start / (float)(width - _DW_SPLITBAR_WIDTH)) * (float)100.0;
4125 } 4125 }
4126 else 4126 else
4127 { 4127 {
4128 start = point.y - rect.top; 4128 start = point.y - rect.top;
4129 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH) 4129 if(height - _DW_SPLITBAR_WIDTH > 1 && start < height - _DW_SPLITBAR_WIDTH)
4130 *percent = ((float)start / (float)(height - SPLITBAR_WIDTH)) * (float)100.0; 4130 *percent = ((float)start / (float)(height - _DW_SPLITBAR_WIDTH)) * (float)100.0;
4131 } 4131 }
4132 _dw_handle_splitbar_resize(hwnd, *percent, type, width, height); 4132 _dw_handle_splitbar_resize(hwnd, *percent, type, width, height);
4133 } 4133 }
4134 memcpy(&lastpoint, &point, sizeof(POINT)); 4134 memcpy(&lastpoint, &point, sizeof(POINT));
4135 } 4135 }
5751 SendMessage(handle, WM_SETFONT, (WPARAM)hfont, (LPARAM)TRUE); 5751 SendMessage(handle, WM_SETFONT, (WPARAM)hfont, (LPARAM)TRUE);
5752 if(oldfont) 5752 if(oldfont)
5753 DeleteObject(oldfont); 5753 DeleteObject(oldfont);
5754 5754
5755 /* Check to see if any of the sizes need to be recalculated */ 5755 /* Check to see if any of the sizes need to be recalculated */
5756 if(item && (item->origwidth == -1 || item->origheight == -1)) 5756 if(item && (item->origwidth == DW_SIZE_AUTO || item->origheight == DW_SIZE_AUTO))
5757 { 5757 {
5758 _dw_control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); 5758 _dw_control_size(handle, item->origwidth == DW_SIZE_AUTO ? &item->width : NULL, item->origheight == DW_SIZE_AUTO ? &item->height : NULL);
5759 /* Queue a redraw on the top-level window */ 5759 /* Queue a redraw on the top-level window */
5760 _dw_redraw(_dw_toplevel_window(handle), TRUE); 5760 _dw_redraw(_dw_toplevel_window(handle), TRUE);
5761 } 5761 }
5762 return DW_ERROR_NONE; 5762 return DW_ERROR_NONE;
5763 } 5763 }
5988 #ifdef AEROGLASS 5988 #ifdef AEROGLASS
5989 flStyleEx = WS_EX_LAYERED; 5989 flStyleEx = WS_EX_LAYERED;
5990 #endif 5990 #endif
5991 5991
5992 newbox->type = DW_VERT; 5992 newbox->type = DW_VERT;
5993 newbox->vsize = newbox->hsize = SIZEEXPAND; 5993 newbox->vsize = newbox->hsize = _DW_SIZE_EXPAND;
5994 newbox->cinfo.fore = newbox->cinfo.back = -1; 5994 newbox->cinfo.fore = newbox->cinfo.back = -1;
5995 newbox->cinfo.style = flStyle; 5995 newbox->cinfo.style = flStyle;
5996 5996
5997 if(!(flStyle & WS_CAPTION)) 5997 if(!(flStyle & WS_CAPTION))
5998 flStyle |= WS_POPUPWINDOW; 5998 flStyle |= WS_POPUPWINDOW;
7761 /* If we changed the bitmap... */ 7761 /* If we changed the bitmap... */
7762 { 7762 {
7763 Item *item = _dw_box_item(handle); 7763 Item *item = _dw_box_item(handle);
7764 7764
7765 /* Check to see if any of the sizes need to be recalculated */ 7765 /* Check to see if any of the sizes need to be recalculated */
7766 if(item && (item->origwidth == -1 || item->origheight == -1)) 7766 if(item && (item->origwidth == DW_SIZE_AUTO || item->origheight == DW_SIZE_AUTO))
7767 { 7767 {
7768 _dw_control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); 7768 _dw_control_size(handle, item->origwidth == DW_SIZE_AUTO ? &item->width : NULL, item->origheight == DW_SIZE_AUTO ? &item->height : NULL);
7769 /* Queue a redraw on the top-level window */ 7769 /* Queue a redraw on the top-level window */
7770 _dw_redraw(_dw_toplevel_window(handle), TRUE); 7770 _dw_redraw(_dw_toplevel_window(handle), TRUE);
7771 } 7771 }
7772 } 7772 }
7773 } 7773 }
7897 /* If we changed the text... */ 7897 /* If we changed the text... */
7898 { 7898 {
7899 Item *item = _dw_box_item(handle); 7899 Item *item = _dw_box_item(handle);
7900 7900
7901 /* Check to see if any of the sizes need to be recalculated */ 7901 /* Check to see if any of the sizes need to be recalculated */
7902 if(item && (item->origwidth == -1 || item->origheight == -1)) 7902 if(item && (item->origwidth == DW_SIZE_AUTO || item->origheight == DW_SIZE_AUTO))
7903 { 7903 {
7904 int newwidth, newheight; 7904 int newwidth, newheight;
7905 7905
7906 _dw_control_size(handle, &newwidth, &newheight); 7906 _dw_control_size(handle, &newwidth, &newheight);
7907 7907
7908 /* Only update the item and redraw the window if it changed */ 7908 /* Only update the item and redraw the window if it changed */
7909 if((item->origwidth == -1 && item->width != newwidth) || 7909 if((item->origwidth == DW_SIZE_AUTO && item->width != newwidth) ||
7910 (item->origheight == -1 && item->height != newheight)) 7910 (item->origheight == DW_SIZE_AUTO && item->height != newheight))
7911 { 7911 {
7912 if(item->origwidth == -1) 7912 if(item->origwidth == DW_SIZE_AUTO)
7913 item->width = newwidth; 7913 item->width = newwidth;
7914 if(item->origheight == -1) 7914 if(item->origheight == DW_SIZE_AUTO)
7915 item->height = newheight; 7915 item->height = newheight;
7916 /* Queue a redraw on the top-level window */ 7916 /* Queue a redraw on the top-level window */
7917 _dw_redraw(_dw_toplevel_window(handle), TRUE); 7917 _dw_redraw(_dw_toplevel_window(handle), TRUE);
7918 } 7918 }
7919 } 7919 }
8105 height = 1; 8105 height = 1;
8106 if(hsize && !width) 8106 if(hsize && !width)
8107 width = 1; 8107 width = 1;
8108 8108
8109 if(_tcsnicmp(tmpbuf, FRAMECLASSNAME, _tcslen(FRAMECLASSNAME)+1)==0) 8109 if(_tcsnicmp(tmpbuf, FRAMECLASSNAME, _tcslen(FRAMECLASSNAME)+1)==0)
8110 tmpitem[index].type = TYPEBOX; 8110 tmpitem[index].type = _DW_TYPE_BOX;
8111 else 8111 else
8112 { 8112 {
8113 if(_tcsnicmp(tmpbuf, TEXT("SysMonthCal32"), 13)==0) 8113 if(_tcsnicmp(tmpbuf, TEXT("SysMonthCal32"), 13)==0)
8114 { 8114 {
8115 RECT rc; 8115 RECT rc;
8116 MonthCal_GetMinReqRect(item, &rc); 8116 MonthCal_GetMinReqRect(item, &rc);
8117 width = 1 + rc.right - rc.left; 8117 width = 1 + rc.right - rc.left;
8118 height = 1 + rc.bottom - rc.top; 8118 height = 1 + rc.bottom - rc.top;
8119 tmpitem[index].type = TYPEITEM; 8119 tmpitem[index].type = _DW_TYPE_ITEM;
8120 } 8120 }
8121 else 8121 else
8122 { 8122 {
8123 if ( width == 0 && hsize == FALSE ) 8123 if ( width == 0 && hsize == FALSE )
8124 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); 8124 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
8125 if ( height == 0 && vsize == FALSE ) 8125 if ( height == 0 && vsize == FALSE )
8126 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item); 8126 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
8127 8127
8128 tmpitem[index].type = TYPEITEM; 8128 tmpitem[index].type = _DW_TYPE_ITEM;
8129 } 8129 }
8130 } 8130 }
8131 8131
8132 tmpitem[index].hwnd = item; 8132 tmpitem[index].hwnd = item;
8133 tmpitem[index].origwidth = tmpitem[index].width = width; 8133 tmpitem[index].origwidth = tmpitem[index].width = width;
8134 tmpitem[index].origheight = tmpitem[index].height = height; 8134 tmpitem[index].origheight = tmpitem[index].height = height;
8135 tmpitem[index].pad = pad; 8135 tmpitem[index].pad = pad;
8136 tmpitem[index].hsize = hsize ? SIZEEXPAND : SIZESTATIC; 8136 tmpitem[index].hsize = hsize ? _DW_SIZE_EXPAND : _DW_SIZE_STATIC;
8137 tmpitem[index].vsize = vsize ? SIZEEXPAND : SIZESTATIC; 8137 tmpitem[index].vsize = vsize ? _DW_SIZE_EXPAND : _DW_SIZE_STATIC;
8138 8138
8139 /* If either of the parameters are -1 ... calculate the size */ 8139 /* If either of the parameters are -1 (DW_SIZE_AUTO) ... calculate the size */
8140 if(width == -1 || height == -1) 8140 if(width == DW_SIZE_AUTO || height == DW_SIZE_AUTO)
8141 _dw_control_size(item, width == -1 ? &tmpitem[index].width : NULL, height == -1 ? &tmpitem[index].height : NULL); 8141 _dw_control_size(item, width == DW_SIZE_AUTO ? &tmpitem[index].width : NULL, height == DW_SIZE_AUTO ? &tmpitem[index].height : NULL);
8142 8142
8143 thisbox->items = tmpitem; 8143 thisbox->items = tmpitem;
8144 8144
8145 if(thisitem) 8145 if(thisitem)
8146 free(thisitem); 8146 free(thisitem);