Changeset 10098 for trunk/src


Ignore:
Timestamp:
May 15, 2003, 4:26:27 PM (22 years ago)
Author:
sandervl
Message:

Wine resync

Location:
trunk/src/comctl32
Files:
2 added
4 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/comctl32.def

    r9998 r10098  
    1 ; $Id: comctl32.def,v 1.28 2003-04-09 11:58:39 sandervl Exp $
     1; $Id: comctl32.def,v 1.29 2003-05-15 14:26:27 sandervl Exp $
    22LIBRARY COMCTL32 INITINSTANCE
    33DESCRIPTION 'Odin32 System DLL - ComCtl32 - Common Controls Library'
     
    103103
    104104  CreateMRUListA      = _CreateMRUListA@4          @151
    105 ; ordinals????
    106105  FreeMRUList         = _FreeMRUList@4             @152
    107106  AddMRUStringA       = _AddMRUStringA@8           @153
     
    160159  StrCmpNIW           = _COMCTL32_StrCmpNIW@12     @361
    161160  StrStrW             = _COMCTL32_StrStrW@8        @362
    162 ;StrStrIW @363
     161  StrStrIW            = _COMCTL32_StrStrIW@8      @363
    163162  StrSpnW             = _COMCTL32_StrSpnW@8        @364
    164163  StrToIntW           = _COMCTL32_StrToIntW@4      @365
     
    191190  CreateMRUListLazyW  = _CreateMRUListLazyW@16     @404
    192191
    193                         _COMCTL32_410@16           @410 NONAME
    194                         _COMCTL32_411@12           @411 NONAME
    195                         _COMCTL32_412@12           @412 NONAME
    196                         _COMCTL32_413@16           @413 NONAME
     192; These are only available in comctrl 6
     193  DefSubclassProc      = _DefSubclassProc@16       @410
     194  GetWindowSubclass    = _GetWindowSubclass@16     @411
     195  RemoveWindowSubclass = _RemoveWindowSubclass@12  @412
     196  SetWindowSubclass    = _SetWindowSubclass@16     @413
    197197                        _COMCTL32_415@20           @415 NONAME
    198198
     
    201201
    202202
    203 ; These are only available in comctrl 6
    204   DefSubclassProc      = _DefSubclassProc@16        @500
    205   GetWindowSubclass    = _GetWindowSubclass@16      @501
    206   RemoveWindowSubclass = _RemoveWindowSubclass@12   @502
    207   SetWindowSubclass    = _SetWindowSubclass@16      @503
    208 
  • trunk/src/comctl32/comctl32dbg.def

    r9998 r10098  
    1 ; $Id: comctl32dbg.def,v 1.4 2003-04-09 11:58:40 sandervl Exp $
     1; $Id: comctl32dbg.def,v 1.5 2003-05-15 14:26:27 sandervl Exp $
    22LIBRARY COMCTL32 INITINSTANCE
    33DESCRIPTION 'Odin32 System DLL - ComCtl32 - Common Controls Library'
     
    103103
    104104  CreateMRUListA      = _DbgCreateMRUListA@4          @151
    105 ; ordinals????
    106105  FreeMRUList         = _DbgFreeMRUList@4             @152
    107106  AddMRUStringA       = _DbgAddMRUStringA@8           @153
     
    157156  StrCmpNIW           = _DbgCOMCTL32_StrCmpNIW@12     @361
    158157  StrStrW             = _DbgCOMCTL32_StrStrW@8        @362
    159 ;StrStrIW @363
     158  StrStrIW            = _DbgCOMCTL32_StrStrIW@8      @363
    160159  StrSpnW             = _DbgCOMCTL32_StrSpnW@8        @364
    161160  StrToIntW           = _DbgCOMCTL32_StrToIntW@4      @365
     
    188187  CreateMRUListLazyW  = _DbgCreateMRUListLazyW@16     @404
    189188
    190                         _COMCTL32_410@16           @410 NONAME
    191                         _COMCTL32_411@12           @411 NONAME
    192                         _COMCTL32_412@12           @412 NONAME
    193                         _COMCTL32_413@16           @413 NONAME
     189; These are only available in comctrl 6
     190  DefSubclassProc      = _DefSubclassProc@16       @410
     191  GetWindowSubclass    = _GetWindowSubclass@16     @411
     192  RemoveWindowSubclass = _RemoveWindowSubclass@12  @412
     193  SetWindowSubclass    = _SetWindowSubclass@16     @413
    194194                        _COMCTL32_415@20           @415 NONAME
    195195
     
    197197                        _COMCTL32_419@16           @419 NONAME
    198198
    199 ; These are only available in comctrl 6
    200   DefSubclassProc      = _DefSubclassProc@16        @500
    201   GetWindowSubclass    = _GetWindowSubclass@16      @501
    202   RemoveWindowSubclass = _RemoveWindowSubclass@12   @502
    203   SetWindowSubclass    = _SetWindowSubclass@16      @503
  • trunk/src/comctl32/initcomctl32.cpp

    r10097 r10098  
    1 /* $Id: initcomctl32.cpp,v 1.5 2003-05-15 14:25:13 sandervl Exp $ */
     1/* $Id: initcomctl32.cpp,v 1.6 2003-05-15 14:26:27 sandervl Exp $ */
    22/*
    33 * COMCTL32 DLL entry point
  • trunk/src/comctl32/makefile

    r10097 r10098  
    1 # $Id: makefile,v 1.39 2003-05-15 14:25:14 sandervl Exp $
     1# $Id: makefile,v 1.40 2003-05-15 14:26:27 sandervl Exp $
    22
    33#
  • trunk/src/comctl32/monthcal.c

    r6709 r10098  
    88 * Copyright 2000 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
    99 *
     10 * This library is free software; you can redistribute it and/or
     11 * modify it under the terms of the GNU Lesser General Public
     12 * License as published by the Free Software Foundation; either
     13 * version 2.1 of the License, or (at your option) any later version.
     14 *
     15 * This library is distributed in the hope that it will be useful,
     16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     18 * Lesser General Public License for more details.
     19 *
     20 * You should have received a copy of the GNU Lesser General Public
     21 * License along with this library; if not, write to the Free Software
     22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     23 *
    1024 * TODO:
    1125 *   - Notifications.
     
    1327 *
    1428 *  FIXME: handle resources better (doesn't work now); also take care
    15            of internationalization. 
     29           of internationalization.
    1630 *  FIXME: keyboard handling.
    1731 */
    18 
    19 #ifdef __WIN32OS2__
    20 #include <odin.h>
    21 #include <string.h>
    22 #define inline
    23 #endif
    2432
    2533#include <math.h>
     
    3543#include "commctrl.h"
    3644#include "comctl32.h"
    37 #include "debugtools.h"
    38 
    39 #ifdef __WIN32OS2__
    40 #include "ccbase.h"
    41 #endif
    42 
    43 DEFAULT_DEBUG_CHANNEL(monthcal);
     45#include "wine/debug.h"
     46
     47WINE_DEFAULT_DEBUG_CHANNEL(monthcal);
    4448
    4549#define MC_SEL_LBUTUP       1   /* Left button released */
     
    5155                                                                                /* to the next month */
    5256#define MC_NEXTMONTHTIMER   1                   /* Timer ID's */
    53 #define MC_PREVMONTHTIMER   2                   
     57#define MC_PREVMONTHTIMER   2
    5458
    5559typedef struct
    5660{
    57 #ifdef __WIN32OS2__
    58     COMCTL32_HEADER header;
    59 #endif
    6061    COLORREF    bk;
    6162    COLORREF    txt;
     
    9192    SYSTEMTIME  minDate;
    9293    SYSTEMTIME  maxDate;
    93                
     94
    9495    RECT rcClient;      /* rect for whole client area */
    9596    RECT rcDraw;        /* rect for drawable portion of client area */
    9697    RECT title;         /* rect for the header above the calendar */
    9798    RECT titlebtnnext;  /* the `next month' button in the header */
    98     RECT titlebtnprev;  /* the `prev month' button in the header */     
     99    RECT titlebtnprev;  /* the `prev month' button in the header */
    99100    RECT titlemonth;    /* the `month name' txt in the header */
    100101    RECT titleyear;     /* the `year number' txt in the header */
     
    121122{
    122123const int mdays[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0};
    123   /*Wrap around, this eases handleing*/
     124  /*Wrap around, this eases handling*/
    124125  if(month == 0)
    125126    month = 12;
     
    141142
    142143/* make sure that time is valid */
    143 static int MONTHCAL_ValidateTime(SYSTEMTIME time) 
     144static int MONTHCAL_ValidateTime(SYSTEMTIME time)
    144145{
    145146  if(time.wMonth > 12) return FALSE;
     
    156157
    157158
    158 void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) 
     159void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to)
    159160{
    160161  to->wYear = from->wYear;
     
    169170
    170171
    171 /* Note:Depending on DST, this may be offset by a day. 
     172/* Note:Depending on DST, this may be offset by a day.
    172173   Need to find out if we're on a DST place & adjust the clock accordingly.
    173174   Above function assumes we have a valid data.
     
    182183  year-=(month < 3);
    183184
    184   return((year + year/4 - year/100 + year/400 + 
     185  return((year + year/4 - year/100 + year/400 +
    185186         DayOfWeekTable[month-1] + day - 1 ) % 7);
    186187}
     
    189190   and day in the calendar. day== 0 mean the last day of tha last month
    190191*/
    191 static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y, 
    192                                    int *daypos,int *weekpos) 
     192static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y,
     193                                   int *daypos,int *weekpos)
    193194{
    194195  int retval, firstDay;
     
    202203  *daypos = (x - infoPtr->days.left ) / infoPtr->width_increment;
    203204  *weekpos = (y - infoPtr->days.top ) / infoPtr->height_increment;
    204    
     205
    205206  firstDay = (MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear)+6 - infoPtr->firstDay)%7;
    206207  retval = *daypos + (7 * *weekpos) - firstDay;
     
    211212/* sets x and y to be the position of the day */
    212213/* x == day, y == week where(0,0) == firstDay, 1st week */
    213 static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month, 
     214static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month,
    214215                                 int *x, int *y)
    215216{
     
    227228    if(prevMonth==0)
    228229       prevMonth = 12;
    229    
     230
    230231    *x = (MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) - firstDay) % 7;
    231232    *y = 0;
     
    240241
    241242/* x: column(day), y: row(week) */
    242 static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y) 
     243static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y)
    243244{
    244245  r->left = infoPtr->days.left + x * infoPtr->width_increment;
     
    252253/* day is the day value of the month(1 == 1st), month is the month */
    253254/* value(january == 1, december == 12) */
    254 static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr, 
     255static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr,
    255256                                            int day, int month, RECT *r)
    256257{
     
    278279  x = day_rect.left;
    279280  y = day_rect.top;
    280        
     281
    281282  points[0].x = x;
    282283  points[0].y = y - 1;
     
    287288  points[3].x = x + infoPtr->width_increment;
    288289  points[3].y = y + 0.5 * infoPtr->height_increment;
    289        
     290
    290291  points[4].x = x + infoPtr->width_increment;
    291292  points[4].y = y + 0.9 * infoPtr->height_increment;
     
    295296  points[6].y = y + 0.9 * infoPtr->height_increment; /* bring the bottom up just
    296297                                a hair to fit inside the day rectangle */
    297        
     298
    298299  points[7].x = x + 0.2 * infoPtr->width_increment;
    299300  points[7].y = y + 0.8 * infoPtr->height_increment;
     
    309310  points[12].x = x + 0.4 * infoPtr->width_increment;
    310311  points[12].y = y + 0.2 * infoPtr->height_increment;
    311  
     312
    312313  PolyBezier(hdc, points, 13);
    313314  DeleteObject(hRedPen);
     
    329330  sprintf(buf, "%d", day);
    330331
    331 /* No need to check styles: when selection is not valid, it is set to zero. 
     332/* No need to check styles: when selection is not valid, it is set to zero.
    332333 * 1<day<31, so evertyhing's OK.
    333334 */
     
    341342
    342343    TRACE("%d %d %d\n",day, infoPtr->minSel.wDay, infoPtr->maxSel.wDay);
    343     TRACE("%d %d %d %d\n", r.left, r.top, r.right, r.bottom);
     344    TRACE("%ld %ld %ld %ld\n", r.left, r.top, r.right, r.bottom);
    344345    oldCol = SetTextColor(hdc, infoPtr->monthbk);
    345346    oldBk = SetBkColor(hdc, infoPtr->trailingtxt);
     
    390391
    391392/* CHECKME: For `todays date', do we need to check the locale?*/
    392 static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps) 
     393static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
    393394{
    394395  MONTHCAL_INFO *infoPtr=MONTHCAL_GetInfoPtr(hwnd);
     
    425426  hbr = CreateSolidBrush (infoPtr->bk);
    426427  FillRect(hdc, rcClient, hbr);
    427   DeleteObject(hbr);       
     428  DeleteObject(hbr);
    428429
    429430  /* draw header */
     
    434435    DeleteObject(hbr);
    435436  }
    436        
     437
    437438  /* if the previous button is pressed draw it depressed */
    438439  if(IntersectRect(&rcTemp, &(ps->rcPaint), prev))
    439   { 
     440  {
    440441    if((infoPtr->status & MC_PREVPRESSED))
    441442        DrawFrameControl(hdc, prev, DFC_SCROLL,
     
    447448  }
    448449
    449   /* if next button is depressed draw it depressed */   
     450  /* if next button is depressed draw it depressed */
    450451  if(IntersectRect(&rcTemp, &(ps->rcPaint), next))
    451452  {
     
    466467  titlemonth->left   = title->left;
    467468  titlemonth->right  = title->right;
    468  
     469
    469470  GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1,
    470471                  buf1,sizeof(buf1));
    471472  sprintf(buf, "%s %ld", buf1, infoPtr->currentYear);
    472  
     473
    473474  if(IntersectRect(&rcTemp, &(ps->rcPaint), titlemonth))
    474475  {
    475     DrawTextA(hdc, buf, strlen(buf), titlemonth, 
     476    DrawTextA(hdc, buf, strlen(buf), titlemonth,
    476477                        DT_CENTER | DT_VCENTER | DT_SINGLELINE);
    477478  }
     
    481482/* titlemonth left/right contained rect for whole titletxt('June  1999')
    482483  * MCM_HitTestInfo wants month & year rects, so prepare these now.
    483   *(no, we can't draw them separately; the whole text is centered) 
     484  *(no, we can't draw them separately; the whole text is centered)
    484485  */
    485486  GetTextExtentPoint32A(hdc, buf, strlen(buf), &size);
     
    489490  titlemonth->right = titlemonth->left + size.cx;
    490491  titleyear->left = titlemonth->right;
    491  
     492
    492493  /* draw month area */
    493494  rcTemp.top=infoPtr->wdays.top;
     
    501502    DeleteObject(hbr);
    502503  }
    503        
     504
    504505/* draw line under day abbreviatons */
    505506
    506507  MoveToEx(hdc, infoPtr->days.left + 3, title->bottom + textHeight + 1, NULL);
    507      
     508
    508509  LineTo(hdc, rcDraw->right - 3, title->bottom + textHeight + 1);
    509  
     510
    510511  prevMonth = infoPtr->currentMonth - 1;
    511512  if(prevMonth == 0) /* if currentMonth is january(1) prevMonth is */
     
    537538
    538539/* draw day numbers; first, the previous month */
    539  
     540
    540541  firstDay = MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear);
    541  
    542   day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear)  + 
     542
     543  day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear)  +
    543544    (infoPtr->firstDay + 7  - firstDay)%7 + 1;
    544545  if (day > MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear))
     
    553554    if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay))
    554555    {
    555       MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0, 
     556      MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0,
    556557          infoPtr->monthdayState[m] & mask);
    557558    }
     
    577578    {
    578579
    579       MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0, 
     580      MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0,
    580581        infoPtr->monthdayState[m] & mask);
    581582
     
    595596  j = 1; /* move to the 2nd week of the current month */
    596597  i = 0; /* move back to sunday */
    597   while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) {     
     598  while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) {
    598599    MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j);
    599600    if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay))
     
    604605      if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) &&
    605606          (day==infoPtr->todaysDate.wDay) &&
    606           (infoPtr->currentYear == infoPtr->todaysDate.wYear)) 
    607         if(!(dwStyle & MCS_NOTODAYCIRCLE)) 
     607          (infoPtr->currentYear == infoPtr->todaysDate.wYear))
     608        if(!(dwStyle & MCS_NOTODAYCIRCLE))
    608609          MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth);
    609610    }
     
    627628    MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j);
    628629    if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay))
    629     {   
     630    {
    630631      MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth + 1, i, j,
    631632                infoPtr->monthdayState[m] & mask);
     
    634635    mask<<=1;
    635636    day++;
    636     i++;       
     637    i++;
    637638    if(i==7) { /* past saturday, go to next week's sunday */
    638639      i = 0;
     
    650651    if(!(dwStyle & MCS_NOTODAYCIRCLE))  {
    651652      /*day is the number of days from nextmonth we put on the calendar */
    652       MONTHCAL_CircleDay(hdc, infoPtr, 
    653                          day+MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear), 
     653      MONTHCAL_CircleDay(hdc, infoPtr,
     654                         day+MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear),
    654655                         infoPtr->currentMonth);
    655656      offset+=textWidth;
     
    674675  }
    675676
    676 /*eventually draw week numbers*/   
     677/*eventually draw week numbers*/
    677678  if(dwStyle & MCS_WEEKNUMBERS)  {
    678679    /* display weeknumbers*/
     
    682683       LOCALE_IFIRSTWEEKOFYEAR == 0 (e.g US?):
    683684       The week containing Jan 1 is the first week of year
    684        LOCALE_IFIRSTWEEKOFYEAR == 2 (e.g. Germany): 
     685       LOCALE_IFIRSTWEEKOFYEAR == 2 (e.g. Germany):
    685686       First week of year must contain 4 days of the new year
    686687       LOCALE_IFIRSTWEEKOFYEAR == 1  (what contries?)
     
    704705        /* calculate all those exceptions for january */
    705706        weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear);
    706         if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays) 
     707        if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays)
    707708            weeknum =1;
    708709        else
    709710          {
    710711            weeknum = 0;
    711             for(i=0; i<11; i++) 
     712            for(i=0; i<11; i++)
    712713              weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear-1);
    713714            weeknum +=startofprescal+ 7;
     
    721722      {
    722723        weeknum = 0;
    723         for(i=0; i<prevMonth-1; i++) 
     724        for(i=0; i<prevMonth-1; i++)
    724725          weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear);
    725726        weeknum +=startofprescal+ 7;
     
    749750      days->bottom+=infoPtr->height_increment;
    750751    }
    751                        
     752
    752753    MoveToEx(hdc, infoPtr->weeknums.right, infoPtr->weeknums.top + 3 , NULL);
    753754    LineTo(hdc,   infoPtr->weeknums.right, infoPtr->weeknums.bottom );
    754                
     755
    755756  }
    756757  /* currentFont was font at entering Refresh */
    757758
    758759  SetBkColor(hdc, oldBkColor);
    759   SelectObject(hdc, currentFont);     
     760  SelectObject(hdc, currentFont);
    760761  SetTextColor(hdc, oldTextColor);
    761762}
    762763
    763764
    764 static LRESULT 
     765static LRESULT
    765766MONTHCAL_GetMinReqRect(HWND hwnd, WPARAM wParam, LPARAM lParam)
    766767{
     
    768769  LPRECT lpRect = (LPRECT) lParam;
    769770  TRACE("%x %lx\n", wParam, lParam);
    770        
     771
    771772  /* validate parameters */
    772773
     
    781782
    782783
    783 static LRESULT 
     784static LRESULT
    784785MONTHCAL_GetColor(HWND hwnd, WPARAM wParam, LPARAM lParam)
    785786{
     
    807808
    808809
    809 static LRESULT 
     810static LRESULT
    810811MONTHCAL_SetColor(HWND hwnd, WPARAM wParam, LPARAM lParam)
    811812{
     
    847848
    848849
    849 static LRESULT 
     850static LRESULT
    850851MONTHCAL_GetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam)
    851852{
     
    853854
    854855  TRACE("%x %lx\n", wParam, lParam);
    855  
     856
    856857  if(infoPtr->delta)
    857858    return infoPtr->delta;
     
    861862
    862863
    863 static LRESULT 
     864static LRESULT
    864865MONTHCAL_SetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam)
    865866{
     
    868869
    869870  TRACE("%x %lx\n", wParam, lParam);
    870        
     871
    871872  infoPtr->delta = (int)wParam;
    872873  return prev;
     
    874875
    875876
    876 static LRESULT 
     877static LRESULT
    877878MONTHCAL_GetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam)
    878879{
    879880  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
    880        
     881
    881882  return infoPtr->firstDay;
    882883}
     
    887888/* FIXME: this needs to be implemented properly in MONTHCAL_Refresh() */
    888889/* FIXME: we need more error checking here */
    889 static LRESULT 
     890static LRESULT
    890891MONTHCAL_SetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam)
    891892{
     
    916917/* FIXME: fill this in */
    917918static LRESULT
    918 MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 
     919MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
    919920{
    920921  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
     
    937938
    938939/* FIXME: are validated times taken from current date/time or simply
    939  * copied? 
     940 * copied?
    940941 * FIXME:    check whether MCM_GETMONTHRANGE shows correct result after
    941942 *            adjusting range with MCM_SETRANGE
     
    950951
    951952  TRACE("%x %lx\n", wParam, lParam);
    952  
     953
    953954  if(wParam & GDTR_MAX) {
    954955    if(MONTHCAL_ValidateTime(lprgSysTimeArray[1])){
     
    973974  infoPtr->monthRange = infoPtr->maxDate.wMonth - infoPtr->minDate.wMonth;
    974975
    975   if(infoPtr->monthRange!=prev) { 
    976         COMCTL32_ReAlloc(infoPtr->monthdayState,
    977                 infoPtr->monthRange * sizeof(MONTHDAYSTATE));
     976  if(infoPtr->monthRange!=prev) {
     977        infoPtr->monthdayState = COMCTL32_ReAlloc(infoPtr->monthdayState,
     978                                                  infoPtr->monthRange * sizeof(MONTHDAYSTATE));
    978979  }
    979980
     
    983984
    984985/* CHECKME: At the moment, we copy ranges anyway,regardless of
    985  * infoPtr->rangeValid; a invalid range is simply filled with zeros in 
     986 * infoPtr->rangeValid; a invalid range is simply filled with zeros in
    986987 * SetRange.  Is this the right behavior?
    987988*/
     
    10151016  if(iMonths!=infoPtr->monthRange) return 0;
    10161017
    1017   for(i=0; i<iMonths; i++) 
     1018  for(i=0; i<iMonths; i++)
    10181019    infoPtr->monthdayState[i] = dayStates[i];
    10191020  return 1;
    10201021}
    10211022
    1022 static LRESULT 
     1023static LRESULT
    10231024MONTHCAL_GetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
    10241025{
     
    10361037/* FIXME: if the specified date is not visible, make it visible */
    10371038/* FIXME: redraw? */
    1038 static LRESULT 
     1039static LRESULT
    10391040MONTHCAL_SetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
    10401041{
     
    10571058
    10581059
    1059 static LRESULT 
     1060static LRESULT
    10601061MONTHCAL_GetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam)
    10611062{
     
    10671068
    10681069
    1069 static LRESULT 
     1070static LRESULT
    10701071MONTHCAL_SetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam)
    10711072{
     
    10811082
    10821083
    1083 static LRESULT 
     1084static LRESULT
    10841085MONTHCAL_GetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
    10851086{
     
    11001101    return TRUE;
    11011102  }
    1102  
     1103
    11031104  return FALSE;
    11041105}
    11051106
    11061107
    1107 static LRESULT 
     1108static LRESULT
    11081109MONTHCAL_SetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
    11091110{
     
    11241125    return TRUE;
    11251126  }
    1126  
     1127
    11271128  return FALSE;
    11281129}
    11291130
    11301131
    1131 static LRESULT 
     1132static LRESULT
    11321133MONTHCAL_GetToday(HWND hwnd, WPARAM wParam, LPARAM lParam)
    11331134{
     
    11451146
    11461147
    1147 static LRESULT 
     1148static LRESULT
    11481149MONTHCAL_SetToday(HWND hwnd, WPARAM wParam, LPARAM lParam)
    11491150{
     
    11701171  DWORD retval;
    11711172  int day,wday,wnum;
    1172  
    1173  
     1173
     1174
    11741175  x = lpht->pt.x;
    11751176  y = lpht->pt.y;
    11761177  retval = MCHT_NOWHERE;
    1177  
    1178 
    1179   /* Comment in for debugging... 
    1180   TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y, 
     1178
     1179
     1180  /* Comment in for debugging...
     1181  TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y,
    11811182        infoPtr->wdays.left, infoPtr->wdays.right,
    11821183        infoPtr->wdays.top, infoPtr->wdays.bottom,
     
    11901191
    11911192  /* are we in the header? */
    1192  
     1193
    11931194  if(PtInRect(&infoPtr->title, lpht->pt)) {
    11941195    if(PtInRect(&infoPtr->titlebtnprev, lpht->pt)) {
     
    12081209      goto done;
    12091210    }
    1210    
     1211
    12111212    retval = MCHT_TITLE;
    12121213    goto done;
    12131214  }
    1214  
     1215
    12151216  day = MONTHCAL_CalcDayFromPos(infoPtr,x,y,&wday,&wnum);
    12161217  if(PtInRect(&infoPtr->wdays, lpht->pt)) {
     
    12181219    lpht->st.wYear  = infoPtr->currentYear;
    12191220    lpht->st.wMonth = (day < 1)? infoPtr->currentMonth -1 : infoPtr->currentMonth;
    1220     lpht->st.wDay   = (day < 1)? 
     1221    lpht->st.wDay   = (day < 1)?
    12211222      MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : day;
    12221223    goto done;
    12231224  }
    1224   if(PtInRect(&infoPtr->weeknums, lpht->pt)) { 
    1225     retval = MCHT_CALENDARWEEKNUM; 
     1225  if(PtInRect(&infoPtr->weeknums, lpht->pt)) {
     1226    retval = MCHT_CALENDARWEEKNUM;
    12261227    lpht->st.wYear  = infoPtr->currentYear;
    1227     lpht->st.wMonth = (day < 1) ? infoPtr->currentMonth -1 : 
    1228       (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 
     1228    lpht->st.wMonth = (day < 1) ? infoPtr->currentMonth -1 :
     1229      (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ?
    12291230      infoPtr->currentMonth +1 :infoPtr->currentMonth;
    1230     lpht->st.wDay   = (day < 1 ) ? 
    1231       MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : 
    1232       (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 
     1231    lpht->st.wDay   = (day < 1 ) ?
     1232      MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day :
     1233      (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ?
    12331234      day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) : day;
    1234     goto done;                             
    1235   }
    1236   if(PtInRect(&infoPtr->days, lpht->pt)) 
     1235    goto done;
     1236  }
     1237  if(PtInRect(&infoPtr->days, lpht->pt))
    12371238    {
    12381239      lpht->st.wYear  = infoPtr->currentYear;
    1239       if ( day < 1) 
     1240      if ( day < 1)
    12401241        {
    12411242          retval = MCHT_CALENDARDATEPREV;
     
    12671268    }
    12681269  if(PtInRect(&infoPtr->todayrect, lpht->pt)) {
    1269     retval = MCHT_TODAYLINK; 
     1270    retval = MCHT_TODAYLINK;
    12701271    goto done;
    12711272  }
    1272  
    1273  
     1273
     1274
    12741275  /* Hit nothing special? What's left must be background :-) */
    1275  
    1276   retval = MCHT_CALENDARBK;       
    1277  done: 
     1276
     1277  retval = MCHT_CALENDARBK;
     1278 done:
    12781279  lpht->uHit = retval;
    12791280  return retval;
     
    13311332    nmds.nmhdr.code     = MCN_GETDAYSTATE;
    13321333    nmds.cDayState      = infoPtr->monthRange;
    1333     nmds.prgDayState    = COMCTL32_Alloc 
     1334    nmds.prgDayState    = COMCTL32_Alloc
    13341335                        (infoPtr->monthRange * sizeof(MONTHDAYSTATE));
    13351336
     
    13481349  POINT menupoint;
    13491350  char buf[32];
    1350  
     1351
    13511352  hMenu = CreatePopupMenu();
    13521353  if (!LoadStringA(COMCTL32_hModule,IDM_GOTODAY,buf,sizeof(buf)))
     
    13651366      infoPtr->currentYear=infoPtr->todaysDate.wYear;
    13661367      InvalidateRect(hwnd, NULL, FALSE);
    1367     }   
     1368    }
    13681369  return 0;
    13691370}
     
    13811382  POINT menupoint;
    13821383  TRACE("%x %lx\n", wParam, lParam);
    1383        
     1384
    13841385  if (infoPtr->hWndYearUpDown)
    13851386    {
     
    13991400      InvalidateRect(hwnd, NULL, FALSE);
    14001401    }
    1401  
     1402
    14021403  ht.pt.x = (INT)LOWORD(lParam);
    14031404  ht.pt.y = (INT)HIWORD(lParam);
     
    14141415    return TRUE;
    14151416  }
    1416   if(hit == MCHT_TITLEBTNPREV){ 
     1417  if(hit == MCHT_TITLEBTNPREV){
    14171418    MONTHCAL_GoToPrevMonth(hwnd, infoPtr);
    14181419    infoPtr->status = MC_PREVPRESSED;
     
    14241425  if(hit == MCHT_TITLEMONTH) {
    14251426    hMenu = CreatePopupMenu();
    1426    
     1427
    14271428    for (i=0; i<12;i++)
    14281429      {
     
    14511452                         infoPtr->textHeight,
    14521453                         hwnd,
    1453                          (HMENU)NULL,
    1454                          (HINSTANCE)NULL,
     1454                         NULL,
     1455                         NULL,
    14551456                         NULL);
    14561457    infoPtr->hWndYearUpDown=CreateWindowExA(0,
     
    14621463                         infoPtr->textHeight,
    14631464                         hwnd,
    1464                          (HMENU)NULL,
    1465                          (HINSTANCE)NULL,
     1465                         NULL,
     1466                         NULL,
    14661467                         NULL);
    14671468    SendMessageA( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753));
     
    14691470    SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS,   (WPARAM) 0,(LPARAM)infoPtr->currentYear );
    14701471    return TRUE;
    1471          
     1472
    14721473  }
    14731474  if(hit == MCHT_TODAYLINK) {
     
    14871488    MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel);
    14881489    MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel);
    1489        
     1490
    14901491    SendMessageA(GetParent(hwnd), WM_NOTIFY,
    14911492           (WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc);
     
    14931494    MONTHCAL_CopyTime(&ht.st, &selArray[0]);
    14941495    MONTHCAL_CopyTime(&ht.st, &selArray[1]);
    1495     MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray); 
     1496    MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray);
    14961497
    14971498    /* redraw both old and new days if the selected day changed */
     
    15461547    return TRUE;
    15471548  }
    1548   if(hit == MCHT_CALENDARDATEPREV){ 
     1549  if(hit == MCHT_CALENDARDATEPREV){
    15491550    MONTHCAL_GoToPrevMonth(hwnd, infoPtr);
    15501551    InvalidateRect(hwnd, NULL, FALSE);
     
    15541555  nmhdr.idFrom   = GetWindowLongA( hwnd, GWL_ID);
    15551556  nmhdr.code     = NM_RELEASEDCAPTURE;
    1556   TRACE("Sent notification from %x to %x\n", hwnd, GetParent(hwnd));
     1557  TRACE("Sent notification from %p to %p\n", hwnd, GetParent(hwnd));
    15571558
    15581559  SendMessageA(GetParent(hwnd), WM_NOTIFY,
     
    15641565  MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel);
    15651566  MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel);
    1566        
     1567
    15671568  SendMessageA(GetParent(hwnd), WM_NOTIFY,
    15681569           (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
    1569  
     1570
    15701571  /* redraw if necessary */
    15711572  if(redraw)
    15721573    InvalidateRect(hwnd, NULL, FALSE);
    1573        
     1574
    15741575  return 0;
    15751576}
     
    15861587
    15871588  switch(wParam) {
    1588   case MC_NEXTMONTHTIMER: 
     1589  case MC_NEXTMONTHTIMER:
    15891590    redraw = TRUE;
    15901591    MONTHCAL_GoToNextMonth(hwnd, infoPtr);
     
    16181619  ht.pt.x = LOWORD(lParam);
    16191620  ht.pt.y = HIWORD(lParam);
    1620        
     1621
    16211622  hit = MONTHCAL_HitTest(hwnd, (LPARAM)&ht);
    1622  
     1623
    16231624  /* not on the calendar date numbers? bail out */
    16241625  TRACE("hit:%x\n",hit);
     
    16381639    if(infoPtr->firstSelDay==selArray[0].wDay) i=1;
    16391640    TRACE("oldRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i);
    1640     if(infoPtr->firstSelDay==selArray[1].wDay) { 
     1641    if(infoPtr->firstSelDay==selArray[1].wDay) {
    16411642      /* 1st time we get here: selArray[0]=selArray[1])  */
    16421643      /* if we're still at the first selected date, return */
     
    16441645      if(selday<infoPtr->firstSelDay) i = 0;
    16451646    }
    1646                        
     1647
    16471648    if(abs(infoPtr->firstSelDay - selday) >= infoPtr->maxSelCount) {
    16481649      if(selday>infoPtr->firstSelDay)
     
    16511652        selday = infoPtr->firstSelDay - infoPtr->maxSelCount;
    16521653    }
    1653                
     1654
    16541655    if(selArray[i].wDay!=selday) {
    16551656      TRACE("newRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i);
    1656                        
     1657
    16571658      selArray[i].wDay = selday;
    16581659
     
    17121713{
    17131714  TRACE("\n");
    1714  
     1715
    17151716  InvalidateRect(hwnd, NULL, FALSE);
    17161717
     
    17691770
    17701771  /* recalculate the height and width increments and offsets */
    1771   /* FIXME: We use up all available width. This will inhibit having multiple 
    1772      calendars in a row, like win doesn 
     1772  /* FIXME: We use up all available width. This will inhibit having multiple
     1773     calendars in a row, like win doesn
    17731774  */
    17741775  if(dwStyle & MCS_WEEKNUMBERS)
     
    17761777  else
    17771778    xdiv=7.0;
    1778   infoPtr->width_increment = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) / xdiv; 
    1779   infoPtr->height_increment = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) / 10.0; 
     1779  infoPtr->width_increment = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) / xdiv;
     1780  infoPtr->height_increment = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) / 10.0;
    17801781  infoPtr->left_offset = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) - (infoPtr->width_increment * xdiv);
    17811782  infoPtr->top_offset = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) - (infoPtr->height_increment * 10.0);
     
    17901791    rcDraw->bottom = rcDraw->top + 9 * infoPtr->textHeight + 5;
    17911792    }*/
    1792    
     1793
    17931794  /* calculate title area */
    17941795  title->top    = rcClient->top;
     
    18051806  next->right  = title->right - 6;
    18061807  next->left   = next->right - (title->bottom - title->top);
    1807  
     1808
    18081809  /* titlemonth->left and right change based upon the current month */
    18091810  /* and are recalculated in refresh as the current month may change */
     
    18111812  titlemonth->top    = titleyear->top    = title->top    + (infoPtr->height_increment)/2;
    18121813  titlemonth->bottom = titleyear->bottom = title->bottom - (infoPtr->height_increment)/2;
    1813  
     1814
    18141815  /* setup the dimensions of the rectangle we draw the names of the */
    18151816  /* days of the week in */
    18161817  weeknumrect->left =infoPtr->left_offset;
    1817   if(dwStyle & MCS_WEEKNUMBERS) 
     1818  if(dwStyle & MCS_WEEKNUMBERS)
    18181819    weeknumrect->right=prev->right;
    18191820  else
     
    18231824  wdays->top    = title->bottom ;
    18241825  wdays->bottom = wdays->top + infoPtr->height_increment;
    1825  
     1826
    18261827  days->top    = weeknumrect->top = wdays->bottom ;
    18271828  days->bottom = weeknumrect->bottom = days->top     + 6 * infoPtr->height_increment;
    1828  
     1829
    18291830  todayrect->left   = rcClient->left;
    18301831  todayrect->right  = rcClient->right;
     
    18321833  todayrect->bottom = days->bottom + infoPtr->height_increment;
    18331834
    1834   /* uncomment for excessive debugging 
     1835  /* uncomment for excessive debugging
    18351836  TRACE("dx=%d dy=%d rcC[%d %d %d %d] t[%d %d %d %d] wd[%d %d %d %d] w[%d %d %d %d] t[%d %d %d %d]\n",
    18361837        infoPtr->width_increment,infoPtr->height_increment,
     
    18411842        todayrect->left,todayrect->right,todayrect->top,todayrect->bottom);
    18421843  */
    1843  
     1844
    18441845  /* restore the originally selected font */
    1845   SelectObject(hdc, currentFont);     
     1846  SelectObject(hdc, currentFont);
    18461847
    18471848  ReleaseDC(hwnd, hdc);
     
    18501851static LRESULT MONTHCAL_Size(HWND hwnd, int Width, int Height)
    18511852{
    1852   TRACE("(hwnd=%x, width=%d, height=%d)\n", hwnd, Width, Height);
     1853  TRACE("(hwnd=%p, width=%d, height=%d)\n", hwnd, Width, Height);
    18531854
    18541855  MONTHCAL_UpdateSize(hwnd);
     
    18681869
    18691870  /* allocate memory for info structure */
    1870 #ifdef __WIN32OS2__
    1871   infoPtr =(MONTHCAL_INFO*)initControl(hwnd,sizeof(MONTHCAL_INFO));
    1872 #else
    18731871  infoPtr =(MONTHCAL_INFO*)COMCTL32_Alloc(sizeof(MONTHCAL_INFO));
    1874 #endif
    18751872  SetWindowLongA(hwnd, 0, (DWORD)infoPtr);
    18761873
     
    19001897  infoPtr->maxSelCount  = 7;
    19011898  infoPtr->monthRange = 3;
    1902   infoPtr->monthdayState = COMCTL32_Alloc 
     1899  infoPtr->monthdayState = COMCTL32_Alloc
    19031900                         (infoPtr->monthRange * sizeof(MONTHDAYSTATE));
    19041901  infoPtr->titlebk     = GetSysColor(COLOR_ACTIVECAPTION);
     
    19231920
    19241921  /* free month calendar info data */
     1922  if(infoPtr->monthdayState)
     1923      COMCTL32_Free(infoPtr->monthdayState);
    19251924  COMCTL32_Free(infoPtr);
    19261925  SetWindowLongA(hwnd, 0, 0);
     
    19321931MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    19331932{
    1934   TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", hwnd, uMsg, wParam, lParam);
     1933  TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hwnd, uMsg, wParam, lParam);
    19351934  if (!MONTHCAL_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
    19361935    return DefWindowProcA(hwnd, uMsg, wParam, lParam);
     
    20372036
    20382037  default:
    2039     if(uMsg >= WM_USER)
     2038    if ((uMsg >= WM_USER) && (uMsg < WM_APP))
    20402039      ERR( "unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);
    2041 #ifdef __WIN32OS2__
    2042     return defComCtl32ProcA(hwnd, uMsg, wParam, lParam);
    2043 #else
    20442040    return DefWindowProcA(hwnd, uMsg, wParam, lParam);
    2045 #endif
    20462041  }
    20472042  return 0;
     
    20622057  wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    20632058  wndClass.lpszClassName = MONTHCAL_CLASSA;
    2064  
     2059
    20652060  RegisterClassA(&wndClass);
    20662061}
     
    20702065MONTHCAL_Unregister(void)
    20712066{
    2072     UnregisterClassA(MONTHCAL_CLASSA, (HINSTANCE)NULL);
    2073 }
     2067    UnregisterClassA(MONTHCAL_CLASSA, NULL);
     2068}
  • trunk/src/comctl32/nativefont.c

    r8382 r10098  
    124124    wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    125125    wndClass.lpszClassName = WC_NATIVEFONTCTLA;
    126  
     126
    127127    RegisterClassA (&wndClass);
    128128}
     
    132132NATIVEFONT_Unregister (void)
    133133{
    134     UnregisterClassA (WC_NATIVEFONTCTLA, (HINSTANCE)NULL);
     134    UnregisterClassA (WC_NATIVEFONTCTLA, NULL);
    135135}
    136 
  • trunk/src/comctl32/pager.c

    r9370 r10098  
    837837
    838838    /* set default settings */
    839     infoPtr->hwndChild = (HWND)NULL;
     839    infoPtr->hwndChild = NULL;
    840840    infoPtr->bNoResize = dwStyle & CCS_NORESIZE;
    841841    infoPtr->clrBk = GetSysColor(COLOR_BTNFACE);
     
    898898    DefWindowProcA (hwnd, WM_NCCALCSIZE, wParam, lParam);
    899899
    900     TRACE("orig rect=(%d,%d)-(%d,%d)\n",
     900    TRACE("orig rect=(%ld,%ld)-(%ld,%ld)\n",
    901901          lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
    902902
     
    913913        scrollRange = infoPtr->nWidth - (rcmyw.right - rcmyw.left);
    914914
    915         TRACE("nPos=%d, scrollrange=%d, nHeigth=%d, myw=(%d,%d)-(%d,%d), cursor=(%ld,%ld)\n",
     915        TRACE("nPos=%d, scrollrange=%d, nHeigth=%d, myw=(%ld,%ld)-(%ld,%ld), cursor=(%ld,%ld)\n",
    916916              infoPtr->nPos, scrollRange, infoPtr->nHeight,
    917917              rcmyw.left, rcmyw.top,
     
    927927            rbrc = wnrc;
    928928            rbrc.left = rbrc.right - infoPtr->nButtonSize;
    929             TRACE("horz lt rect=(%d,%d)-(%d,%d), rb rect=(%d,%d)-(%d,%d)\n",
     929            TRACE("horz lt rect=(%ld,%ld)-(%ld,%ld), rb rect=(%ld,%ld)-(%ld,%ld)\n",
    930930                  ltrc.left, ltrc.top, ltrc.right, ltrc.bottom,
    931931                  rbrc.left, rbrc.top, rbrc.right, rbrc.bottom);
     
    962962        scrollRange = infoPtr->nHeight - (rcmyw.bottom - rcmyw.top);
    963963
    964         TRACE("nPos=%d, scrollrange=%d, nHeigth=%d, myw=(%d,%d)-(%d,%d), cursor=(%ld,%ld)\n",
     964        TRACE("nPos=%d, scrollrange=%d, nHeigth=%d, myw=(%ld,%ld)-(%ld,%ld), cursor=(%ld,%ld)\n",
    965965              infoPtr->nPos, scrollRange, infoPtr->nHeight,
    966966              rcmyw.left, rcmyw.top,
     
    987987            rbrc = wnrc;
    988988            rbrc.left = rbrc.right - infoPtr->nButtonSize;
    989             TRACE("vert lt rect=(%d,%d)-(%d,%d), rb rect=(%d,%d)-(%d,%d)\n",
     989            TRACE("vert lt rect=(%ld,%ld)-(%ld,%ld), rb rect=(%ld,%ld)-(%ld,%ld)\n",
    990990                  ltrc.left, ltrc.top, ltrc.right, ltrc.bottom,
    991991                  rbrc.left, rbrc.top, rbrc.right, rbrc.bottom);
     
    999999        if (infoPtr->BRbtnState && (lpRect->bottom - infoPtr->nButtonSize > lpRect->top))
    10001000            lpRect->bottom -= infoPtr->nButtonSize;
    1001         /* ???? */
    1002         if ((lpRect->bottom < 0) || (lpRect->bottom > infoPtr->nHeight))
    1003             lpRect->bottom = infoPtr->nHeight;
    1004     }
    1005 
    1006     TRACE("[%p] client rect set to %dx%d at (%d,%d) BtnState[%d,%d]\n",
     1001    }
     1002
     1003    TRACE("[%p] client rect set to %ldx%ld at (%ld,%ld) BtnState[%d,%d]\n",
    10071004          hwnd, lpRect->right-lpRect->left, lpRect->bottom-lpRect->top,
    10081005          lpRect->left, lpRect->top,
     
    12331230        /* If in one of the buttons the capture and draw buttons */
    12341231        if (btnrect) {
    1235             TRACE("[%p] draw btn (%d,%d)-(%d,%d), Capture %s, style %08lx\n",
     1232            TRACE("[%p] draw btn (%ld,%ld)-(%ld,%ld), Capture %s, style %08lx\n",
    12361233                  hwnd, btnrect->left, btnrect->top,
    12371234                  btnrect->right, btnrect->bottom,
     
    16041601PAGER_Unregister (void)
    16051602{
    1606     UnregisterClassA (WC_PAGESCROLLERA, (HINSTANCE)NULL);
    1607 }
     1603    UnregisterClassA (WC_PAGESCROLLERA, NULL);
     1604}
  • trunk/src/comctl32/progress.c

    r9370 r10098  
    258258    infoPtr->MaxVal = high;
    259259    PROGRESS_CoercePos(infoPtr);
     260    InvalidateRect(infoPtr->Self, NULL, TRUE);
    260261    return res;
    261262}
     
    335336    case PBM_SETPOS:
    336337    {
    337         INT oldVal;
     338        UINT oldVal;
    338339        oldVal = infoPtr->CurVal;
    339340        if(oldVal != wParam) {
     
    431432VOID PROGRESS_Unregister (void)
    432433{
    433     UnregisterClassW (PROGRESS_CLASSW, (HINSTANCE)NULL);
    434 }
     434    UnregisterClassW (PROGRESS_CLASSW, NULL);
     435}
  • trunk/src/comctl32/propsheet.c

    r9425 r10098  
    2626#include <string.h>
    2727
     28#define NONAMELESSUNION
     29#define NONAMELESSSTRUCT
    2830#include "winbase.h"
    2931#include "commctrl.h"
     
    3133#include "winnls.h"
    3234#include "comctl32.h"
    33 #include "heap.h"
    3435
    3536#include "wine/debug.h"
     
    113114#define MAX_BUTTONTEXT_LENGTH 64
    114115
    115 #define PSH_WIZARD97_OLD   0x00002000
    116 #define PSH_WIZARD97_NEW   0x01000000
    117116#define INTRNL_ANY_WIZARD (PSH_WIZARD | PSH_WIZARD97_OLD | PSH_WIZARD97_NEW | PSH_WIZARD_LITE)
    118117
     
    120119 * Prototypes
    121120 */
    122 static BOOL PROPSHEET_CreateDialog(PropSheetInfo* psInfo);
     121static int PROPSHEET_CreateDialog(PropSheetInfo* psInfo);
    123122static BOOL PROPSHEET_SizeMismatch(HWND hwndDlg, PropSheetInfo* psInfo);
    124123static BOOL PROPSHEET_AdjustSize(HWND hwndDlg, PropSheetInfo* psInfo);
     
    290289  psInfo->hasHelp = dwFlags & PSH_HASHELP;
    291290  psInfo->hasApply = !(dwFlags & PSH_NOAPPLYNOW);
    292   psInfo->useCallback = dwFlags & PSH_USECALLBACK;
     291  psInfo->useCallback = (dwFlags & PSH_USECALLBACK )&& (lppsh->pfnCallback);
    293292  psInfo->isModeless = dwFlags & PSH_MODELESS;
    294293
     
    341340  psInfo->hasHelp = dwFlags & PSH_HASHELP;
    342341  psInfo->hasApply = !(dwFlags & PSH_NOAPPLYNOW);
    343   psInfo->useCallback = dwFlags & PSH_USECALLBACK;
     342  psInfo->useCallback = (dwFlags & PSH_USECALLBACK) && (lppsh->pfnCallback);
    344343  psInfo->isModeless = dwFlags & PSH_MODELESS;
    345344
     
    554553 * Creates the actual property sheet.
    555554 */
    556 BOOL PROPSHEET_CreateDialog(PropSheetInfo* psInfo)
     555int PROPSHEET_CreateDialog(PropSheetInfo* psInfo)
    557556{
    558557  LRESULT ret;
     
    570569                            MAKEINTRESOURCEW(resID),
    571570                            RT_DIALOGW)))
    572     return FALSE;
     571    return -1;
    573572
    574573  if(!(template = (LPVOID)LoadResource(COMCTL32_hModule, hRes)))
    575     return FALSE;
     574    return -1;
    576575
    577576  /*
     
    583582
    584583  if (!temp)
    585     return FALSE;
     584    return -1;
    586585
    587586  memcpy(temp, template, resSize);
     
    597596                                    (LPARAM)psInfo);
    598597  else
    599       ret = CreateDialogIndirectParamW(psInfo->ppshheader.hInstance,
    600                                        (LPDLGTEMPLATEW) temp,
    601                                        psInfo->ppshheader.hwndParent,
    602                                        PROPSHEET_DialogProc,
    603                                        (LPARAM)psInfo) ? TRUE : FALSE;
     598  {
     599      ret = (int)CreateDialogIndirectParamW(psInfo->ppshheader.hInstance,
     600                                            (LPDLGTEMPLATEW) temp,
     601                                            psInfo->ppshheader.hwndParent,
     602                                            PROPSHEET_DialogProc,
     603                                            (LPARAM)psInfo);
     604      if ( !ret ) ret = -1;
     605  }
    604606
    605607  COMCTL32_Free(temp);
     
    623625   */
    624626  GetClientRect(hwndTabCtrl, &rcOrigTab);
    625   TRACE("orig tab %d %d %d %d\n", rcOrigTab.left, rcOrigTab.top,
     627  TRACE("orig tab %ld %ld %ld %ld\n", rcOrigTab.left, rcOrigTab.top,
    626628        rcOrigTab.right, rcOrigTab.bottom);
    627629
     
    635637
    636638  MapDialogRect(hwndDlg, &rcPage);
    637   TRACE("biggest page %d %d %d %d\n", rcPage.left, rcPage.top,
     639  TRACE("biggest page %ld %ld %ld %ld\n", rcPage.left, rcPage.top,
    638640        rcPage.right, rcPage.bottom);
    639641
     
    677679
    678680  MapDialogRect(hwndDlg, &rcPage);
    679   TRACE("biggest page %d %d %d %d\n", rcPage.left, rcPage.top,
     681  TRACE("biggest page %ld %ld %ld %ld\n", rcPage.left, rcPage.top,
    680682        rcPage.right, rcPage.bottom);
    681683
     
    748750  rc.right -= rc.left;
    749751  rc.bottom -= rc.top;
    750   TRACE("setting tab %08lx, rc (0,0)-(%d,%d)\n",
     752  TRACE("setting tab %08lx, rc (0,0)-(%ld,%ld)\n",
    751753        (DWORD)hwndTabCtrl, rc.right, rc.bottom);
    752754  SetWindowPos(hwndTabCtrl, 0, 0, 0, rc.right, rc.bottom,
     
    755757  GetClientRect(hwndTabCtrl, &rc);
    756758
    757   TRACE("tab client rc %d %d %d %d\n",
     759  TRACE("tab client rc %ld %ld %ld %ld\n",
    758760        rc.left, rc.top, rc.right, rc.bottom);
    759761
     
    764766   * Resize the property sheet.
    765767   */
    766   TRACE("setting dialog %08lx, rc (0,0)-(%d,%d)\n",
     768  TRACE("setting dialog %08lx, rc (0,0)-(%ld,%ld)\n",
    767769        (DWORD)hwndDlg, rc.right, rc.bottom);
    768770  SetWindowPos(hwndDlg, 0, 0, 0, rc.right, rc.bottom,
     
    822824  }
    823825
    824   TRACE("Biggest page %d %d %d %d\n", rc.left, rc.top, rc.right, rc.bottom);
     826  TRACE("Biggest page %ld %ld %ld %ld\n", rc.left, rc.top, rc.right, rc.bottom);
    825827  TRACE("   constants padx=%d, pady=%d, butH=%d, lH=%d\n",
    826828        padding.x, padding.y, buttonHeight, lineHeight);
     
    833835   * Resize the property sheet.
    834836   */
    835   TRACE("setting dialog %08lx, rc (0,0)-(%d,%d)\n",
     837  TRACE("setting dialog %08lx, rc (0,0)-(%ld,%ld)\n",
    836838        (DWORD)hwndDlg, rc.right, rc.bottom);
    837839  SetWindowPos(hwndDlg, 0, 0, 0, rc.right, rc.bottom,
     
    14251427
    14261428      padding = PROPSHEET_GetPaddingInfoWizard(hwndParent, psInfo);
    1427       TRACE("setting page %08lx, rc (%d,%d)-(%d,%d) w=%d, h=%d, padx=%d, pady=%d\n",
     1429      TRACE("setting page %08lx, rc (%ld,%ld)-(%ld,%ld) w=%d, h=%d, padx=%d, pady=%d\n",
    14281430            (DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom,
    14291431            pageWidth, pageHeight, padding.x, padding.y);
     
    14411443      pageWidth = rc.right - rc.left;
    14421444      pageHeight = rc.bottom - rc.top;
    1443       TRACE("setting page %08lx, rc (%d,%d)-(%d,%d) w=%d, h=%d\n",
     1445      TRACE("setting page %08lx, rc (%ld,%ld)-(%ld,%ld) w=%d, h=%d\n",
    14441446            (DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom,
    14451447            pageWidth, pageHeight);
     
    16171619  HWND hwndPage;
    16181620  PSHNOTIFY psn;
    1619   LRESULT msgResult;
    16201621  PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
    16211622                                                    PropSheetInfoStr);
     
    16511652    if (hwndPage)
    16521653    {
    1653        msgResult = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
    1654        if (msgResult == PSNRET_INVALID_NOCHANGEPAGE)
    1655           return FALSE;
     1654       switch (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn))
     1655       {
     1656       case PSNRET_INVALID:
     1657           PROPSHEET_ShowPage(hwndDlg, i, psInfo);
     1658           /* fall through */
     1659       case PSNRET_INVALID_NOCHANGEPAGE:
     1660           return FALSE;
     1661       }
    16561662    }
    16571663  }
     
    23852391  PropSheetInfo* psInfo = (PropSheetInfo*) GlobalAlloc(GPTR,
    23862392                                                       sizeof(PropSheetInfo));
    2387   int i, n;
     2393  UINT i, n;
    23882394  BYTE* pByte;
    23892395
     
    24292435  PropSheetInfo* psInfo = (PropSheetInfo*) GlobalAlloc(GPTR,
    24302436                                                       sizeof(PropSheetInfo));
    2431   int i, n;
     2437  UINT i, n;
    24322438  BYTE* pByte;
    24332439
  • trunk/src/comctl32/rebar.c

    r9370 r10098  
    12281228        infoPtr->hwndSelf, infoPtr->dwStyle,
    12291229        x, y, width, height);
    1230     SetWindowPos (infoPtr->hwndSelf, 0, x, y, width, height,
    1231                     SWP_NOZORDER);
     1230
     1231//testestest
     1232#ifdef __WIN32OS2__
     1233//NOTE: this one is causing problems!!!!
     1234#endif
     1235//    SetWindowPos (infoPtr->hwndSelf, 0, x, y, width, height,
     1236//                  SWP_NOZORDER);
     1237//testestest
    12321238}
    12331239
  • trunk/src/comctl32/smoothscroll.c

    r7815 r10098  
    33 *
    44 * Copyright 2000 Marcus Meissner <marcus@jet.franken.de>
     5 *
     6 * This library is free software; you can redistribute it and/or
     7 * modify it under the terms of the GNU Lesser General Public
     8 * License as published by the Free Software Foundation; either
     9 * version 2.1 of the License, or (at your option) any later version.
     10 *
     11 * This library is distributed in the hope that it will be useful,
     12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14 * Lesser General Public License for more details.
     15 *
     16 * You should have received a copy of the GNU Lesser General Public
     17 * License along with this library; if not, write to the Free Software
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    519 *
    620 * TODO
     
    1226#include "winerror.h"
    1327#include "commctrl.h"
    14 #include "debugtools.h"
     28#include "wine/debug.h"
    1529
    16 DEFAULT_DEBUG_CHANNEL(commctrl);
     30WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
    1731
    1832static DWORD    smoothscroll = 2;
     
    98112   }
    99113
    100    FIXME("(hwnd=%x,flags=%lx,x2=%lx): should smooth scroll here.\n",
     114   FIXME("(hwnd=%p,flags=%lx,x2=%lx): should smooth scroll here.\n",
    101115           smooth->hwnd,flags,smooth->x2
    102116   );
  • trunk/src/comctl32/tab.c

    r9469 r10098  
    5959  INT        tabHeight;       /* height of the tab row */
    6060  INT        tabWidth;        /* width of tabs */
     61  USHORT     uHItemPadding;   /* amount of horizontal padding, in pixels */
     62  USHORT     uVItemPadding;   /* amount of vertical padding, in pixels */
    6163  HFONT      hFont;           /* handle to the current font */
    6264  HCURSOR    hcurArrow;       /* handle to the current cursor */
     
    8183 */
    8284#define SELECTED_TAB_OFFSET     2
    83 #define HORIZONTAL_ITEM_PADDING 6
    84 #define VERTICAL_ITEM_PADDING   3
    8585#define ROUND_CORNER_SIZE       2
    8686#define DISPLAY_AREA_PADDINGX   2
     
    173173              iItem, ti->mask, ti->dwState, debugstr_w(ti->pszText),
    174174              ti->iImage);
    175         TRACE("tab %d, lParam=0x%08lx, rect.left=%d, rect.top(row)=%d\n",
     175        TRACE("tab %d, lParam=0x%08lx, rect.left=%ld, rect.top(row)=%ld\n",
    176176              iItem, ti->lParam, ti->rect.left, ti->rect.top);
    177177    }
     
    259259}
    260260
     261static LRESULT
     262TAB_SetPadding (HWND hwnd, WPARAM wParam, LPARAM lParam)
     263{
     264    TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
     265   
     266    if (infoPtr == NULL) return 0;
     267    infoPtr->uHItemPadding=LOWORD(lParam);
     268    infoPtr->uVItemPadding=HIWORD(lParam);
     269    return 0;
     270}
     271
    261272/******************************************************************************
    262273 * TAB_InternalGetItemRect
     
    367378             0);
    368379  }
    369   TRACE("item %d tab h=%d, rect=(%d,%d)-(%d,%d)\n",
     380  TRACE("item %d tab h=%d, rect=(%ld,%ld)-(%ld,%ld)\n",
    370381        itemIndex, infoPtr->tabHeight,
    371382        itemRect->left, itemRect->top, itemRect->right, itemRect->bottom);
     
    488499  if (isVisible)
    489500  {
    490       TRACE("invalidate (%d,%d)-(%d,%d)\n",
     501      TRACE("invalidate (%ld,%ld)-(%ld,%ld)\n",
    491502            selectedRect.left,selectedRect.top,
    492503            selectedRect.right,selectedRect.bottom);
     
    987998                                          controlPos.bottom - controlPos.top,
    988999                                          hwnd,
    989                                           (HMENU)NULL,
    990                                           (HINSTANCE)NULL,
     1000                                          NULL,
     1001                                          NULL,
    9911002                                          NULL);
    9921003    }
     
    9941005    {
    9951006      SetWindowPos(infoPtr->hwndUpDown,
    996                    (HWND)NULL,
     1007                   NULL,
    9971008                   controlPos.left, controlPos.top,
    9981009                   controlPos.right - controlPos.left,
     
    11001111    /* Take the highest between font or icon */
    11011112    if (fontMetrics.tmHeight > icon_height)
    1102       item_height = fontMetrics.tmHeight;
     1113      item_height = fontMetrics.tmHeight + 2;
    11031114    else
    11041115      item_height = icon_height;
     
    11081119     * selected item + extra space for the selected item.
    11091120     */
    1110 #ifdef __WIN32OS2__
    1111     //Code below doesn't always work
    1112     infoPtr->tabHeight = item_height + 2 * VERTICAL_ITEM_PADDING +
    1113         SELECTED_TAB_OFFSET;
    1114 #else
    11151121    infoPtr->tabHeight = item_height + SELECTED_TAB_OFFSET +
    11161122                         ((lStyle & TCS_BUTTONS) ? 2 : 1) *
    1117                           VERTICAL_ITEM_PADDING;
    1118 #endif
     1123                          infoPtr->uVItemPadding;
     1124
    11191125    TRACE("tabH=%d, tmH=%ld, iconh=%d\n",
    11201126          infoPtr->tabHeight, fontMetrics.tmHeight, icon_height);
    11211127  }
    11221128
    1123   TRACE("client right=%d\n", clientRect.right);
     1129  TRACE("client right=%ld\n", clientRect.right);
    11241130
    11251131  for (curItem = 0; curItem < infoPtr->uNumItem; curItem++)
     
    11321138      infoPtr->items[curItem].rect.right = infoPtr->items[curItem].rect.left +
    11331139                                           infoPtr->tabWidth +
    1134                                            2 * HORIZONTAL_ITEM_PADDING;
     1140                                           2 * infoPtr->uHItemPadding;
    11351141    }
    11361142    else
     
    11571163      infoPtr->items[curItem].rect.right = infoPtr->items[curItem].rect.left +
    11581164                                           size.cx + icon_width +
    1159                                            num * HORIZONTAL_ITEM_PADDING;
    1160       TRACE("for <%s>, l,r=%d,%d, num=%d\n",
     1165                                           num * infoPtr->uHItemPadding;
     1166      TRACE("for <%s>, l,r=%ld,%ld, num=%d\n",
    11611167          debugstr_w(infoPtr->items[curItem].pszText),
    11621168          infoPtr->items[curItem].rect.left,
     
    11821188        infoPtr->items[curItem].rect.left = 0;
    11831189        curItemRowCount++;
    1184         TRACE("wrapping <%s>, l,r=%d,%d\n",
     1190        TRACE("wrapping <%s>, l,r=%ld,%ld\n",
    11851191            debugstr_w(infoPtr->items[curItem].pszText),
    11861192            infoPtr->items[curItem].rect.left,
     
    11921198
    11931199    TRACE("TextSize: %li\n", size.cx);
    1194     TRACE("Rect: T %i, L %i, B %i, R %i\n",
     1200    TRACE("Rect: T %li, L %li, B %li, R %li\n",
    11951201          infoPtr->items[curItem].rect.top,
    11961202          infoPtr->items[curItem].rect.left,
     
    12561262          infoPtr->items[iItm].rect.left = 0;
    12571263
    1258           TRACE("r=%d, cl=%d, cl.r=%d, iCount=%d, iRow=%d, uNumRows=%d, remTab=%d, tabPerRow=%d\n",
     1264          TRACE("r=%ld, cl=%d, cl.r=%ld, iCount=%d, iRow=%d, uNumRows=%d, remTab=%d, tabPerRow=%d\n",
    12591265              infoPtr->items[iItm].rect.right,
    12601266              curItemLeftPos, clientRect.right,
     
    13051311            curItemLeftPos = infoPtr->items[iItm].rect.right;
    13061312
    1307           TRACE("arranging <%s>, l,r=%d,%d, row=%d\n",
     1313          TRACE("arranging <%s>, l,r=%ld,%ld, row=%ld\n",
    13081314              debugstr_w(infoPtr->items[iItm].pszText),
    13091315              infoPtr->items[iItm].rect.left,
     
    13531359              infoPtr->items[iIndex].rect.right += (iCount + 1) * widthDiff;
    13541360
    1355               TRACE("adjusting 1 <%s>, l,r=%d,%d\n",
     1361              TRACE("adjusting 1 <%s>, l,r=%ld,%ld\n",
    13561362                  debugstr_w(infoPtr->items[iIndex].pszText),
    13571363                  infoPtr->items[iIndex].rect.left,
     
    13661372          infoPtr->items[iIndexStart].rect.right = clientRect.right - 4;
    13671373
    1368           TRACE("adjusting 2 <%s>, l,r=%d,%d\n",
     1374          TRACE("adjusting 2 <%s>, l,r=%ld,%ld\n",
    13691375              debugstr_w(infoPtr->items[iIndexStart].pszText),
    13701376              infoPtr->items[iIndexStart].rect.left,
     
    14831489                     comctl32_color.clrHighlight : comctl32_color.clrBtnText);
    14841490
    1485   /*
    1486    * Deflate the rectangle to acount for the padding
    1487    */
    1488   if(lStyle & TCS_VERTICAL)
    1489     InflateRect(drawRect, -VERTICAL_ITEM_PADDING, -HORIZONTAL_ITEM_PADDING);
    1490   else
    1491     InflateRect(drawRect, -HORIZONTAL_ITEM_PADDING, -VERTICAL_ITEM_PADDING);
    1492 
    14931491
    14941492  /*
     
    15121510    dis.itemID     = iItem;
    15131511    dis.itemAction = ODA_DRAWENTIRE;
     1512    dis.itemState = 0;
    15141513    if ( iItem == infoPtr->iSelected )
    1515       dis.itemState = ODS_SELECTED;
    1516     else
    1517       dis.itemState = 0;
     1514      dis.itemState |= ODS_SELECTED;
     1515    if (infoPtr->uFocus == iItem)
     1516      dis.itemState |= ODS_FOCUS;
    15181517    dis.hwndItem = hwnd;                /* */
    15191518    dis.hDC      = hdc;
    1520     dis.rcItem   = *drawRect;           /* */
     1519    CopyRect(&dis.rcItem,drawRect);
    15211520    dis.itemData = infoPtr->items[iItem].lParam;
    15221521
     
    15441543    RECT rcText;
    15451544    INT center_offset;
     1545
     1546    /*
     1547     * Deflate the rectangle to acount for the padding
     1548     */
     1549    if(lStyle & TCS_VERTICAL)
     1550      InflateRect(drawRect, -infoPtr->uVItemPadding, -infoPtr->uHItemPadding);
     1551    else
     1552      InflateRect(drawRect, -infoPtr->uHItemPadding, -infoPtr->uVItemPadding);
    15461553
    15471554    /* set rcImage to drawRect, we will use top & left in our ImageList_Draw call */
     
    15731580
    15741581      if(lStyle & TCS_VERTICAL)
    1575         center_offset = ((drawRect->bottom - drawRect->top) - (cy + HORIZONTAL_ITEM_PADDING + (rcText.right - rcText.left))) / 2;
     1582        center_offset = ((drawRect->bottom - drawRect->top) - (cy + infoPtr->uHItemPadding + (rcText.right - rcText.left))) / 2;
    15761583      else
    1577         center_offset = ((drawRect->right - drawRect->left) - (cx + HORIZONTAL_ITEM_PADDING + (rcText.right - rcText.left))) / 2;
    1578 
    1579       TRACE("for <%s>, c_o=%d, draw=(%d,%d)-(%d,%d), textlen=%d\n",
     1584        center_offset = ((drawRect->right - drawRect->left) - (cx + infoPtr->uHItemPadding + (rcText.right - rcText.left))) / 2;
     1585
     1586      TRACE("for <%s>, c_o=%d, draw=(%ld,%ld)-(%ld,%ld), textlen=%ld\n",
    15801587          debugstr_w(infoPtr->items[iItem].pszText), center_offset,
    15811588          drawRect->left, drawRect->top, drawRect->right, drawRect->bottom,
     
    15881595                                             /* right side of the tab, but the image still uses the left as its x position */
    15891596                                             /* this keeps the image always drawn off of the same side of the tab */
    1590         drawRect->top = rcImage.top + (cx + HORIZONTAL_ITEM_PADDING);
     1597        drawRect->top = rcImage.top + (cx + infoPtr->uHItemPadding);
    15911598      }
    15921599      else if(lStyle & TCS_VERTICAL)
     
    15941601        rcImage.top = drawRect->bottom - cy - center_offset;
    15951602        rcImage.left--;
    1596         drawRect->bottom = rcImage.top - HORIZONTAL_ITEM_PADDING;
     1603        drawRect->bottom = rcImage.top - infoPtr->uHItemPadding;
    15971604      }
    15981605      else /* normal style, whether TCS_BOTTOM or not */
    15991606      {
    16001607        rcImage.left = drawRect->left + center_offset + 3;
    1601         drawRect->left = rcImage.left + cx + HORIZONTAL_ITEM_PADDING;
     1608        drawRect->left = rcImage.left + cx + infoPtr->uHItemPadding;
    16021609        rcImage.top -= (lStyle & TCS_BOTTOM) ? 2 : 1;
    16031610      }
    16041611
    1605       TRACE("drawing image=%d, left=%d, top=%d\n",
     1612      TRACE("drawing image=%d, left=%ld, top=%ld\n",
    16061613            infoPtr->items[iItem].iImage, rcImage.left, rcImage.top-1);
    16071614      ImageList_Draw
     
    18611868          r.left += (1-ZZ);
    18621869
    1863           TRACE("<left> item=%d, fill=(%d,%d)-(%d,%d), edge=(%d,%d)-(%d,%d)\n",
     1870          TRACE("<left> item=%d, fill=(%ld,%ld)-(%ld,%ld), edge=(%ld,%ld)-(%ld,%ld)\n",
    18641871                iItem,
    18651872                fillRect.left,fillRect.top,fillRect.right,fillRect.bottom,
     
    19051912          fillRect.right += (1-ZZ);
    19061913
    1907           TRACE("<left> item=%d, fill=(%d,%d)-(%d,%d), edge=(%d,%d)-(%d,%d)\n",
     1914          TRACE("<left> item=%d, fill=(%ld,%ld)-(%ld,%ld), edge=(%ld,%ld)-(%ld,%ld)\n",
    19081915                iItem,
    19091916                fillRect.left,fillRect.top,fillRect.right,fillRect.bottom,
     
    19621969          r.top -= ZZ;
    19631970
    1964           TRACE("<bottom> item=%d, fill=(%d,%d)-(%d,%d), edge=(%d,%d)-(%d,%d)\n",
     1971          TRACE("<bottom> item=%d, fill=(%ld,%ld)-(%ld,%ld), edge=(%ld,%ld)-(%ld,%ld)\n",
    19651972                iItem,
    19661973                fillRect.left,fillRect.top,fillRect.right,fillRect.bottom,
     
    20072014          fillRect.bottom += (1-ZZ);
    20082015
    2009           TRACE("<top> item=%d, fill=(%d,%d)-(%d,%d), edge=(%d,%d)-(%d,%d)\n",
     2016          TRACE("<top> item=%d, fill=(%ld,%ld)-(%ld,%ld), edge=(%ld,%ld)-(%ld,%ld)\n",
    20102017                iItem,
    20112018                fillRect.left,fillRect.top,fillRect.right,fillRect.bottom,
     
    21022109  }
    21032110
    2104   TRACE("border=(%d,%d)-(%d,%d)\n",
     2111  TRACE("border=(%ld,%ld)-(%ld,%ld)\n",
    21052112        rect.left, rect.top, rect.right, rect.bottom);
    21062113
     
    23192326  TAB_INFO* infoPtr)
    23202327{
    2321   RECT clientRect;
     2328  RECT clientRect, r;
    23222329  DWORD lStyle = GetWindowLongA(hwnd, GWL_STYLE);
    23232330  INT lastRow = infoPtr->uNumRows - 1;
     
    23532360                      ((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) + 2;
    23542361  }
    2355 
    2356   TRACE("invalidate (%d,%d)-(%d,%d)\n",
     2362 
     2363  /* Punch out the updown control */
     2364  if (infoPtr->needsScrolling && (clientRect.right > 0)) {
     2365    GetClientRect(infoPtr->hwndUpDown, &r);
     2366    clientRect.right = clientRect.right - (r.right - r.left);
     2367  }
     2368 
     2369  TRACE("invalidate (%ld,%ld)-(%ld,%ld)\n",
    23572370        clientRect.left,clientRect.top,
    23582371        clientRect.right,clientRect.bottom);
     2372 
    23592373  InvalidateRect(hwnd, &clientRect, TRUE);
    23602374}
     
    23682382  hdc = wParam== 0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
    23692383
    2370   TRACE("erase %d, rect=(%d,%d)-(%d,%d)\n",
     2384  TRACE("erase %d, rect=(%ld,%ld)-(%ld,%ld)\n",
    23712385        ps.fErase,
    23722386        ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right,ps.rcPaint.bottom);
     
    23922406
    23932407  GetClientRect (hwnd, &rect);
    2394   TRACE("Rect: %p T %i, L %i, B %i, R %i\n", hwnd,
     2408  TRACE("Rect: %p T %li, L %li, B %li, R %li\n", hwnd,
    23952409        rect.top, rect.left, rect.bottom, rect.right);
    23962410
     
    24672481
    24682482  GetClientRect (hwnd, &rect);
    2469   TRACE("Rect: %p T %i, L %i, B %i, R %i\n", hwnd,
     2483  TRACE("Rect: %p T %li, L %li, B %li, R %li\n", hwnd,
    24702484        rect.top, rect.left, rect.bottom, rect.right);
    24712485
     
    25432557  {
    25442558    lResult = MAKELONG(infoPtr->tabWidth, infoPtr->tabHeight);
    2545     infoPtr->tabWidth = (INT)LOWORD(lParam);
    2546     infoPtr->tabHeight = (INT)HIWORD(lParam);
     2559    /* UNDOCUMENTED: If requested Width or Height is 0 this means that program wants to use default. */   
     2560    if (LOWORD(lParam)) infoPtr->tabWidth = (INT)LOWORD(lParam);
     2561    if (HIWORD(lParam)) infoPtr->tabHeight = (INT)HIWORD(lParam);
    25472562    TRACE("was h=%d,w=%d, now h=%d,w=%d\n",
    25482563          HIWORD(lResult), LOWORD(lResult),
     
    28992914  infoPtr->uNumItem        = 0;
    29002915  infoPtr->uNumRows        = 0;
     2916  infoPtr->uHItemPadding   = 6;
     2917  infoPtr->uVItemPadding   = 3;
    29012918  infoPtr->hFont           = 0;
    29022919  infoPtr->items           = 0;
     
    29592976  infoPtr->tabHeight = fontMetrics.tmHeight + SELECTED_TAB_OFFSET +
    29602977                       ((dwStyle & TCS_BUTTONS) ? 2 : 1) *
    2961                         VERTICAL_ITEM_PADDING;
     2978                        infoPtr->uVItemPadding;
    29622979
    29632980  /* Initialize the width of a tab. */
     
    30733090
    30743091    case TCM_SETPADDING:
    3075       FIXME("Unimplemented msg TCM_SETPADDING\n");
    3076       return 0;
     3092      return TAB_SetPadding (hwnd, wParam, lParam);
    30773093
    30783094    case TCM_GETROWCOUNT:
     
    32023218  wndClass.cbWndExtra    = sizeof(TAB_INFO *);
    32033219  wndClass.hCursor       = LoadCursorA (0, IDC_ARROWA);
    3204   wndClass.hbrBackground = (HBRUSH)NULL;
     3220  wndClass.hbrBackground = NULL;
    32053221  wndClass.lpszClassName = WC_TABCONTROLA;
    32063222
     
    32123228TAB_Unregister (void)
    32133229{
    3214     UnregisterClassA (WC_TABCONTROLA, (HINSTANCE)NULL);
    3215 }
     3230    UnregisterClassA (WC_TABCONTROLA, NULL);
     3231}
  • trunk/src/comctl32/toolbar.c

    r9394 r10098  
    3030 *
    3131 * TODO:
    32  *   - A little bug in TOOLBAR_DrawMasked()
    3332 *   - Button wrapping (under construction).
    3433 *   - Messages.
     
    9796typedef struct
    9897{
     98    HIMAGELIST himl;
     99    INT id;
     100} IMLENTRY, *PIMLENTRY;
     101
     102typedef struct
     103{
    99104    DWORD      dwStructSize;   /* size of TBBUTTON struct */
    100105    INT      nHeight;        /* height of the toolbar */
     
    125130    HFONT    hFont;           /* text font */
    126131    HIMAGELIST himlInt;         /* image list created internally */
    127     HIMAGELIST himlDef;         /* default image list */
    128     HIMAGELIST himlHot;         /* hot image list */
    129     HIMAGELIST himlDis;         /* disabled image list */
     132    PIMLENTRY *himlDef;       /* default image list array */
     133    INT       cimlDef;        /* default image list array count */
     134    PIMLENTRY *himlHot;       /* hot image list array */
     135    INT       cimlHot;        /* hot image list array count */
     136    PIMLENTRY *himlDis;       /* disabled image list array */
     137    INT       cimlDis;        /* disabled image list array count */
    130138    HWND     hwndToolTip;     /* handle to tool tip control */
    131139    HWND     hwndNotify;      /* handle to the window that gets notifications */
     
    164172    BOOL     bVirtual;
    165173    BOOL     bRemovable;
    166     CHAR     text[64];
     174    WCHAR    text[64];
    167175} CUSTOMBUTTON, *PCUSTOMBUTTON;
    168176
     
    183191                        TBSTYLE_EX_HIDECLIPPEDBUTTONS)
    184192
     193#define GETIBITMAP(infoPtr, i) (infoPtr->iVersion >= 5 ? LOWORD(i) : i)
     194#define GETHIMLID(infoPtr, i) (infoPtr->iVersion >= 5 ? HIWORD(i) : 0)
     195#define GETDEFIMAGELIST(infoPtr, id) TOOLBAR_GetImageList(infoPtr->himlDef, infoPtr->cimlDef, id)
     196#define GETHOTIMAGELIST(infoPtr, id) TOOLBAR_GetImageList(infoPtr->himlHot, infoPtr->cimlHot, id)
     197#define GETDISIMAGELIST(infoPtr, id) TOOLBAR_GetImageList(infoPtr->himlDis, infoPtr->cimlDis, id)
     198
     199static BOOL TOOLBAR_GetButtonInfo(TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb);
     200static BOOL TOOLBAR_IsButtonRemovable(TOOLBAR_INFO *infoPtr, int iItem, PCUSTOMBUTTON btnInfo);
     201static HIMAGELIST TOOLBAR_GetImageList(PIMLENTRY *pies, INT cies, INT id);
     202static PIMLENTRY TOOLBAR_GetImageListEntry(PIMLENTRY *pies, INT cies, INT id);
     203static VOID TOOLBAR_DeleteImageList(PIMLENTRY **pies, INT *cies);
     204static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id);
     205
    185206static LRESULT
    186207TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam);
     
    206227    if (TRACE_ON(toolbar)){
    207228        TRACE("button %d id %d, bitmap=%d, state=%02x, style=%02x, data=%08lx, stringid=0x%08x\n",
    208               btn_num, bP->idCommand,
    209               bP->iBitmap, bP->fsState, bP->fsStyle, bP->dwData, bP->iString);
     229              btn_num, bP->idCommand, GETIBITMAP(infoPtr, bP->iBitmap),
     230              bP->fsState, bP->fsStyle, bP->dwData, bP->iString);
    210231        TRACE("string %s\n", debugstr_w(TOOLBAR_GetText(infoPtr,bP)));
    211232        if (internal)
    212             TRACE("button %d id %d, hot=%s, row=%d, rect=(%d,%d)-(%d,%d)\n",
     233            TRACE("button %d id %d, hot=%s, row=%d, rect=(%ld,%ld)-(%ld,%ld)\n",
    213234                  btn_num, bP->idCommand,
    214235                  (bP->bHot) ? "TRUE":"FALSE", bP->nRow,
     
    309330              ret, nmgd.dwMask, infoPtr->nNumBitmaps);
    310331    }
     332
     333    if (ret != I_IMAGENONE)
     334        ret = GETIBITMAP(infoPtr, ret);
     335
    311336    return ret;
    312337}
     
    316341TOOLBAR_IsValidBitmapIndex(TOOLBAR_INFO *infoPtr, INT index)
    317342{
    318     if (((index>=0) && (index <= infoPtr->nNumBitmaps)) ||
    319         (index == I_IMAGECALLBACK))
     343    HIMAGELIST himl;
     344    INT id = GETHIMLID(infoPtr, index);
     345    INT iBitmap = GETIBITMAP(infoPtr, index);
     346
     347    if (((himl = GETDEFIMAGELIST(infoPtr, id)) &&
     348        iBitmap >= 0 && iBitmap < ImageList_GetImageCount(himl)) ||
     349        (index == I_IMAGECALLBACK))
    320350      return TRUE;
    321351    else
     
    444474    InflateRect (&myrect, -2, 0);
    445475
    446     TRACE("rect=(%d,%d)-(%d,%d)\n",
     476    TRACE("rect=(%ld,%ld)-(%ld,%ld)\n",
    447477          myrect.left, myrect.top, myrect.right, myrect.bottom);
    448478
     
    500530    /* draw text */
    501531    if (lpText) {
    502         TRACE("string rect=(%d,%d)-(%d,%d)\n",
     532        TRACE("string rect=(%ld,%ld)-(%ld,%ld)\n",
    503533              rcText->left, rcText->top, rcText->right, rcText->bottom);
    504534
     
    543573                    HDC hdc, INT x, INT y)
    544574{
    545     /* FIXME: this function is a hack since it uses image list
    546               internals directly */
    547 
    548     HIMAGELIST himl = infoPtr->himlDef;
     575    HIMAGELIST himl = GETDEFIMAGELIST(infoPtr, 0);
     576    INT cx, cy;
    549577    HBITMAP hbmMask;
    550     HDC hdcImageList;
    551578    HDC hdcMask;
    552579
     
    554581        return;
    555582
     583    ImageList_GetIconSize(himl, &cx, &cy);
     584
    556585    /* create new dc's */
    557     hdcImageList = CreateCompatibleDC (0);
    558586    hdcMask = CreateCompatibleDC (0);
    559587
    560588    /* create new bitmap */
    561     hbmMask = CreateBitmap (himl->cx, himl->cy, 1, 1, NULL);
     589    hbmMask = CreateBitmap (cx, cy, 1, 1, NULL);
    562590    SelectObject (hdcMask, hbmMask);
    563591
    564592    /* copy the mask bitmap */
    565     SelectObject (hdcImageList, himl->hbmMask);
    566     SetBkColor (hdcImageList, RGB(255, 255, 255));
    567     SetTextColor (hdcImageList, RGB(0, 0, 0));
    568     BitBlt (hdcMask, 0, 0, himl->cx, himl->cy,
    569               hdcImageList, himl->cx * btnPtr->iBitmap, 0, SRCCOPY);
     593    ImageList_DrawEx(himl, btnPtr->iBitmap, hdcMask, 0, 0, 0, 0, RGB(255, 255, 255), RGB(0, 0, 0), ILD_MASK);
    570594
    571595    /* draw the new mask */
    572596    SelectObject (hdc, GetSysColorBrush (COLOR_3DHILIGHT));
    573     BitBlt (hdc, x+1, y+1, himl->cx, himl->cy,
    574               hdcMask, 0, 0, 0xB8074A);
     597    BitBlt (hdc, x+1, y+1, cx, cy, hdcMask, 0, 0, 0xB8074A);
    575598
    576599    SelectObject (hdc, GetSysColorBrush (COLOR_3DSHADOW));
    577     BitBlt (hdc, x, y, himl->cx, himl->cy,
    578               hdcMask, 0, 0, 0xB8074A);
     600    BitBlt (hdc, x, y, cx, cy, hdcMask, 0, 0, 0xB8074A);
    579601
    580602    DeleteObject (hbmMask);
    581603    DeleteDC (hdcMask);
    582     DeleteDC (hdcImageList);
    583604}
    584605
     
    613634    DWORD ntfret;
    614635    INT offset;
     636    HIMAGELIST himlDef;
    615637
    616638    if (btnPtr->fsState & TBSTATE_HIDDEN)
     
    646668        rcBitmap.top+=(infoPtr->nButtonHeight - infoPtr->nBitmapHeight) / 2;
    647669
    648     TRACE("iBitmap: %d, start=(%d,%d) w=%d, h=%d\n",
     670    TRACE("iBitmap: %d, start=(%ld,%ld) w=%d, h=%d\n",
    649671          btnPtr->iBitmap, rcBitmap.left, rcBitmap.top,
    650672          infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
     
    657679        InflateRect (&rcText, -3, -3);
    658680
    659         if (infoPtr->himlDef &&
     681        if (GETDEFIMAGELIST(infoPtr, 0) &&
    660682            TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
    661683                /* The following test looked like this before
     
    756778    }
    757779
     780    /* Determine index of image list */
     781    himlDef = GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr, btnPtr->iBitmap));
     782
    758783    /* disabled */
    759784    if (!(btnPtr->fsState & TBSTATE_ENABLED)) {
     785        HIMAGELIST himlDis = GETDISIMAGELIST(infoPtr, GETHIMLID(infoPtr, btnPtr->iBitmap));
    760786        if (!(dwStyle & TBSTYLE_FLAT) && !(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
    761787        {
     
    773799        }
    774800
    775         if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDis,
     801        if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDis,
    776802                                   hdc, rcBitmap.left, rcBitmap.top,
    777803                                   ILD_NORMAL))
     
    804830            TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top, COLOR_WINDOWFRAME);
    805831
    806         TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,
     832        TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef,
    807833                               hdc, rcBitmap.left+offset, rcBitmap.top+offset,
    808834                               ILD_NORMAL);
     
    827853        TOOLBAR_DrawPattern (hdc, &rc);
    828854
    829         TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,
     855        TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef,
    830856                               hdc, rcBitmap.left+1, rcBitmap.top+1,
    831857                               ILD_NORMAL);
     
    888914
    889915        if (btnPtr->bHot) {
     916            HIMAGELIST himlHot = GETHOTIMAGELIST(infoPtr,
     917                GETHIMLID(infoPtr, btnPtr->iBitmap));
    890918            /* if hot, attempt to draw with himlHot, if fails, use himlDef */
    891919            if (!TOOLBAR_DrawImageList (infoPtr, btnPtr,
    892                                         infoPtr->himlHot,
     920                                        himlHot,
    893921                                        hdc, rcBitmap.left,
    894922                                        rcBitmap.top, ILD_NORMAL))
    895                 TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,
     923                TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef,
    896924                                       hdc, rcBitmap.left, rcBitmap.top,
    897925                                       ILD_NORMAL);
    898926        }
    899927        else
    900             TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,
     928            TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef,
    901929                                   hdc, rcBitmap.left, rcBitmap.top,
    902930                                   ILD_NORMAL);
     
    916944        }
    917945
    918         TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,
     946        TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef,
    919947                               hdc, rcBitmap.left, rcBitmap.top,
    920948                               ILD_NORMAL);}
     
    953981    /* if imagelist belongs to the app, it can be changed
    954982       by the app after setting it */
    955     if (infoPtr->himlDef != infoPtr->himlInt)
    956         infoPtr->nNumBitmaps = ImageList_GetImageCount(infoPtr->himlDef);
     983    if (GETDEFIMAGELIST(infoPtr, 0) != infoPtr->himlInt)
     984    {
     985        infoPtr->nNumBitmaps = 0;
     986        for (i = 0; i < infoPtr->cimlDef; i++)
     987            infoPtr->nNumBitmaps += ImageList_GetImageCount(infoPtr->himlDef[i]->himl);
     988    }
    957989
    958990    TOOLBAR_DumpToolbar (infoPtr, __LINE__);
     
    14081440              cx = sz.cx + 6 + 5 + 5;
    14091441              if ((dwStyle & TBSTYLE_LIST) &&
    1410                   (TOOLBAR_TestImageExist (infoPtr, btnPtr, infoPtr->himlDef)))
     1442                  (TOOLBAR_TestImageExist (infoPtr, btnPtr, GETDEFIMAGELIST(infoPtr,0))))
    14111443                  cx += infoPtr->nBitmapWidth;
    14121444            }
     
    16461678            if (custInfo)
    16471679            {
    1648                 char Buffer[256];
     1680                WCHAR Buffer[256];
    16491681                int i = 0;
    16501682                int index;
     
    16581690                    return FALSE;
    16591691
     1692                /* Send TBN_INITCUSTOMIZE notification */
     1693                if (TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_INITCUSTOMIZE) ==
     1694                    TBNRF_HIDEHELP)
     1695                {
     1696                    FIXME("TBNRF_HIDEHELP not supported\n");
     1697                }
     1698
    16601699                /* add items to 'toolbar buttons' list and check if removable */
    16611700                for (i = 0; i < custInfo->tbInfo->nNumButtons; i++)
    1662                 {
     1701                {
    16631702                    btnInfo = (PCUSTOMBUTTON)COMCTL32_Alloc(sizeof(CUSTOMBUTTON));
    1664                     memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
    1665                     btnInfo->btn.fsStyle = TBSTYLE_SEP;
    1666                     btnInfo->bVirtual = FALSE;
    1667                     LoadStringA (COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64);
     1703                    memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
     1704                    btnInfo->btn.fsStyle = TBSTYLE_SEP;
     1705                    btnInfo->bVirtual = FALSE;
     1706                    LoadStringW (COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64);
    16681707
    16691708                    /* send TBN_QUERYDELETE notification */
    1670                     nmtb.iItem = i;
    1671                     btnInfo->bRemovable = TOOLBAR_SendNotify ((NMHDR *) &nmtb,
    1672                                                       infoPtr,
    1673                                                       TBN_QUERYDELETE);
     1709                    btnInfo->bRemovable = TOOLBAR_IsButtonRemovable(infoPtr, i, btnInfo);
    16741710
    16751711                    index = (int)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_ADDSTRING, 0, 0);
     
    16831719                btnInfo->bVirtual = FALSE;
    16841720                btnInfo->bRemovable = TRUE;
    1685                 LoadStringA (COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64);
     1721                LoadStringW (COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64);
    16861722                index = (int)SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)btnInfo);
    16871723                SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo);
     
    16911727                {
    16921728                    /* send TBN_GETBUTTONINFO notification */
     1729                    NMTOOLBARW nmtb;
    16931730                    nmtb.iItem = i;
    16941731                    nmtb.pszText = Buffer;
    16951732                    nmtb.cchText = 256;
    16961733
    1697                     if (!TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_GETBUTTONINFOA))
     1734                    /* Clear previous button's text */
     1735                    ZeroMemory(nmtb.pszText, nmtb.cchText * sizeof(WCHAR));
     1736
     1737                    if (!TOOLBAR_GetButtonInfo(infoPtr, &nmtb))
    16981738                        break;
    16991739
    1700                     TRACE("style: %x\n", nmtb.tbButton.fsStyle);
     1740                    TRACE("WM_INITDIALOG style: %x iItem(%d) idCommand(%d) iString(%d) %s\n",
     1741                        nmtb.tbButton.fsStyle, i,
     1742                        nmtb.tbButton.idCommand,
     1743                        nmtb.tbButton.iString,
     1744                        nmtb.tbButton.iString >= 0 ? debugstr_w(infoPtr->strings[nmtb.tbButton.iString])
     1745                        : "");
    17011746
    17021747                    /* insert button into the apropriate list */
     
    17051750                    {
    17061751                        btnInfo = (PCUSTOMBUTTON)COMCTL32_Alloc(sizeof(CUSTOMBUTTON));
    1707                         memcpy (&btnInfo->btn, &nmtb.tbButton, sizeof(TBBUTTON));
    17081752                        btnInfo->bVirtual = FALSE;
    17091753                        btnInfo->bRemovable = TRUE;
    1710                         if (!(nmtb.tbButton.fsStyle & TBSTYLE_SEP))
    1711                             strcpy (btnInfo->text, nmtb.pszText);
    17121754
    17131755                        index = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, 0);
    1714                         SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo);
     1756                        SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX,
     1757                                LB_SETITEMDATA, index, (LPARAM)btnInfo);
    17151758                    }
    17161759                    else
    17171760                    {
    1718                         btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0);
    1719                         memcpy (&btnInfo->btn, &nmtb.tbButton, sizeof(TBBUTTON));
    1720                         if (!(nmtb.tbButton.fsStyle & TBSTYLE_SEP))
    1721                             strcpy (btnInfo->text, nmtb.pszText);
    1722 
    1723                         SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo);
     1761                        btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd,
     1762                            IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0);
     1763                    }
     1764
     1765                    memcpy (&btnInfo->btn, &nmtb.tbButton, sizeof(TBBUTTON));
     1766                    if (!(nmtb.tbButton.fsStyle & TBSTYLE_SEP))
     1767                    {
     1768                        if (lstrlenW(nmtb.pszText))
     1769                            lstrcpyW(btnInfo->text, nmtb.pszText);
     1770                        else if (nmtb.tbButton.iString >= 0 &&
     1771                            nmtb.tbButton.iString < infoPtr->nNumStrings)
     1772                        {
     1773                            lstrcpyW(btnInfo->text,
     1774                                infoPtr->strings[nmtb.tbButton.iString]);
     1775                        }
    17241776                    }
    17251777                }
     
    17341786                btnInfo->bVirtual = TRUE;
    17351787                btnInfo->bRemovable = FALSE;
    1736                 LoadStringA (COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64);
     1788                LoadStringW (COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64);
    17371789                index = (int)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)btnInfo);
    17381790                SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo);
     
    18821934
    18831935                        index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0);
     1936
     1937                        if (LB_ERR == index)
     1938                                break;
     1939
    18841940                        TRACE("Remove: index %d\n", index);
    18851941
     1942                        btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX,
     1943                                LB_GETITEMDATA, index, 0);
     1944
    18861945                        /* send TBN_QUERYDELETE notification */
    1887                         nmtb.iItem = index;
    1888                         if (TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
    1889                                             TBN_QUERYDELETE))
     1946                        if (TOOLBAR_IsButtonRemovable(infoPtr, index, btnInfo))
    18901947                        {
    18911948                            btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0);
     
    19902047            {
    19912048                LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam;
     2049        DWORD dwStyle = GetWindowLongA (infoPtr->hwndSelf, GWL_STYLE);
    19922050                RECT rcButton;
    19932051                RECT rcText;
     
    20322090
    20332091                /* draw button */
     2092                if (!(dwStyle & TBSTYLE_FLAT))
    20342093                DrawEdge (lpdis->hDC, &rcButton, EDGE_RAISED, BF_RECT|BF_MIDDLE|BF_SOFT);
    20352094
    20362095                /* draw image and text */
    2037                 if ((btnInfo->btn.fsStyle & TBSTYLE_SEP) == 0)
    2038                     ImageList_Draw (custInfo->tbInfo->himlDef, btnInfo->btn.iBitmap, lpdis->hDC,
    2039                                     rcButton.left+3, rcButton.top+3, ILD_NORMAL);
    2040                 DrawTextA (lpdis->hDC,  btnInfo->text, -1, &rcText,
     2096                if ((btnInfo->btn.fsStyle & TBSTYLE_SEP) == 0) {
     2097                        HIMAGELIST himl = GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr,
     2098                                btnInfo->btn.iBitmap));
     2099                    ImageList_Draw (himl, GETIBITMAP(infoPtr, btnInfo->btn.iBitmap),
     2100                                lpdis->hDC, rcButton.left+3, rcButton.top+3, ILD_NORMAL);
     2101                }
     2102                DrawTextW (lpdis->hDC,  btnInfo->text, -1, &rcText,
    20412103                               DT_LEFT | DT_VCENTER | DT_SINGLELINE);
    20422104
     
    20822144    INT nIndex = 0, nButtons, nCount;
    20832145    HBITMAP hbmLoad;
     2146    HIMAGELIST himlDef;
    20842147
    20852148    TRACE("hwnd=%p wParam=%x lParam=%lx\n", hwnd, wParam, lParam);
     
    21322195    }
    21332196
    2134     if (!(infoPtr->himlDef)) {
     2197    if (!infoPtr->cimlDef) {
    21352198        /* create new default image list */
    21362199        TRACE ("creating default image list!\n");
    21372200
    2138         infoPtr->himlDef =
    2139             ImageList_Create (infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,
    2140                               ILC_COLOR | ILC_MASK, nButtons, 2);
    2141         infoPtr->himlInt = infoPtr->himlDef;
    2142     }
    2143 
    2144     nCount = ImageList_GetImageCount(infoPtr->himlDef);
     2201    himlDef = ImageList_Create (infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,
     2202                ILC_COLOR | ILC_MASK, nButtons, 2);
     2203        TOOLBAR_InsertImageList(&infoPtr->himlDef, &infoPtr->cimlDef, himlDef, 0);
     2204    infoPtr->himlInt = himlDef;
     2205    }
     2206    else {
     2207        himlDef = GETDEFIMAGELIST(infoPtr, 0);
     2208    }
     2209
     2210    if (!himlDef) {
     2211        WARN("No default image list available\n");
     2212        return -1;
     2213    }
     2214
     2215    nCount = ImageList_GetImageCount(himlDef);
    21452216
    21462217    /* Add bitmaps to the default image list */
    2147     if (lpAddBmp->hInst == (HINSTANCE)0)
     2218    if (lpAddBmp->hInst == NULL)
    21482219    {
    2149         nIndex =
    2150             ImageList_AddMasked (infoPtr->himlDef, (HBITMAP)lpAddBmp->nID,
    2151                                  CLR_DEFAULT);
     2220       BITMAP  bmp;
     2221       HBITMAP hOldBitmapBitmap, hOldBitmapLoad;
     2222       HDC     hdcImage, hdcBitmap;
     2223
     2224       /* copy the bitmap before adding it so that the user's bitmap
     2225        * doesn't get modified.
     2226        */
     2227       GetObjectA ((HBITMAP)lpAddBmp->nID, sizeof(BITMAP), (LPVOID)&bmp);
     2228
     2229       hdcImage  = CreateCompatibleDC(0);
     2230       hdcBitmap = CreateCompatibleDC(0);
     2231
     2232       /* create new bitmap */
     2233       hbmLoad = CreateBitmap (bmp.bmWidth, bmp.bmHeight, bmp.bmPlanes, bmp.bmBitsPixel, NULL);
     2234       hOldBitmapBitmap = SelectObject(hdcBitmap, (HBITMAP)lpAddBmp->nID);
     2235       hOldBitmapLoad = SelectObject(hdcImage, hbmLoad);
     2236
     2237       /* Copy the user's image */
     2238       BitBlt (hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight,
     2239               hdcBitmap, 0, 0, SRCCOPY);
     2240
     2241       SelectObject (hdcImage, hOldBitmapLoad);
     2242       SelectObject (hdcBitmap, hOldBitmapBitmap);
     2243       DeleteDC (hdcImage);
     2244       DeleteDC (hdcBitmap);
     2245
     2246       nIndex = ImageList_AddMasked (himlDef, hbmLoad, CLR_DEFAULT);
     2247       DeleteObject (hbmLoad);
    21522248    }
    21532249    else if (lpAddBmp->hInst == HINST_COMMCTRL)
     
    21592255                hbmLoad = LoadBitmapA (COMCTL32_hModule,
    21602256                                       MAKEINTRESOURCEA(IDB_STD_SMALL));
    2161                 nIndex = ImageList_AddMasked (infoPtr->himlDef,
     2257                nIndex = ImageList_AddMasked (himlDef,
    21622258                                              hbmLoad, CLR_DEFAULT);
    21632259                DeleteObject (hbmLoad);
     
    21672263                hbmLoad = LoadBitmapA (COMCTL32_hModule,
    21682264                                       MAKEINTRESOURCEA(IDB_STD_LARGE));
    2169                 nIndex = ImageList_AddMasked (infoPtr->himlDef,
     2265                nIndex = ImageList_AddMasked (himlDef,
    21702266                                              hbmLoad, CLR_DEFAULT);
    21712267                DeleteObject (hbmLoad);
     
    21752271                hbmLoad = LoadBitmapA (COMCTL32_hModule,
    21762272                                       MAKEINTRESOURCEA(IDB_VIEW_SMALL));
    2177                 nIndex = ImageList_AddMasked (infoPtr->himlDef,
     2273                nIndex = ImageList_AddMasked (himlDef,
    21782274                                              hbmLoad, CLR_DEFAULT);
    21792275                DeleteObject (hbmLoad);
     
    21832279                hbmLoad = LoadBitmapA (COMCTL32_hModule,
    21842280                                       MAKEINTRESOURCEA(IDB_VIEW_LARGE));
    2185                 nIndex = ImageList_AddMasked (infoPtr->himlDef,
     2281                nIndex = ImageList_AddMasked (himlDef,
    21862282                                              hbmLoad, CLR_DEFAULT);
    21872283                DeleteObject (hbmLoad);
     
    21912287                hbmLoad = LoadBitmapA (COMCTL32_hModule,
    21922288                                       MAKEINTRESOURCEA(IDB_HIST_SMALL));
    2193                 nIndex = ImageList_AddMasked (infoPtr->himlDef,
     2289                nIndex = ImageList_AddMasked (himlDef,
    21942290                                              hbmLoad, CLR_DEFAULT);
    21952291                DeleteObject (hbmLoad);
     
    21992295                hbmLoad = LoadBitmapA (COMCTL32_hModule,
    22002296                                       MAKEINTRESOURCEA(IDB_HIST_LARGE));
    2201                 nIndex = ImageList_AddMasked (infoPtr->himlDef,
     2297                nIndex = ImageList_AddMasked (himlDef,
    22022298                                              hbmLoad, CLR_DEFAULT);
    22032299                DeleteObject (hbmLoad);
     
    22052301
    22062302            default:
    2207         nIndex = ImageList_GetImageCount (infoPtr->himlDef);
     2303        nIndex = ImageList_GetImageCount (himlDef);
    22082304                ERR ("invalid imagelist!\n");
    22092305                break;
     
    22132309    {
    22142310        hbmLoad = LoadBitmapA (lpAddBmp->hInst, (LPSTR)lpAddBmp->nID);
    2215         nIndex = ImageList_AddMasked (infoPtr->himlDef, hbmLoad, CLR_DEFAULT);
     2311        nIndex = ImageList_AddMasked (himlDef, hbmLoad, CLR_DEFAULT);
    22162312        DeleteObject (hbmLoad);
    22172313    }
     
    22392335    if (nIndex != -1)
    22402336    {
    2241        INT imagecount = ImageList_GetImageCount(infoPtr->himlDef);
     2337       INT imagecount = ImageList_GetImageCount(himlDef);
    22422338
    22432339       if (infoPtr->nNumBitmaps + nButtons != imagecount)
     
    29213017    lpTbb->fsState   = btnPtr->fsState;
    29223018    lpTbb->fsStyle   = btnPtr->fsStyle;
     3019    lpTbb->bReserved[0] = 0;
     3020    lpTbb->bReserved[1] = 0;
    29233021    lpTbb->dwData    = btnPtr->dwData;
    29243022    lpTbb->iString   = btnPtr->iString;
     
    30753173TOOLBAR_GetDisabledImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
    30763174{
    3077     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    3078 
    3079     return (LRESULT)infoPtr->himlDis;
     3175    return (LRESULT)GETDISIMAGELIST(TOOLBAR_GetInfoPtr (hwnd), 0);
    30803176}
    30813177
     
    30933189TOOLBAR_GetHotImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
    30943190{
    3095     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    3096 
    3097     return (LRESULT)infoPtr->himlHot;
     3191    return (LRESULT)GETHOTIMAGELIST(TOOLBAR_GetInfoPtr (hwnd), 0);
    30983192}
    30993193
     
    31153209
    31163210static LRESULT
    3117 TOOLBAR_GetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
    3118 {
    3119     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    3120 
    3121     return (LRESULT)infoPtr->himlDef;
     3211TOOLBAR_GetDefImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
     3212{
     3213    return (LRESULT) GETDEFIMAGELIST(TOOLBAR_GetInfoPtr(hwnd), 0);
    31223214}
    31233215
     
    31683260    lpSize->cy = infoPtr->rcBound.bottom - infoPtr->rcBound.top;
    31693261
    3170     TRACE("maximum size %d x %d\n",
     3262    TRACE("maximum size %ld x %ld\n",
    31713263           infoPtr->rcBound.right - infoPtr->rcBound.left,
    31723264           infoPtr->rcBound.bottom - infoPtr->rcBound.top);
     
    36803772    HBITMAP hBitmap;
    36813773    int i = 0, nOldButtons = 0, pos = 0;
     3774    HIMAGELIST himlDef = 0;
    36823775
    36833776    TRACE("hInstOld %p nIDOld %x hInstNew %p nIDNew %x nButtons %x\n",
     
    37253818    infoPtr->nNumBitmaps = infoPtr->nNumBitmaps - nOldButtons + lpReplace->nButtons;
    37263819
    3727     /* ImageList_Replace(infoPtr->himlDef, pos, hBitmap, NULL); */
    3728 
    3729 
     3820    /* ImageList_Replace(GETDEFIMAGELIST(), pos, hBitmap, NULL); */
     3821
     3822
     3823    himlDef = GETDEFIMAGELIST(infoPtr, 0);
    37303824    for (i = pos + nOldButtons - 1; i >= pos; i--) {
    3731         ImageList_Remove(infoPtr->himlDef, i);
    3732     }
    3733 
    3734     ImageList_AddMasked(infoPtr->himlDef, hBitmap, CLR_DEFAULT);
     3825        ImageList_Remove(himlDef, i);
     3826    }
     3827
     3828    {
     3829       BITMAP  bmp;
     3830       HBITMAP hOldBitmapBitmap, hOldBitmapLoad, hbmLoad;
     3831       HDC     hdcImage, hdcBitmap;
     3832
     3833       /* copy the bitmap before adding it so that the user's bitmap
     3834        * doesn't get modified.
     3835        */
     3836       GetObjectA (hBitmap, sizeof(BITMAP), (LPVOID)&bmp);
     3837
     3838       hdcImage  = CreateCompatibleDC(0);
     3839       hdcBitmap = CreateCompatibleDC(0);
     3840
     3841       /* create new bitmap */
     3842       hbmLoad = CreateBitmap (bmp.bmWidth, bmp.bmHeight, bmp.bmPlanes, bmp.bmBitsPixel, NULL);
     3843       hOldBitmapBitmap = SelectObject(hdcBitmap, hBitmap);
     3844       hOldBitmapLoad = SelectObject(hdcImage, hbmLoad);
     3845
     3846       /* Copy the user's image */
     3847       BitBlt (hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight,
     3848               hdcBitmap, 0, 0, SRCCOPY);
     3849
     3850       SelectObject (hdcImage, hOldBitmapLoad);
     3851       SelectObject (hdcBitmap, hOldBitmapBitmap);
     3852       DeleteDC (hdcImage);
     3853       DeleteDC (hdcBitmap);
     3854
     3855       ImageList_AddMasked (himlDef, hbmLoad, CLR_DEFAULT);
     3856       DeleteObject (hbmLoad);
     3857    }
    37353858
    37363859    InvalidateRect(hwnd, NULL, FALSE);
     
    38163939{
    38173940    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     3941    HIMAGELIST himlDef = GETDEFIMAGELIST(infoPtr, 0);
    38183942
    38193943    if ((LOWORD(lParam) <= 0) || (HIWORD(lParam)<=0))
     
    38293953    infoPtr->nBitmapHeight = (INT)HIWORD(lParam);
    38303954
     3955
    38313956    /* uses image list internals directly */
    3832     if (infoPtr->himlDef) {
    3833         infoPtr->himlDef->cx = infoPtr->nBitmapWidth;
    3834         infoPtr->himlDef->cy = infoPtr->nBitmapHeight;
     3957    if (himlDef) {
     3958        himlDef->cx = infoPtr->nBitmapWidth;
     3959        himlDef->cy = infoPtr->nBitmapHeight;
    38353960    }
    38363961
     
    40204145{
    40214146    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     4147    HIMAGELIST himl = (HIMAGELIST)lParam;
    40224148    HIMAGELIST himlTemp;
    4023 
    4024 
    4025     if (wParam != 0) {
    4026         FIXME("no support for multiple image lists\n");
    4027         return 0;
    4028     }
    4029 
    4030     himlTemp = infoPtr->himlDis;
    4031     infoPtr->himlDis = (HIMAGELIST)lParam;
     4149    INT id = 0;
     4150
     4151    if (infoPtr->iVersion >= 5)
     4152        id = wParam;
     4153
     4154    himlTemp = TOOLBAR_InsertImageList(&infoPtr->himlDis,
     4155        &infoPtr->cimlDis, himl, id);
    40324156
    40334157    /* FIXME: redraw ? */
     
    40814205    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
    40824206    HIMAGELIST himlTemp;
    4083 
    4084     if (wParam != 0) {
    4085         FIXME("no support for multiple image lists\n");
    4086         return 0;
    4087     }
    4088 
    4089     himlTemp = infoPtr->himlHot;
    4090     infoPtr->himlHot = (HIMAGELIST)lParam;
     4207    HIMAGELIST himl = (HIMAGELIST)lParam;
     4208    INT id = 0;
     4209
     4210    if (infoPtr->iVersion >= 5)
     4211        id = wParam;
     4212
     4213    himlTemp = TOOLBAR_InsertImageList(&infoPtr->himlHot,
     4214        &infoPtr->cimlHot, himl, id);
    40914215
    40924216    /* FIXME: redraw ? */
     
    41384262    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    41394263    HIMAGELIST himlTemp;
    4140 
    4141     if (wParam != 0) {
    4142         FIXME("no support for multiple image lists\n");
    4143         return 0;
    4144     }
    4145 
    4146     himlTemp = infoPtr->himlDef;
    4147     infoPtr->himlDef = (HIMAGELIST)lParam;
    4148 
    4149     infoPtr->nNumBitmaps = ImageList_GetImageCount(infoPtr->himlDef);
    4150 
    4151     ImageList_GetIconSize(infoPtr->himlDef, &infoPtr->nBitmapWidth,
     4264    HIMAGELIST himl = (HIMAGELIST)lParam;
     4265    INT i, id = 0;
     4266
     4267    if (infoPtr->iVersion >= 5)
     4268        id = wParam;
     4269
     4270    himlTemp = TOOLBAR_InsertImageList(&infoPtr->himlDef,
     4271        &infoPtr->cimlDef, himl, id);
     4272
     4273    infoPtr->nNumBitmaps = 0;
     4274    for (i = 0; i < infoPtr->cimlDef; i++)
     4275        infoPtr->nNumBitmaps += ImageList_GetImageCount(infoPtr->himlDef[i]->himl);
     4276
     4277    ImageList_GetIconSize(himl, &infoPtr->nBitmapWidth,
    41524278                          &infoPtr->nBitmapHeight);
    41534279    TRACE("hwnd %p, new himl=%08x, count=%d, bitmap w=%d, h=%d\n",
     
    44074533
    44084534    infoPtr->iVersion = iVersion;
     4535
     4536    if (infoPtr->iVersion >= 5)
     4537        TOOLBAR_SetUnicodeFormat(hwnd, (WPARAM)TRUE, (LPARAM)0);
    44094538
    44104539    return iOldVersion;
     
    44974626            GetWindowRect(hwnd, &rc);
    44984627            MapWindowPoints(0, hwndParent, (LPPOINT)&rc, 2);
    4499             TRACE("mapped to (%d,%d)-(%d,%d)\n",
     4628            TRACE("mapped to (%ld,%ld)-(%ld,%ld)\n",
    45004629                rc.left, rc.top, rc.right, rc.bottom);
    45014630            lpsize->cx = max(rc.right-rc.left,
     
    46174746    if (infoPtr->himlInt)
    46184747        ImageList_Destroy (infoPtr->himlInt);
     4748
     4749        TOOLBAR_DeleteImageList(&infoPtr->himlDef, &infoPtr->cimlDef);
     4750        TOOLBAR_DeleteImageList(&infoPtr->himlDis, &infoPtr->cimlDis);
     4751        TOOLBAR_DeleteImageList(&infoPtr->himlHot, &infoPtr->cimlHot);
    46194752
    46204753    /* delete default font */
     
    53125445    hdc = wParam==0 ? BeginPaint(hwnd, &ps) : (HDC)wParam;
    53135446
    5314     TRACE("psrect=(%d,%d)-(%d,%d)\n",
     5447    TRACE("psrect=(%ld,%ld)-(%ld,%ld)\n",
    53155448          ps.rcPaint.left, ps.rcPaint.top,
    53165449          ps.rcPaint.right, ps.rcPaint.bottom);
     
    55685701
    55695702        case TB_GETIMAGELIST:
    5570             return TOOLBAR_GetImageList (hwnd, wParam, lParam);
     5703            return TOOLBAR_GetDefImageList (hwnd, wParam, lParam);
    55715704
    55725705/*      case TB_GETINSERTMARK:                  */ /* 4.71 */
     
    58746007TOOLBAR_Unregister (void)
    58756008{
    5876     UnregisterClassA (TOOLBARCLASSNAMEA, (HINSTANCE)NULL);
    5877 }
     6009    UnregisterClassA (TOOLBARCLASSNAMEA, NULL);
     6010}
     6011
     6012static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id)
     6013{
     6014    HIMAGELIST himlold;
     6015    PIMLENTRY c = NULL;
     6016
     6017    /* Check if the entry already exists */
     6018    c = TOOLBAR_GetImageListEntry(*pies, *cies, id);
     6019
     6020    /* If this is a new entry we must create it and insert into the array */
     6021    if (!c)
     6022    {
     6023        PIMLENTRY *pnies;
     6024
     6025        c = (PIMLENTRY) COMCTL32_Alloc(sizeof(IMLENTRY));
     6026        c->id = id;
     6027
     6028        pnies = COMCTL32_Alloc((*cies + 1) * sizeof(PIMLENTRY));
     6029        memcpy(pnies, *pies, ((*cies) * sizeof(PIMLENTRY)));
     6030        pnies[*cies] = c;
     6031        (*cies)++;
     6032
     6033        COMCTL32_Free(*pies);
     6034        *pies = pnies;
     6035    }
     6036
     6037    himlold = c->himl;
     6038    c->himl = himl;
     6039
     6040    return himlold;
     6041}
     6042
     6043
     6044static VOID TOOLBAR_DeleteImageList(PIMLENTRY **pies, INT *cies)
     6045{
     6046    int i;
     6047
     6048    for (i = 0; i < *cies; i++)
     6049        COMCTL32_Free((*pies)[i]);
     6050
     6051    COMCTL32_Free(*pies);
     6052
     6053    *cies = 0;
     6054    *pies = NULL;
     6055}
     6056
     6057
     6058static PIMLENTRY TOOLBAR_GetImageListEntry(PIMLENTRY *pies, INT cies, INT id)
     6059{
     6060    PIMLENTRY c = NULL;
     6061
     6062    if (pies != NULL)
     6063    {
     6064        int i;
     6065
     6066        for (i = 0; i < cies; i++)
     6067        {
     6068            if (pies[i]->id == id)
     6069            {
     6070                c = pies[i];
     6071                break;
     6072            }
     6073        }
     6074    }
     6075
     6076    return c;
     6077}
     6078
     6079
     6080static HIMAGELIST TOOLBAR_GetImageList(PIMLENTRY *pies, INT cies, INT id)
     6081{
     6082    HIMAGELIST himlDef = 0;
     6083    PIMLENTRY pie = TOOLBAR_GetImageListEntry(pies, cies, id);
     6084
     6085    if (pie)
     6086        himlDef = pie->himl;
     6087
     6088    return himlDef;
     6089}
     6090
     6091
     6092static BOOL TOOLBAR_GetButtonInfo(TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb)
     6093{
     6094    if (infoPtr->bUnicode)
     6095        return TOOLBAR_SendNotify ((NMHDR *) nmtb, infoPtr, TBN_GETBUTTONINFOW);
     6096    else
     6097    {
     6098        CHAR Buffer[256];
     6099        NMTOOLBARA nmtba;
     6100        BOOL bRet = FALSE;
     6101
     6102        nmtba.iItem = nmtb->iItem;
     6103        nmtba.pszText = Buffer;
     6104        nmtba.cchText = 256;
     6105        ZeroMemory(nmtba.pszText, nmtba.cchText);
     6106
     6107        if (TOOLBAR_SendNotify ((NMHDR *) &nmtba, infoPtr, TBN_GETBUTTONINFOA))
     6108        {
     6109            int ccht = strlen(nmtba.pszText);
     6110            if (ccht)
     6111               MultiByteToWideChar(CP_ACP, 0, (LPCSTR)nmtba.pszText, -1,
     6112                  nmtb->pszText, nmtb->cchText);
     6113
     6114            memcpy(&nmtb->tbButton, &nmtba.tbButton, sizeof(TBBUTTON));
     6115            bRet = TRUE;
     6116        }
     6117
     6118        return bRet;
     6119    }
     6120}
     6121
     6122
     6123static BOOL TOOLBAR_IsButtonRemovable(TOOLBAR_INFO *infoPtr,
     6124        int iItem, PCUSTOMBUTTON btnInfo)
     6125{
     6126    NMTOOLBARA nmtb;
     6127
     6128    nmtb.iItem = iItem;
     6129    memcpy(&nmtb.tbButton, &btnInfo->btn, sizeof(TBBUTTON));
     6130
     6131    return TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_QUERYDELETE);
     6132}
  • trunk/src/comctl32/tooltips.c

    r9370 r10098  
    21022102        return 0;
    21032103
    2104 #ifdef __WIN32OS2__
    21052104    if(infoPtr->hFont) DeleteObject (infoPtr->hFont);
    2106 #endif
    21072105
    21082106    infoPtr->hFont = CreateFontIndirectW(&lf);
Note: See TracChangeset for help on using the changeset viewer.