Changeset 267 for trunk/src


Ignore:
Timestamp:
Jul 4, 1999, 11:06:00 PM (26 years ago)
Author:
cbratschi
Message:

Unicode and other extensions

Location:
trunk/src/comctl32
Files:
6 edited

Legend:

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

    r180 r267  
    1 /* $Id: propsheet.c,v 1.4 1999-06-24 16:37:44 cbratschi Exp $ */
     1/* $Id: propsheet.c,v 1.5 1999-07-04 21:05:59 cbratschi Exp $ */
    22/*
    33 * Property Sheets
     
    1313 *   - Unicode property sheets
    1414 */
     15
     16/* CB: Odin problems:
     17 - trap in PROPSHEET_DialogProc (tab control creation)
     18 - LockResource traps
     19*/
    1520
    1621#include <string.h>
     
    201206    HGLOBAL hTemplate = LoadResource(lppsp->hInstance,
    202207                                     hResource);
    203     pTemplate = (LPDLGTEMPLATEA)LockResource(hTemplate);
     208    //pTemplate = (LPDLGTEMPLATEA)LockResource(hTemplate); //CB: trap, fix it
    204209  }
    205210
     
    287292  HRSRC hRes;
    288293
     294  if (psInfo->useCallback)
     295    (*(psInfo->ppshheader->pfnCallback))(0, PSCB_PRECREATE, (LPARAM)template);
     296
     297  //load OS/2 dialog
     298
     299  if (psInfo->ppshheader->dwFlags & PSH_MODELESS)
     300    ret = NativeCreateDlgIP(COMCTL32_hModule,
     301                         psInfo->ppshheader->hInstance,
     302                         MAKEINTRESOURCEA(IDD_PROPSHEET),
     303                         psInfo->ppshheader->hwndParent,
     304                         (DLGPROC)PROPSHEET_DialogProc,
     305                         (LPARAM)psInfo);
     306  else
     307    ret = NativeDlgBoxIP(COMCTL32_hModule,
     308                         psInfo->ppshheader->hInstance,
     309                         MAKEINTRESOURCEA(IDD_PROPSHEET),
     310                         psInfo->ppshheader->hwndParent,
     311                         (DLGPROC)PROPSHEET_DialogProc,
     312                         (LPARAM)psInfo);
     313
     314  if (ret == (INT)-1) return FALSE;
     315
     316/* //CB: original WINE code
    289317  if (!(hRes = FindResourceA(COMCTL32_hModule,
    290318                            MAKEINTRESOURCEA(IDD_PROPSHEET),
     
    310338                                  (DLGPROC) PROPSHEET_DialogProc,
    311339                                  (LPARAM)psInfo);
     340*/
    312341
    313342  return ret;
  • trunk/src/comctl32/status.c

    r252 r267  
    1 /* $Id: status.c,v 1.7 1999-06-30 15:52:17 cbratschi Exp $ */
     1/* $Id: status.c,v 1.8 1999-07-04 21:05:59 cbratschi Exp $ */
    22/*
    33 * Interface code to StatusWindow widget/control
     
    2727 */
    2828
     29/* CB: Odin problems
     30 - DrawText: DT_VCENTER doesn't work
     31*/
     32
    2933#define _MAX(a,b) (((a)>(b))?(a):(b))
    3034#define _MIN(a,b) (((a)>(b))?(b):(a))
     
    3236#define HORZ_BORDER 0
    3337#define VERT_BORDER 2
     38#define VERT_SPACE  2 //space between boder and text
    3439#define HORZ_GAP    2
     40#define TOP_MARGIN  2
     41#define ICON_SPACE  2
     42#define TEXT_SPACE  3
    3543
    3644#define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongA (hwnd, 0))
     
    8795    DrawEdge(hdc, &r, border, BF_RECT|BF_ADJUST);
    8896
     97    r.bottom -= VERT_SPACE;
     98    r.top += VERT_SPACE;
     99
    89100    /* draw the icon */
    90101    if (part->hIcon) {
    91102        INT cy = r.bottom - r.top;
    92103
    93         r.left += 2;
     104        r.left += ICON_SPACE;
    94105        DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);
    95106        r.left += cy;
     
    110121        }
    111122      }
    112       r.left += 3;
     123      r.left += TEXT_SPACE;
    113124      DrawTextW (hdc, p, lstrlenW (p), &r, align|DT_VCENTER|DT_SINGLELINE);
    114125      if (oldbkmode != TRANSPARENT)
     
    232243    GetClientRect (hwnd, &rect);
    233244
    234     rect.top += VERT_BORDER;
     245    rect.top += TOP_MARGIN;
    235246
    236247    /* set bounds for simple rectangle */
     
    638649    int style;
    639650    LPSTR text;
     651    LPWSTR newText;
    640652    int len;
    641653    HDC hdc;
     
    651663    if (!part) return FALSE;
    652664
    653     if (!(part->style & SBT_OWNERDRAW) && part->text)
    654         COMCTL32_Free (part->text);
    655     part->text = 0;
    656 
    657     if (style & SBT_OWNERDRAW) {
    658         part->text = (LPWSTR)text;
    659     }
    660     else {
    661         /* duplicate string */
    662         if (text && (len = lstrlenA(text))) {
    663             part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
    664             lstrcpyAtoW (part->text, text);
    665         }
     665    if (style & SBT_OWNERDRAW)
     666    {
     667      part->text = (LPWSTR)text;
     668    } else
     669    {
     670      //compare
     671      if (text && (len = lstrlenA(text)))
     672      {
     673        newText = COMCTL32_Alloc((len+1)*sizeof(WCHAR));
     674        lstrcpyAtoW (newText,text);
     675      } else newText = NULL;
     676      if (lstrcmpW(part->text,newText) == 0)
     677      {
     678        COMCTL32_Free(newText);
     679        if (part->style != style)
     680        {
     681          hdc = GetDC(hwnd);
     682          STATUSBAR_RefreshPart(hwnd,part,hdc);
     683          ReleaseDC(hwnd, hdc);
     684        }
     685        return TRUE;
     686      }
     687
     688      COMCTL32_Free(part->text);
     689      part->text = newText;
    666690    }
    667691    part->style = style;
     
    694718    if (!part) return FALSE;
    695719
    696     if (!(part->style & SBT_OWNERDRAW) && part->text)
    697         COMCTL32_Free (part->text);
    698     part->text = 0;
    699 
    700     if (style & SBT_OWNERDRAW) {
    701         part->text = text;
    702     }
    703     else {
    704         /* duplicate string */
    705         if (text && (len = lstrlenW(text))) {
    706             part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
    707             lstrcpyW(part->text, text);
    708         }
     720    if (style & SBT_OWNERDRAW)
     721    {
     722      part->text = text;
     723    } else
     724    {
     725      if (lstrcmpW(part->text,text) == 0)
     726      {
     727        if (part->style != style)
     728        {
     729          hdc = GetDC(hwnd);
     730          STATUSBAR_RefreshPart(hwnd,part,hdc);
     731          ReleaseDC(hwnd, hdc);
     732        }
     733        return TRUE;
     734      }
     735
     736      /* duplicate string */
     737      COMCTL32_Free(part->text);
     738      if (text && (len = lstrlenW(text)))
     739      {
     740        part->text = COMCTL32_Alloc((len+1)*sizeof(WCHAR));
     741        lstrcpyW(part->text,text);
     742      }
    709743    }
    710744    part->style = style;
     
    837871    if (IsWindowUnicode (hwnd)) {
    838872        self->bUnicode = TRUE;
    839         if ((len = lstrlenW ((LPCWSTR)lpCreate->lpszName))) {
     873        len = lstrlenW ((LPCWSTR)lpCreate->lpszName);
     874        if (len) {
    840875            self->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
    841876            lstrcpyW (self->parts[0].text, (LPCWSTR)lpCreate->lpszName);
     
    843878    }
    844879    else {
    845         if ((len = lstrlenA ((LPCSTR)lpCreate->lpszName))) {
     880        len = lstrlenA ((LPCSTR)lpCreate->lpszName);
     881        if (len) {
    846882            self->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
    847             lstrcpyAtoW (self->parts[0].text, (LPCSTR)lpCreate->lpszName);
    848         }
    849     }
    850 
    851     if ((hdc = GetDC (0))) {
     883            lstrcpyAtoW (self->parts[0].text, (char*)lpCreate->lpszName);
     884        }
     885    }
     886
     887    hdc = GetDC(hwnd);
     888    if (hdc) {
    852889        TEXTMETRICA tm;
    853890        HFONT hOldFont;
     
    857894        self->textHeight = tm.tmHeight;
    858895        SelectObject (hdc, hOldFont);
    859         ReleaseDC(0, hdc);
     896        ReleaseDC(hwnd, hdc);
    860897    }
    861898
     
    883920    GetClientRect (GetParent (hwnd), &rect);
    884921    width = rect.right - rect.left;
    885     self->height = self->textHeight + 4 + VERT_BORDER;
     922    self->height = self->textHeight+2*VERT_BORDER+2*VERT_SPACE;
    886923    MoveWindow (hwnd, lpCreate->x, lpCreate->y-1,
    887924                  width, self->height, FALSE);
     
    10571094        if (lParam && (len = lstrlenA((LPCSTR)lParam))) {
    10581095            part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
    1059             lstrcpyAtoW (part->text, (LPCSTR)lParam);
     1096            lstrcpyAtoW (part->text, (char*)lParam);
    10601097        }
    10611098    }
  • trunk/src/comctl32/tab.c

    r252 r267  
    1 /* $Id: tab.c,v 1.7 1999-06-30 15:52:17 cbratschi Exp $ */
     1/* $Id: tab.c,v 1.8 1999-07-04 21:05:59 cbratschi Exp $ */
    22/*
    33 * Tab control
     
    1212 *  Image list support
    1313 *  Multiline support
    14  *  Unicode support
    1514 */
    1615
     
    2019#include "commctrl.h"
    2120#include "tab.h"
     21#include "comctl32.h"
    2222
    2323
     
    709709       * Calculate how wide the tab is depending on the text it contains
    710710       */
    711       GetTextExtentPoint32A(hdc, infoPtr->items[curItem].pszText,
    712                             lstrlenA(infoPtr->items[curItem].pszText), &size);
     711      GetTextExtentPoint32W(hdc, infoPtr->items[curItem].pszText,
     712                            lstrlenW(infoPtr->items[curItem].pszText), &size);
    713713
    714714      infoPtr->items[curItem].rect.right = infoPtr->items[curItem].rect.left +
     
    934934     * Draw the text;
    935935     */
    936     DrawTextA(hdc,
     936    DrawTextW(hdc,
    937937              infoPtr->items[iItem].pszText,
    938               lstrlenA(infoPtr->items[iItem].pszText),
     938              lstrlenW(infoPtr->items[iItem].pszText),
    939939              &r,
    940940              DT_LEFT|DT_SINGLELINE|DT_VCENTER);
     
    12381238}
    12391239
    1240 static LRESULT
    1241 TAB_InsertItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
     1240static LRESULT TAB_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
    12421241{
    12431242  TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
     
    12861285  if (pti->mask & TCIF_TEXT) {
    12871286    len = lstrlenA (pti->pszText);
    1288     infoPtr->items[iItem].pszText = COMCTL32_Alloc (len+1);
    1289     lstrcpyA (infoPtr->items[iItem].pszText, pti->pszText);
     1287    infoPtr->items[iItem].pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
     1288    lstrcpyAtoW (infoPtr->items[iItem].pszText, pti->pszText);
     1289    infoPtr->items[iItem].cchTextMax = pti->cchTextMax;
     1290  }
     1291
     1292  if (pti->mask & TCIF_IMAGE)
     1293    infoPtr->items[iItem].iImage = pti->iImage;
     1294
     1295  if (pti->mask & TCIF_PARAM)
     1296    infoPtr->items[iItem].lParam = pti->lParam;
     1297
     1298  TAB_InvalidateTabArea(hwnd, infoPtr);
     1299
     1300//  TRACE(tab, "[%04x]: added item %d '%s'\n",
     1301//      hwnd, iItem, infoPtr->items[iItem].pszText);
     1302
     1303  TAB_SetItemBounds(hwnd);
     1304  return iItem;
     1305}
     1306
     1307static LRESULT TAB_InsertItemW(HWND hwnd, WPARAM wParam, LPARAM lParam)
     1308{
     1309  TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
     1310  TCITEMW *pti;
     1311  INT iItem, len;
     1312  RECT rect;
     1313
     1314  GetClientRect (hwnd, &rect);
     1315//  TRACE(tab, "Rect: %x T %i, L %i, B %i, R %i\n", hwnd,
     1316//        rect.top, rect.left, rect.bottom, rect.right);
     1317
     1318  pti = (TCITEMW*)lParam;
     1319  iItem = (INT)wParam;
     1320
     1321  if (iItem < 0) return -1;
     1322  if (iItem > infoPtr->uNumItem)
     1323    iItem = infoPtr->uNumItem;
     1324
     1325  if (infoPtr->uNumItem == 0) {
     1326    infoPtr->items = COMCTL32_Alloc (sizeof (TAB_ITEM));
     1327    infoPtr->uNumItem++;
     1328  }
     1329  else {
     1330    TAB_ITEM *oldItems = infoPtr->items;
     1331
     1332    infoPtr->uNumItem++;
     1333    infoPtr->items = COMCTL32_Alloc (sizeof (TAB_ITEM) * infoPtr->uNumItem);
     1334
     1335    /* pre insert copy */
     1336    if (iItem > 0) {
     1337      memcpy (&infoPtr->items[0], &oldItems[0],
     1338              iItem * sizeof(TAB_ITEM));
     1339    }
     1340
     1341    /* post insert copy */
     1342    if (iItem < infoPtr->uNumItem - 1) {
     1343      memcpy (&infoPtr->items[iItem+1], &oldItems[iItem],
     1344              (infoPtr->uNumItem - iItem - 1) * sizeof(TAB_ITEM));
     1345
     1346    }
     1347
     1348    COMCTL32_Free (oldItems);
     1349  }
     1350
     1351  infoPtr->items[iItem].mask = pti->mask;
     1352  if (pti->mask & TCIF_TEXT) {
     1353    len = lstrlenW (pti->pszText);
     1354    infoPtr->items[iItem].pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
     1355    lstrcpyW (infoPtr->items[iItem].pszText, pti->pszText);
    12901356    infoPtr->items[iItem].cchTextMax = pti->cchTextMax;
    12911357  }
     
    13531419   len = lstrlenA (tabItem->pszText);
    13541420   if (len>wineItem->cchTextMax)
    1355      wineItem->pszText = COMCTL32_ReAlloc (wineItem->pszText, len+1);
    1356    lstrcpynA (wineItem->pszText, tabItem->pszText, len+1);
     1421     wineItem->pszText = COMCTL32_ReAlloc (wineItem->pszText, (len+1)*sizeof(WCHAR));
     1422   lstrcpynAtoW (wineItem->pszText, tabItem->pszText, len+1);
     1423  }
     1424
     1425  return TRUE;
     1426}
     1427
     1428static LRESULT TAB_SetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
     1429{
     1430  TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
     1431  TCITEMW *tabItem;
     1432  TAB_ITEM *wineItem;
     1433  INT    iItem,len;
     1434
     1435  iItem=(INT) wParam;
     1436  tabItem=(LPTCITEMW) lParam;
     1437//  TRACE (tab,"%d %p\n",iItem, tabItem);
     1438  if ((iItem<0) || (iItem>infoPtr->uNumItem)) return FALSE;
     1439
     1440  wineItem=& infoPtr->items[iItem];
     1441
     1442  if (tabItem->mask & TCIF_IMAGE)
     1443    wineItem->iImage=tabItem->iImage;
     1444
     1445  if (tabItem->mask & TCIF_PARAM)
     1446    wineItem->lParam=tabItem->lParam;
     1447
     1448//  if (tabItem->mask & TCIF_RTLREADING)
     1449//    FIXME (tab,"TCIF_RTLREADING\n");
     1450
     1451  if (tabItem->mask & TCIF_STATE)
     1452    wineItem->dwState=tabItem->dwState;
     1453
     1454  if (tabItem->mask & TCIF_TEXT) {
     1455   len = lstrlenW (tabItem->pszText);
     1456   if (len>wineItem->cchTextMax)
     1457     wineItem->pszText = COMCTL32_ReAlloc (wineItem->pszText, (len+1)*sizeof(WCHAR));
     1458   lstrcpynW (wineItem->pszText, tabItem->pszText, len+1);
    13571459  }
    13581460
     
    13971499
    13981500  if (tabItem->mask & TCIF_TEXT)
    1399    lstrcpynA (tabItem->pszText, wineItem->pszText, tabItem->cchTextMax);
     1501   lstrcpynWtoA (tabItem->pszText, wineItem->pszText, tabItem->cchTextMax);
     1502
     1503  return TRUE;
     1504}
     1505
     1506static LRESULT TAB_GetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
     1507{
     1508   TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
     1509   TCITEMW *tabItem;
     1510   TAB_ITEM *wineItem;
     1511   INT    iItem;
     1512
     1513  iItem=(INT) wParam;
     1514  tabItem=(LPTCITEMW) lParam;
     1515//  TRACE (tab,"\n");
     1516  if ((iItem<0) || (iItem>infoPtr->uNumItem)) return FALSE;
     1517
     1518  wineItem=& infoPtr->items[iItem];
     1519
     1520  if (tabItem->mask & TCIF_IMAGE)
     1521    tabItem->iImage=wineItem->iImage;
     1522
     1523  if (tabItem->mask & TCIF_PARAM)
     1524    tabItem->lParam=wineItem->lParam;
     1525
     1526//  if (tabItem->mask & TCIF_RTLREADING)
     1527//    FIXME (tab, "TCIF_RTLREADING\n");
     1528
     1529  if (tabItem->mask & TCIF_STATE)
     1530    tabItem->dwState=wineItem->dwState;
     1531
     1532  if (tabItem->mask & TCIF_TEXT)
     1533   lstrcpynW (tabItem->pszText, wineItem->pszText, tabItem->cchTextMax);
    14001534
    14011535  return TRUE;
     
    16681802
    16691803    case TCM_GETITEMW:
    1670 //      FIXME (tab, "Unimplemented msg TCM_GETITEMW\n");
    1671       return 0;
     1804      return TAB_GetItemW(hwnd,wParam,lParam);
    16721805
    16731806    case TCM_SETITEMA:
     
    16751808
    16761809    case TCM_SETITEMW:
    1677 //      FIXME (tab, "Unimplemented msg TCM_SETITEMW\n");
    1678       return 0;
     1810      return TAB_SetItemW(hwnd,wParam,lParam);
    16791811
    16801812    case TCM_DELETEITEM:
     
    16971829
    16981830    case TCM_INSERTITEMA:
    1699       return TAB_InsertItem (hwnd, wParam, lParam);
     1831      return TAB_InsertItemA(hwnd,wParam,lParam);
    17001832
    17011833    case TCM_INSERTITEMW:
    1702 //      FIXME (tab, "Unimplemented msg TCM_INSERTITEM32W\n");
    1703       return 0;
     1834      return TAB_InsertItemW(hwnd,wParam,lParam);
    17041835
    17051836    case TCM_SETITEMEXTRA:
  • trunk/src/comctl32/toolbar.c

    r252 r267  
    1 /* $Id: toolbar.c,v 1.8 1999-06-30 15:52:18 cbratschi Exp $ */
     1/* $Id: toolbar.c,v 1.9 1999-07-04 21:06:00 cbratschi Exp $ */
    22/*
    33 * Toolbar control
     
    1414 *   - Fix TB_SETROWS.
    1515 *   - Tooltip support (almost complete).
    16  *   - Unicode suppport.
    1716 *   - Internal COMMCTL32 bitmaps.
    1817 *   - Fix TOOLBAR_SetButtonInfo32A.
     
    3635
    3736#include "winbase.h"
    38 #include "winuser.h"
    39 #include "wingdi.h"
    4037#include "commctrl.h"
    4138#include "cache.h"
    4239#include "comctl32.h"
    4340#include "toolbar.h"
    44 
    4541
    4642#define SEPARATOR_WIDTH    8
     
    732728TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    733729{
    734     TOOLBAR_INFO *infoPtr = (TOOLBAR_INFO *)GetWindowLongA (hwnd, DWL_USER);
     730    TOOLBAR_INFO *infoPtr;
    735731    static HDSA hDsa = NULL;
    736732
     
    804800//                    lpdis->itemAction, lpdis->itemState);
    805801
     802                infoPtr = (TOOLBAR_INFO *)GetWindowLongA(hwnd,DWL_USER);
     803
    806804                if (lpdis->itemState & ODS_FOCUS)
    807805                {
     
    853851            {
    854852                MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*)lParam;
     853
     854                infoPtr = (TOOLBAR_INFO *)GetWindowLongA(hwnd,DWL_USER);
    855855
    856856                if (infoPtr)
     
    10141014}
    10151015
     1016
     1017static LRESULT TOOLBAR_AddButtonsW(HWND hwnd,WPARAM wParam,LPARAM lParam)
     1018{
     1019  //CB: just call AddButtonsA, no Unicode used?!?
     1020
     1021  return TOOLBAR_AddButtonsA(hwnd,wParam,lParam);
     1022}
    10161023
    10171024/* << TOOLBAR_AddButtons32W >> */
     
    13061313}
    13071314
    1308 
    13091315static LRESULT
    13101316TOOLBAR_Customize (HWND hwnd)
     
    13241330                  (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
    13251331
     1332    //load OS/2 dialog
     1333
     1334    ret = NativeDlgBoxIP(COMCTL32_hModule,
     1335                         GetWindowLongA(hwnd,GWL_HINSTANCE),
     1336                         MAKEINTRESOURCEA(IDD_TBCUSTOMIZE),
     1337                         hwnd,
     1338                         (DLGPROC)TOOLBAR_CustomizeDialogProc,
     1339                         (LPARAM)infoPtr);
     1340
     1341    if (ret == (INT)-1) return FALSE;
     1342
     1343/* //original WINE code
    13261344    if (!(hRes = FindResourceA (COMCTL32_hModule,
    13271345                                MAKEINTRESOURCEA(IDD_TBCUSTOMIZE),
     
    13371355                                   (DLGPROC)TOOLBAR_CustomizeDialogProc,
    13381356                                   (LPARAM)infoPtr);
     1357*/
    13391358
    13401359    /* send TBN_ENDADJUST notification */
     
    15161535    if (lpTbInfo->dwMask & TBIF_TEXT) {
    15171536        if ((btnPtr->iString >= 0) || (btnPtr->iString < infoPtr->nNumStrings))
    1518             lstrcpynA (lpTbInfo->pszText,
    1519                          (LPSTR)infoPtr->strings[btnPtr->iString],
     1537            lstrcpynWtoA (lpTbInfo->pszText,
     1538                         infoPtr->strings[btnPtr->iString],
    15201539                         lpTbInfo->cchText);
    15211540    }
     
    15241543}
    15251544
    1526 
    1527 /* << TOOLBAR_GetButtonInfo32W >> */
    1528 
    1529 
    1530 static LRESULT
    1531 TOOLBAR_GetButtonSize (HWND hwnd)
    1532 {
    1533     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    1534 
    1535     return MAKELONG((WORD)infoPtr->nButtonWidth,
    1536                     (WORD)infoPtr->nButtonHeight);
    1537 }
    1538 
    1539 
    1540 static LRESULT
    1541 TOOLBAR_GetButtonTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
    1542 {
    1543     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    1544     INT nIndex, nStringIndex;
     1545static LRESULT TOOLBAR_GetButtonInfoW(HWND hwnd,WPARAM wParam,LPARAM lParam)
     1546{
     1547    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     1548    LPTBBUTTONINFOW lpTbInfo = (LPTBBUTTONINFOW)lParam;
     1549    TBUTTON_INFO *btnPtr;
     1550    INT nIndex;
     1551
     1552    if (infoPtr == NULL)
     1553        return -1;
     1554    if (lpTbInfo == NULL)
     1555        return -1;
     1556    if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOW))
     1557        return -1;
    15451558
    15461559    nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam);
     
    15481561        return -1;
    15491562
     1563    btnPtr = &infoPtr->buttons[nIndex];
     1564
     1565    if (lpTbInfo->dwMask & TBIF_COMMAND)
     1566        lpTbInfo->idCommand = btnPtr->idCommand;
     1567    if (lpTbInfo->dwMask & TBIF_IMAGE)
     1568        lpTbInfo->iImage = btnPtr->iBitmap;
     1569    if (lpTbInfo->dwMask & TBIF_LPARAM)
     1570        lpTbInfo->lParam = btnPtr->dwData;
     1571    if (lpTbInfo->dwMask & TBIF_SIZE)
     1572        lpTbInfo->cx = (WORD)(btnPtr->rect.right - btnPtr->rect.left);
     1573    if (lpTbInfo->dwMask & TBIF_STATE)
     1574        lpTbInfo->fsState = btnPtr->fsState;
     1575    if (lpTbInfo->dwMask & TBIF_STYLE)
     1576        lpTbInfo->fsStyle = btnPtr->fsStyle;
     1577    if (lpTbInfo->dwMask & TBIF_TEXT) {
     1578        if ((btnPtr->iString >= 0) || (btnPtr->iString < infoPtr->nNumStrings))
     1579            lstrcpynW (lpTbInfo->pszText,
     1580                       infoPtr->strings[btnPtr->iString],
     1581                       lpTbInfo->cchText);
     1582    }
     1583
     1584    return nIndex;
     1585}
     1586
     1587/* << TOOLBAR_GetButtonInfo32W >> */
     1588
     1589
     1590static LRESULT
     1591TOOLBAR_GetButtonSize (HWND hwnd)
     1592{
     1593    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     1594
     1595    return MAKELONG((WORD)infoPtr->nButtonWidth,
     1596                    (WORD)infoPtr->nButtonHeight);
     1597}
     1598
     1599
     1600static LRESULT
     1601TOOLBAR_GetButtonTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
     1602{
     1603    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     1604    INT nIndex, nStringIndex;
     1605
     1606    nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam);
     1607    if (nIndex == -1)
     1608        return -1;
     1609
    15501610    nStringIndex = infoPtr->buttons[nIndex].iString;
    15511611
     
    15571617    if (lParam == 0) return -1;
    15581618
    1559     lstrcpyA ((LPSTR)lParam, (LPSTR)infoPtr->strings[nStringIndex]);
    1560 
    1561     return lstrlenA ((LPSTR)infoPtr->strings[nStringIndex]);
    1562 }
    1563 
     1619    lstrcpyWtoA ((LPSTR)lParam, infoPtr->strings[nStringIndex]);
     1620
     1621    return lstrlenW (infoPtr->strings[nStringIndex]);
     1622}
     1623
     1624static LRESULT TOOLBAR_GetButtonTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
     1625{
     1626    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     1627    INT nIndex, nStringIndex;
     1628
     1629    nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam);
     1630    if (nIndex == -1)
     1631        return -1;
     1632
     1633    nStringIndex = infoPtr->buttons[nIndex].iString;
     1634
     1635//    TRACE (toolbar, "index=%d stringIndex=%d\n", nIndex, nStringIndex);
     1636
     1637    if ((nStringIndex < 0) || (nStringIndex >= infoPtr->nNumStrings))
     1638        return -1;
     1639
     1640    if (lParam == 0) return -1;
     1641
     1642    lstrcpyW ((LPWSTR)lParam, infoPtr->strings[nStringIndex]);
     1643
     1644    return lstrlenW (infoPtr->strings[nStringIndex]);
     1645}
    15641646
    15651647/* << TOOLBAR_GetButtonText32W >> */
     
    18981980}
    18991981
     1982static LRESULT TOOLBAR_InsertButtonW (HWND hwnd, WPARAM wParam, LPARAM lParam)
     1983{
     1984  //CB: just call InsertButtonA, no Unicode used?!?
     1985
     1986  return TOOLBAR_InsertButtonA(hwnd,wParam,lParam);
     1987}
    19001988
    19011989/* << TOOLBAR_InsertButton32W >> */
     
    20512139}
    20522140
     2141static LRESULT TOOLBAR_SaveRestoreW(HWND hwnd,WPARAM wParam,LPARAM lParam)
     2142{
     2143#if 0
     2144    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     2145    LPTBSAVEPARAMSW lpSave = (LPTBSAVEPARAMSW)lParam;
     2146
     2147    if (lpSave == NULL) return 0;
     2148
     2149    if ((BOOL)wParam) {
     2150        /* save toolbar information */
     2151//      FIXME (toolbar, "save to \"%s\" \"%s\"\n",
     2152//             lpSave->pszSubKey, lpSave->pszValueName);
     2153
     2154
     2155    }
     2156    else {
     2157        /* restore toolbar information */
     2158
     2159//      FIXME (toolbar, "restore from \"%s\" \"%s\"\n",
     2160//             lpSave->pszSubKey, lpSave->pszValueName);
     2161
     2162
     2163    }
     2164#endif
     2165
     2166    return 0;
     2167}
    20532168
    20542169/* << TOOLBAR_SaveRestore32W >> */
     
    20612176    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    20622177
    2063     if ((LOWORD(lParam) <= 0) || (HIWORD(lParam) <= 0)) return FALSE;
     2178    if (((INT)LOWORD(lParam) <= 0) || ((INT)HIWORD(lParam) <= 0)) return FALSE;
    20642179
    20652180    infoPtr->nBitmapWidth = (INT)LOWORD(lParam);
     
    21052220            (btnPtr->iString < infoPtr->nNumStrings)) {
    21062221#if 0
    2107             CHAR **lpString = &infoPtr->strings[btnPtr->iString];
     2222            CHAR **lpString = &infoPtr->strings[btnPtr->iString]; //wrong, it's Unicode!!!
    21082223            INT len = lstrlenA (lptbbi->pszText);
    21092224            *lpString = COMCTL32_ReAlloc (lpString, sizeof(char)*(len+1));
     
    21182233}
    21192234
     2235static LRESULT TOOLBAR_SetButtonInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
     2236{
     2237    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     2238    LPTBBUTTONINFOW lptbbi = (LPTBBUTTONINFOW)lParam;
     2239    TBUTTON_INFO *btnPtr;
     2240    INT nIndex;
     2241
     2242    if (lptbbi == NULL)
     2243        return FALSE;
     2244    if (lptbbi->cbSize < sizeof(TBBUTTONINFOW))
     2245        return FALSE;
     2246
     2247    nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam);
     2248    if (nIndex == -1)
     2249        return FALSE;
     2250
     2251    btnPtr = &infoPtr->buttons[nIndex];
     2252    if (lptbbi->dwMask & TBIF_COMMAND)
     2253        btnPtr->idCommand = lptbbi->idCommand;
     2254    if (lptbbi->dwMask & TBIF_IMAGE)
     2255        btnPtr->iBitmap = lptbbi->iImage;
     2256    if (lptbbi->dwMask & TBIF_LPARAM)
     2257        btnPtr->dwData = lptbbi->lParam;
     2258/*    if (lptbbi->dwMask & TBIF_SIZE) */
     2259/*      btnPtr->cx = lptbbi->cx; */
     2260    if (lptbbi->dwMask & TBIF_STATE)
     2261        btnPtr->fsState = lptbbi->fsState;
     2262    if (lptbbi->dwMask & TBIF_STYLE)
     2263        btnPtr->fsStyle = lptbbi->fsStyle;
     2264
     2265    if (lptbbi->dwMask & TBIF_TEXT) {
     2266        if ((btnPtr->iString >= 0) ||
     2267            (btnPtr->iString < infoPtr->nNumStrings)) {
     2268#if 0
     2269            WCHAR **lpString = &infoPtr->strings[btnPtr->iString];
     2270            INT len = lstrlenW (lptbbi->pszText);
     2271            *lpString = COMCTL32_ReAlloc (lpString, sizeof(wchar)*(len+1));
     2272#endif
     2273
     2274            /* this is the ultimate sollution */
     2275/*          Str_SetPtrW (&infoPtr->strings[btnPtr->iString], lptbbi->pszText); */
     2276        }
     2277    }
     2278
     2279    return TRUE;
     2280}
    21202281
    21212282/* << TOOLBAR_SetButtonInfo32W >> */
     
    21272288    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    21282289
    2129     if ((LOWORD(lParam) <= 0) || (HIWORD(lParam) <= 0)) return FALSE;
     2290    if (((INT)LOWORD(lParam) <= 0) || ((INT)HIWORD(lParam) <= 0)) return FALSE;
    21302291
    21312292    infoPtr->nButtonWidth = (INT)LOWORD(lParam);
     
    29663127            return TOOLBAR_AddButtonsA (hwnd, wParam, lParam);
    29673128
    2968 /*      case TB_ADDBUTTONSW: */
     3129        case TB_ADDBUTTONSW:
     3130            return TOOLBAR_AddButtonsW(hwnd,wParam,lParam);
    29693131
    29703132        case TB_ADDSTRINGA:
     
    30153177            return TOOLBAR_GetButtonInfoA (hwnd, wParam, lParam);
    30163178
    3017 /*      case TB_GETBUTTONINFOW:         */ /* 4.71 */
     3179        case TB_GETBUTTONINFOW:         /* 4.71 */
     3180            return TOOLBAR_GetButtonInfoW(hwnd,wParam,lParam);
    30183181
    30193182        case TB_GETBUTTONSIZE:
     
    30233186            return TOOLBAR_GetButtonTextA (hwnd, wParam, lParam);
    30243187
    3025 /*      case TB_GETBUTTONTEXTW: */
     3188        case TB_GETBUTTONTEXTW:
     3189            return TOOLBAR_GetButtonTextW(hwnd,wParam,lParam);
     3190
    30263191/*      case TB_GETCOLORSCHEME:                 */ /* 4.71 */
    30273192
     
    30853250            return TOOLBAR_InsertButtonA (hwnd, wParam, lParam);
    30863251
    3087 /*      case TB_INSERTBUTTONW: */
     3252        case TB_INSERTBUTTONW:
     3253            return TOOLBAR_InsertButtonW(hwnd,wParam,lParam);
     3254
    30883255/*      case TB_INSERTMARKHITTEST:              */ /* 4.71 */
    30893256
     
    31203287            return TOOLBAR_SaveRestoreA (hwnd, wParam, lParam);
    31213288
    3122 /*      case TB_SAVERESTOREW: */
     3289        case TB_SAVERESTOREW:
     3290            return TOOLBAR_SaveRestoreW(hwnd,wParam,lParam);
     3291
    31233292/*      case TB_SETANCHORHIGHLIGHT:             */ /* 4.71 */
    31243293
     
    31293298            return TOOLBAR_SetButtonInfoA (hwnd, wParam, lParam);
    31303299
    3131 /*      case TB_SETBUTTONINFOW:                 */ /* 4.71 */
     3300        case TB_SETBUTTONINFOW:                 /* 4.71 */
     3301            return TOOLBAR_SetButtonInfoW(hwnd,wParam,lParam);
    31323302
    31333303        case TB_SETBUTTONSIZE:
  • trunk/src/comctl32/tooltips.c

    r252 r267  
    1 /* $Id: tooltips.c,v 1.9 1999-06-30 15:52:18 cbratschi Exp $ */
     1/* $Id: tooltips.c,v 1.10 1999-07-04 21:06:00 cbratschi Exp $ */
    22/*
    33 * Tool tip control
     
    19971997    infoPtr->hFont = (HFONT)wParam;
    19981998
    1999     if ((LOWORD(lParam)) & (infoPtr->nCurrentTool != -1)) {
    2000 //      FIXME (tooltips, "full redraw needed!\n");
     1999    if ((LOWORD(lParam)) & (infoPtr->nCurrentTool != -1))
     2000    {
     2001      /* force repaint */
     2002      if (infoPtr->bActive) TOOLTIPS_Show(hwnd,infoPtr);
     2003      else if (infoPtr->bTrackActive) TOOLTIPS_TrackShow(hwnd,infoPtr);
    20012004    }
    20022005
  • trunk/src/comctl32/trackbar.c

    r252 r267  
    1 /* $Id: trackbar.c,v 1.10 1999-06-30 15:52:18 cbratschi Exp $ */
     1/* $Id: trackbar.c,v 1.11 1999-07-04 21:06:00 cbratschi Exp $ */
    22/*
    33 * Trackbar control
     
    11591159    newMax = (INT)HIWORD(lParam);
    11601160
    1161     if (newMin >= newMax) return 0;
     1161    if (newMin == newMax) return 0;
     1162    if (newMin > newMax)
     1163    { //exchange
     1164      int x;
     1165
     1166      x = newMin;
     1167      newMin = newMax;
     1168      newMax = x;
     1169    }
    11621170    if (newMin == infoPtr->nRangeMin && newMax == infoPtr->nRangeMax) return 0;
    11631171
Note: See TracChangeset for help on using the changeset viewer.