Changeset 3145 for trunk/src


Ignore:
Timestamp:
Mar 17, 2000, 6:13:26 PM (25 years ago)
Author:
cbratschi
Message:

trackbar buddy fix, tooltip enhancements

Location:
trunk/src/comctl32
Files:
10 edited

Legend:

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

    r2895 r3145  
    1 /* $Id: CCBase.cpp,v 1.2 2000-02-25 17:00:15 cbratschi Exp $ */
     1/* $Id: CCBase.cpp,v 1.3 2000-03-17 17:13:22 cbratschi Exp $ */
    22/*
    33 * COMCTL32 Base Functions and Macros for all Controls
     
    3535  infoPtr->fUnicode      = IsWindowUnicode(hwnd);
    3636  infoPtr->uNotifyFormat = sendNotifyFormat(GetParent(hwnd),hwnd,NF_QUERY);
     37  infoPtr->hwndNotify    = GetParent(hwnd);
    3738
    3839  return infoPtr;
     
    109110      break;
    110111    }
     112
     113    case CCM_SETNOTIFYWINDOW:
     114    {
     115      infoPtr = getInfoPtr(hwnd);
     116
     117      if (!infoPtr) break;
     118
     119      infoPtr->hwndNotify = (HWND)wParam;
     120
     121      break;
     122    }
    111123  }
    112124
     
    143155}
    144156
     157HWND getNotifyWindow(COMCTL32_HEADER *infoPtr)
     158{
     159  if (!infoPtr) return 0;
     160
     161  return infoPtr->hwndNotify;
     162}
     163
     164HWND getNotifyWindow(HWND hwnd)
     165{
     166  COMCTL32_HEADER *infoPtr = getInfoPtr(hwnd);
     167
     168  return getNotifyWindow(infoPtr);
     169}
     170
    145171LRESULT sendNotify(HWND hwnd,UINT code)
    146172{
     
    151177  nmhdr.code     = code;
    152178
    153   return SendMessageA(GetParent(hwnd),WM_NOTIFY,nmhdr.idFrom,(LPARAM)&nmhdr);
     179  return SendMessageA(getNotifyWindow(hwnd),WM_NOTIFY,nmhdr.idFrom,(LPARAM)&nmhdr);
    154180}
    155181
     
    162188  nmhdr->code     = code;
    163189
    164   return SendMessageA(GetParent(hwnd),WM_NOTIFY,nmhdr->idFrom,(LPARAM)nmhdr);
     190  return SendMessageA(getNotifyWindow(hwnd),WM_NOTIFY,nmhdr->idFrom,(LPARAM)nmhdr);
    165191}
    166192
     
    172198LRESULT sendCommand(HWND hwnd,UINT wNotifyCode)
    173199{
    174   return SendMessageA(GetParent(hwnd),WM_COMMAND,MAKEWPARAM(GetWindowLongA(hwnd,GWL_ID),wNotifyCode),(LPARAM)hwnd);
     200  return SendMessageA(getNotifyWindow(hwnd),WM_COMMAND,MAKEWPARAM(GetWindowLongA(hwnd,GWL_ID),wNotifyCode),(LPARAM)hwnd);
     201}
     202
     203LRESULT sendHScroll(HWND hwnd,UINT wNotifyCode)
     204{
     205  return SendMessageA(getNotifyWindow(hwnd),WM_HSCROLL,(WPARAM)wNotifyCode,(LPARAM)hwnd);
     206}
     207
     208LRESULT sendVScroll(HWND hwnd,UINT wNotifyCode)
     209{
     210  return SendMessageA(getNotifyWindow(hwnd),WM_VSCROLL,(WPARAM)wNotifyCode,(LPARAM)hwnd);
    175211}
    176212
  • trunk/src/comctl32/CCBase.h

    r2895 r3145  
    1 /* $Id: CCBase.h,v 1.3 2000-02-25 17:00:15 cbratschi Exp $ */
     1/* $Id: CCBase.h,v 1.4 2000-03-17 17:13:22 cbratschi Exp $ */
    22/*
    33 * COMCTL32 Base Functions and Macros for all Controls
     
    1717  BOOL  fUnicode;      //Unicode flag
    1818  UINT  uNotifyFormat; //notify format
     19  HWND  hwndNotify;    //notify window
    1920} COMCTL32_HEADER;
    2021
     
    2829BOOL isUnicodeNotify(HWND hwnd);
    2930
     31HWND getNotifyWindow(COMCTL32_HEADER *infoPtr);
     32HWND getNotifyWindow(COMCTL32_HEADER *infoPtr);
     33
    3034LRESULT sendNotify(HWND hwnd,UINT code);
    3135LRESULT sendNotify(HWND hwnd,UINT code,LPNMHDR nmhdr);
    3236LRESULT sendNotifyFormat(HWND hwnd,HWND hwndFrom,LPARAM command);
    3337LRESULT sendCommand(HWND hwnd,UINT wNotifyCode);
     38LRESULT sendHScroll(HWND hwnd,UINT wNotifyCode);
     39LRESULT sendVScroll(HWND hwnd,UINT wNotifyCode);
    3440
    3541HWND createToolTip(HWND hwnd,UINT flags);
  • trunk/src/comctl32/monthcal.cpp

    r2875 r3145  
    2424#include "commctrl.h"
    2525#include "comctl32.h"
     26#include "ccbase.h"
    2627#include "monthcal.h"
    2728#include "winnls.h"
     
    4546
    4647
    47 #define MONTHCAL_GetInfoPtr(hwnd) ((MONTHCAL_INFO *)GetWindowLongA(hwnd, 0))
     48#define MONTHCAL_GetInfoPtr(hwnd) ((MONTHCAL_INFO *)getInfoPtr(hwnd))
    4849
    4950/* helper functions  */
     
    10951096    int i;
    10961097
    1097     nmds.nmhdr.hwndFrom = hwnd;
    1098     nmds.nmhdr.idFrom   = GetWindowLongA(hwnd, GWL_ID);
    1099     nmds.nmhdr.code     = MCN_GETDAYSTATE;
    11001098    nmds.cDayState      = infoPtr->monthRange;
    11011099    nmds.prgDayState    = (DWORD*)COMCTL32_Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE));
    11021100
    1103     SendMessageA(GetParent(hwnd), WM_NOTIFY,
    1104     (WPARAM)nmds.nmhdr.idFrom, (LPARAM)&nmds);
     1101    sendNotify(hwnd,MCN_GETDAYSTATE,&nmds.nmhdr);
    11051102    for(i=0; i<infoPtr->monthRange; i++)
    11061103      infoPtr->monthdayState[i] = nmds.prgDayState[i];
     
    11251122    int i;
    11261123
    1127     nmds.nmhdr.hwndFrom = hwnd;
    1128     nmds.nmhdr.idFrom   = GetWindowLongA(hwnd, GWL_ID);
    1129     nmds.nmhdr.code     = MCN_GETDAYSTATE;
    11301124    nmds.cDayState      = infoPtr->monthRange;
    11311125    nmds.prgDayState    = (DWORD*)COMCTL32_Alloc
    11321126                        (infoPtr->monthRange * sizeof(MONTHDAYSTATE));
    11331127
    1134     SendMessageA(GetParent(hwnd), WM_NOTIFY,
    1135         (WPARAM)nmds.nmhdr.idFrom, (LPARAM)&nmds);
     1128    sendNotify(hwnd,MCN_GETDAYSTATE,&nmds.nmhdr);
    11361129    for(i=0; i<infoPtr->monthRange; i++)
    11371130       infoPtr->monthdayState[i] = nmds.prgDayState[i];
     
    12091202
    12101203    //TRACE("\n");
    1211     nmsc.nmhdr.hwndFrom = hwnd;
    1212     nmsc.nmhdr.idFrom   = GetWindowLongA(hwnd, GWL_ID);
    1213     nmsc.nmhdr.code     = MCN_SELCHANGE;
    12141204    MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel);
    12151205    MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel);
    12161206
    1217     SendMessageA(GetParent(hwnd), WM_NOTIFY,
    1218            (WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc);
     1207    sendNotify(hwnd,MCN_SELCHANGE,&nmsc.nmhdr);
    12191208
    12201209    MONTHCAL_CopyTime(&ht.st, &selArray[0]);
     
    12481237  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
    12491238  NMSELCHANGE nmsc;
    1250   NMHDR nmhdr;
    12511239  HDC hdc;
    12521240  BOOL redraw = FALSE;
     
    12651253  infoPtr->status = MC_SEL_LBUTUP;
    12661254
    1267   nmhdr.hwndFrom = hwnd;
    1268   nmhdr.idFrom   = GetWindowLongA( hwnd, GWL_ID);
    1269   nmhdr.code     = NM_RELEASEDCAPTURE;
    1270   //TRACE("Sent notification from %x to %x\n", hwnd, GetParent(hwnd));
    1271 
    1272   SendMessageA(GetParent(hwnd), WM_NOTIFY,
    1273                                 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
    1274 
    1275   nmsc.nmhdr.hwndFrom = hwnd;
    1276   nmsc.nmhdr.idFrom   = GetWindowLongA(hwnd, GWL_ID);
    1277   nmsc.nmhdr.code     = MCN_SELECT;
     1255  sendNotify(hwnd,NM_RELEASEDCAPTURE);
     1256
    12781257  MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel);
    12791258  MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel);
    12801259
    1281   SendMessageA(GetParent(hwnd), WM_NOTIFY,
    1282            (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
     1260  sendNotify(hwnd,MCN_SELECT,&nmsc.nmhdr);
    12831261
    12841262  /* redraw if necessary */
     
    15691547
    15701548  /* allocate memory for info structure */
    1571   infoPtr =(MONTHCAL_INFO*)COMCTL32_Alloc(sizeof(MONTHCAL_INFO));
    1572   SetWindowLongA(hwnd, 0, (DWORD)infoPtr);
     1549  infoPtr =(MONTHCAL_INFO*)initControl(hwnd,sizeof(MONTHCAL_INFO));
    15731550
    15741551  if(infoPtr == NULL) {
     
    16201597
    16211598  /* free month calendar info data */
    1622   COMCTL32_Free(infoPtr);
     1599  doneControl(hwnd);
    16231600
    16241601  return 0;
     
    17301707    //if(uMsg >= WM_USER)
    17311708    //  ERR( "unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);
    1732     return DefWindowProcA(hwnd, uMsg, wParam, lParam);
     1709    return defComCtl32ProcA(hwnd, uMsg, wParam, lParam);
    17331710  }
    17341711  return 0;
     
    17401717{
    17411718  WNDCLASSA wndClass;
    1742 
    1743 //SvL: Don't check this now
    1744 //  if(GlobalFindAtomA(MONTHCAL_CLASSA)) return;
    17451719
    17461720  ZeroMemory(&wndClass, sizeof(WNDCLASSA));
     
    17601734MONTHCAL_Unregister(void)
    17611735{
    1762   if(GlobalFindAtomA(MONTHCAL_CLASSA))
    1763     UnregisterClassA(MONTHCAL_CLASSA, (HINSTANCE)NULL);
    1764 }
     1736  UnregisterClassA(MONTHCAL_CLASSA, (HINSTANCE)NULL);
     1737}
  • trunk/src/comctl32/nativefont.cpp

    r2875 r3145  
    1 /* $Id: nativefont.cpp,v 1.1 2000-02-23 17:09:44 cbratschi Exp $ */
     1/* $Id: nativefont.cpp,v 1.2 2000-03-17 17:13:23 cbratschi Exp $ */
    22/*
    33 * Native Font control
     
    1818#include "winbase.h"
    1919#include "commctrl.h"
     20#include "ccbase.h"
    2021#include "nativefont.h"
    2122
    22 
    23 
    24 #define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongA (hwnd, 0))
    25 
    26 
    27 
     23#define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO*)getInfoPtr(hwnd))
    2824
    2925static LRESULT
     
    3329
    3430    /* allocate memory for info structure */
    35     infoPtr = (NATIVEFONT_INFO *)COMCTL32_Alloc (sizeof(NATIVEFONT_INFO));
    36     SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
     31    infoPtr = (NATIVEFONT_INFO*)initControl(hwnd,sizeof(NATIVEFONT_INFO));
    3732
    3833
     
    5348
    5449    /* free comboex info data */
    55     COMCTL32_Free (infoPtr);
     50    doneControl(hwnd);
    5651
    5752    return 0;
     
    7570//          ERR (nativefont, "unknown msg %04x wp=%08x lp=%08lx\n",
    7671//                   uMsg, wParam, lParam);
    77             return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     72            return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
    7873    }
    7974    return 0;
     
    8580{
    8681    WNDCLASSA wndClass;
    87 
    88 //SvL: Don't check this now
    89 //    if (GlobalFindAtomA (WC_NATIVEFONTCTLA)) return;
    9082
    9183    ZeroMemory (&wndClass, sizeof(WNDCLASSA));
     
    10597NATIVEFONT_Unregister (VOID)
    10698{
    107     if (GlobalFindAtomA (WC_NATIVEFONTCTLA))
    108         UnregisterClassA (WC_NATIVEFONTCTLA, (HINSTANCE)NULL);
     99    UnregisterClassA (WC_NATIVEFONTCTLA, (HINSTANCE)NULL);
    109100}
    110101
  • trunk/src/comctl32/pager.cpp

    r2875 r3145  
    1 /* $Id: pager.cpp,v 1.1 2000-02-23 17:09:45 cbratschi Exp $ */
     1/* $Id: pager.cpp,v 1.2 2000-03-17 17:13:23 cbratschi Exp $ */
    22/*
    33 * Pager control
     
    1818#include "winbase.h"
    1919#include "commctrl.h"
     20#include "ccbase.h"
    2021#include "pager.h"
    2122
    22 
    23 #define PAGER_GetInfoPtr(hwnd) ((PAGER_INFO *)GetWindowLongA(hwnd, 0))
    24 
     23#define PAGER_GetInfoPtr(hwnd) ((PAGER_INFO*)getInfoPtr(hwnd))
    2524
    2625static LRESULT
     
    9493    if (infoPtr->hwndChild) {
    9594        ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE));
    96         nmpgcs.hdr.hwndFrom = hwnd;
    97         nmpgcs.hdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
    98         nmpgcs.hdr.code = PGN_CALCSIZE;
    9995        nmpgcs.dwFlag = (dwStyle & PGS_HORZ) ? PGF_CALCWIDTH : PGF_CALCHEIGHT;
    100         SendMessageA (GetParent (hwnd), WM_NOTIFY,
    101                         (WPARAM)nmpgcs.hdr.idFrom, (LPARAM)&nmpgcs);
     96        sendNotify(hwnd,PGN_CALCSIZE,&nmpgcs.hdr);
    10297
    10398        infoPtr->nChildSize = (dwStyle & PGS_HORZ) ? nmpgcs.iWidth : nmpgcs.iHeight;
     
    205200
    206201    /* allocate memory for info structure */
    207     infoPtr = (PAGER_INFO *)COMCTL32_Alloc (sizeof(PAGER_INFO));
     202    infoPtr = (PAGER_INFO*)initControl(hwnd,sizeof(PAGER_INFO));
    208203    SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
    209204
     
    225220    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
    226221
    227 
    228 
    229 
    230222    /* free pager info data */
    231     COMCTL32_Free (infoPtr);
     223    doneControl(hwnd);
    232224
    233225    return 0;
     
    356348//              ERR (pager, "unknown msg %04x wp=%08x lp=%08lx\n",
    357349//                   uMsg, wParam, lParam);
    358             return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     350            return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
    359351    }
    360352    return 0;
     
    366358{
    367359    WNDCLASSA wndClass;
    368 
    369 //SvL: Don't check this now
    370 //    if (GlobalFindAtomA (WC_PAGESCROLLERA)) return;
    371360
    372361    ZeroMemory (&wndClass, sizeof(WNDCLASSA));
     
    386375PAGER_Unregister (VOID)
    387376{
    388     if (GlobalFindAtomA (WC_PAGESCROLLERA))
    389         UnregisterClassA (WC_PAGESCROLLERA, (HINSTANCE)NULL);
    390 }
    391 
     377    UnregisterClassA (WC_PAGESCROLLERA, (HINSTANCE)NULL);
     378}
     379
  • trunk/src/comctl32/progress.cpp

    r2875 r3145  
    1 /* $Id: progress.cpp,v 1.1 2000-02-23 17:09:46 cbratschi Exp $ */
     1/* $Id: progress.cpp,v 1.2 2000-03-17 17:13:23 cbratschi Exp $ */
    22/*
    33 * Progress control
     
    1414#include "winbase.h"
    1515#include "commctrl.h"
     16#include "ccbase.h"
    1617#include "progress.h"
    1718#include "comctl32.h"
    1819
    19 
    2020/* Control configuration constants */
    2121
     
    2323#define BORDER_WIDTH 1
    2424
    25 #define PROGRESS_GetInfoPtr(hwnd) ((PROGRESS_INFO *)GetWindowLongA(hwnd,0))
     25#define PROGRESS_GetInfoPtr(hwnd) ((PROGRESS_INFO*)getInfoPtr(hwnd))
    2626
    2727
     
    279279
    280280  /* allocate memory for info struct */
    281   infoPtr = (PROGRESS_INFO *)COMCTL32_Alloc(sizeof(PROGRESS_INFO));
     281  infoPtr = (PROGRESS_INFO*)initControl(hwnd,sizeof(PROGRESS_INFO));
    282282  SetWindowLongA(hwnd,0,(DWORD)infoPtr);
    283283
     
    290290  infoPtr->ColorBk = CLR_DEFAULT;
    291291  infoPtr->hFont = (HANDLE)NULL;
    292 //      TRACE(progress, "Progress Ctrl creation, hwnd=%04x\n", hwnd);
    293292
    294293  return 0;
     
    299298  PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd);
    300299
    301   //      TRACE (progress, "Progress Ctrl destruction, hwnd=%04x\n", hwnd);
    302   COMCTL32_Free (infoPtr);
     300  doneControl(hwnd);
    303301
    304302  return 0;
     
    536534//      ERR(progress, "unknown msg %04x wp=%04x lp=%08lx\n",
    537535//                  message, wParam, lParam );
    538       return DefWindowProcA( hwnd, message, wParam, lParam );
     536      return defComCtl32ProcA( hwnd, message, wParam, lParam );
    539537    }
    540538
     
    553551{
    554552    WNDCLASSA wndClass;
    555 
    556 //SvL: Don't check this now
    557 //    if (GlobalFindAtomA(PROGRESS_CLASSA)) return;
    558553
    559554    ZeroMemory (&wndClass, sizeof( WNDCLASSA));
     
    578573PROGRESS_Unregister (VOID)
    579574{
    580     if (GlobalFindAtomA(PROGRESS_CLASSA))
    581         UnregisterClassA(PROGRESS_CLASSA, (HINSTANCE)NULL);
    582 }
    583 
     575    UnregisterClassA(PROGRESS_CLASSA, (HINSTANCE)NULL);
     576}
     577
  • trunk/src/comctl32/propsheet.cpp

    r2875 r3145  
    1 /* $Id: propsheet.cpp,v 1.1 2000-02-23 17:09:46 cbratschi Exp $ */
     1/* $Id: propsheet.cpp,v 1.2 2000-03-17 17:13:24 cbratschi Exp $ */
    22/*
    33 * Property Sheets
     
    2020#include "prsht.h"
    2121#include "dialog.h"
    22 #include "win.h"
    2322#include "winnls.h"
    2423#include "comctl32.h"
     
    349348static INT PROPSHEET_DoDialogBox( HWND hwnd, HWND owner)
    350349{
    351    WND * wndPtr;
    352350   DIALOGINFO * dlgInfo;
    353351   MSG msg;
    354352   INT retval;
    355353
    356 //AH: that WINE internal - design violation!!1
    357 #if 0
     354   dprintf(("PROPSHEET: PROPSHEET_DoDialogBox not implemented!!!"));
     355
     356#if 0 //CB: implement! sync with user32\win32dlg.cpp DoDialogBox method (not easy)
     357      //    this functions isn't used so far
    358358     /* Owner must be a top-level window */
    359359   owner = WIN_GetTopParent( owner );
    360    if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return -1;
    361    dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
     360   if (!IsWindow(hwnd))) return -1;
     361   dlgInfo = (DIALOGINFO*)wndPtr->wExtra;
    362362
    363363   if (!dlgInfo->flags & DF_END) /* was EndDialog called in WM_INITDIALOG ? */
     
    377377   }
    378378   retval = dlgInfo->idResult;
    379 
    380    WIN_ReleaseWndPtr(wndPtr);
    381379#endif
    382380   DestroyWindow( hwnd );
     
    390388 */
    391389
    392 //AH: WINE 9912123 not merged due to design violation (internal WINE structures used)
    393 
    394390BOOL PROPSHEET_CreateDialog(PropSheetInfo* psInfo)
    395391{
    396 #if 0
    397   LRESULT ret;
    398   LPCVOID template;
    399   LPVOID temp = 0;
    400   HRSRC hRes;
    401   DWORD resSize;
    402   WORD resID = IDD_PROPSHEET;
    403 
    404   if (psInfo->ppshheader->dwFlags & PSH_WIZARD)
    405     resID = IDD_WIZARD;
    406 
    407   if(!(hRes = FindResourceA(COMCTL32_hModule,
    408                             MAKEINTRESOURCEA(resID),
    409                             RT_DIALOGA)))
    410     return FALSE;
    411 
    412   if(!(template = (LPVOID)LoadResource(COMCTL32_hModule, hRes)))
    413     return FALSE;
    414 
    415   /*
    416    * Make a copy of the dialog template.
    417    */
    418   resSize = SizeofResource(COMCTL32_hModule, hRes);
    419 
    420   temp = COMCTL32_Alloc(resSize);
    421 
    422   if (!temp)
    423     return FALSE;
    424 
    425   memcpy(temp, template, resSize);
    426 
    427   if (psInfo->useCallback)
    428     (*(psInfo->ppshheader->pfnCallback))(0, PSCB_PRECREATE, (LPARAM)temp);
    429 
    430   ret = CreateDialogIndirectParamA(psInfo->ppshheader->hInstance,
    431                                      (LPDLGTEMPLATEA) temp,
    432                                      psInfo->ppshheader->hwndParent,
    433                                      (DLGPROC) PROPSHEET_DialogProc,
    434                                      (LPARAM)psInfo);
    435 
    436   if (!(psInfo->ppshheader->dwFlags & PSH_MODELESS))
    437      ret = PROPSHEET_DoDialogBox((HWND)ret, psInfo->ppshheader->hwndParent);
    438 
    439   COMCTL32_Free(temp);
    440 
    441   return ret;
    442 #endif
    443392  LRESULT ret;
    444393  LPCVOID templ;
  • trunk/src/comctl32/toolbar.cpp

    r2875 r3145  
    1 /* $Id: toolbar.cpp,v 1.1 2000-02-23 17:09:48 cbratschi Exp $ */
     1/* $Id: toolbar.cpp,v 1.2 2000-03-17 17:13:24 cbratschi Exp $ */
    22/*
    33 * Toolbar control
     
    16131613}
    16141614
    1615 //WINE version - not currently used
    1616 #if 0
    1617 static BOOL WINAPI
    1618 TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    1619 {
    1620     TOOLBAR_INFO *infoPtr = (TOOLBAR_INFO *)GetWindowLongA (hwnd, DWL_USER);
    1621     static HDSA hDsa = NULL;
    1622 
    1623     switch (uMsg)
    1624     {
    1625         case WM_INITDIALOG:
    1626             infoPtr = (TOOLBAR_INFO *)lParam;
    1627             SetWindowLongA (hwnd, DWL_USER, (DWORD)infoPtr);
    1628 
    1629             hDsa = DSA_Create (sizeof(TBUTTON_INFO), 5);
    1630 
    1631             if (infoPtr)
    1632             {
    1633                 TBUTTON_INFO *btnPtr;
    1634                 INT i;
    1635 
    1636                 /* insert 'virtual' separator button into 'available buttons' list */
    1637                 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)"");
    1638 
    1639                 /* copy all buttons and append them to the right listbox */
    1640                 btnPtr = infoPtr->buttons;
    1641                 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++)
    1642                 {
    1643                     DSA_InsertItem (hDsa, i, btnPtr);
    1644 
    1645                     /* FIXME: hidden buttons appear in the 'toolbar buttons' list too */
    1646                     if (btnPtr->fsState & TBSTATE_HIDDEN)
    1647                     {
    1648                         SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)"");
    1649                     }
    1650                     else
    1651                     {
    1652                         SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)"");
    1653                     }
    1654                 }
    1655 
    1656                 /* append 'virtual' separator button to the 'toolbar buttons' list */
    1657                 /* TODO */
    1658             }
    1659             return TRUE;
    1660 
    1661         case WM_CLOSE:
    1662             EndDialog(hwnd, FALSE);
    1663             return TRUE;
    1664 
    1665         case WM_COMMAND:
    1666             switch (LOWORD(wParam))
    1667             {
    1668                 case IDCANCEL:
    1669                     EndDialog(hwnd, FALSE);
    1670                     break;
    1671             }
    1672             return TRUE;
    1673 
    1674         case WM_DESTROY:
    1675             if (hDsa)
    1676                 DSA_Destroy (hDsa);
    1677             return TRUE;
    1678 
    1679         case WM_DRAWITEM:
    1680             if (wParam == IDC_AVAILBTN_LBOX || wParam == IDC_TOOLBARBTN_LBOX)
    1681             {
    1682                 LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam;
    1683                 TBUTTON_INFO btnPtr;
    1684                 RECT rcButton;
    1685                 RECT rcText;
    1686                 HPEN hOldPen;
    1687                 HBRUSH hOldBrush;
    1688                 COLORREF oldText = 0;
    1689                 COLORREF oldBk = 0;
    1690 
    1691                 FIXME("action: %x itemState: %x\n",
    1692                       lpdis->itemAction, lpdis->itemState);
    1693 
    1694                 DSA_GetItem (hDsa, 0 /*lpdis->itemID*/, &btnPtr);
    1695 
    1696                 if (lpdis->itemState & ODS_FOCUS)
    1697                 {
    1698                     oldBk = SetBkColor (lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT));
    1699                     oldText = SetTextColor (lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
    1700                 }
    1701 
    1702                 hOldPen = SelectObject (lpdis->hDC, GetSysColorPen ((lpdis->itemState & ODS_SELECTED)?COLOR_HIGHLIGHT:COLOR_WINDOW));
    1703                 hOldBrush = SelectObject (lpdis->hDC, GetSysColorBrush ((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHT:COLOR_WINDOW));
    1704 
    1705                 /* fill background rectangle */
    1706                 Rectangle (lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
    1707                            lpdis->rcItem.right, lpdis->rcItem.bottom);
    1708 
    1709                 /* calculate button and text rectangles */
    1710                 CopyRect (&rcButton, &lpdis->rcItem);
    1711                 InflateRect (&rcButton, -1, -1);
    1712                 CopyRect (&rcText, &rcButton);
    1713                 rcButton.right = rcButton.left + infoPtr->nBitmapWidth + 6;
    1714                 rcText.left = rcButton.right + 2;
    1715 
    1716                 /* draw focus rectangle */
    1717                 if (lpdis->itemState & ODS_FOCUS)
    1718                     DrawFocusRect (lpdis->hDC, &lpdis->rcItem);
    1719 
    1720                 /* draw button */
    1721                 DrawEdge (lpdis->hDC, &rcButton, EDGE_RAISED, BF_RECT|BF_MIDDLE|BF_SOFT);
    1722 
    1723                 /* draw image and text */
    1724                 if (wParam == IDC_AVAILBTN_LBOX && lpdis->itemID == 0)
    1725                 {
    1726                     /* virtual separator in the 'available' list */
    1727                     DrawTextA (lpdis->hDC, "Separator", -1, &rcText,
    1728                                DT_LEFT | DT_VCENTER | DT_SINGLELINE);
    1729                 }
    1730                 else
    1731                 {
    1732                     /* real button */
    1733 
    1734                     ImageList_Draw (infoPtr->himlDef, btnPtr.iBitmap, lpdis->hDC,
    1735                                     rcButton.left+1, rcButton.top+1, ILD_NORMAL);
    1736 //AH: TODO: Find out why this happens!!!
    1737 if ((infoPtr->strings == NULL) || (infoPtr->strings[btnPtr.iString] == NULL))
    1738   dprintf(("COMCTL32:TOOLBAR:CustomizeDialog - Error drawing string - pointer not found!\n"));
    1739 else
    1740                     DrawTextW (lpdis->hDC,  infoPtr->strings[btnPtr.iString], -1, &rcText,
    1741                                DT_LEFT | DT_VCENTER | DT_SINGLELINE);
    1742 
    1743                 }
    1744 
    1745                 if (lpdis->itemState & ODS_FOCUS)
    1746                 {
    1747                     SetBkColor (lpdis->hDC, oldBk);
    1748                     SetTextColor (lpdis->hDC, oldText);
    1749                 }
    1750 
    1751                 SelectObject (lpdis->hDC, hOldBrush);
    1752                 SelectObject (lpdis->hDC, hOldPen);
    1753 
    1754                 return TRUE;
    1755             }
    1756             return FALSE;
    1757 
    1758         case WM_MEASUREITEM:
    1759             if (wParam == IDC_AVAILBTN_LBOX || wParam == IDC_TOOLBARBTN_LBOX)
    1760             {
    1761                 MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*)lParam;
    1762 
    1763                 if (infoPtr)
    1764                     lpmis->itemHeight = infoPtr->nBitmapHeight + 8;
    1765                 else
    1766                     lpmis->itemHeight = 16 + 8; /* default height */
    1767 
    1768                 return TRUE;
    1769             }
    1770             return FALSE;
    1771 
    1772         default:
    1773             return FALSE;
    1774     }
    1775 }
    1776 #endif
    1777 
    1778 
    17791615/***********************************************************************
    17801616 * TOOLBAR_AddBitmap:  Add the bitmaps to the default image list.
  • trunk/src/comctl32/tooltips.cpp

    r2893 r3145  
    1 /* $Id: tooltips.cpp,v 1.2 2000-02-25 09:57:19 achimha Exp $ */
     1/* $Id: tooltips.cpp,v 1.3 2000-03-17 17:13:26 cbratschi Exp $ */
    22/*
    33 * Tool tip control
     
    4242
    4343
    44 static VOID
    45 TOOLTIPS_Refresh (HWND hwnd, HDC hdc)
     44static VOID TOOLTIPS_Draw (HWND hwnd, HDC hdc)
    4645{
    4746    TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(hwnd);
     
    170169    }
    171170    if (GetWindowLongA(hwnd,GWL_STYLE) & TTS_NOPREFIX) uFlags |= DT_NOPREFIX;
    172 //    TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText));
     171    //TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText));
    173172
    174173    hdc = GetDC(hwnd);
     
    181180    size.cy = rc.bottom-rc.top+4+infoPtr->rcMargin.bottom+infoPtr->rcMargin.top;
    182181
    183     //CB: optimize
    184 
    185182    if (toolPtr->uFlags & TTF_ABSOLUTE)
    186183    {
     
    188185      rc.top  = infoPtr->yTrackPos;
    189186
    190       if (toolPtr->uFlags & TTF_CENTERTIP)
     187      if (toolPtr->uFlags & TTF_ALIGNMASK)
    191188      {
    192         rc.left -= (size.cx/2);
    193         rc.top  -= (size.cy/2);
     189        //CB: Odin only (Win32 does something similar but with an undocumented mechanism)
     190
     191        if (toolPtr->uFlags & TTF_ALIGNLEFT)
     192          rc.left -= size.cx;
     193        else if (toolPtr->uFlags & TTF_HCENTER)
     194          rc.left -= size.cx/2;
     195
     196        if (toolPtr->uFlags & TTF_ALIGNTOP)
     197          rc.top -= size.cy;
     198        else if (toolPtr->uFlags & TTF_VCENTER)
     199          rc.top -= size.cy/2;
     200
     201      } else
     202      {
     203        if (toolPtr->uFlags & TTF_CENTERTIP)
     204        {
     205          rc.left -= (size.cx/2);
     206          rc.top  -= (size.cy/2);
     207        }
    194208      }
    195209    } else
     
    235249    }
    236250
    237 //    TRACE (tooltips, "pos %d - %d\n", rect.left, rect.top);
     251    //TRACE (tooltips, "pos %d - %d\n", rect.left, rect.top);
    238252
    239253    rc.right = rc.left+size.cx;
     
    260274    if (GetWindowLongA (hwnd, GWL_STYLE) & TTS_NOPREFIX)
    261275        uFlags |= DT_NOPREFIX;
    262 //    TRACE("\"%s\"\n", debugstr_w(infoPtr->szTipText));
     276    //TRACE("\"%s\"\n", debugstr_w(infoPtr->szTipText));
    263277
    264278    hdc = GetDC (hwnd);
     
    364378    /* repaint the tooltip */
    365379    hdc = GetDC (hwnd);
    366     TOOLTIPS_Refresh (hwnd, hdc);
     380    TOOLTIPS_Draw(hwnd, hdc);
    367381    ReleaseDC (hwnd, hdc);
    368382
     
    407421    if (infoPtr->nTrackTool == -1)
    408422    {
    409 //    TRACE (tooltips, "invalid tracking tool (-1)!\n");
     423      //TRACE (tooltips, "invalid tracking tool (-1)!\n");
    410424      return;
    411425    }
    412426
    413 //    TRACE (tooltips, "show tracking tooltip pre %d!\n", infoPtr->nTrackTool);
     427    //TRACE (tooltips, "show tracking tooltip pre %d!\n", infoPtr->nTrackTool);
    414428
    415429    TOOLTIPS_GetTipText(hwnd,infoPtr,infoPtr->nTrackTool);
     
    421435    }
    422436
    423 //    TRACE (tooltips, "show tracking tooltip %d!\n", infoPtr->nTrackTool);
     437    //TRACE (tooltips, "show tracking tooltip %d!\n", infoPtr->nTrackTool);
    424438    toolPtr = &infoPtr->tools[infoPtr->nTrackTool];
    425439
     
    429443    SendMessageA(toolPtr->hwnd,WM_NOTIFY,(WPARAM)toolPtr->uId,(LPARAM)&hdr);
    430444
    431 //    TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText));
     445    //TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText));
    432446
    433447    TOOLTIPS_CalcTipRect(hwnd,infoPtr,toolPtr,&rect);
     
    438452
    439453    hdc = GetDC (hwnd);
    440     TOOLTIPS_Refresh (hwnd, hdc);
     454    TOOLTIPS_Draw(hwnd, hdc);
    441455    ReleaseDC (hwnd, hdc);
    442456}
     
    17401754      if (infoPtr->nTrackTool != -1)
    17411755      {
    1742 //      TRACE (tooltips, "activated!\n");
     1756        //TRACE (tooltips, "activated!\n");
    17431757        infoPtr->bTrackActive = TRUE;
    17441758        TOOLTIPS_TrackShow(hwnd,infoPtr);
     
    17521766      infoPtr->nTrackTool = -1;
    17531767
    1754 //      TRACE (tooltips, "deactivated!\n");
     1768      //TRACE (tooltips, "deactivated!\n");
    17551769    }
    17561770
     
    20902104
    20912105    hdc = (wParam == 0) ? BeginPaint (hwnd, &ps) : (HDC)wParam;
    2092     TOOLTIPS_Refresh (hwnd, hdc);
     2106    TOOLTIPS_Draw(hwnd, hdc);
    20932107    if (!wParam)
    20942108        EndPaint (hwnd, &ps);
     
    24612475    WNDCLASSA wndClass;
    24622476
    2463 //SvL: Don't check this now
    2464 //    if (GlobalFindAtomA (TOOLTIPS_CLASSA)) return;
    2465 
    24662477    ZeroMemory (&wndClass, sizeof(WNDCLASSA));
    24672478    wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS;
     
    24802491TOOLTIPS_Unregister (VOID)
    24812492{
    2482     if (GlobalFindAtomA (TOOLTIPS_CLASSA))
    2483         UnregisterClassA (TOOLTIPS_CLASSA, (HINSTANCE)NULL);
    2484 }
    2485 
     2493    UnregisterClassA (TOOLTIPS_CLASSA, (HINSTANCE)NULL);
     2494}
     2495
  • trunk/src/comctl32/trackbar.cpp

    r2875 r3145  
    1 /* $Id: trackbar.cpp,v 1.1 2000-02-23 17:09:49 cbratschi Exp $ */
     1/* $Id: trackbar.cpp,v 1.2 2000-03-17 17:13:26 cbratschi Exp $ */
    22/*
    33 * Trackbar control
     
    1818#include "winbase.h"
    1919#include "commctrl.h"
     20#include "ccbase.h"
    2021#include "trackbar.h"
    2122#include <stdio.h>
    2223
    23 #define TRACKBAR_GetInfoPtr(hwnd) ((TRACKBAR_INFO*)GetWindowLongA(hwnd,0))
     24#define TRACKBAR_GetInfoPtr(hwnd) ((TRACKBAR_INFO*)getInfoPtr(hwnd))
    2425
    2526
     
    6061#define CHANNEL_SCALE_SPACE  SCALE_SIZE+SCALE_SPACE+BORDER_SIZE
    6162#define CHANNEL_THUMB_SPACE  BORDER_SIZE
     63
     64#define TOOLTIP_SPACE 5
    6265
    6366/* scroll mode */
     
    705708
    706709    //Custom draw
    707     cdraw.hdr.hwndFrom = hwnd;
    708     cdraw.hdr.idFrom   = GetWindowLongA(hwnd,GWL_ID);
    709     cdraw.hdr.code     = NM_CUSTOMDRAW;
    710710    cdraw.dwDrawStage  = CDDS_PREPAINT;
    711711    cdraw.hdc          = hdc;
     
    715715    cdraw.lItemlParam  = 0;
    716716
    717     cdctlres = SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)cdraw.hdr.idFrom,(LPARAM)&cdraw);
     717    cdctlres = sendNotify(hwnd,NM_CUSTOMDRAW,&cdraw.hdr);
    718718
    719719    if (cdctlres & CDRF_SKIPDEFAULT) return;
     
    750750      cdraw.rc             = infoPtr->rcChannel;
    751751
    752       cdres = SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)cdraw.hdr.idFrom,(LPARAM)&cdraw);
     752      cdres = sendNotify(hwnd,NM_CUSTOMDRAW,&cdraw.hdr);
    753753    } else cdres = 0;
    754754
     
    777777        cdraw.dwDrawStage    = CDDS_ITEMPOSTPAINT;
    778778
    779         SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)cdraw.hdr.idFrom,(LPARAM)&cdraw);
     779        sendNotify(hwnd,NM_CUSTOMDRAW,&cdraw.hdr);
    780780      }
    781781    }
     
    789789      SetRectEmpty(&cdraw.rc);
    790790
    791       cdres = SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)cdraw.hdr.idFrom,(LPARAM)&cdraw);
     791      cdres = sendNotify(hwnd,NM_CUSTOMDRAW,&cdraw.hdr);
    792792    } else cdres = 0;
    793793
     
    840840        cdraw.dwDrawStage    = CDDS_ITEMPOSTPAINT;
    841841
    842         SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)cdraw.hdr.idFrom,(LPARAM)&cdraw);
     842        sendNotify(hwnd,NM_CUSTOMDRAW,&cdraw.hdr);
    843843      }
    844844    }
     
    852852      cdraw.rc             = infoPtr->rcFullThumb;
    853853
    854       cdres = SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)cdraw.hdr.idFrom,(LPARAM)&cdraw);
     854      cdres = sendNotify(hwnd,NM_CUSTOMDRAW,&cdraw.hdr);
    855855    } else cdres = 0;
    856856
     
    863863        cdraw.dwDrawStage    = CDDS_ITEMPOSTPAINT;
    864864
    865         SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)cdraw.hdr.idFrom,(LPARAM)&cdraw);
     865        sendNotify(hwnd,NM_CUSTOMDRAW,&cdraw.hdr);
    866866      }
    867867
     
    876876      GetClientRect(hwnd,&cdraw.rc);
    877877
    878       SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)cdraw.hdr.idFrom,(LPARAM)&cdraw);
     878      sendNotify(hwnd,NM_CUSTOMDRAW,&cdraw.hdr);
    879879    }
    880880
     
    977977
    978978    GetWindowRect(hwnd,&rcSelf);
     979    MapWindowPoints(HWND_DESKTOP,hwndParent,(LPPOINT)&rcSelf,2);
    979980
    980981    /* align buddy left or above */
     
    985986      if (dwStyle & TBS_VERT)
    986987      { //above
    987         x = rcSelf.left-(rcBuddy.right-rcBuddy.left)/2+infoPtr->rcChannel.left+(infoPtr->rcChannel.right-infoPtr->rcChannel.left)/2;
    988         y = rcSelf.top-(rcBuddy.bottom-rcBuddy.top);
     988        x = (infoPtr->rcChannel.right+infoPtr->rcChannel.left)/2-(rcBuddy.right-rcBuddy.left)/2+rcSelf.left;
     989        y = rcSelf.top-(rcBuddy.bottom-rcBuddy.top);
    989990      } else
    990991      { //left
    991         x = rcSelf.left+infoPtr->rcChannel.left-(rcBuddy.right-rcBuddy.left)/2;
    992         y = rcSelf.top-(rcBuddy.bottom-rcBuddy.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;
    993994      }
    994995
     
    10041005      if (dwStyle & TBS_VERT)
    10051006      { //below
    1006         x = rcSelf.left-(rcBuddy.right-rcBuddy.left)/2+infoPtr->rcChannel.left+(infoPtr->rcChannel.right-infoPtr->rcChannel.left)/2;
    1007         y = rcSelf.bottom;
     1007        x = (infoPtr->rcChannel.right+infoPtr->rcChannel.left)/2-(rcBuddy.right-rcBuddy.left)/2+rcSelf.left;
     1008        y = rcSelf.bottom;
    10081009      } else
    1009       {
    1010         x = rcSelf.right-infoPtr->rcChannel.left-(rcBuddy.right-rcBuddy.left)/2;
    1011         y = rcSelf.top-(rcBuddy.bottom-rcBuddy.top);
     1010      { //right
     1011        x = rcSelf.right;
     1012        y = (infoPtr->rcChannel.bottom+infoPtr->rcChannel.top)/2-(rcBuddy.bottom-rcBuddy.top)/2+rcSelf.top;
    10121013      }
    10131014
     
    12271228}
    12281229
    1229 
    1230 static
    1231 TRACKBAR_GetUnicodeFormat(HWND hwnd,WPARAM wParam,LPARAM lParam)
    1232 {
    1233   return FALSE; //Unicode not used
    1234 }
    12351230
    12361231static LRESULT
     
    16751670    DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    16761671
    1677     infoPtr = (TRACKBAR_INFO *)COMCTL32_Alloc(sizeof(TRACKBAR_INFO));
    1678     SetWindowLongA(hwnd,0,(DWORD)infoPtr);
     1672    infoPtr = (TRACKBAR_INFO*)initControl(hwnd,sizeof(TRACKBAR_INFO));
    16791673
    16801674    /* set default values */
     
    16911685    infoPtr->tics       = NULL;
    16921686    infoPtr->clrBk      = GetSysColor(COLOR_3DFACE);
    1693     infoPtr->hwndNotify = GetParent(hwnd);
    16941687
    16951688    infoPtr->hwndBuddyLA = 0;
     
    17111704    if (dwStyle & TBS_TOOLTIPS)
    17121705    {
    1713       TTTOOLINFOA ti;
    1714 
    1715       infoPtr->hwndToolTip =
    1716           CreateWindowExA (WS_EX_TOOLWINDOW,TOOLTIPS_CLASSA,NULL,WS_POPUP,
    1717                            CW_USEDEFAULT,CW_USEDEFAULT,
    1718                            CW_USEDEFAULT,CW_USEDEFAULT,
    1719                            hwnd,0,0,0);
    1720 
    1721       /* Send NM_TOOLTIPSCREATED notification */
    1722       if (infoPtr->hwndToolTip)
    1723       {
    1724         NMTOOLTIPSCREATED nmttc;
    1725 
    1726         nmttc.hdr.hwndFrom = hwnd;
    1727         nmttc.hdr.idFrom   = GetWindowLongA(hwnd,GWL_ID);
    1728         nmttc.hdr.code = NM_TOOLTIPSCREATED;
    1729         nmttc.hwndToolTips = infoPtr->hwndToolTip;
    1730 
    1731         SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmttc.hdr.idFrom,(LPARAM)&nmttc);
    1732       }
    1733 
    1734       ZeroMemory(&ti,sizeof(TTTOOLINFOA));
    1735       ti.cbSize   = sizeof(TTTOOLINFOA);
    1736       ti.uFlags   = TTF_TRACK | TTF_CENTERTIP | TTF_ABSOLUTE;
    1737       ti.hwnd     = hwnd;
    1738       ti.uId      = 0;
    1739       ti.lpszText = "";
    1740       SetRectEmpty(&ti.rect);
    1741 
    1742       SendMessageA(infoPtr->hwndToolTip,TTM_ADDTOOLA,0,(LPARAM)&ti);
    1743     } else infoPtr->hwndToolTip = 0;
     1706      UINT uFlags = TTF_TRACK | TTF_ABSOLUTE;
     1707
     1708      if (dwStyle & TBS_VERT)
     1709        if (infoPtr->fLocation == TBTS_RIGHT)
     1710          uFlags |= TTF_ALIGNRIGHT | TTF_VCENTER;
     1711        else
     1712          uFlags |= TTF_ALIGNLEFT | TTF_VCENTER;
     1713      else
     1714        if (infoPtr->fLocation == TBTS_TOP)
     1715          uFlags |= TTF_ALIGNTOP | TTF_HCENTER;
     1716        else
     1717          uFlags |= TTF_ALIGNBOTTOM | TTF_HCENTER;
     1718
     1719      infoPtr->hwndToolTip = createToolTip(hwnd,uFlags);
     1720    }
    17441721
    17451722    return 0;
     
    17531730
    17541731    /* delete tooltip control */
    1755     if (infoPtr->hwndToolTip) DestroyWindow(infoPtr->hwndToolTip);
     1732    destroyToolTip(infoPtr->hwndToolTip);
    17561733
    17571734    COMCTL32_Free(infoPtr->tics);
    1758     COMCTL32_Free(infoPtr);
     1735    doneControl(hwnd);
    17591736
    17601737    return 0;
     
    17671744    if (infoPtr->fLocation == TBTS_RIGHT)
    17681745    {
    1769       pt->x = infoPtr->rcFullThumb.right;
     1746      pt->x = infoPtr->rcFullThumb.right+TOOLTIP_SPACE;
    17701747      pt->y = infoPtr->rcFullThumb.top+(infoPtr->rcFullThumb.bottom-infoPtr->rcFullThumb.top)/2;
    17711748    } else
    17721749    {
    1773       pt->x = infoPtr->rcFullThumb.left-15; //CB: optimize!
     1750      pt->x = infoPtr->rcFullThumb.left-TOOLTIP_SPACE;
    17741751      pt->y = infoPtr->rcFullThumb.top+(infoPtr->rcFullThumb.bottom-infoPtr->rcFullThumb.top)/2;
    17751752    }
     
    17801757    {
    17811758      pt->x = infoPtr->rcFullThumb.left+(infoPtr->rcFullThumb.right-infoPtr->rcFullThumb.left)/2;
    1782       pt->y = infoPtr->rcFullThumb.top-15; //CB: optimize!
     1759      pt->y = infoPtr->rcFullThumb.top-TOOLTIP_SPACE;
    17831760    } else
    17841761    {
    17851762      pt->x = infoPtr->rcFullThumb.left+(infoPtr->rcFullThumb.right-infoPtr->rcFullThumb.left)/2;
    1786       pt->y = infoPtr->rcFullThumb.bottom;
     1763      pt->y = infoPtr->rcFullThumb.bottom+TOOLTIP_SPACE;
    17871764    }
    17881765  }
     
    18771854           char buf[80];
    18781855
    1879            TRACKBAR_CalcToolTipPos(hwnd,dwStyle,infoPtr,&pt);
    1880            SendMessageA(infoPtr->hwndToolTip,TTM_TRACKPOSITION,0,(LPARAM)MAKELPARAM(pt.x,pt.y));
    1881 
    18821856           ti.cbSize   = sizeof(TTTOOLINFOA);
    18831857           ti.uId      = 0;
     
    18911865
    18921866           SendMessageA(infoPtr->hwndToolTip,TTM_UPDATETIPTEXTA,0,(LPARAM)&ti);
     1867           TRACKBAR_CalcToolTipPos(hwnd,dwStyle,infoPtr,&pt);
     1868           SendMessageA(infoPtr->hwndToolTip,TTM_TRACKPOSITION,0,(LPARAM)MAKELPARAM(pt.x,pt.y));
     1869
    18931870           SendMessageA(infoPtr->hwndToolTip,TTM_TRACKACTIVATE,(WPARAM)TRUE,(LPARAM)&ti);
    18941871         }
     
    19551932      if (GetCapture() == hwnd)
    19561933      {
    1957         NMHDR nmhdr;
    1958 
    1959         nmhdr.hwndFrom = hwnd;
    1960         nmhdr.idFrom   = GetWindowLongA(hwnd,GWL_ID);
    1961         nmhdr.code     = NM_RELEASEDCAPTURE;
    1962 
    1963         SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmhdr.idFrom,(LPARAM)&nmhdr);
     1934        sendNotify(hwnd,NM_RELEASEDCAPTURE);
    19641935
    19651936        ReleaseCapture();
     
    19751946      if (GetCapture() == hwnd)
    19761947      {
    1977         NMHDR nmhdr;
    1978 
    1979         nmhdr.hwndFrom = hwnd;
    1980         nmhdr.idFrom   = GetWindowLongA(hwnd,GWL_ID);
    1981         nmhdr.code     = NM_RELEASEDCAPTURE;
    1982 
    1983         SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmhdr.idFrom,(LPARAM)&nmhdr);
     1948        sendNotify(hwnd,NM_RELEASEDCAPTURE);
    19841949
    19851950        ReleaseCapture();
     
    21502115
    21512116
    2152 static BOOL
    2153 TRACKBAR_SendNotify (HWND hwnd, UINT code)
    2154 {
    2155 //    TRACE (trackbar, "%x\n",code);
    2156 
    2157     if (GetWindowLongA(hwnd, GWL_STYLE) & TBS_VERT)
    2158     {
    2159       return (BOOL)SendMessageA(GetParent(hwnd),WM_VSCROLL,(WPARAM)code,(LPARAM)hwnd);
    2160     } else
    2161     {
    2162       return (BOOL)SendMessageA(GetParent(hwnd),WM_HSCROLL,(WPARAM)code,(LPARAM)hwnd);
    2163     }
     2117static BOOL TRACKBAR_SendNotify (HWND hwnd, UINT code)
     2118{
     2119  if (GetWindowLongA(hwnd, GWL_STYLE) & TBS_VERT)
     2120    return sendVScroll(hwnd,code);
     2121  else
     2122    return sendHScroll(hwnd,code);
    21642123}
    21652124
     
    21722131    SHORT clickPlace;
    21732132    DOUBLE dragPos;
    2174 
    2175 //    TRACE (trackbar, "%x\n",wParam);
    21762133
    21772134    if (!(infoPtr->flags & TB_DRAG_MODE)) return TRUE;
     
    22022159      ti.uId = 0;
    22032160      ti.hinst = 0;
    2204       sprintf (buf,"%d",infoPtr->nPos);
     2161      sprintf(buf,"%d",infoPtr->nPos);
    22052162      ti.lpszText = (LPSTR)buf;
    22062163
     
    23732330        return TRACKBAR_GetToolTips (hwnd, wParam, lParam);
    23742331
    2375     case TBM_GETUNICODEFORMAT:
    2376         return TRACKBAR_GetUnicodeFormat(hwnd,wParam,lParam);
    2377 
    23782332    case TBM_SETBUDDY:
    23792333        return TRACKBAR_SetBuddy (hwnd, wParam, lParam);
     
    24792433//            ERR (trackbar, "unknown msg %04x wp=%08x lp=%08lx\n",
    24802434//                 uMsg, wParam, lParam);
    2481         return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     2435        return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
    24822436    }
    24832437    return 0;
     
    24892443{
    24902444    WNDCLASSA wndClass;
    2491 
    2492 //SvL: Don't check this now
    2493 //    if (GlobalFindAtomA (TRACKBAR_CLASSA)) return;
    24942445
    24952446    ZeroMemory (&wndClass, sizeof(WNDCLASSA));
     
    25092460TRACKBAR_Unregister (VOID)
    25102461{
    2511     if (GlobalFindAtomA (TRACKBAR_CLASSA))
    2512         UnregisterClassA (TRACKBAR_CLASSA, (HINSTANCE)NULL);
    2513 }
    2514 
     2462    UnregisterClassA (TRACKBAR_CLASSA, (HINSTANCE)NULL);
     2463}
     2464
Note: See TracChangeset for help on using the changeset viewer.