Changeset 722 for trunk/src


Ignore:
Timestamp:
Aug 28, 1999, 11:25:56 AM (26 years ago)
Author:
achimha
Message:

merged with latest WINE changes

Location:
trunk/src/comctl32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/comctl32undoc.c

    r496 r722  
    1 /* $Id: comctl32undoc.c,v 1.10 1999-08-14 16:13:10 cbratschi Exp $ */
     1/* $Id: comctl32undoc.c,v 1.11 1999-08-28 09:25:56 achimha Exp $ */
    22/*
    33 * Undocumented functions from COMCTL32.DLL
     
    1111 *
    1212 */
     13
     14/* WINE 990815 level */
    1315
    1416/* CB: todo
     
    18371839 */
    18381840INT WINAPI COMCTL32_StrCmpNA( LPCSTR lpStr1, LPCSTR lpStr2, int nChar) {
    1839 //  return lstrncmpA(lpStr1, lpStr2, nChar);
     1841  return strncmp(lpStr1, lpStr2, nChar);
    18401842}
    18411843
  • trunk/src/comctl32/propsheet.c

    r496 r722  
    1 /* $Id: propsheet.c,v 1.7 1999-08-14 16:13:12 cbratschi Exp $ */
     1/* $Id: propsheet.c,v 1.8 1999-08-28 09:25:56 achimha Exp $ */
    22/*
    33 * Property Sheets
     
    1313 *   - Unicode property sheets
    1414 */
     15
     16/* WINE 990815 level */
    1517
    1618/* CB: Odin problems:
     
    6769  int width;
    6870  int height;
     71  HIMAGELIST hImageList;
    6972} PropSheetInfo;
    7073
     
    159162  psInfo->restartWindows = FALSE;
    160163  psInfo->rebootSystem = FALSE;
     164  psInfo->hImageList = 0;
    161165
    162166  return TRUE;
     
    277281//  TRACE(propsheet, "Tab %d %s\n",index,debugstr_w((LPCWSTR)p));
    278282  p += lstrlenW((LPCWSTR)p) + 1;
     283
     284  /*
     285   * Build the image list for icons
     286   */
     287  if ((dwFlags & PSP_USEHICON) || (dwFlags & PSP_USEICONID))
     288  {
     289    HICON hIcon;
     290    int icon_cx = GetSystemMetrics(SM_CXSMICON);
     291    int icon_cy = GetSystemMetrics(SM_CYSMICON);
     292
     293    if (dwFlags & PSP_USEICONID)
     294      hIcon = LoadImageA(lppsp->hInstance, lppsp->u2.pszIcon, IMAGE_ICON,
     295                         icon_cx, icon_cy, LR_DEFAULTCOLOR);
     296    else
     297      hIcon = lppsp->u2.hIcon;
     298
     299    if (psInfo->hImageList == 0)
     300      psInfo->hImageList = ImageList_Create(icon_cx, icon_cy, ILC_COLOR, 1, 1);
     301
     302    ImageList_AddIcon(psInfo->hImageList, hIcon);
     303  }
    279304
    280305  return TRUE;
     
    577602  nTabs = psInfo->ppshheader->nPages;
    578603
     604  /*
     605   * Set the image list for icons.
     606   */
     607  if (psInfo->hImageList)
     608  {
     609    item.mask |= TCIF_IMAGE;
     610    SendMessageA(hwndTabCtrl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList);
     611  }
     612
    579613  for (i = 0; i < nTabs; i++)
    580614  {
     615    item.iImage = i;
     616
    581617    WideCharToMultiByte(CP_ACP, 0,
    582618                        (LPCWSTR)psInfo->proppage[i].pszText,
     
    11931229  COMCTL32_Free(psInfo->proppage);
    11941230  COMCTL32_Free(psInfo->strPropertiesFor);
     1231  ImageList_Destroy(psInfo->hImageList);
    11951232
    11961233  GlobalFree((HGLOBAL)psInfo);
  • trunk/src/comctl32/tab.c

    r603 r722  
    1 /* $Id: tab.c,v 1.11 1999-08-21 12:10:02 cbratschi Exp $ */
     1/* $Id: tab.c,v 1.12 1999-08-28 09:25:56 achimha Exp $ */
    22/*
    33 * Tab control
     
    1212 *  Image list support
    1313 *  Multiline support
     14 *  Unicode support
    1415 */
     16
     17/* WINE 990815 level */
    1518
    1619#include <string.h>
     
    643646   * a font.
    644647   */
    645   hdc = GetDC(hwnd);
    646 
     648  hdc = GetDC(hwnd); 
     649   
    647650  hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject (SYSTEM_FONT);
    648651  hOldFont = SelectObject (hdc, hFont);
     
    653656   */
    654657  GetClientRect(hwnd, &clientRect);
    655 
     658 
    656659  /*
    657660   * The leftmost item will be "0" aligned
     
    661664  if (!((lStyle & TCS_FIXEDWIDTH) || (lStyle & TCS_OWNERDRAWFIXED)))
    662665  {
     666    int item_height;
     667    int icon_height = 0;
     668
    663669    /*
    664670     * Use the current font to determine the height of a tab.
     
    667673
    668674    /*
    669      * Make sure there is enough space for the letters + growing the
    670      * selected item + extra space for the selected item.
    671      */
    672     infoPtr->tabHeight = fontMetrics.tmHeight + 2*VERTICAL_ITEM_PADDING +
     675     * Get the icon height
     676     */
     677    if (infoPtr->himl)
     678      ImageList_GetIconSize(infoPtr->himl, 0, &icon_height);
     679
     680    /*
     681     * Take the highest between font or icon
     682     */
     683    if (fontMetrics.tmHeight > icon_height)
     684      item_height = fontMetrics.tmHeight;
     685    else
     686      item_height = icon_height;
     687
     688    /*
     689     * Make sure there is enough space for the letters + icon + growing the
     690     * selected item + extra space for the selected item.   
     691     */
     692    infoPtr->tabHeight = item_height + 2*VERTICAL_ITEM_PADDING + 
    673693      SELECTED_TAB_OFFSET;
    674694  }
     
    679699     * Calculate the vertical position of the tab
    680700     */
    681     if (lStyle & TCS_BOTTOM)
    682     {
    683       infoPtr->items[curItem].rect.bottom = clientRect.bottom -
     701    if (lStyle & TCS_BOTTOM) 
     702    {
     703      infoPtr->items[curItem].rect.bottom = clientRect.bottom - 
    684704                                            SELECTED_TAB_OFFSET;
    685       infoPtr->items[curItem].rect.top = clientRect.bottom -
     705      infoPtr->items[curItem].rect.top = clientRect.bottom - 
    686706                                         infoPtr->tabHeight;
    687707    }
    688     else
    689     {
    690       infoPtr->items[curItem].rect.top = clientRect.top +
     708    else 
     709    {
     710      infoPtr->items[curItem].rect.top = clientRect.top + 
    691711                                         SELECTED_TAB_OFFSET;
    692       infoPtr->items[curItem].rect.bottom = clientRect.top +
     712      infoPtr->items[curItem].rect.bottom = clientRect.top + 
    693713                                            infoPtr->tabHeight;
    694714    }
     
    707727    else
    708728    {
     729      int icon_width  = 0;
     730      int num = 2;
     731
    709732      /*
    710733       * Calculate how wide the tab is depending on the text it contains
    711734       */
    712       GetTextExtentPoint32W(hdc, infoPtr->items[curItem].pszText,
    713                             lstrlenW(infoPtr->items[curItem].pszText), &size);
     735      GetTextExtentPoint32A(hdc, infoPtr->items[curItem].pszText,
     736                            lstrlenA(infoPtr->items[curItem].pszText), &size);
     737
     738      /*
     739       * Add the icon width
     740       */
     741      if (infoPtr->himl)
     742      {
     743        ImageList_GetIconSize(infoPtr->himl, &icon_width, 0);
     744        num++;
     745      }
    714746
    715747      infoPtr->items[curItem].rect.right = infoPtr->items[curItem].rect.left +
    716                                            size.cx + 2*HORIZONTAL_ITEM_PADDING;
    717     }
    718 
    719 //    TRACE(tab, "TextSize: %i\n ", size.cx);
    720 //    TRACE(tab, "Rect: T %i, L %i, B %i, R %i\n",
    721 //        infoPtr->items[curItem].rect.top,
    722 //        infoPtr->items[curItem].rect.left,
    723 //        infoPtr->items[curItem].rect.bottom,
    724 //        infoPtr->items[curItem].rect.right);
     748                                           size.cx + icon_width +
     749                                           num*HORIZONTAL_ITEM_PADDING;
     750    }
     751
     752//    TRACE("TextSize: %i\n ", size.cx);
     753//    TRACE("Rect: T %i, L %i, B %i, R %i\n",
     754//        infoPtr->items[curItem].rect.top,
     755//        infoPtr->items[curItem].rect.left,
     756//        infoPtr->items[curItem].rect.bottom,
     757//        infoPtr->items[curItem].rect.right); 
    725758
    726759    /*
     
    737770   * Check if we need a scrolling control.
    738771   */
    739   infoPtr->needsScrolling = (curItemLeftPos + (2*SELECTED_TAB_OFFSET) >
     772  infoPtr->needsScrolling = (curItemLeftPos + (2*SELECTED_TAB_OFFSET) > 
    740773                             clientRect.right);
    741774
    742   TAB_SetupScrolling(hwnd, infoPtr, &clientRect);
    743 
     775  TAB_SetupScrolling(hwnd, infoPtr, &clientRect);     
     776 
    744777  /*
    745778   * Cleanup
     
    933966                      r.left, r.top+1, ILD_NORMAL);
    934967      ImageList_GetIconSize (infoPtr->himl, &cx, &cy);
    935       r.left+=cx;
     968      r.left+=(cx + HORIZONTAL_ITEM_PADDING);
    936969    }
    937970
     
    13981431}
    13991432
    1400 static LRESULT
     1433static LRESULT 
    14011434TAB_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
    14021435{
    14031436  TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
    1404   TCITEMA *tabItem;
    1405   TAB_ITEM *wineItem;
     1437  TCITEMA *tabItem; 
     1438  TAB_ITEM *wineItem; 
    14061439  INT    iItem,len;
    14071440
    14081441  iItem=(INT) wParam;
    14091442  tabItem=(LPTCITEMA ) lParam;
    1410 //  TRACE (tab,"%d %p\n",iItem, tabItem);
     1443//  TRACE("%d %p\n",iItem, tabItem);
    14111444  if ((iItem<0) || (iItem>infoPtr->uNumItem)) return FALSE;
    14121445
     
    14191452    wineItem->lParam=tabItem->lParam;
    14201453
    1421 //  if (tabItem->mask & TCIF_RTLREADING)
    1422 //    FIXME (tab,"TCIF_RTLREADING\n");
    1423 
    1424   if (tabItem->mask & TCIF_STATE)
     1454//  if (tabItem->mask & TCIF_RTLREADING) 
     1455//    FIXME("TCIF_RTLREADING\n");
     1456
     1457  if (tabItem->mask & TCIF_STATE) 
    14251458    wineItem->dwState=tabItem->dwState;
    14261459
    14271460  if (tabItem->mask & TCIF_TEXT) {
    1428    len = lstrlenA (tabItem->pszText);
    1429    if (len>wineItem->cchTextMax)
    1430      wineItem->pszText = COMCTL32_ReAlloc (wineItem->pszText, (len+1)*sizeof(WCHAR));
    1431    lstrcpyAtoW (wineItem->pszText, tabItem->pszText);
    1432   }
     1461   len=lstrlenA (tabItem->pszText);
     1462   if (len>wineItem->cchTextMax)
     1463     wineItem->pszText= COMCTL32_ReAlloc (wineItem->pszText, len+1);
     1464   lstrcpyA (wineItem->pszText, tabItem->pszText);
     1465  }
     1466
     1467  /*
     1468   * Update and repaint tabs.
     1469   */
     1470  TAB_SetItemBounds(hwnd);
     1471  TAB_InvalidateTabArea(hwnd,infoPtr);
    14331472
    14341473  return TRUE;
Note: See TracChangeset for help on using the changeset viewer.