Changeset 3154 for trunk/src/comctl32


Ignore:
Timestamp:
Mar 18, 2000, 5:17:35 PM (26 years ago)
Author:
cbratschi
Message:

Corel 20000317 merge, ccbase finished, bug fixes

Location:
trunk/src/comctl32
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/CCBase.cpp

    r3145 r3154  
    1 /* $Id: CCBase.cpp,v 1.3 2000-03-17 17:13:22 cbratschi Exp $ */
     1/* $Id: CCBase.cpp,v 1.4 2000-03-18 16:17:20 cbratschi Exp $ */
    22/*
    33 * COMCTL32 Base Functions and Macros for all Controls
     
    1414BOOL checkVersion(INT iVersion)
    1515{
    16   return TRUE; //CB: todo
     16  return iVersion <= COMCTL32_VERSION;
    1717}
    1818
     
    213213//Tooltips
    214214
    215 HWND createToolTip(HWND hwnd,UINT flags)
     215HWND createToolTip(HWND hwnd,UINT flags,BOOL addtool)
    216216{
    217217  HWND hwndToolTip;
     
    231231  sendNotify(hwnd,NM_TOOLTIPSCREATED,&nmttc.hdr);
    232232
    233   ZeroMemory(&ti,sizeof(TTTOOLINFOA));
    234   ti.cbSize   = sizeof(TTTOOLINFOA);
    235   ti.uFlags   = flags;
    236   ti.hwnd     = hwnd;
    237   ti.uId      = 0;
    238   ti.lpszText = "";
    239   SetRectEmpty (&ti.rect);
    240 
    241   SendMessageA(hwndToolTip,TTM_ADDTOOLA,0,(LPARAM)&ti);
     233  if (addtool)
     234  {
     235    ZeroMemory(&ti,sizeof(TTTOOLINFOA));
     236    ti.cbSize   = sizeof(TTTOOLINFOA);
     237    ti.uFlags   = flags;
     238    ti.hwnd     = hwnd;
     239    ti.uId      = 0;
     240    ti.lpszText = "";
     241    SetRectEmpty (&ti.rect);
     242
     243    SendMessageA(hwndToolTip,TTM_ADDTOOLA,0,(LPARAM)&ti);
     244  }
    242245
    243246  return hwndToolTip;
  • trunk/src/comctl32/CCBase.h

    r3145 r3154  
    1 /* $Id: CCBase.h,v 1.4 2000-03-17 17:13:22 cbratschi Exp $ */
     1/* $Id: CCBase.h,v 1.5 2000-03-18 16:17:21 cbratschi Exp $ */
    22/*
    33 * COMCTL32 Base Functions and Macros for all Controls
     
    3939LRESULT sendVScroll(HWND hwnd,UINT wNotifyCode);
    4040
    41 HWND createToolTip(HWND hwnd,UINT flags);
     41HWND createToolTip(HWND hwnd,UINT flags,BOOL addtool);
    4242VOID destroyToolTip(HWND hwndToolTip);
    4343
  • trunk/src/comctl32/comctl32undoc.cpp

    r2875 r3154  
    1 /* $Id: comctl32undoc.cpp,v 1.1 2000-02-23 17:09:40 cbratschi Exp $ */
     1/* $Id: comctl32undoc.cpp,v 1.2 2000-03-18 16:17:22 cbratschi Exp $ */
    22/*
    33 * Undocumented functions from COMCTL32.DLL
     
    1313
    1414/*
    15  - Corel 20000212 level
    16  - WINE 20000130 level
     15 - Corel 20000317 level
     16 - (WINE 20000130 level)
    1717*/
    1818
     
    764764    LPVOID pSrc;
    765765
    766     dprintf(("COMCTL32: DSA_GetItem"));
     766    dprintf2(("COMCTL32: DSA_GetItem"));
    767767
    768768    if (!hdsa)
     
    797797    LPVOID pSrc;
    798798
    799     dprintf(("COMCTL32: DSA_GetItemPtr"));
     799    dprintf2(("COMCTL32: DSA_GetItemPtr"));
    800800
    801801    if (!hdsa)
     
    833833    LPVOID pDest, lpTemp;
    834834
    835     dprintf(("COMCTL32: DSA_SetItem"));
     835    dprintf2(("COMCTL32: DSA_SetItem"));
    836836
    837837    if ((!hdsa) || nIndex < 0)
     
    890890    LPDWORD p;
    891891
    892     dprintf(("COMCTL32: DSA_InsertItem"));
     892    dprintf2(("COMCTL32: DSA_InsertItem"));
    893893
    894894    if ((!hdsa) || nIndex < 0)
     
    959959    INT  nSize;
    960960
    961     dprintf(("COMCTL32: DSA_DeleteItem"));
     961    dprintf2(("COMCTL32: DSA_DeleteItem"));
    962962
    963963    if (!hdsa)
     
    12001200DPA_GetPtr (const HDPA hdpa, INT i)
    12011201{
    1202     dprintf(("COMCTL32: DPA_GetPtr"));
     1202    dprintf2(("COMCTL32: DPA_GetPtr"));
    12031203
    12041204    if (!hdpa)
     
    12341234    INT i;
    12351235
    1236     dprintf(("COMCTL32: DPA_GetPtrIndex"));
     1236    dprintf2(("COMCTL32: DPA_GetPtrIndex"));
    12371237
    12381238    if (!hdpa->ptrs)
     
    12691269    LPVOID  *lpTemp, *lpDest;
    12701270
    1271     dprintf(("COMCTL32: DPA_InsertPtr"));
     1271    dprintf2(("COMCTL32: DPA_InsertPtr"));
    12721272
    12731273    if ((!hdpa) || (i < 0))
     
    13411341    LPVOID *lpTemp;
    13421342
    1343     dprintf(("COMCTL32: DPA_SetPtr"));
     1343    dprintf2(("COMCTL32: DPA_SetPtr"));
    13441344
    13451345    if ((!hdpa) || i < 0)
     
    13951395    INT  nSize;
    13961396
    1397     dprintf(("COMCTL32: DPA_DeletePtr"));
     1397    dprintf2(("COMCTL32: DPA_DeletePtr"));
    13981398
    13991399    if ((!hdpa) || i < 0 || i >= hdpa->nItemCount)
     
    14791479 * RETURNS
    14801480 *     NONE
     1481 *
     1482 * NOTES:
     1483 *          Reverted back to the orginal quick sort, because the existing sort did not sort.
     1484 *          Kudos to the orginal author of the quick sort.
    14811485 */
    14821486
     
    14921496    i = l;
    14931497    j = r;
    1494 
    1495     if ( i >= j )
    1496         return;
    1497     else if ( i == (j - 1) )
    1498     {
    1499         if ( (pfnCompare)( lpPtrs[i], lpPtrs[j], lParam ) > 0 )
     1498    v = lpPtrs[(int)(l+r)/2];
     1499    do {
     1500        while ((pfnCompare)(lpPtrs[i], v, lParam) < 0) i++;
     1501        while ((pfnCompare)(lpPtrs[j], v, lParam) > 0) j--;
     1502        if (i <= j)
    15001503        {
    1501             t = lpPtrs[i];
    1502             lpPtrs[i] = lpPtrs[j];
    1503             lpPtrs[j] = t;
    1504         }
    1505         return;
    1506     }
    1507 
    1508     v = lpPtrs[(int)(l+r)/2];
    1509 
    1510     while ( i < j)
    1511     {
    1512         while ( (pfnCompare)( lpPtrs[i], v, lParam ) <= 0 && i < j )
    1513             i++;
    1514 
    1515         while ( (pfnCompare)( v, lpPtrs[j], lParam ) <= 0 && i < j )
    1516             j--;
    1517 
    1518         if ( i < j )
    1519         {
    1520             /* Swap the values; increment i and decrement j to avoid
    1521                infinite conditions where i and j swap forever */
    15221504            t = lpPtrs[i];
    15231505            lpPtrs[i++] = lpPtrs[j];
    15241506            lpPtrs[j--] = t;
    15251507        }
    1526     }
    1527 
    1528     if ( i - 1 > l )
    1529         DPA_QuickSort (lpPtrs, l, i - 1, pfnCompare, lParam);
    1530     if ( j + 1 < r )
    1531         DPA_QuickSort (lpPtrs, j + 1, r, pfnCompare, lParam);
     1508    } while (i <= j);
     1509    if (l < j) DPA_QuickSort (lpPtrs, l, j, pfnCompare, lParam);
     1510    if (i < r) DPA_QuickSort (lpPtrs, i, r, pfnCompare, lParam);
    15321511}
    15331512
  • trunk/src/comctl32/header.cpp

    r2895 r3154  
    1 /* $Id: header.cpp,v 1.2 2000-02-25 17:00:15 cbratschi Exp $ */
     1/* $Id: header.cpp,v 1.3 2000-03-18 16:17:23 cbratschi Exp $ */
    22/*
    33 *  Header control
     
    1616 * Version: 5.00
    1717 */
     18
     19/*
     20 - Corel 20000317 level
     21*/
    1822
    1923#include <string.h>
  • trunk/src/comctl32/listview.cpp

    r2895 r3154  
    1 /*$Id: listview.cpp,v 1.2 2000-02-25 17:00:16 cbratschi Exp $*/
     1/*$Id: listview.cpp,v 1.3 2000-03-18 16:17:24 cbratschi Exp $*/
    22/*
    33 * Listview control
     
    3939
    4040/*
    41  - Corel 20000212 level
    42  - WINE 20000130 level
     41 - Corel 20000317 level
     42 - (WINE 20000130 level)
    4343*/
    4444
    4545#include <string.h>
    4646#include <wcstr.h>
     47#include <stdio.h>
    4748#include "winbase.h"
    4849#include "commctrl.h"
     
    5051#include "listview.h"
    5152#include "comctl32.h"
     53#include "ctype.h"
    5254
    5355/*
     
    9698
    9799#define LISTVIEW_GetInfoPtr(hwnd) ((LISTVIEW_INFO*)getInfoPtr(hwnd))
     100
     101INT WINAPI COMCTL32_StrCmpNIA(LPCSTR,LPCSTR,INT);
     102
     103#define strncasecmp COMCTL32_StrCmpNIA
    98104
    99105/*
     
    20322038  }
    20332039
     2040  /* Don't bother painting item being edited */
     2041  if (infoPtr->hwndEdit && lvItem.state & LVIS_FOCUSED)
     2042      return;
     2043
    20342044  rcItem.top += infoPtr->iconSize.cy + ICON_BOTTOM_PADDING;
    20352045  nLabelWidth = ListView_GetStringWidthW(hwnd, lvItem.pszText);
     
    20692079 * None
    20702080 */
    2071 static VOID LISTVIEW_RefreshReport(HWND hwnd, HDC hdc)
     2081static VOID LISTVIEW_DrawReport(HWND hwnd, HDC hdc)
    20722082{
    20732083  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     
    22422252 * None
    22432253 */
    2244 static VOID LISTVIEW_RefreshList(HWND hwnd, HDC hdc)
     2254static VOID LISTVIEW_DrawList(HWND hwnd, HDC hdc)
    22452255{
    22462256  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     
    22502260  INT nColumnCount;
    22512261  INT nCountPerColumn;
    2252   INT nItemWidth = LISTVIEW_GetItemWidth(hwnd);
    2253   INT nItemHeight = LISTVIEW_GetItemHeight(hwnd);
     2262  INT nItemWidth = infoPtr->nItemWidth;
     2263  INT nItemHeight = infoPtr->nItemHeight;
    22542264
    22552265  /* get number of fully visible columns */
     
    22852295 * None
    22862296 */
    2287 static VOID LISTVIEW_RefreshIcon(HWND hwnd, HDC hdc, BOOL bSmall)
     2297static VOID LISTVIEW_DrawIcon(HWND hwnd, HDC hdc, BOOL bSmall)
    22882298{
    22892299  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     
    23382348 * NoneX
    23392349 */
    2340 static VOID LISTVIEW_Refresh(HWND hwnd, HDC hdc)
     2350static VOID LISTVIEW_Draw(HWND hwnd, HDC hdc)
    23412351{
    23422352  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     
    23572367  if (uView == LVS_LIST)
    23582368  {
    2359     LISTVIEW_RefreshList(hwnd, hdc);
     2369    LISTVIEW_DrawList(hwnd, hdc);
    23602370  }
    23612371  else if (uView == LVS_REPORT)
    23622372  {
    2363     LISTVIEW_RefreshReport(hwnd, hdc);
     2373    LISTVIEW_DrawReport(hwnd, hdc);
    23642374  }
    23652375  else if (uView == LVS_SMALLICON)
    23662376  {
    2367     LISTVIEW_RefreshIcon(hwnd, hdc, TRUE);
     2377    LISTVIEW_DrawIcon(hwnd, hdc, TRUE);
    23682378  }
    23692379  else if (uView == LVS_ICON)
    23702380  {
    2371     LISTVIEW_RefreshIcon(hwnd, hdc, FALSE);
     2381    LISTVIEW_DrawIcon(hwnd, hdc, FALSE);
    23722382  }
    23732383
     
    51725182  LISTVIEW_ITEM *lpItem = NULL;
    51735183
    5174 //  TRACE("(hwnd=%x,lpLVItem=%p)\n", hwnd, lpLVItem);
    5175 
    51765184  if (lpLVItem != NULL)
    51775185  {
     
    52145222                if (lpLVItem->mask & LVIF_STATE)
    52155223                {
    5216                   if (lpLVItem->stateMask & LVIS_FOCUSED)
     5224                  lpItem->state &= ~(LVIS_FOCUSED|LVIS_SELECTED);
     5225                  if (lpLVItem->stateMask & LVIS_SELECTED)
     5226                  {
     5227                    LISTVIEW_SetSelection(hwnd, nItem);
     5228                  }
     5229                  else if (lpLVItem->stateMask & LVIS_FOCUSED)
    52175230                  {
    52185231                    LISTVIEW_SetItemFocus(hwnd, nItem);
     
    59405953  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
    59415954
     5955  if (first == second)
     5956    return 0;
     5957
    59425958  rv = (infoPtr->pfnCompare)( ((LISTVIEW_ITEM*) first)->lParam,
    59435959          ((LISTVIEW_ITEM*) second)->lParam, infoPtr->lParamSort );
     
    65236539}
    65246540
     6541/************************ Defines that LISTVIEW_ProcessLetterKeys uses *******************************/
     6542#define KEY_DELAY       900
     6543#define LISTVIEW_InitLvItemStruct(item,idx,TEXT)  \
     6544                    ZeroMemory(&(item), sizeof(LVITEMA)); \
     6545                    (item).mask = LVIF_TEXT; \
     6546                    (item).iItem = (idx); \
     6547                    (item).iSubItem = 0; \
     6548                    (item).pszText = (CHAR*)&(TEXT); \
     6549                    (item).cchTextMax = MAX_PATH
     6550
     6551/************************************************************************************************************************
     6552* DESCRIPTION:
     6553*       Processes keyboard messages generated by pressing the letter keys on the keyboard.
     6554*       Assumes the list is sorted alphabetically, without regard to case.
     6555*
     6556* PARAMETERS:
     6557*       [ I ]   HWND: handle to the window
     6558*       [ I ]   WPARAM: the character code, the actual character
     6559*       [ I ]   LPARAM: key data
     6560*
     6561*
     6562* RETURN:
     6563*       Zero.
     6564*
     6565* CHANGE LOG:
     6566*       Feb 17, 2000 -------------> Creation of function.
     6567*       Feb 22, 2000 -------------> Added macros.
     6568* TODO:
     6569*
     6570*
     6571************************************************************************************************************************/
     6572static INT LISTVIEW_ProcessLetterKeys( HWND hwnd, WPARAM charCode, LPARAM keyData )
     6573{
     6574    LISTVIEW_INFO *infoPtr = NULL;
     6575    INT nItem = -1;
     6576    BOOL bRedraw;
     6577    INT nSize = 0;
     6578    INT idx = 0;
     6579    BOOL bFoundMatchingFiles = FALSE;
     6580    LVITEMA item;
     6581    CHAR TEXT[ MAX_PATH ];
     6582    CHAR szCharCode[ 2 ];
     6583    DWORD timeSinceLastKeyPress = 0;
     6584
     6585    sprintf( szCharCode, "%c", charCode );
     6586
     6587    /* simple parameter checking  */
     6588    if ( !hwnd || !charCode || !keyData )
     6589        return 0;
     6590
     6591    infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
     6592
     6593    if ( !infoPtr )
     6594        return 0;
     6595
     6596    /* only allow the valid WM_CHARs through */
     6597    if ( isalnum( charCode ) || charCode == '.' || charCode == '`' || charCode == '!'
     6598          || charCode == '@' || charCode == '#' || charCode == '$' || charCode == '%'
     6599          || charCode == '^' || charCode == '&' || charCode == '*' || charCode == '('
     6600          || charCode == ')' || charCode == '-' || charCode == '_' || charCode == '+'
     6601          || charCode == '=' || charCode == '\\'|| charCode == ']' || charCode == '}'
     6602          || charCode == '[' || charCode == '{' || charCode == '/' || charCode == '?'
     6603          || charCode == '>' || charCode == '<' || charCode == ',' || charCode == '~')
     6604    {
     6605        timeSinceLastKeyPress = GetTickCount();
     6606
     6607        nSize = GETITEMCOUNT( infoPtr );
     6608        /* if there are 0 items, there is no where to go */
     6609        if ( nSize == 0 )
     6610            return 0;
     6611        /*
     6612         * If the last charCode equals the current charCode then look
     6613         * to the next element in list to see if it matches the previous
     6614         * charCode.
     6615         */
     6616        if ( infoPtr->charCode == charCode )
     6617        {
     6618            if ( timeSinceLastKeyPress - infoPtr->timeSinceLastKeyPress < KEY_DELAY )
     6619            {    /* append new character to search string */
     6620                strcat( infoPtr->szSearchParam, szCharCode );
     6621                infoPtr->nSearchParamLength++;
     6622
     6623                /* loop from start of list view */
     6624                for( idx = infoPtr->nFocusedItem; idx < nSize; idx++ )
     6625                {   /* get item */
     6626                    LISTVIEW_InitLvItemStruct( item, idx, TEXT );
     6627                    ListView_GetItemA( hwnd, &item );
     6628
     6629                    /* compare items */
     6630                    if ( strncasecmp( item.pszText, infoPtr->szSearchParam,
     6631                                      infoPtr->nSearchParamLength ) == 0 )
     6632                    {
     6633                        nItem = idx;
     6634                        break;
     6635                    }
     6636                }
     6637            }
     6638            else if ( infoPtr->timeSinceLastKeyPress > timeSinceLastKeyPress )
     6639            { /* The DWORD went over it's boundery?? Ergo assuming too slow??. */
     6640                for ( idx = 0; idx < nSize; idx++ )
     6641                {
     6642                    LISTVIEW_InitLvItemStruct( item, idx, TEXT );
     6643                    ListView_GetItemA( hwnd, &item );
     6644
     6645                    if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
     6646                    {
     6647                        nItem = idx;
     6648                        break;
     6649                    }
     6650                }
     6651                strcpy( infoPtr->szSearchParam, szCharCode );
     6652                infoPtr->nSearchParamLength = 1;
     6653            }
     6654            else
     6655            {   /* Save szCharCode for use in later searches */
     6656                strcpy( infoPtr->szSearchParam, szCharCode );
     6657                infoPtr->nSearchParamLength = 1;
     6658
     6659                LISTVIEW_InitLvItemStruct( item, infoPtr->nFocusedItem + 1, TEXT );
     6660                ListView_GetItemA( hwnd, &item );
     6661
     6662                if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
     6663                    nItem = infoPtr->nFocusedItem + 1;
     6664                else
     6665                {   /*
     6666                     * Ok so there are no more folders that match
     6667                     * now we look for files.
     6668                     */
     6669                    for ( idx = infoPtr->nFocusedItem + 1; idx < nSize; idx ++ )
     6670                    {
     6671                        LISTVIEW_InitLvItemStruct( item, idx, TEXT );
     6672                        ListView_GetItemA( hwnd, &item );
     6673
     6674                        if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
     6675                        {
     6676                            nItem = idx;
     6677                            bFoundMatchingFiles = TRUE;
     6678                            break;
     6679                        }
     6680                    }
     6681                    if ( !bFoundMatchingFiles )
     6682                    {  /* go back to first instance */
     6683                        for ( idx = 0; idx < nSize; idx ++ )
     6684                        {
     6685                            LISTVIEW_InitLvItemStruct( item,idx, TEXT );
     6686                            ListView_GetItemA( hwnd, &item );
     6687
     6688                            if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
     6689                            {
     6690                                nItem = idx;
     6691                                break;
     6692                            }
     6693                        }
     6694                    }
     6695                }
     6696            }
     6697        } /*END: if ( infoPtr->charCode == charCode )*/
     6698
     6699        else /* different keypressed */
     6700        {
     6701            /* could be that they are spelling the file/directory for us */
     6702            if ( timeSinceLastKeyPress - infoPtr->timeSinceLastKeyPress > KEY_DELAY )
     6703            {   /*
     6704                 * Too slow, move to the first instance of the
     6705                 * charCode.
     6706                 */
     6707                for ( idx = 0; idx < nSize; idx++ )
     6708                {
     6709                    LISTVIEW_InitLvItemStruct( item,idx, TEXT );
     6710                    ListView_GetItemA( hwnd, &item );
     6711
     6712                    if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
     6713                    {
     6714                        nItem = idx;
     6715                        break;
     6716                    }
     6717                }
     6718                strcpy( infoPtr->szSearchParam, szCharCode );
     6719                infoPtr->nSearchParamLength = 1;
     6720            }
     6721            else if ( infoPtr->timeSinceLastKeyPress > timeSinceLastKeyPress )
     6722            {  /* The DWORD went over it's boundery?? Ergo assuming too slow??. */
     6723                for ( idx = 0; idx < nSize; idx++ )
     6724                {
     6725                    LISTVIEW_InitLvItemStruct( item,idx, TEXT );
     6726                    ListView_GetItemA( hwnd, &item );
     6727
     6728                    if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
     6729                    {
     6730                        nItem = idx;
     6731                        break;
     6732                    }
     6733                }
     6734                strcpy( infoPtr->szSearchParam, szCharCode );
     6735                infoPtr->nSearchParamLength = 1;
     6736            }
     6737            else /* Search for the string the user is typing */
     6738            {
     6739                /* append new character to search string */
     6740                strcat( infoPtr->szSearchParam, szCharCode );
     6741                infoPtr->nSearchParamLength++;
     6742
     6743                /* loop from start of list view */
     6744                for( idx = 0; idx < nSize; idx++ )
     6745                {   /* get item */
     6746                    LISTVIEW_InitLvItemStruct( item, idx, TEXT );
     6747                    ListView_GetItemA( hwnd, &item );
     6748
     6749                    /* compare items */
     6750                    if ( strncasecmp( item.pszText, infoPtr->szSearchParam,
     6751                                      infoPtr->nSearchParamLength ) == 0 )
     6752                    {
     6753                        nItem = idx;
     6754                        break;
     6755                    }
     6756                }
     6757            }
     6758        }/*END: else */
     6759    }
     6760    else
     6761        return 0;
     6762
     6763    bRedraw = LISTVIEW_KeySelection(hwnd, nItem );
     6764    if (bRedraw != FALSE)
     6765    {
     6766        /* refresh client area */
     6767        InvalidateRect(hwnd, NULL, TRUE);
     6768        UpdateWindow(hwnd);
     6769    }
     6770
     6771    /* Store the WM_CHAR for next time */
     6772    infoPtr->charCode = charCode;
     6773
     6774    /* Store time */
     6775    infoPtr->timeSinceLastKeyPress = timeSinceLastKeyPress;
     6776
     6777    return 0;
     6778
     6779}/*END:LISTVIEW_ProcessLetterKeys( HWND hwndParent, INT nVirtualKey, LONG lKeyData ) */
     6780
    65256781/***
    65266782 * DESCRIPTION:
     
    68667122  {
    68677123    hdc = BeginPaint(hwnd, &ps);
    6868     LISTVIEW_Refresh(hwnd, hdc);
     7124    LISTVIEW_Draw(hwnd, hdc);
    68697125    EndPaint(hwnd, &ps);
    68707126  }
    68717127  else
    68727128  {
    6873     LISTVIEW_Refresh(hwnd, hdc);
     7129    LISTVIEW_Draw(hwnd, hdc);
    68747130  }
    68757131
     
    73077563  }
    73087564
     7565  /* If they change the view and we have an active edit control
     7566     we will need to kill the control since the redraw will
     7567     misplace the edit control.
     7568   */
     7569  if (infoPtr->hwndEdit &&
     7570        ((uNewView & (LVS_ICON|LVS_LIST|LVS_SMALLICON)) !=
     7571        ((LVS_ICON|LVS_LIST|LVS_SMALLICON) & uOldView)))
     7572  {
     7573     SendMessageA(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0);
     7574  }
     7575
    73097576  return 0;
    73107577}
     
    75687835    return LISTVIEW_Update(hwnd, (INT)wParam);
    75697836
    7570 /*      case WM_CHAR: */
     7837  case WM_CHAR:
     7838    return LISTVIEW_ProcessLetterKeys( hwnd, wParam, lParam );
     7839
    75717840  case WM_COMMAND:
    75727841    return LISTVIEW_Command(hwnd, wParam, lParam);
  • trunk/src/comctl32/propsheet.cpp

    r3145 r3154  
    1 /* $Id: propsheet.cpp,v 1.2 2000-03-17 17:13:24 cbratschi Exp $ */
     1/* $Id: propsheet.cpp,v 1.3 2000-03-18 16:17:26 cbratschi Exp $ */
    22/*
    33 * Property Sheets
     
    1313 */
    1414
    15 /* WINE 991212 level */
     15/*
     16 - Corel WINE 20000317 level
     17 - (WINE 991212 level)
     18*/
    1619
    1720#include <string.h>
     
    8891 */
    8992static BOOL PROPSHEET_CreateDialog(PropSheetInfo* psInfo);
     93static BOOL PROPSHEET_SizeMismatch(HWND hwndDlg, PropSheetInfo* psInfo);
    9094static BOOL PROPSHEET_IsTooSmall(HWND hwndDlg, PropSheetInfo* psInfo);
    9195static BOOL PROPSHEET_AdjustSize(HWND hwndDlg, PropSheetInfo* psInfo);
     
    480484
    481485/******************************************************************************
     486 *            PROPSHEET_SizeMismatch
     487 *
     488 *     Verify that the tab control and the "largest" property sheet page dlg. template
     489 *     match in size.
     490 */
     491static BOOL PROPSHEET_SizeMismatch(HWND hwndDlg, PropSheetInfo* psInfo)
     492{
     493  HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
     494  RECT rcOrigTab, rcPage;
     495
     496  /*
     497   * Original tab size.
     498   */
     499  GetClientRect(hwndTabCtrl, &rcOrigTab);
     500  //TRACE("orig tab %d %d %d %d\n", rcOrigTab.left, rcOrigTab.top,
     501  //      rcOrigTab.right, rcOrigTab.bottom);
     502
     503  /*
     504   * Biggest page size.
     505   */
     506  rcPage.left   = psInfo->x;
     507  rcPage.top    = psInfo->y;
     508  rcPage.right  = psInfo->width;
     509  rcPage.bottom = psInfo->height;
     510
     511  MapDialogRect(hwndDlg, &rcPage);
     512  //TRACE("biggest page %d %d %d %d\n", rcPage.left, rcPage.top,
     513  //      rcPage.right, rcPage.bottom);
     514
     515  if ( (rcPage.right - rcPage.left) != (rcOrigTab.right - rcOrigTab.left) )
     516    return TRUE;
     517  if ( (rcPage.bottom - rcPage.top) != (rcOrigTab.bottom - rcOrigTab.top) )
     518    return TRUE;
     519
     520  return FALSE;
     521}
     522
     523/******************************************************************************
    482524 *            PROPSHEET_IsTooSmallWizard
    483525 *
     
    20942136      else
    20952137      {
    2096         if (PROPSHEET_IsTooSmall(hwnd, psInfo))
     2138        if (PROPSHEET_SizeMismatch(hwnd, psInfo))
    20972139        {
    20982140          PROPSHEET_AdjustSize(hwnd, psInfo);
  • trunk/src/comctl32/rebar.cpp

    r2875 r3154  
    1 /* $Id: rebar.cpp,v 1.1 2000-02-23 17:09:47 cbratschi Exp $ */
     1/* $Id: rebar.cpp,v 1.2 2000-03-18 16:17:27 cbratschi Exp $ */
    22/*
    33 * Rebar control
     
    2929#include "wingdi.h"
    3030#include "commctrl.h"
     31#include "ccbase.h"
    3132#include "rebar.h"
    3233#include "comctl32.h"
     
    4243
    4344
    44 #define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongA (hwnd, 0))
     45#define REBAR_GetInfoPtr(hwnd) ((REBAR_INFO*)getInfoPtr(hwnd))
    4546
    4647
     
    909910
    910911static LRESULT
    911 REBAR_GetUnicodeFormat (HWND hwnd)
    912 {
    913     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
    914     return infoPtr->bUnicode;
    915 }
    916 
    917 static LRESULT
    918 REBAR_GetVersion (HWND hwnd)
    919 {
    920     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
    921     return infoPtr->iVersion;
    922 }
    923 
    924 static LRESULT
    925912REBAR_HitTest (HWND hwnd, WPARAM wParam, LPARAM lParam)
    926913{
     
    14981485{
    14991486    REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
    1500     HWND hwndTemp = infoPtr->hwndNotify;
    1501 
    1502     infoPtr->hwndNotify = (HWND)wParam;
     1487    HWND hwndTemp = infoPtr->header.hwndNotify;
     1488
     1489    infoPtr->header.hwndNotify = (HWND)wParam;
    15031490
    15041491    return (LRESULT)hwndTemp;
     
    15231510/* << REBAR_SetTooltips >> */
    15241511
    1525 
    1526 static LRESULT
    1527 REBAR_SetUnicodeFormat (HWND hwnd, WPARAM wParam)
    1528 {
    1529     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
    1530     BOOL bTemp = infoPtr->bUnicode;
    1531     infoPtr->bUnicode = (BOOL)wParam;
    1532     return bTemp;
    1533 }
    1534 
    1535 static LRESULT
    1536 REBAR_SetVersion (HWND hwnd, INT iVersion)
    1537 {
    1538     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
    1539     INT iOldVersion = infoPtr->iVersion;
    1540 
    1541     if (iVersion > COMCTL32_VERSION)
    1542         return -1;
    1543 
    1544     infoPtr->iVersion = iVersion;
    1545 
    1546     return iOldVersion;
    1547 }
    15481512
    15491513static LRESULT
     
    16131577
    16141578    /* allocate memory for info structure */
    1615     infoPtr = (REBAR_INFO *)COMCTL32_Alloc (sizeof(REBAR_INFO));
    1616     SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
     1579    infoPtr = (REBAR_INFO*)initControl(hwnd,sizeof(REBAR_INFO));
    16171580
    16181581    /* initialize info structure */
    1619     infoPtr->iVersion = 0;
    16201582    infoPtr->clrBk = CLR_NONE;
    16211583    infoPtr->clrText = RGB(0, 0, 0);
     
    16271589    infoPtr->hcurDrag  = LoadCursorA (0, IDC_SIZEA);
    16281590
    1629     infoPtr->bUnicode = IsWindowUnicode (hwnd);
    1630 
    16311591//    if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_AUTOSIZE)
    16321592//      FIXME (rebar, "style RBS_AUTOSIZE set!\n");
    16331593
    1634 #if 0
    1635     SendMessageA (hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
    1636 #endif
    1637 
    1638 //    TRACE (rebar, "created!\n");
    16391594    return 0;
    16401595}
     
    16811636
    16821637    /* free rebar info data */
    1683     COMCTL32_Free (infoPtr);
    1684 
    1685 //    TRACE (rebar, "destroyed!\n");
     1638    doneControl(hwnd);
     1639
    16861640    return 0;
    16871641}
     
    19431897            return REBAR_GetToolTips (hwnd);
    19441898
    1945         case RB_GETUNICODEFORMAT:
    1946             return REBAR_GetUnicodeFormat (hwnd);
    1947 
    1948         case CCM_GETVERSION:
    1949             return REBAR_GetVersion (hwnd);
    1950 
    19511899        case RB_HITTEST:
    19521900            return REBAR_HitTest (hwnd, wParam, lParam);
     
    19931941
    19941942/*      case RB_SETTOOLTIPS: */
    1995 
    1996         case RB_SETUNICODEFORMAT:
    1997             return REBAR_SetUnicodeFormat (hwnd, wParam);
    1998 
    1999         case CCM_SETVERSION:
    2000             return REBAR_SetVersion (hwnd, (INT)wParam);
    20011943
    20021944        case RB_SHOWBAND:
     
    20511993//              ERR (rebar, "unknown msg %04x wp=%08x lp=%08lx\n",
    20521994//                   uMsg, wParam, lParam);
    2053             return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     1995            return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
    20541996    }
    20551997    return 0;
     
    20612003{
    20622004    WNDCLASSA wndClass;
    2063 
    2064 //SvL: Don't check this now
    2065 //    if (GlobalFindAtomA (REBARCLASSNAMEA)) return;
    20662005
    20672006    ZeroMemory (&wndClass, sizeof(WNDCLASSA));
     
    20812020REBAR_Unregister (VOID)
    20822021{
    2083     if (GlobalFindAtomA (REBARCLASSNAMEA))
    2084         UnregisterClassA (REBARCLASSNAMEA, (HINSTANCE)NULL);
    2085 }
    2086 
     2022     UnregisterClassA (REBARCLASSNAMEA, (HINSTANCE)NULL);
     2023}
     2024
  • trunk/src/comctl32/rsrc.orc

    r3031 r3154  
    7070
    7171IDT_CHECK BITMAP LOADONCALL DISCARDABLE
    72 { 
     72{
    7373 '42 4D 8E 01 00 00 00 00 00 00 5E 00 00 00 28 00'
    7474 '00 00 1F 00 00 00 10 00 00 00 01 00 04 00 02 00'
     
    959959    BLOCK "VarFileInfo"
    960960    BEGIN
    961         VALUE "Translation", 0x409, 0x04E4
     961        VALUE "Translation", 0x409, 0x04E4
    962962    END
    963963END
  • trunk/src/comctl32/status.cpp

    r2875 r3154  
    1 /* $Id: status.cpp,v 1.1 2000-02-23 17:09:48 cbratschi Exp $ */
     1/* $Id: status.cpp,v 1.2 2000-03-18 16:17:29 cbratschi Exp $ */
    22/*
    33 * Interface code to StatusWindow widget/control
     
    1414#include "commctrl.h"
    1515#include "comctl32.h"
     16#include "ccbase.h"
    1617#include "status.h"
    1718#include <string.h>
     
    4445#define TEXT_SPACE  3
    4546
    46 #define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongA (hwnd, 0))
     47#define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO*)getInfoPtr(hwnd))
    4748
    4849
     
    489490
    490491    return 0;
    491 }
    492 
    493 
    494 static LRESULT
    495 STATUSBAR_GetUnicodeFormat (HWND hwnd)
    496 {
    497     STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (hwnd);
    498     return infoPtr->bUnicode;
    499492}
    500493
     
    793786    STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (hwnd);
    794787
    795 //    TRACE (statusbar, "part %d: \"%s\"\n", (INT)wParam, (LPSTR)lParam);
    796788    if (infoPtr->hwndToolTip) {
    797789        TTTOOLINFOW ti;
     
    808800}
    809801
    810 
    811 static LRESULT
    812 STATUSBAR_SetUnicodeFormat (HWND hwnd, WPARAM wParam)
    813 {
    814     STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (hwnd);
    815     BOOL bTemp = infoPtr->bUnicode;
    816 
    817 //    TRACE (statusbar, "(0x%x)\n", (BOOL)wParam);
    818     infoPtr->bUnicode = (BOOL)wParam;
    819 
    820     return bTemp;
    821 }
    822 
    823 
    824802static LRESULT
    825803STATUSBAR_Simple (HWND hwnd, WPARAM wParam, LPARAM lParam)
     
    827805    STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (hwnd);
    828806    HDC  hdc;
    829     NMHDR  nmhdr;
    830807
    831808    infoPtr->simple = (BOOL)wParam;
    832809
    833810    /* send notification */
    834     nmhdr.hwndFrom = hwnd;
    835     nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
    836     nmhdr.code = SBN_SIMPLEMODECHANGE;
    837     SendMessageA (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);
     811    sendNotify(hwnd,SBN_SIMPLEMODECHANGE);
    838812
    839813    hdc = GetDC (hwnd);
     
    855829    STATUSWINDOWINFO *infoPtr;
    856830
    857     infoPtr = (STATUSWINDOWINFO*)COMCTL32_Alloc (sizeof(STATUSWINDOWINFO));
    858     SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
     831    infoPtr = (STATUSWINDOWINFO*)initControl(hwnd,sizeof(STATUSWINDOWINFO));
    859832
    860833    infoPtr->numParts = 1;
     
    884857    infoPtr->parts[0].hIcon = 0;
    885858
    886     if (IsWindowUnicode (hwnd)) {
    887         infoPtr->bUnicode = TRUE;
    888         if (lpCreate->lpszName &&
    889             (len = lstrlenW ((LPCWSTR)lpCreate->lpszName))) {
    890             infoPtr->parts[0].text = (WCHAR*)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
    891             lstrcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName);
    892         }
    893     }
    894     else {
    895         if (lpCreate->lpszName &&
    896             (len = lstrlenA ((LPCSTR)lpCreate->lpszName))) {
    897             infoPtr->parts[0].text = (WCHAR*)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
    898             lstrcpyAtoW (infoPtr->parts[0].text, (char*)lpCreate->lpszName);
    899         }
     859    if (infoPtr->header.fUnicode)
     860    {
     861      if (lpCreate->lpszName && (len = lstrlenW ((LPCWSTR)lpCreate->lpszName)))
     862      {
     863        infoPtr->parts[0].text = (WCHAR*)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
     864        lstrcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName);
     865      }
     866    } else
     867    {
     868      if (lpCreate->lpszName && (len = lstrlenA ((LPCSTR)lpCreate->lpszName)))
     869      {
     870        infoPtr->parts[0].text = (WCHAR*)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
     871        lstrcpyAtoW (infoPtr->parts[0].text, (char*)lpCreate->lpszName);
     872      }
    900873    }
    901874
     
    912885    }
    913886
    914     if (GetWindowLongA (hwnd, GWL_STYLE) & SBT_TOOLTIPS) {
    915         infoPtr->hwndToolTip =
    916             CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0,
    917                                CW_USEDEFAULT, CW_USEDEFAULT,
    918                                CW_USEDEFAULT, CW_USEDEFAULT,
    919                              hwnd, 0,
    920                              GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);
    921 
    922         if (infoPtr->hwndToolTip) {
    923             NMTOOLTIPSCREATED nmttc;
    924 
    925             nmttc.hdr.hwndFrom = hwnd;
    926             nmttc.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
    927             nmttc.hdr.code = NM_TOOLTIPSCREATED;
    928             nmttc.hwndToolTips = infoPtr->hwndToolTip;
    929 
    930             SendMessageA (GetParent (hwnd), WM_NOTIFY,
    931                             (WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc);
    932         }
    933     }
     887    if (GetWindowLongA(hwnd,GWL_STYLE) & SBT_TOOLTIPS)
     888      infoPtr->hwndToolTip = createToolTip(hwnd,0,FALSE);
    934889
    935890    GetClientRect (GetParent (hwnd), &rect);
     
    948903STATUSBAR_WMDestroy (HWND hwnd)
    949904{
    950     STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (hwnd);
     905    STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (hwnd);
    951906    int i;
    952907
    953     for (i = 0; i < self->numParts; i++) {
    954         if (self->parts[i].text && !(self->parts[i].style & SBT_OWNERDRAW))
    955             COMCTL32_Free (self->parts[i].text);
    956     }
    957     if (self->part0.text && !(self->part0.style & SBT_OWNERDRAW))
    958         COMCTL32_Free (self->part0.text);
    959     COMCTL32_Free (self->parts);
     908    for (i = 0; i < infoPtr->numParts; i++) {
     909        if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW))
     910            COMCTL32_Free (infoPtr->parts[i].text);
     911    }
     912    if (infoPtr->part0.text && !(infoPtr->part0.style & SBT_OWNERDRAW))
     913        COMCTL32_Free (infoPtr->part0.text);
     914    COMCTL32_Free (infoPtr->parts);
    960915
    961916    /* delete default font */
    962     if (self->hDefaultFont)
    963         DeleteObject (self->hDefaultFont);
     917    if (infoPtr->hDefaultFont)
     918        DeleteObject (infoPtr->hDefaultFont);
    964919
    965920    /* delete tool tip control */
    966     if (self->hwndToolTip)
    967         DestroyWindow (self->hwndToolTip);
    968 
    969     COMCTL32_Free (self);
     921    destroyToolTip(infoPtr->hwndToolTip);
     922
     923    doneControl(hwnd);
    970924
    971925    return 0;
     
    990944        return 0;
    991945    len = lstrlenW (infoPtr->parts[0].text);
    992     if (wParam > len) {
    993         if (infoPtr->bUnicode)
    994             lstrcpyW ((LPWSTR)lParam, infoPtr->parts[0].text);
    995         else
    996             lstrcpyWtoA ((LPSTR)lParam, infoPtr->parts[0].text);
    997         return len;
     946    if (wParam > len)
     947    {
     948      if (infoPtr->header.fUnicode)
     949        lstrcpyW ((LPWSTR)lParam, infoPtr->parts[0].text);
     950      else
     951        lstrcpyWtoA ((LPSTR)lParam, infoPtr->parts[0].text);
     952      return len;
    998953    }
    999954
     
    11091064        COMCTL32_Free (part->text);
    11101065    part->text = 0;
    1111     if (infoPtr->bUnicode) {
     1066    if (infoPtr->header.fUnicode) {
    11121067        if (lParam && (len = lstrlenW((LPCWSTR)lParam))) {
    11131068            part->text = (WCHAR*)COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
     
    11601115}
    11611116
    1162 
    1163 static LRESULT
    1164 STATUSBAR_SendNotify (HWND hwnd, UINT code)
    1165 {
    1166     NMHDR  nmhdr;
    1167 
    1168     nmhdr.hwndFrom = hwnd;
    1169     nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
    1170     nmhdr.code = code;
    1171     SendMessageA (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);
    1172     return 0;
    1173 }
    1174 
    1175 
    1176 
    11771117static LRESULT WINAPI
    11781118StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
     
    12071147            return STATUSBAR_GetTipTextW (hwnd, wParam, lParam);
    12081148
    1209         case SB_GETUNICODEFORMAT:
    1210             return STATUSBAR_GetUnicodeFormat (hwnd);
    1211 
    12121149        case SB_ISSIMPLE:
    12131150            return STATUSBAR_IsSimple (hwnd);
     
    12371174            return STATUSBAR_SetTipTextW (hwnd, wParam, lParam);
    12381175
    1239         case SB_SETUNICODEFORMAT:
    1240             return STATUSBAR_SetUnicodeFormat (hwnd, wParam);
    1241 
    12421176        case SB_SIMPLE:
    12431177            return STATUSBAR_Simple (hwnd, wParam, lParam);
     
    12601194
    12611195        case WM_LBUTTONDBLCLK:
    1262             return STATUSBAR_SendNotify (hwnd, NM_DBLCLK);
     1196            return sendNotify(hwnd,NM_DBLCLK);
    12631197
    12641198        case WM_LBUTTONUP:
    1265             return STATUSBAR_SendNotify (hwnd, NM_CLICK);
     1199            return sendNotify(hwnd,NM_CLICK);
    12661200
    12671201        case WM_MOUSEMOVE:
     
    12811215
    12821216        case WM_RBUTTONDBLCLK:
    1283             return STATUSBAR_SendNotify (hwnd, NM_RDBLCLK);
     1217            return sendNotify(hwnd,NM_RDBLCLK);
    12841218
    12851219        case WM_RBUTTONUP:
    1286             return STATUSBAR_SendNotify (hwnd, NM_RCLICK);
     1220            return sendNotify(hwnd,NM_RCLICK);
    12871221
    12881222        case WM_SETFONT:
     
    12991233//              ERR (statusbar, "unknown msg %04x wp=%04x lp=%08lx\n",
    13001234//                   msg, wParam, lParam);
    1301             return DefWindowProcA (hwnd, msg, wParam, lParam);
     1235            return defComCtl32ProcA (hwnd, msg, wParam, lParam);
    13021236    }
    13031237    return 0;
     
    13151249{
    13161250    WNDCLASSA wndClass;
    1317 
    1318 //SvL: Don't check this now
    1319 //    if (GlobalFindAtomA (STATUSCLASSNAMEA)) return;
    13201251
    13211252    ZeroMemory (&wndClass, sizeof(WNDCLASSA));
     
    13411272STATUS_Unregister (VOID)
    13421273{
    1343     if (GlobalFindAtomA (STATUSCLASSNAMEA))
    1344         UnregisterClassA (STATUSCLASSNAMEA, (HINSTANCE)NULL);
    1345 }
    1346 
     1274    UnregisterClassA (STATUSCLASSNAMEA, (HINSTANCE)NULL);
     1275}
     1276
  • trunk/src/comctl32/tab.cpp

    r2875 r3154  
    1 /* $Id: tab.cpp,v 1.1 2000-02-23 17:09:48 cbratschi Exp $ */
     1/* $Id: tab.cpp,v 1.2 2000-03-18 16:17:30 cbratschi Exp $ */
    22/*
    33 * Tab control
     
    1616
    1717/* inconsistent: report! */
    18 /* WINE 991212 level */
     18/*
     19 - Corel WINE 20000317 level
     20 - (WINE 991212 level)
     21*/
    1922
    2023#include <string.h>
     
    2225#include "winbase.h"
    2326#include "commctrl.h"
     27#include "ccbase.h"
    2428#include "tab.h"
    2529#include "comctl32.h"
     
    4246#define DEFAULT_TAB_WIDTH       96
    4347
    44 #define TAB_GetInfoPtr(hwnd) ((TAB_INFO *)GetWindowLongA(hwnd,0))
     48#define TAB_GetInfoPtr(hwnd) ((TAB_INFO*)getInfoPtr(hwnd))
    4549
    4650/******************************************************************************
     
    5054static void TAB_InvalidateTabArea(HWND      hwnd, TAB_INFO* infoPtr);
    5155static void TAB_EnsureSelectionVisible(HWND hwnd, TAB_INFO* infoPtr);
    52 
    53 static BOOL
    54 TAB_SendSimpleNotify (HWND hwnd, UINT code)
    55 {
    56     NMHDR nmhdr;
    57 
    58     nmhdr.hwndFrom = hwnd;
    59     nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID);
    60     nmhdr.code = code;
    61 
    62     return (BOOL) SendMessageA (GetParent (hwnd), WM_NOTIFY,
    63             (WPARAM) nmhdr.idFrom, (LPARAM) &nmhdr);
    64 }
    65 
    6656
    6757static VOID
     
    8272}
    8373
    84 
    85 
    8674static LRESULT
    8775TAB_GetCurSel (HWND hwnd)
     
    140128  } else {
    141129    if (infoPtr->iSelected != iItem) {
    142       if (TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING)!=TRUE)  {
     130      if (sendNotify(hwnd,TCN_SELCHANGING) != TRUE)  {
    143131        infoPtr->iSelected = iItem;
    144         TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE);
     132        sendNotify(hwnd,TCN_SELCHANGE);
    145133
    146134        TAB_EnsureSelectionVisible(hwnd, infoPtr);
     
    282270       (infoPtr->uFocus != newItem) )
    283271  {
    284     if (!TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING))
     272    if (!sendNotify(hwnd,TCN_SELCHANGING))
    285273    {
    286274      infoPtr->iSelected = newItem;
    287275      infoPtr->uFocus    = newItem;
    288       TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE);
     276      sendNotify(hwnd,TCN_SELCHANGE);
    289277
    290278      TAB_EnsureSelectionVisible(hwnd, infoPtr);
     
    404392       (infoPtr->iSelected != newItem) )
    405393  {
    406     if (TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING)!=TRUE)
     394    if (sendNotify(hwnd,TCN_SELCHANGING) != TRUE)
    407395    {
    408396      infoPtr->iSelected = newItem;
    409397      infoPtr->uFocus    = newItem;
    410       TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE);
     398      sendNotify(hwnd, TCN_SELCHANGE);
    411399
    412400      TAB_EnsureSelectionVisible(hwnd, infoPtr);
     
    440428       (infoPtr->iSelected != newItem) )
    441429  {
    442     if (TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING)!=TRUE)
     430    if (sendNotify(hwnd,TCN_SELCHANGING) != TRUE)
    443431    {
    444432      infoPtr->iSelected = newItem;
    445433      infoPtr->uFocus    = newItem;
    446       TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE);
     434      sendNotify(hwnd,TCN_SELCHANGE);
    447435
    448436      TAB_EnsureSelectionVisible(hwnd, infoPtr);
     
    451439    }
    452440  }
    453   TAB_SendSimpleNotify(hwnd, NM_CLICK);
     441  sendNotify(hwnd,NM_CLICK);
    454442
    455443  return 0;
     
    459447TAB_RButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
    460448{
    461   TAB_SendSimpleNotify(hwnd, NM_RCLICK);
     449  sendNotify(hwnd,NM_RCLICK);
     450
    462451  return 0;
    463452}
     
    805794                             clientRect.right);
    806795
     796  /* Don't need scrolling, then update infoPtr->leftmostVisible */
     797  if(!infoPtr->needsScrolling)
     798    infoPtr->leftmostVisible = 0;
     799
    807800  TAB_SetupScrolling(hwnd, infoPtr, &clientRect);
    808801
     
    13791372    infoPtr->items[iItem].lParam = pti->lParam;
    13801373
     1374  TAB_SetItemBounds(hwnd);
    13811375  TAB_InvalidateTabArea(hwnd, infoPtr);
    13821376
     
    13841378//      hwnd, iItem, infoPtr->items[iItem].pszText);
    13851379
    1386   TAB_SetItemBounds(hwnd);
    13871380  return iItem;
    13881381}
     
    14461439    infoPtr->items[iItem].lParam = pti->lParam;
    14471440
     1441  TAB_SetItemBounds(hwnd);
    14481442  TAB_InvalidateTabArea(hwnd, infoPtr);
    14491443
     
    14511445//      hwnd, iItem, infoPtr->items[iItem].pszText);
    14521446
    1453   TAB_SetItemBounds(hwnd);
    14541447  return iItem;
    14551448}
     
    17831776  HDC hdc;
    17841777  HFONT hOldFont;
    1785 
    1786   infoPtr = (TAB_INFO *)COMCTL32_Alloc (sizeof(TAB_INFO));
    1787 
    1788   SetWindowLongA(hwnd, 0, (DWORD)infoPtr);
     1778  DWORD dwStyle;
     1779
     1780  infoPtr = (TAB_INFO*)initControl(hwnd,sizeof(TAB_INFO));
    17891781
    17901782  infoPtr->uNumItem        = 0;
     
    18001792  infoPtr->leftmostVisible = 0;
    18011793
    1802 //  TRACE(tab, "Created tab control, hwnd [%04x]\n", hwnd);
    1803   if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_TOOLTIPS) {
    1804     /* Create tooltip control */
    1805     infoPtr->hwndToolTip =
    1806       CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0,
    1807                        CW_USEDEFAULT, CW_USEDEFAULT,
    1808                        CW_USEDEFAULT, CW_USEDEFAULT,
    1809                        hwnd, 0, 0, 0);
    1810 
    1811     /* Send NM_TOOLTIPSCREATED notification */
    1812     if (infoPtr->hwndToolTip) {
    1813       NMTOOLTIPSCREATED nmttc;
    1814 
    1815       nmttc.hdr.hwndFrom = hwnd;
    1816       nmttc.hdr.idFrom = GetWindowLongA(hwnd, GWL_ID);
    1817       nmttc.hdr.code = NM_TOOLTIPSCREATED;
    1818       nmttc.hwndToolTips = infoPtr->hwndToolTip;
    1819 
    1820       SendMessageA (GetParent (hwnd), WM_NOTIFY,
    1821                     (WPARAM)GetWindowLongA(hwnd, GWL_ID), (LPARAM)&nmttc);
    1822     }
    1823   }
     1794  /* The tab control always has the WS_CLIPSIBLINGS style. Even
     1795     if you don't specify in CreateWindow. This is necesary in
     1796     order for paint to work correctly. This follows windows behaviour. */
     1797  dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
     1798  SetWindowLongA(hwnd, GWL_STYLE, dwStyle|WS_CLIPSIBLINGS);
     1799
     1800
     1801  /* Create tooltip control */
     1802  if (dwStyle & TCS_TOOLTIPS)
     1803    infoPtr->hwndToolTip = createToolTip(hwnd,0,FALSE);
    18241804
    18251805  /*
     
    18731853    DestroyWindow(infoPtr->hwndUpDown);
    18741854
    1875   COMCTL32_Free (infoPtr);
     1855  doneControl(hwnd);
     1856
    18761857  return 0;
    18771858}
     
    20442025//      ERR (tab, "unknown msg %04x wp=%08x lp=%08lx\n",
    20452026//           uMsg, wParam, lParam);
    2046       return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     2027      return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
    20472028    }
    20482029
     
    20552036{
    20562037  WNDCLASSA wndClass;
    2057 
    2058 //SvL: Don't check this now
    2059 //  if (GlobalFindAtomA (WC_TABCONTROLA)) return;
    20602038
    20612039  ZeroMemory (&wndClass, sizeof(WNDCLASSA));
     
    20752053TAB_Unregister (VOID)
    20762054{
    2077   if (GlobalFindAtomA (WC_TABCONTROLA))
    2078     UnregisterClassA (WC_TABCONTROLA, (HINSTANCE)NULL);
    2079 }
    2080 
     2055  UnregisterClassA (WC_TABCONTROLA, (HINSTANCE)NULL);
     2056}
     2057
  • trunk/src/comctl32/toolbar.cpp

    r3145 r3154  
    1 /* $Id: toolbar.cpp,v 1.2 2000-03-17 17:13:24 cbratschi Exp $ */
     1/* $Id: toolbar.cpp,v 1.3 2000-03-18 16:17:31 cbratschi Exp $ */
    22/*
    33 * Toolbar control
     
    2929
    3030/*
    31  - Corel 20000212 level
     31 - Corel 20000317 level
    3232 - WINE 991212 level
    3333*/
     
    4444#include "cache.h"
    4545#include "comctl32.h"
     46#include "ccbase.h"
    4647#include "toolbar.h"
    4748
     
    5051#define BOTTOM_BORDER      2
    5152
    52 #define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongA(hwnd,0))
     53#define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO*)getInfoPtr(hwnd))
    5354
    5455
     
    738739}
    739740
    740 static void TBCUSTOMIZE_GetToolNameA(TOOLBAR_INFO* infoPtr,TBUTTON_INFO* btnPtr,INT pos)
     741static void TBCUSTOMIZE_GetToolName(TOOLBAR_INFO* infoPtr,TBUTTON_INFO* btnPtr,INT pos)
    741742{
    742743  if (btnPtr->iString > -1 && btnPtr->iString < infoPtr->nNumStrings)
     
    751752  {
    752753    if (!btnPtr->pszName) btnPtr->pszName = (WCHAR*)COMCTL32_Alloc(MAXTOOLNAME*sizeof(WCHAR));
    753     lstrcpyAtoW(btnPtr->pszName,"Separator");
     754    lstrcpyW(btnPtr->pszName,(WCHAR*)L"Separator");
    754755  } else
    755756  {
    756     TBNOTIFYA tbNotify;
    757 
    758     tbNotify.hdr.hwndFrom = infoPtr->hwndToolbar;
    759     tbNotify.hdr.idFrom   = GetWindowLongA(infoPtr->hwndToolbar,GWL_ID);
    760     tbNotify.hdr.code     = TBN_GETBUTTONINFOA;
     757    TBNOTIFYW tbNotify;
     758    BOOL unicode = isUnicodeNotify(&infoPtr->header);
     759
    761760    tbNotify.iItem    = pos;
    762761    tbNotify.tbButton = (TBBUTTON*)btnPtr;
    763762    tbNotify.cchText  = MAXTOOLNAME;
    764     tbNotify.pszText  = (CHAR*)COMCTL32_Alloc(MAXTOOLNAME);
    765     tbNotify.pszText[0] = 0;
    766 
    767     if (!SendMessageA(infoPtr->hwndNotify,WM_NOTIFY,(WPARAM)tbNotify.hdr.idFrom,(LPARAM)&tbNotify))
    768     { //CB: failed, try other methods
    769       if (infoPtr->hwndToolTip)
    770       { //try to get tool tip text
    771         TTTOOLINFOA ti;
    772 
    773         ZeroMemory (&ti,sizeof(ti));
    774         ti.cbSize   = sizeof(ti);
    775         ti.hwnd     = infoPtr->hwndToolbar;
    776         ti.uId      = btnPtr->idCommand;
    777         ti.hinst    = 0;
    778         ti.lpszText = (CHAR*)COMCTL32_Alloc(INFOTIPSIZE);
    779         ti.lpszText[0] = 0;
    780 
    781         SendMessageA(infoPtr->hwndToolTip,TTM_GETTEXTA,0,(LPARAM)&ti);
    782         if (ti.lpszText[0] != 0) lstrcpynA(tbNotify.pszText,ti.lpszText,MAXTOOLNAME);
    783         else strcpy(tbNotify.pszText,"Button");
    784 
    785         COMCTL32_Free(ti.lpszText);
    786 
    787       } else strcpy(tbNotify.pszText,"Button");
    788     }
    789 
    790     if (!btnPtr->pszName) btnPtr->pszName = (WCHAR*)COMCTL32_Alloc(MAXTOOLNAME*sizeof(WCHAR));
    791     lstrcpyAtoW(btnPtr->pszName,tbNotify.pszText);
    792     COMCTL32_Free(tbNotify.pszText);
    793   }
    794 }
    795 
    796 static void TBCUSTOMIZE_GetToolNameW(TOOLBAR_INFO* infoPtr,TBUTTON_INFO* btnPtr,INT pos)
    797 {
    798   if (btnPtr->iString > -1 && btnPtr->iString < infoPtr->nNumStrings)
    799   {
    800     if (!btnPtr->pszName) btnPtr->pszName = (WCHAR*)COMCTL32_Alloc(MAXTOOLNAME*sizeof(WCHAR));
    801     lstrcpynW(btnPtr->pszName,infoPtr->strings[btnPtr->iString],MAXTOOLNAME*sizeof(WCHAR));
    802 
    803     return;
    804   }
    805 
    806   if (btnPtr->fsStyle & TBSTYLE_SEP)
    807   {
    808     if (!btnPtr->pszName) btnPtr->pszName = (WCHAR*)COMCTL32_Alloc(MAXTOOLNAME*sizeof(WCHAR));
    809     lstrcpyAtoW(btnPtr->pszName,"Separator");
    810   } else
    811   {
    812     TBNOTIFYW tbNotify;
    813 
    814     if (!btnPtr->pszName) btnPtr->pszName = (WCHAR*)COMCTL32_Alloc(MAXTOOLNAME*sizeof(WCHAR));
    815     btnPtr->pszName[0] = 0;
    816 
    817     tbNotify.hdr.hwndFrom = infoPtr->hwndToolbar;
    818     tbNotify.hdr.idFrom   = GetWindowLongA(infoPtr->hwndToolbar,GWL_ID);
    819     tbNotify.hdr.code     = TBN_GETBUTTONINFOW;
    820     tbNotify.iItem    = pos;
    821     tbNotify.tbButton = (TBBUTTON*)btnPtr;
    822     tbNotify.cchText  = MAXTOOLNAME;
    823     tbNotify.pszText  = btnPtr->pszName;
    824 
    825     if (!SendMessageW(infoPtr->hwndNotify,WM_NOTIFY,(WPARAM)tbNotify.hdr.idFrom,(LPARAM)&tbNotify))
     763    if (unicode)
     764    {
     765      tbNotify.pszText  = (WCHAR*)COMCTL32_Alloc(MAXTOOLNAME*sizeof(WCHAR));
     766      tbNotify.pszText[0] = 0;
     767    } else
     768    {
     769      tbNotify.pszText  = (WCHAR*)COMCTL32_Alloc(MAXTOOLNAME*sizeof(CHAR));
     770      ((CHAR*)tbNotify.pszText)[0] = 0;
     771    }
     772
     773    if (!sendNotify(infoPtr->hwndToolbar,unicode ? TBN_GETBUTTONINFOW:TBN_GETBUTTONINFOA,&tbNotify.hdr))
    826774    { //CB: failed, try other methods
    827775      if (infoPtr->hwndToolTip)
     
    837785        ti.lpszText[0] = 0;
    838786
    839         SendMessageA(infoPtr->hwndToolTip,TTM_GETTEXTW,0,(LPARAM)&ti);
    840         if (ti.lpszText[0] != 0) lstrcpynW(btnPtr->pszName,ti.lpszText,MAXTOOLNAME);
    841         else lstrcpyAtoW(btnPtr->pszName,"Button");
     787        SendMessageW(infoPtr->hwndToolTip,TTM_GETTEXTW,0,(LPARAM)&ti);
     788        if (unicode)
     789        {
     790          if (ti.lpszText[0] != 0) lstrcpynW(tbNotify.pszText,ti.lpszText,MAXTOOLNAME);
     791          else lstrcpyW(tbNotify.pszText,(WCHAR*)L"Button");
     792        } else
     793        {
     794          if (ti.lpszText[0] != 0) lstrcpynWtoA((CHAR*)tbNotify.pszText,ti.lpszText,MAXTOOLNAME);
     795          else lstrcpyWtoA((CHAR*)tbNotify.pszText,(WCHAR*)L"Button");
     796        }
    842797
    843798        COMCTL32_Free(ti.lpszText);
    844799
    845       } else lstrcpyAtoW(btnPtr->pszName,"Button");
    846     }
     800      } else
     801      {
     802        if (unicode)
     803          lstrcpyW(tbNotify.pszText,(WCHAR*)L"Button");
     804        else
     805          lstrcpyA((CHAR*)tbNotify.pszText,"Button");
     806      }
     807    }
     808
     809    if (!btnPtr->pszName) btnPtr->pszName = (WCHAR*)COMCTL32_Alloc(MAXTOOLNAME*sizeof(WCHAR));
     810    if (unicode)
     811      lstrcpyW(btnPtr->pszName,tbNotify.pszText);
     812    else
     813      lstrcpyAtoW(btnPtr->pszName,(CHAR*)tbNotify.pszText);
     814    COMCTL32_Free(tbNotify.pszText);
    847815  }
    848816}
     
    872840  for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++)
    873841  {
    874     if (IsWindowUnicode(infoPtr->hwndNotify))
    875     {
    876       TBNOTIFYW tbNotify;
    877 
    878       tbNotify.hdr.hwndFrom = infoPtr->hwndToolbar;
    879       tbNotify.hdr.idFrom   = GetWindowLongA(infoPtr->hwndToolbar,GWL_ID);
    880       tbNotify.iItem    = i;
    881       tbNotify.tbButton = (TBBUTTON*)btnPtr;
    882       tbNotify.cchText  = 0;
    883       tbNotify.pszText  = NULL;
    884 
    885       // send TBN_QUERYINSERT notification
    886 
    887       tbNotify.hdr.code     = TBN_QUERYINSERT;
    888 
    889       if (!SendMessageW(infoPtr->hwndNotify,WM_NOTIFY,(WPARAM)tbNotify.hdr.idFrom,(LPARAM)&tbNotify)) continue;
    890 
    891       // send TBN_QUERYDELETE notification
    892 
    893       tbNotify.hdr.code     = TBN_QUERYDELETE;
    894 
    895       btnPtr->bDelete = (BOOL)SendMessageW(infoPtr->hwndNotify,WM_NOTIFY,(WPARAM)tbNotify.hdr.idFrom,(LPARAM)&tbNotify);
    896 
    897       //get tool name
    898 
    899       TBCUSTOMIZE_GetToolNameW(infoPtr,btnPtr,i);
    900 
    901     } else
    902     {
    903       TBNOTIFYA tbNotify;
    904 
    905       tbNotify.hdr.hwndFrom = infoPtr->hwndToolbar;
    906       tbNotify.hdr.idFrom   = GetWindowLongA(infoPtr->hwndToolbar,GWL_ID);
    907       tbNotify.iItem    = i;
    908       tbNotify.tbButton = (TBBUTTON*)btnPtr;
    909       tbNotify.cchText  = 0;
    910       tbNotify.pszText  = NULL;
    911 
    912       // send TBN_QUERYINSERT notification
    913 
    914       tbNotify.hdr.code     = TBN_QUERYINSERT;
    915 
    916       if (!SendMessageA(infoPtr->hwndNotify,WM_NOTIFY,(WPARAM)tbNotify.hdr.idFrom,(LPARAM)&tbNotify)) continue;
    917 
    918       // send TBN_QUERYDELETE notification
    919 
    920       tbNotify.hdr.code     = TBN_QUERYDELETE;
    921 
    922       btnPtr->bDelete = (BOOL)SendMessageA(infoPtr->hwndNotify,WM_NOTIFY,(WPARAM)tbNotify.hdr.idFrom,(LPARAM)&tbNotify);
    923 
    924       //get tool name
    925 
    926       TBCUSTOMIZE_GetToolNameA(infoPtr,btnPtr,i);
    927     }
     842    TBNOTIFYW tbNotify;
     843
     844    tbNotify.iItem    = i;
     845    tbNotify.tbButton = (TBBUTTON*)btnPtr;
     846    tbNotify.cchText  = 0;
     847    tbNotify.pszText  = NULL;
     848
     849    // send TBN_QUERYINSERT notification
     850    if (!sendNotify(infoPtr->hwndToolbar,TBN_QUERYINSERT,&tbNotify.hdr)) continue;
     851
     852    // send TBN_QUERYDELETE notification
     853    btnPtr->bDelete = (BOOL)sendNotify(infoPtr->hwndToolbar,TBN_QUERYDELETE,&tbNotify.hdr);
     854
     855    //get tool name
     856
     857    TBCUSTOMIZE_GetToolName(infoPtr,btnPtr,i);
    928858
    929859    if (btnPtr->fsState & TBSTATE_HIDDEN)
     
    959889{
    960890  TOOLBAR_INFO* infoPtr;
     891  DWORD dwStyle;
    961892
    962893  infoPtr = (TOOLBAR_INFO*)lParam;
    963894  SetWindowLongA(hwnd,DWL_USER,(DWORD)infoPtr);
     895  dwStyle = GetWindowLongA(infoPtr->hwndToolbar,GWL_STYLE);
    964896
    965897  if (infoPtr)
    966898  {
    967     INT x;
     899    INT x,itemHeight;
    968900
    969901    //custom ID: 1-nNumButtons, 0 == new separator
     
    980912    memcpy(&infoPtr->oldButtons[0],&infoPtr->buttons[0],infoPtr->nNumOldButtons*sizeof(TBUTTON_INFO));
    981913
     914    //set height
     915    if (dwStyle & TBSTYLE_FLAT)
     916      itemHeight = infoPtr->nBitmapHeight+4;
     917    else
     918      itemHeight = infoPtr->nBitmapHeight+8;
     919
     920    SendDlgItemMessageA(hwnd,IDC_AVAILBTN_LBOX,LB_SETITEMHEIGHT,0,itemHeight);
     921    SendDlgItemMessageA(hwnd,IDC_TOOLBARBTN_LBOX,LB_SETITEMHEIGHT,0,itemHeight);
     922
     923    infoPtr->changed = FALSE;
     924
    982925    if (!TBCUSTOMIZE_FillData(hwnd,infoPtr)) EndDialog(hwnd,FALSE);
    983   }
     926  } else EndDialog(hwnd,FALSE);
    984927
    985928  return TRUE;
     
    996939{
    997940  TOOLBAR_INFO* infoPtr = (TOOLBAR_INFO*)GetWindowLongA(hwnd,DWL_USER);
    998   NMHDR nmhdr;
    999941  INT x;
    1000942
     943  if (!infoPtr->changed) return;
     944
    1001945  //Send TBN_RESET
    1002   nmhdr.hwndFrom = infoPtr->hwndToolbar;
    1003   nmhdr.idFrom   = GetWindowLongA(infoPtr->hwndToolbar,GWL_ID);
    1004   nmhdr.code     = TBN_RESET;
    1005 
    1006   SendMessageA(infoPtr->hwndNotify,WM_NOTIFY,(WPARAM)nmhdr.idFrom,(LPARAM)&nmhdr);
     946  sendNotify(infoPtr->hwndToolbar,TBN_RESET);
    1007947
    1008948  for (x = 0;x < infoPtr->nNumOldButtons;x++) COMCTL32_Free(infoPtr->oldButtons[x].pszName);
     
    1021961  TOOLBAR_CalcToolbar(infoPtr->hwndToolbar);
    1022962  InvalidateRect(infoPtr->hwndToolbar,NULL,TRUE);
     963
     964  infoPtr->changed = FALSE;
    1023965}
    1024966
     
    11431085  TOOLBAR_CalcToolbar(infoPtr->hwndToolbar);
    11441086  InvalidateRect(infoPtr->hwndToolbar,NULL,TRUE);
     1087
     1088  infoPtr->changed = TRUE;
    11451089}
    11461090
     
    12611205  TOOLBAR_CalcToolbar(infoPtr->hwndToolbar);
    12621206  InvalidateRect(infoPtr->hwndToolbar,NULL,TRUE);
     1207
     1208  infoPtr->changed = TRUE;
    12631209}
    12641210
     
    12661212{
    12671213 TOOLBAR_INFO* infoPtr = (TOOLBAR_INFO*)GetWindowLongA(hwnd,DWL_USER);
    1268  NMHDR nmhdr;
    12691214
    12701215 //Send TBN_CUSTHELP
    1271  nmhdr.hwndFrom = infoPtr->hwndToolbar;
    1272  nmhdr.idFrom   = GetWindowLongA(infoPtr->hwndToolbar,GWL_ID);
    1273  nmhdr.code     = TBN_CUSTHELP;
    1274 
    1275  SendMessageA(infoPtr->hwndNotify,WM_NOTIFY,(WPARAM)nmhdr.idFrom,(LPARAM)&nmhdr);
     1216 sendNotify(infoPtr->hwndToolbar,TBN_CUSTHELP);
    12761217}
    12771218
     
    13101251  TOOLBAR_CalcToolbar(infoPtr->hwndToolbar);
    13111252  InvalidateRect(infoPtr->hwndToolbar,NULL,TRUE);
     1253
     1254  infoPtr->changed = TRUE;
    13121255}
    13131256
     
    13491292  TOOLBAR_CalcToolbar(infoPtr->hwndToolbar);
    13501293  InvalidateRect(infoPtr->hwndToolbar,NULL,TRUE);
     1294
     1295  infoPtr->changed = TRUE;
    13511296}
    13521297
     
    14001345      EndDialog(hwnd,FALSE);
    14011346      break;
     1347
    14021348    case IDC_RESET_BTN:
    14031349      TBCUSTOMIZE_Reset(hwnd);
    14041350      break;
     1351
    14051352    case IDOK: //== add tool
    14061353      TBCUSTOMIZE_AddTool(hwnd);
    14071354      break;
     1355
    14081356    case IDC_REMOVE_BTN:
    14091357      TBCUSTOMIZE_RemoveTool(hwnd);
    14101358      break;
     1359
    14111360    case IDC_HELP_BTN:
    14121361      TBCUSTOMIZE_Help(hwnd);
    14131362      break;
     1363
    14141364    case IDC_MOVEUP_BTN:
    14151365      TBCUSTOMIZE_MoveToolUp(hwnd);
    14161366      break;
     1367
    14171368    case IDC_MOVEDN_BTN:
    14181369      TBCUSTOMIZE_MoveToolDown(hwnd);
    14191370      break;
     1371
    14201372    case IDC_AVAILBTN_LBOX:
    14211373      switch(HIWORD(wParam))
     
    14291381      }
    14301382      break;
     1383
    14311384    case IDC_TOOLBARBTN_LBOX:
    14321385      switch(HIWORD(wParam))
     
    15511504}
    15521505
    1553 static BOOL TBCUSTOMIZE_MeasureItem(HWND hwnd,WPARAM wParam,LPARAM lParam)
    1554 {
    1555   if (wParam == IDC_AVAILBTN_LBOX || wParam == IDC_TOOLBARBTN_LBOX)
    1556   {
    1557     TOOLBAR_INFO* infoPtr = (TOOLBAR_INFO*)GetWindowLongA(hwnd,DWL_USER);
    1558     MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*)lParam;
    1559 
    1560     if (infoPtr)
    1561     {
    1562       DWORD dwStyle = GetWindowLongA(infoPtr->hwndToolbar,GWL_STYLE);
    1563 
    1564       if (dwStyle & TBSTYLE_FLAT)
    1565         lpmis->itemHeight = infoPtr->nBitmapHeight+4;
    1566       else
    1567         lpmis->itemHeight = infoPtr->nBitmapHeight+8;
    1568     } else lpmis->itemHeight = 16+8;
    1569 
    1570     return TRUE;
    1571   }
    1572 
    1573   return FALSE;
    1574 }
    1575 
    1576 /***********************************************************************
    1577  * TOOLBAR_CustomizeDialogProc
    1578  * This function implements the toolbar customization dialog.
    1579  */
    1580 
    15811506/***********************************************************************
    15821507 * TOOLBAR_CustomizeDialogProc
     
    16041529        case WM_DRAWITEM:
    16051530            return TBCUSTOMIZE_DrawItem(hwnd,wParam,lParam);
    1606 
    1607         case WM_MEASUREITEM:
    1608             return TBCUSTOMIZE_MeasureItem(hwnd,wParam,lParam);
    16091531
    16101532        default:
     
    20761998                    cx, cy, uPosFlags);
    20771999
     2000    /* The following line makes sure that the infoPtr->bAutoSize is turned off after
     2001     * the setwindowpos calls */
     2002    infoPtr->bAutoSize = FALSE;
     2003
    20782004    return 0;
    20792005}
     
    21942120    LPCVOID temp;
    21952121    HRSRC hRes;
    2196     NMHDR nmhdr;
    21972122
    21982123    if (infoPtr->nNumButtons == 0) return 0;
    21992124
    22002125    /* send TBN_BEGINADJUST notification */
    2201     nmhdr.hwndFrom = hwnd;
    2202     nmhdr.idFrom   = GetWindowLongA(hwnd,GWL_ID);
    2203     nmhdr.code     = TBN_BEGINADJUST;
    2204 
    2205     SendMessageA (infoPtr->hwndNotify,WM_NOTIFY,(WPARAM)nmhdr.idFrom,(LPARAM)&nmhdr);
     2126    sendNotify(hwnd,TBN_BEGINADJUST);
    22062127
    22072128    if (!(hRes = FindResourceA (COMCTL32_hModule,
     
    22202141
    22212142    /* send TBN_ENDADJUST notification */
    2222     nmhdr.code = TBN_ENDADJUST;
    2223 
    2224     SendMessageA(infoPtr->hwndNotify,WM_NOTIFY,(WPARAM)nmhdr.idFrom,(LPARAM)&nmhdr);
     2143    sendNotify(hwnd,TBN_ENDADJUST);
    22252144
    22262145    return ret;
     
    27232642
    27242643static LRESULT
    2725 TOOLBAR_GetUnicodeFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
    2726 {
    2727     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    2728 
    2729 //    TRACE (toolbar, "%s hwnd=0x%x stub!\n",
    2730 //         infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd);
    2731 
    2732     return infoPtr->bUnicode;
    2733 }
    2734 
    2735 static LRESULT
    2736 TOOLBAR_GetVersion (HWND hwnd)
    2737 {
    2738     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    2739     return infoPtr->iVersion;
    2740 }
    2741 
    2742 static LRESULT
    27432644TOOLBAR_HideButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
    27442645{
     
    34033304    if (infoPtr == NULL)
    34043305        return 0;
    3405     hwndOldNotify = infoPtr->hwndNotify;
    3406     infoPtr->hwndNotify = (HWND)wParam;
     3306    hwndOldNotify = infoPtr->header.hwndNotify;
     3307    infoPtr->header.hwndNotify = (HWND)wParam;
    34073308
    34083309    return hwndOldNotify;
     
    35033404}
    35043405
    3505 
    3506 static LRESULT
    3507 TOOLBAR_SetUnicodeFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
    3508 {
    3509     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    3510     BOOL bTemp;
    3511 
    3512 //    TRACE (toolbar, "%s hwnd=0x%04x stub!\n",
    3513 //         ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd);
    3514 
    3515     bTemp = infoPtr->bUnicode;
    3516     infoPtr->bUnicode = (BOOL)wParam;
    3517 
    3518     return bTemp;
    3519 }
    3520 
    3521 static LRESULT
    3522 TOOLBAR_SetVersion (HWND hwnd, INT iVersion)
    3523 {
    3524     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    3525     INT iOldVersion = infoPtr->iVersion;
    3526 
    3527     infoPtr->iVersion = iVersion;
    3528 
    3529     return iOldVersion;
    3530 }
    3531 
    35323406static LRESULT
    35333407TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
     
    35503424
    35513425    infoPtr->bCaptured = FALSE;
    3552     infoPtr->bUnicode = IsWindowUnicode(hwnd);
    35533426    infoPtr->nButtonDown = -1;
    35543427    infoPtr->nOldHit = -1;
    35553428    infoPtr->nHotItem = -2; /* It has to be initially different from nOldHit */
    3556     infoPtr->hwndNotify = GetParent (hwnd);
    35573429    infoPtr->bTransparent = (dwStyle & TBSTYLE_FLAT);
    35583430    infoPtr->dwDTFlags = (dwStyle & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER | DT_SINGLELINE : DT_CENTER;
    35593431    infoPtr->bAnchor = FALSE; /* no anchor highlighting */
    3560     infoPtr->iVersion = 0;
    35613432
    35623433    infoPtr->hwndToolbar = hwnd;
     
    35673438    infoPtr->hFont = CreateFontIndirectA (&logFont);
    35683439
     3440    /* Create tooltip control */
    35693441    if (dwStyle & TBSTYLE_TOOLTIPS)
    3570     {
    3571         /* Create tooltip control */
    3572         infoPtr->hwndToolTip =
    3573             CreateWindowExA (WS_EX_TOOLWINDOW,TOOLTIPS_CLASSA,NULL,WS_POPUP,
    3574                                CW_USEDEFAULT,CW_USEDEFAULT,
    3575                                CW_USEDEFAULT,CW_USEDEFAULT,
    3576                                hwnd,0,0,0);
    3577 
    3578         /* Send NM_TOOLTIPSCREATED notification */
    3579         if (infoPtr->hwndToolTip)
    3580         {
    3581             NMTOOLTIPSCREATED nmttc;
    3582 
    3583             nmttc.hdr.hwndFrom = hwnd;
    3584             nmttc.hdr.idFrom   = GetWindowLongA(hwnd,GWL_ID);
    3585             nmttc.hdr.code = NM_TOOLTIPSCREATED;
    3586             nmttc.hwndToolTips = infoPtr->hwndToolTip;
    3587 
    3588             SendMessageA(infoPtr->hwndNotify,WM_NOTIFY,(WPARAM)nmttc.hdr.idFrom,(LPARAM)&nmttc);
    3589         }
    3590     }
     3442      infoPtr->hwndToolTip = createToolTip(hwnd,0,FALSE);
    35913443
    35923444    return 0;
     
    36313483
    36323484    /* free toolbar info data */
    3633     COMCTL32_Free (infoPtr);
    3634     SetWindowLongA(hwnd, 0, 0);
     3485    doneControl(hwnd);
    36353486
    36363487    return 0;
     
    37183569            NMTOOLBARA nmtb;
    37193570
    3720             nmtb.hdr.hwndFrom = hwnd;
    3721             nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
    3722             nmtb.hdr.code = TBN_DROPDOWN;
    37233571            nmtb.iItem = btnPtr->idCommand;
    37243572
    3725             SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
    3726                           (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb);
     3573            sendNotify(hwnd,TBN_DROPDOWN,&nmtb.hdr);
    37273574        }
    37283575
     
    38053652               NMTOOLBARW       nmtb;
    38063653
    3807                nmtb.hdr.hwndFrom = hwnd;
    3808                nmtb.hdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
    3809                nmtb.hdr.code     = TBN_DROPDOWN;
    38103654               nmtb.iItem        = nHit;
    38113655               /* nmtb.tbButton not used with TBN_DROPDOWN */
     
    38193663               nmtb.rcButton     = btnPtr->rect;
    38203664
    3821                SendMessageW(infoPtr->hwndNotify, WM_NOTIFY,
    3822                             (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb);
     3665               sendNotify(hwnd,TBN_DROPDOWN,&nmtb.hdr);
    38233666            }
    38243667        }
     
    39353778
    39363779    /* allocate memory for info structure */
    3937     infoPtr = (TOOLBAR_INFO *)COMCTL32_Alloc (sizeof(TOOLBAR_INFO));
    3938     SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
     3780    infoPtr = (TOOLBAR_INFO*)initControl(hwnd,sizeof(TOOLBAR_INFO));
    39393781
    39403782    /* paranoid!! */
     
    39903832
    39913833    if ((infoPtr->hwndToolTip) && (lpnmh->hwndFrom == infoPtr->hwndToolTip)) {
    3992         SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,   wParam, lParam);
     3834        SendMessageA (infoPtr->header.hwndNotify, WM_NOTIFY,   wParam, lParam);
    39933835
    39943836#if 0
     
    42564098            return TOOLBAR_GetToolTips (hwnd, wParam, lParam);
    42574099
    4258         case TB_GETUNICODEFORMAT:
    4259             return TOOLBAR_GetUnicodeFormat (hwnd, wParam, lParam);
    4260 
    4261         case CCM_GETVERSION:
    4262             return TOOLBAR_GetVersion (hwnd);
    4263 
    42644100        case TB_HIDEBUTTON:
    42654101            return TOOLBAR_HideButton (hwnd, wParam, lParam);
     
    43854221            return TOOLBAR_SetToolTips (hwnd, wParam, lParam);
    43864222
    4387         case TB_SETUNICODEFORMAT:
    4388             return TOOLBAR_SetUnicodeFormat (hwnd, wParam, lParam);
    4389 
    4390         case CCM_SETVERSION:
    4391             return TOOLBAR_SetVersion (hwnd, (INT)wParam);
    4392 
    43934223/*      case WM_CHAR: */
    43944224
     
    44284258        case WM_NOTIFY:
    44294259            return TOOLBAR_Notify (hwnd, wParam, lParam);
    4430 
    4431 /*      case WM_NOTIFYFORMAT: */
    44324260
    44334261        case WM_PAINT:
     
    44554283//              ERR (toolbar, "unknown msg %04x wp=%08x lp=%08lx\n",
    44564284//                   uMsg, wParam, lParam);
    4457             return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     4285            return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
    44584286    }
    44594287    return 0;
  • trunk/src/comctl32/tooltips.cpp

    r3145 r3154  
    1 /* $Id: tooltips.cpp,v 1.3 2000-03-17 17:13:26 cbratschi Exp $ */
     1/* $Id: tooltips.cpp,v 1.4 2000-03-18 16:17:32 cbratschi Exp $ */
    22/*
    33 * Tool tip control
     
    1717 */
    1818
    19 /* WINE 20000130 level */
     19/*
     20 - Corel WINE 20000317 level
     21 - (WINE 20000130 level)
     22*/
    2023
    2124#include <string.h>
     
    2326#include "winbase.h"
    2427#include "commctrl.h"
     28#include "ccbase.h"
    2529#include "tooltips.h"
    2630#include "comctl32.h"
     
    19261930
    19271931    /* allocate memory for info structure */
    1928     infoPtr = (TOOLTIPS_INFO *)COMCTL32_Alloc(sizeof(TOOLTIPS_INFO));
    1929     SetWindowLongA(hwnd,0,(DWORD)infoPtr);
     1932    infoPtr = (TOOLTIPS_INFO*)initControl(hwnd,sizeof(TOOLTIPS_INFO));
    19301933
    19311934    /* initialize info structure */
     
    19541957
    19551958    SetRectEmpty(&infoPtr->rcMargin);
    1956 
    1957     nResult = (INT)SendMessageA(GetParent(hwnd),WM_NOTIFYFORMAT,(WPARAM)hwnd,(LPARAM)NF_QUERY);
    1958 //    if (nResult == NFR_ANSI)
    1959 //      TRACE (tooltips, " -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
    1960 //    else if (nResult == NFR_UNICODE)
    1961 //      FIXME (tooltips, " -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
    1962 //    else
    1963 //      FIXME (tooltips, " -- WM_NOTIFYFORMAT returns: error!\n");
    19641959
    19651960    SetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);
     
    20132008
    20142009    /* free tool tips info data */
    2015     COMCTL32_Free(infoPtr);
     2010    doneControl(hwnd);
    20162011
    20172012    return 0;
     
    20872082
    20882083    return DefWindowProcA (hwnd, WM_NCHITTEST, wParam, lParam);
    2089 }
    2090 
    2091 static LRESULT
    2092 TOOLTIPS_NotifyFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
    2093 {
    2094 //    FIXME ("hwnd=%x wParam=%x lParam=%lx\n", hwnd, wParam, lParam);
    2095 
    2096     return 0;
    20972084}
    20982085
     
    22442231        case WM_RBUTTONUP:
    22452232            infoPtr = TOOLTIPS_GetInfoPtr(lpttsi->hwndToolTip);
    2246                 nTool = TOOLTIPS_GetToolFromMessage (infoPtr, hwnd);
    2247 
    2248 //              TRACE (tooltips, "subclassed mouse message %04x\n", uMsg);
    2249                 infoPtr->nOldTool = infoPtr->nTool;
    2250                 infoPtr->nTool = nTool;
     2233            if (!infoPtr) break;
     2234            nTool = TOOLTIPS_GetToolFromMessage (infoPtr, hwnd);
     2235
     2236            infoPtr->nOldTool = infoPtr->nTool;
     2237            infoPtr->nTool = nTool;
    22512238            TOOLTIPS_Hide (lpttsi->hwndToolTip, infoPtr);
    22522239            break;
     
    22542241        case WM_MOUSEMOVE:
    22552242                infoPtr = TOOLTIPS_GetInfoPtr (lpttsi->hwndToolTip);
    2256                 //@@@AH 2000/02/25 check if there is a valid instance data pointer
    2257                 if (!infoPtr)
    2258                 {
    2259                   dprintf(("Tooltips:SubclassProc:WM_MOUSEMOVE: infoPtr == NULL!\n"));
    2260                   break;
    2261                 }
     2243                if (!infoPtr) break;
    22622244                nTool = TOOLTIPS_GetToolFromMessage (infoPtr, hwnd);
    22632245
    2264 //              TRACE (tooltips, "subclassed WM_MOUSEMOVE\n");
    22652246                infoPtr->nOldTool = infoPtr->nTool;
    22662247                infoPtr->nTool = nTool;
     
    22712252                    SetTimer (hwnd, ID_TIMERSHOW,
    22722253                                    infoPtr->nInitialTime, 0);
    2273 //                      TRACE (tooltips, "timer 1 started!\n");
     2254                      //TRACE (tooltips, "timer 1 started!\n");
    22742255                    }
    22752256                    else {
     
    24452426            return TOOLTIPS_NCHitTest (hwnd, wParam, lParam);
    24462427
    2447         case WM_NOTIFYFORMAT:
    2448             return TOOLTIPS_NotifyFormat (hwnd, wParam, lParam);
    2449 
    24502428        case WM_PAINT:
    24512429            return TOOLTIPS_Paint (hwnd, wParam, lParam);
     
    24642442//              ERR (tooltips, "unknown msg %04x wp=%08x lp=%08lx\n",
    24652443//                   uMsg, wParam, lParam);
    2466             return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     2444            return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
    24672445    }
    24682446    return 0;
  • trunk/src/comctl32/trackbar.cpp

    r3145 r3154  
    1 /* $Id: trackbar.cpp,v 1.2 2000-03-17 17:13:26 cbratschi Exp $ */
     1/* $Id: trackbar.cpp,v 1.3 2000-03-18 16:17:33 cbratschi Exp $ */
    22/*
    33 * Trackbar control
     
    987987      { //above
    988988        x = (infoPtr->rcChannel.right+infoPtr->rcChannel.left)/2-(rcBuddy.right-rcBuddy.left)/2+rcSelf.left;
    989         y = rcSelf.top-(rcBuddy.bottom-rcBuddy.top);
     989        y = rcSelf.top-(rcBuddy.bottom-rcBuddy.top);
    990990      } else
    991991      { //left
    992         x = rcSelf.left-(rcBuddy.right-rcBuddy.left);
    993         y = (infoPtr->rcChannel.bottom+infoPtr->rcChannel.top)/2-(rcBuddy.bottom-rcBuddy.top)/2+rcSelf.top;
     992        x = rcSelf.left-(rcBuddy.right-rcBuddy.left);
     993        y = (infoPtr->rcChannel.bottom+infoPtr->rcChannel.top)/2-(rcBuddy.bottom-rcBuddy.top)/2+rcSelf.top;
    994994      }
    995995
     
    10051005      if (dwStyle & TBS_VERT)
    10061006      { //below
    1007         x = (infoPtr->rcChannel.right+infoPtr->rcChannel.left)/2-(rcBuddy.right-rcBuddy.left)/2+rcSelf.left;
    1008         y = rcSelf.bottom;
     1007        x = (infoPtr->rcChannel.right+infoPtr->rcChannel.left)/2-(rcBuddy.right-rcBuddy.left)/2+rcSelf.left;
     1008        y = rcSelf.bottom;
    10091009      } else
    10101010      { //right
     
    17171717          uFlags |= TTF_ALIGNBOTTOM | TTF_HCENTER;
    17181718
    1719       infoPtr->hwndToolTip = createToolTip(hwnd,uFlags);
     1719      infoPtr->hwndToolTip = createToolTip(hwnd,uFlags,TRUE);
    17201720    }
    17211721
     
    21472147    TRACKBAR_UpdateThumbPosition(hwnd,infoPtr->nPos,FALSE); //infoPtr->nPos now set
    21482148
    2149     TRACKBAR_SendNotify(hwnd,TB_THUMBTRACK | (infoPtr->nPos >> 16));
     2149    TRACKBAR_SendNotify(hwnd,TB_THUMBTRACK | (infoPtr->nPos << 16));
    21502150
    21512151    if (infoPtr->flags & TB_SHOW_TOOLTIP)
  • trunk/src/comctl32/treeview.cpp

    r2895 r3154  
    1 /* $Id: treeview.cpp,v 1.2 2000-02-25 17:00:18 cbratschi Exp $ */
     1/* $Id: treeview.cpp,v 1.3 2000-03-18 16:17:34 cbratschi Exp $ */
    22/* Treeview control
    33 *
     
    6969static BOOL    TREEVIEW_SendCustomDrawNotify (HWND hwnd, DWORD dwDrawStage, HDC hdc, RECT rc);
    7070static BOOL    TREEVIEW_SendCustomDrawItemNotify (HWND hwnd, HDC hdc, TREEVIEW_ITEM *tvItem, UINT uItemDrawState);
     71static LRESULT TREEVIEW_RButtonUp (HWND hwnd, LPPOINT pPt);
    7172static LRESULT TREEVIEW_SelectItem (HWND hwnd, WPARAM wParam, LPARAM lParam);
    7273static LRESULT TREEVIEW_DoSelectItem(HWND hwnd,INT action,HTREEITEM newSelect,INT cause);
     
    19861987  txt2 = item->pszText;
    19871988
    1988   return lstrcmpW(txt1,txt2);
     1989  return lstrcmpiW(txt1,txt2); //CB: or lstrcmpW?
    19891990}
    19901991
     
    24292430
    24302431  wineItem->calculated = FALSE;
     2432  //TREEVIEW_Sort(hwnd,0,NULL,NULL); //CB: the Corel people do this, I think it's wrong
    24312433  TREEVIEW_QueueRefresh(hwnd);
    24322434
     
    27342736  infoPtr->hwndToolTip = 0;
    27352737  if (!(dwStyle & TVS_NOTOOLTIPS))
    2736     infoPtr->hwndToolTip = createToolTip(hwnd,TTF_TRACK | TTF_ABSOLUTE);
     2738    infoPtr->hwndToolTip = createToolTip(hwnd,TTF_TRACK | TTF_ABSOLUTE,TRUE);
    27372739
    27382740  if (dwStyle & TVS_CHECKBOXES)
     
    27972799  sendNotify(hwnd,NM_SETFOCUS);
    27982800
    2799   if (!(dwStyle & TVS_SHOWSELALWAYS) && infoPtr->selectedItem)
    2800     TREEVIEW_RefreshItem(hwnd,TREEVIEW_ValidItem(infoPtr,infoPtr->selectedItem),FALSE);
     2801  if (!(dwStyle & TVS_SHOWSELALWAYS))
     2802  {
     2803    if (infoPtr->selectedItem)
     2804      TREEVIEW_RefreshItem(hwnd,TREEVIEW_ValidItem(infoPtr,infoPtr->selectedItem),FALSE);
     2805    else if (infoPtr->firstVisible)
     2806      TREEVIEW_DoSelectItem(hwnd,TVGN_CARET,infoPtr->firstVisible,TVC_UNKNOWN);
     2807  }
    28012808
    28022809  return 0;
     
    31993206  }
    32003207
     3208  /* If item was collapsed we probably need to change selection */
     3209  if (flag & TVE_COLLAPSE)
     3210  {
     3211     HTREEITEM hItem = infoPtr->selectedItem;
     3212
     3213     if (!TREEVIEW_ValidItem (infoPtr, hItem))
     3214        hItem = wineItem->hItem;
     3215     else
     3216     {
     3217        while ( hItem )
     3218        {
     3219           hItem = infoPtr->items[(INT)hItem].parent;
     3220
     3221           if (hItem == wineItem->hItem)
     3222              break;
     3223        }
     3224     }
     3225
     3226     if (hItem)
     3227        TREEVIEW_DoSelectItem(hwnd, TVGN_CARET, hItem, TVC_UNKNOWN);
     3228  }
     3229
    32013230  //CB: todo: optimize!
    32023231  TREEVIEW_UnqueueRefresh(hwnd,FALSE,FALSE);
     
    34863515                  msg.message <= WM_RBUTTONDBLCLK)
    34873516         {
     3517            if (msg.message == WM_RBUTTONUP)
     3518              TREEVIEW_RButtonUp (hwnd, &pt);
    34883519            break;
    34893520         }
     
    37353766
    37363767static LRESULT
     3768TREEVIEW_RButtonUp (HWND hwnd, LPPOINT pPt)
     3769{
     3770    POINT pt;
     3771
     3772    pt.x = pPt->x;
     3773    pt.y = pPt->y;
     3774
     3775    /* Change to screen coordinate for WM_CONTEXTMENU */
     3776    ClientToScreen(hwnd, &pt);
     3777
     3778    /* Send the WM_CONTEXTMENU on a right click */
     3779    SendMessageA( hwnd, WM_CONTEXTMENU, (WPARAM) hwnd, MAKELPARAM(pt.x, pt.y));
     3780    return 0;
     3781}
     3782
     3783static LRESULT
    37373784TREEVIEW_CreateDragImage (HWND hwnd, WPARAM wParam, LPARAM lParam)
    37383785{
     
    42194266        newItem = (& infoPtr->items[(INT)prevItem->parent]);
    42204267
    4221         hNewSelection = newItem->hItem;
     4268        hNewSelection = newItem->hItem; //CB: what does Win32??? Please not the Corel hack!!!
    42224269      }
    42234270
  • trunk/src/comctl32/updown.cpp

    r2875 r3154  
    1 /* $Id: updown.cpp,v 1.1 2000-02-23 17:09:51 cbratschi Exp $ */
     1/* $Id: updown.cpp,v 1.2 2000-03-18 16:17:35 cbratschi Exp $ */
    22/*
    33 * Updown control
     
    3737#include "commctrl.h"
    3838#include "winnls.h"
     39#include "ccbase.h"
    3940#include "updown.h"
    4041
     
    7071#define UNKNOWN_PARAM(msg, wParam, lParam)
    7172
    72 #define UPDOWN_GetInfoPtr(hwnd) ((UPDOWN_INFO *)GetWindowLongA(hwnd,0))
     73#define UPDOWN_GetInfoPtr(hwnd) ((UPDOWN_INFO*)getInfoPtr(hwnd))
    7374
    7475static LRESULT CALLBACK
     
    714715  DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    715716
    716   infoPtr = (UPDOWN_INFO*)COMCTL32_Alloc(sizeof(UPDOWN_INFO));
    717   SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
     717  infoPtr = (UPDOWN_INFO*)initControl(hwnd,sizeof(UPDOWN_INFO));
    718718
    719719  /* initialize the info struct */
     
    744744        RemovePropA(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
    745745
    746   COMCTL32_Free (infoPtr);
    747 
    748 //      TRACE(updown, "UpDown Ctrl destruction, hwnd=%04x\n", hwnd);
     746  doneControl(hwnd);
    749747
    750748  return 0;
     
    10941092//      ERR (updown, "unknown msg %04x wp=%04x lp=%08lx\n",
    10951093//           message, wParam, lParam);
    1096       return DefWindowProcA(hwnd,message,wParam,lParam);
     1094      return defComCtl32ProcA(hwnd,message,wParam,lParam);
    10971095    }
    10981096
     
    11591157    WNDCLASSA wndClass;
    11601158
    1161 //SvL: Don't check this now
    1162 //    if( GlobalFindAtomA( UPDOWN_CLASSA ) ) return;
    1163 
    11641159    ZeroMemory( &wndClass, sizeof( WNDCLASSA ) );
    11651160    wndClass.style         = CS_GLOBALCLASS | CS_VREDRAW;
     
    11841179UPDOWN_Unregister (VOID)
    11851180{
    1186     if (GlobalFindAtomA (UPDOWN_CLASSA))
    1187         UnregisterClassA (UPDOWN_CLASSA, (HINSTANCE)NULL);
    1188 }
    1189 
     1181    UnregisterClassA (UPDOWN_CLASSA, (HINSTANCE)NULL);
     1182}
     1183
Note: See TracChangeset for help on using the changeset viewer.