- Timestamp:
- May 15, 2003, 4:26:27 PM (22 years ago)
- 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.2 8 2003-04-09 11:58:39sandervl Exp $1 ; $Id: comctl32.def,v 1.29 2003-05-15 14:26:27 sandervl Exp $ 2 2 LIBRARY COMCTL32 INITINSTANCE 3 3 DESCRIPTION 'Odin32 System DLL - ComCtl32 - Common Controls Library' … … 103 103 104 104 CreateMRUListA = _CreateMRUListA@4 @151 105 ; ordinals????106 105 FreeMRUList = _FreeMRUList@4 @152 107 106 AddMRUStringA = _AddMRUStringA@8 @153 … … 160 159 StrCmpNIW = _COMCTL32_StrCmpNIW@12 @361 161 160 StrStrW = _COMCTL32_StrStrW@8 @362 162 ;StrStrIW@363161 StrStrIW = _COMCTL32_StrStrIW@8 @363 163 162 StrSpnW = _COMCTL32_StrSpnW@8 @364 164 163 StrToIntW = _COMCTL32_StrToIntW@4 @365 … … 191 190 CreateMRUListLazyW = _CreateMRUListLazyW@16 @404 192 191 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 197 197 _COMCTL32_415@20 @415 NONAME 198 198 … … 201 201 202 202 203 ; These are only available in comctrl 6204 DefSubclassProc = _DefSubclassProc@16 @500205 GetWindowSubclass = _GetWindowSubclass@16 @501206 RemoveWindowSubclass = _RemoveWindowSubclass@12 @502207 SetWindowSubclass = _SetWindowSubclass@16 @503208 -
trunk/src/comctl32/comctl32dbg.def
r9998 r10098 1 ; $Id: comctl32dbg.def,v 1. 4 2003-04-09 11:58:40sandervl Exp $1 ; $Id: comctl32dbg.def,v 1.5 2003-05-15 14:26:27 sandervl Exp $ 2 2 LIBRARY COMCTL32 INITINSTANCE 3 3 DESCRIPTION 'Odin32 System DLL - ComCtl32 - Common Controls Library' … … 103 103 104 104 CreateMRUListA = _DbgCreateMRUListA@4 @151 105 ; ordinals????106 105 FreeMRUList = _DbgFreeMRUList@4 @152 107 106 AddMRUStringA = _DbgAddMRUStringA@8 @153 … … 157 156 StrCmpNIW = _DbgCOMCTL32_StrCmpNIW@12 @361 158 157 StrStrW = _DbgCOMCTL32_StrStrW@8 @362 159 ;StrStrIW@363158 StrStrIW = _DbgCOMCTL32_StrStrIW@8 @363 160 159 StrSpnW = _DbgCOMCTL32_StrSpnW@8 @364 161 160 StrToIntW = _DbgCOMCTL32_StrToIntW@4 @365 … … 188 187 CreateMRUListLazyW = _DbgCreateMRUListLazyW@16 @404 189 188 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 194 194 _COMCTL32_415@20 @415 NONAME 195 195 … … 197 197 _COMCTL32_419@16 @419 NONAME 198 198 199 ; These are only available in comctrl 6200 DefSubclassProc = _DefSubclassProc@16 @500201 GetWindowSubclass = _GetWindowSubclass@16 @501202 RemoveWindowSubclass = _RemoveWindowSubclass@12 @502203 SetWindowSubclass = _SetWindowSubclass@16 @503 -
trunk/src/comctl32/initcomctl32.cpp
r10097 r10098 1 /* $Id: initcomctl32.cpp,v 1. 5 2003-05-15 14:25:13sandervl Exp $ */1 /* $Id: initcomctl32.cpp,v 1.6 2003-05-15 14:26:27 sandervl Exp $ */ 2 2 /* 3 3 * COMCTL32 DLL entry point -
trunk/src/comctl32/makefile
r10097 r10098 1 # $Id: makefile,v 1. 39 2003-05-15 14:25:14sandervl Exp $1 # $Id: makefile,v 1.40 2003-05-15 14:26:27 sandervl Exp $ 2 2 3 3 # -
trunk/src/comctl32/monthcal.c
r6709 r10098 8 8 * Copyright 2000 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> 9 9 * 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 * 10 24 * TODO: 11 25 * - Notifications. … … 13 27 * 14 28 * FIXME: handle resources better (doesn't work now); also take care 15 of internationalization. 29 of internationalization. 16 30 * FIXME: keyboard handling. 17 31 */ 18 19 #ifdef __WIN32OS2__20 #include <odin.h>21 #include <string.h>22 #define inline23 #endif24 32 25 33 #include <math.h> … … 35 43 #include "commctrl.h" 36 44 #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 47 WINE_DEFAULT_DEBUG_CHANNEL(monthcal); 44 48 45 49 #define MC_SEL_LBUTUP 1 /* Left button released */ … … 51 55 /* to the next month */ 52 56 #define MC_NEXTMONTHTIMER 1 /* Timer ID's */ 53 #define MC_PREVMONTHTIMER 2 57 #define MC_PREVMONTHTIMER 2 54 58 55 59 typedef struct 56 60 { 57 #ifdef __WIN32OS2__58 COMCTL32_HEADER header;59 #endif60 61 COLORREF bk; 61 62 COLORREF txt; … … 91 92 SYSTEMTIME minDate; 92 93 SYSTEMTIME maxDate; 93 94 94 95 RECT rcClient; /* rect for whole client area */ 95 96 RECT rcDraw; /* rect for drawable portion of client area */ 96 97 RECT title; /* rect for the header above the calendar */ 97 98 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 */ 99 100 RECT titlemonth; /* the `month name' txt in the header */ 100 101 RECT titleyear; /* the `year number' txt in the header */ … … 121 122 { 122 123 const int mdays[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0}; 123 /*Wrap around, this eases handl eing*/124 /*Wrap around, this eases handling*/ 124 125 if(month == 0) 125 126 month = 12; … … 141 142 142 143 /* make sure that time is valid */ 143 static int MONTHCAL_ValidateTime(SYSTEMTIME time) 144 static int MONTHCAL_ValidateTime(SYSTEMTIME time) 144 145 { 145 146 if(time.wMonth > 12) return FALSE; … … 156 157 157 158 158 void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) 159 void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) 159 160 { 160 161 to->wYear = from->wYear; … … 169 170 170 171 171 /* Note:Depending on DST, this may be offset by a day. 172 /* Note:Depending on DST, this may be offset by a day. 172 173 Need to find out if we're on a DST place & adjust the clock accordingly. 173 174 Above function assumes we have a valid data. … … 182 183 year-=(month < 3); 183 184 184 return((year + year/4 - year/100 + year/400 + 185 return((year + year/4 - year/100 + year/400 + 185 186 DayOfWeekTable[month-1] + day - 1 ) % 7); 186 187 } … … 189 190 and day in the calendar. day== 0 mean the last day of tha last month 190 191 */ 191 static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y, 192 int *daypos,int *weekpos) 192 static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y, 193 int *daypos,int *weekpos) 193 194 { 194 195 int retval, firstDay; … … 202 203 *daypos = (x - infoPtr->days.left ) / infoPtr->width_increment; 203 204 *weekpos = (y - infoPtr->days.top ) / infoPtr->height_increment; 204 205 205 206 firstDay = (MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear)+6 - infoPtr->firstDay)%7; 206 207 retval = *daypos + (7 * *weekpos) - firstDay; … … 211 212 /* sets x and y to be the position of the day */ 212 213 /* x == day, y == week where(0,0) == firstDay, 1st week */ 213 static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month, 214 static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month, 214 215 int *x, int *y) 215 216 { … … 227 228 if(prevMonth==0) 228 229 prevMonth = 12; 229 230 230 231 *x = (MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) - firstDay) % 7; 231 232 *y = 0; … … 240 241 241 242 /* x: column(day), y: row(week) */ 242 static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y) 243 static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y) 243 244 { 244 245 r->left = infoPtr->days.left + x * infoPtr->width_increment; … … 252 253 /* day is the day value of the month(1 == 1st), month is the month */ 253 254 /* value(january == 1, december == 12) */ 254 static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr, 255 static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr, 255 256 int day, int month, RECT *r) 256 257 { … … 278 279 x = day_rect.left; 279 280 y = day_rect.top; 280 281 281 282 points[0].x = x; 282 283 points[0].y = y - 1; … … 287 288 points[3].x = x + infoPtr->width_increment; 288 289 points[3].y = y + 0.5 * infoPtr->height_increment; 289 290 290 291 points[4].x = x + infoPtr->width_increment; 291 292 points[4].y = y + 0.9 * infoPtr->height_increment; … … 295 296 points[6].y = y + 0.9 * infoPtr->height_increment; /* bring the bottom up just 296 297 a hair to fit inside the day rectangle */ 297 298 298 299 points[7].x = x + 0.2 * infoPtr->width_increment; 299 300 points[7].y = y + 0.8 * infoPtr->height_increment; … … 309 310 points[12].x = x + 0.4 * infoPtr->width_increment; 310 311 points[12].y = y + 0.2 * infoPtr->height_increment; 311 312 312 313 PolyBezier(hdc, points, 13); 313 314 DeleteObject(hRedPen); … … 329 330 sprintf(buf, "%d", day); 330 331 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. 332 333 * 1<day<31, so evertyhing's OK. 333 334 */ … … 341 342 342 343 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); 344 345 oldCol = SetTextColor(hdc, infoPtr->monthbk); 345 346 oldBk = SetBkColor(hdc, infoPtr->trailingtxt); … … 390 391 391 392 /* CHECKME: For `todays date', do we need to check the locale?*/ 392 static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps) 393 static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps) 393 394 { 394 395 MONTHCAL_INFO *infoPtr=MONTHCAL_GetInfoPtr(hwnd); … … 425 426 hbr = CreateSolidBrush (infoPtr->bk); 426 427 FillRect(hdc, rcClient, hbr); 427 DeleteObject(hbr); 428 DeleteObject(hbr); 428 429 429 430 /* draw header */ … … 434 435 DeleteObject(hbr); 435 436 } 436 437 437 438 /* if the previous button is pressed draw it depressed */ 438 439 if(IntersectRect(&rcTemp, &(ps->rcPaint), prev)) 439 { 440 { 440 441 if((infoPtr->status & MC_PREVPRESSED)) 441 442 DrawFrameControl(hdc, prev, DFC_SCROLL, … … 447 448 } 448 449 449 /* if next button is depressed draw it depressed */ 450 /* if next button is depressed draw it depressed */ 450 451 if(IntersectRect(&rcTemp, &(ps->rcPaint), next)) 451 452 { … … 466 467 titlemonth->left = title->left; 467 468 titlemonth->right = title->right; 468 469 469 470 GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1, 470 471 buf1,sizeof(buf1)); 471 472 sprintf(buf, "%s %ld", buf1, infoPtr->currentYear); 472 473 473 474 if(IntersectRect(&rcTemp, &(ps->rcPaint), titlemonth)) 474 475 { 475 DrawTextA(hdc, buf, strlen(buf), titlemonth, 476 DrawTextA(hdc, buf, strlen(buf), titlemonth, 476 477 DT_CENTER | DT_VCENTER | DT_SINGLELINE); 477 478 } … … 481 482 /* titlemonth left/right contained rect for whole titletxt('June 1999') 482 483 * 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) 484 485 */ 485 486 GetTextExtentPoint32A(hdc, buf, strlen(buf), &size); … … 489 490 titlemonth->right = titlemonth->left + size.cx; 490 491 titleyear->left = titlemonth->right; 491 492 492 493 /* draw month area */ 493 494 rcTemp.top=infoPtr->wdays.top; … … 501 502 DeleteObject(hbr); 502 503 } 503 504 504 505 /* draw line under day abbreviatons */ 505 506 506 507 MoveToEx(hdc, infoPtr->days.left + 3, title->bottom + textHeight + 1, NULL); 507 508 508 509 LineTo(hdc, rcDraw->right - 3, title->bottom + textHeight + 1); 509 510 510 511 prevMonth = infoPtr->currentMonth - 1; 511 512 if(prevMonth == 0) /* if currentMonth is january(1) prevMonth is */ … … 537 538 538 539 /* draw day numbers; first, the previous month */ 539 540 540 541 firstDay = MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear); 541 542 day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) + 542 543 day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) + 543 544 (infoPtr->firstDay + 7 - firstDay)%7 + 1; 544 545 if (day > MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear)) … … 553 554 if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) 554 555 { 555 MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0, 556 MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0, 556 557 infoPtr->monthdayState[m] & mask); 557 558 } … … 577 578 { 578 579 579 MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0, 580 MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0, 580 581 infoPtr->monthdayState[m] & mask); 581 582 … … 595 596 j = 1; /* move to the 2nd week of the current month */ 596 597 i = 0; /* move back to sunday */ 597 while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) { 598 while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) { 598 599 MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j); 599 600 if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) … … 604 605 if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) && 605 606 (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)) 608 609 MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth); 609 610 } … … 627 628 MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j); 628 629 if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) 629 { 630 { 630 631 MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth + 1, i, j, 631 632 infoPtr->monthdayState[m] & mask); … … 634 635 mask<<=1; 635 636 day++; 636 i++; 637 i++; 637 638 if(i==7) { /* past saturday, go to next week's sunday */ 638 639 i = 0; … … 650 651 if(!(dwStyle & MCS_NOTODAYCIRCLE)) { 651 652 /*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), 654 655 infoPtr->currentMonth); 655 656 offset+=textWidth; … … 674 675 } 675 676 676 /*eventually draw week numbers*/ 677 /*eventually draw week numbers*/ 677 678 if(dwStyle & MCS_WEEKNUMBERS) { 678 679 /* display weeknumbers*/ … … 682 683 LOCALE_IFIRSTWEEKOFYEAR == 0 (e.g US?): 683 684 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): 685 686 First week of year must contain 4 days of the new year 686 687 LOCALE_IFIRSTWEEKOFYEAR == 1 (what contries?) … … 704 705 /* calculate all those exceptions for january */ 705 706 weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear); 706 if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays) 707 if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays) 707 708 weeknum =1; 708 709 else 709 710 { 710 711 weeknum = 0; 711 for(i=0; i<11; i++) 712 for(i=0; i<11; i++) 712 713 weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear-1); 713 714 weeknum +=startofprescal+ 7; … … 721 722 { 722 723 weeknum = 0; 723 for(i=0; i<prevMonth-1; i++) 724 for(i=0; i<prevMonth-1; i++) 724 725 weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear); 725 726 weeknum +=startofprescal+ 7; … … 749 750 days->bottom+=infoPtr->height_increment; 750 751 } 751 752 752 753 MoveToEx(hdc, infoPtr->weeknums.right, infoPtr->weeknums.top + 3 , NULL); 753 754 LineTo(hdc, infoPtr->weeknums.right, infoPtr->weeknums.bottom ); 754 755 755 756 } 756 757 /* currentFont was font at entering Refresh */ 757 758 758 759 SetBkColor(hdc, oldBkColor); 759 SelectObject(hdc, currentFont); 760 SelectObject(hdc, currentFont); 760 761 SetTextColor(hdc, oldTextColor); 761 762 } 762 763 763 764 764 static LRESULT 765 static LRESULT 765 766 MONTHCAL_GetMinReqRect(HWND hwnd, WPARAM wParam, LPARAM lParam) 766 767 { … … 768 769 LPRECT lpRect = (LPRECT) lParam; 769 770 TRACE("%x %lx\n", wParam, lParam); 770 771 771 772 /* validate parameters */ 772 773 … … 781 782 782 783 783 static LRESULT 784 static LRESULT 784 785 MONTHCAL_GetColor(HWND hwnd, WPARAM wParam, LPARAM lParam) 785 786 { … … 807 808 808 809 809 static LRESULT 810 static LRESULT 810 811 MONTHCAL_SetColor(HWND hwnd, WPARAM wParam, LPARAM lParam) 811 812 { … … 847 848 848 849 849 static LRESULT 850 static LRESULT 850 851 MONTHCAL_GetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam) 851 852 { … … 853 854 854 855 TRACE("%x %lx\n", wParam, lParam); 855 856 856 857 if(infoPtr->delta) 857 858 return infoPtr->delta; … … 861 862 862 863 863 static LRESULT 864 static LRESULT 864 865 MONTHCAL_SetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam) 865 866 { … … 868 869 869 870 TRACE("%x %lx\n", wParam, lParam); 870 871 871 872 infoPtr->delta = (int)wParam; 872 873 return prev; … … 874 875 875 876 876 static LRESULT 877 static LRESULT 877 878 MONTHCAL_GetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam) 878 879 { 879 880 MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); 880 881 881 882 return infoPtr->firstDay; 882 883 } … … 887 888 /* FIXME: this needs to be implemented properly in MONTHCAL_Refresh() */ 888 889 /* FIXME: we need more error checking here */ 889 static LRESULT 890 static LRESULT 890 891 MONTHCAL_SetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam) 891 892 { … … 916 917 /* FIXME: fill this in */ 917 918 static LRESULT 918 MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 919 MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 919 920 { 920 921 MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); … … 937 938 938 939 /* FIXME: are validated times taken from current date/time or simply 939 * copied? 940 * copied? 940 941 * FIXME: check whether MCM_GETMONTHRANGE shows correct result after 941 942 * adjusting range with MCM_SETRANGE … … 950 951 951 952 TRACE("%x %lx\n", wParam, lParam); 952 953 953 954 if(wParam & GDTR_MAX) { 954 955 if(MONTHCAL_ValidateTime(lprgSysTimeArray[1])){ … … 973 974 infoPtr->monthRange = infoPtr->maxDate.wMonth - infoPtr->minDate.wMonth; 974 975 975 if(infoPtr->monthRange!=prev) { 976 COMCTL32_ReAlloc(infoPtr->monthdayState,977 976 if(infoPtr->monthRange!=prev) { 977 infoPtr->monthdayState = COMCTL32_ReAlloc(infoPtr->monthdayState, 978 infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 978 979 } 979 980 … … 983 984 984 985 /* 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 986 987 * SetRange. Is this the right behavior? 987 988 */ … … 1015 1016 if(iMonths!=infoPtr->monthRange) return 0; 1016 1017 1017 for(i=0; i<iMonths; i++) 1018 for(i=0; i<iMonths; i++) 1018 1019 infoPtr->monthdayState[i] = dayStates[i]; 1019 1020 return 1; 1020 1021 } 1021 1022 1022 static LRESULT 1023 static LRESULT 1023 1024 MONTHCAL_GetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam) 1024 1025 { … … 1036 1037 /* FIXME: if the specified date is not visible, make it visible */ 1037 1038 /* FIXME: redraw? */ 1038 static LRESULT 1039 static LRESULT 1039 1040 MONTHCAL_SetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam) 1040 1041 { … … 1057 1058 1058 1059 1059 static LRESULT 1060 static LRESULT 1060 1061 MONTHCAL_GetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam) 1061 1062 { … … 1067 1068 1068 1069 1069 static LRESULT 1070 static LRESULT 1070 1071 MONTHCAL_SetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam) 1071 1072 { … … 1081 1082 1082 1083 1083 static LRESULT 1084 static LRESULT 1084 1085 MONTHCAL_GetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 1085 1086 { … … 1100 1101 return TRUE; 1101 1102 } 1102 1103 1103 1104 return FALSE; 1104 1105 } 1105 1106 1106 1107 1107 static LRESULT 1108 static LRESULT 1108 1109 MONTHCAL_SetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 1109 1110 { … … 1124 1125 return TRUE; 1125 1126 } 1126 1127 1127 1128 return FALSE; 1128 1129 } 1129 1130 1130 1131 1131 static LRESULT 1132 static LRESULT 1132 1133 MONTHCAL_GetToday(HWND hwnd, WPARAM wParam, LPARAM lParam) 1133 1134 { … … 1145 1146 1146 1147 1147 static LRESULT 1148 static LRESULT 1148 1149 MONTHCAL_SetToday(HWND hwnd, WPARAM wParam, LPARAM lParam) 1149 1150 { … … 1170 1171 DWORD retval; 1171 1172 int day,wday,wnum; 1172 1173 1173 1174 1174 1175 x = lpht->pt.x; 1175 1176 y = lpht->pt.y; 1176 1177 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, 1181 1182 infoPtr->wdays.left, infoPtr->wdays.right, 1182 1183 infoPtr->wdays.top, infoPtr->wdays.bottom, … … 1190 1191 1191 1192 /* are we in the header? */ 1192 1193 1193 1194 if(PtInRect(&infoPtr->title, lpht->pt)) { 1194 1195 if(PtInRect(&infoPtr->titlebtnprev, lpht->pt)) { … … 1208 1209 goto done; 1209 1210 } 1210 1211 1211 1212 retval = MCHT_TITLE; 1212 1213 goto done; 1213 1214 } 1214 1215 1215 1216 day = MONTHCAL_CalcDayFromPos(infoPtr,x,y,&wday,&wnum); 1216 1217 if(PtInRect(&infoPtr->wdays, lpht->pt)) { … … 1218 1219 lpht->st.wYear = infoPtr->currentYear; 1219 1220 lpht->st.wMonth = (day < 1)? infoPtr->currentMonth -1 : infoPtr->currentMonth; 1220 lpht->st.wDay = (day < 1)? 1221 lpht->st.wDay = (day < 1)? 1221 1222 MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : day; 1222 1223 goto done; 1223 1224 } 1224 if(PtInRect(&infoPtr->weeknums, lpht->pt)) { 1225 retval = MCHT_CALENDARWEEKNUM; 1225 if(PtInRect(&infoPtr->weeknums, lpht->pt)) { 1226 retval = MCHT_CALENDARWEEKNUM; 1226 1227 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)) ? 1229 1230 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)) ? 1233 1234 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)) 1237 1238 { 1238 1239 lpht->st.wYear = infoPtr->currentYear; 1239 if ( day < 1) 1240 if ( day < 1) 1240 1241 { 1241 1242 retval = MCHT_CALENDARDATEPREV; … … 1267 1268 } 1268 1269 if(PtInRect(&infoPtr->todayrect, lpht->pt)) { 1269 retval = MCHT_TODAYLINK; 1270 retval = MCHT_TODAYLINK; 1270 1271 goto done; 1271 1272 } 1272 1273 1273 1274 1274 1275 /* Hit nothing special? What's left must be background :-) */ 1275 1276 retval = MCHT_CALENDARBK; 1277 done: 1276 1277 retval = MCHT_CALENDARBK; 1278 done: 1278 1279 lpht->uHit = retval; 1279 1280 return retval; … … 1331 1332 nmds.nmhdr.code = MCN_GETDAYSTATE; 1332 1333 nmds.cDayState = infoPtr->monthRange; 1333 nmds.prgDayState = COMCTL32_Alloc 1334 nmds.prgDayState = COMCTL32_Alloc 1334 1335 (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 1335 1336 … … 1348 1349 POINT menupoint; 1349 1350 char buf[32]; 1350 1351 1351 1352 hMenu = CreatePopupMenu(); 1352 1353 if (!LoadStringA(COMCTL32_hModule,IDM_GOTODAY,buf,sizeof(buf))) … … 1365 1366 infoPtr->currentYear=infoPtr->todaysDate.wYear; 1366 1367 InvalidateRect(hwnd, NULL, FALSE); 1367 } 1368 } 1368 1369 return 0; 1369 1370 } … … 1381 1382 POINT menupoint; 1382 1383 TRACE("%x %lx\n", wParam, lParam); 1383 1384 1384 1385 if (infoPtr->hWndYearUpDown) 1385 1386 { … … 1399 1400 InvalidateRect(hwnd, NULL, FALSE); 1400 1401 } 1401 1402 1402 1403 ht.pt.x = (INT)LOWORD(lParam); 1403 1404 ht.pt.y = (INT)HIWORD(lParam); … … 1414 1415 return TRUE; 1415 1416 } 1416 if(hit == MCHT_TITLEBTNPREV){ 1417 if(hit == MCHT_TITLEBTNPREV){ 1417 1418 MONTHCAL_GoToPrevMonth(hwnd, infoPtr); 1418 1419 infoPtr->status = MC_PREVPRESSED; … … 1424 1425 if(hit == MCHT_TITLEMONTH) { 1425 1426 hMenu = CreatePopupMenu(); 1426 1427 1427 1428 for (i=0; i<12;i++) 1428 1429 { … … 1451 1452 infoPtr->textHeight, 1452 1453 hwnd, 1453 (HMENU)NULL,1454 (HINSTANCE)NULL,1454 NULL, 1455 NULL, 1455 1456 NULL); 1456 1457 infoPtr->hWndYearUpDown=CreateWindowExA(0, … … 1462 1463 infoPtr->textHeight, 1463 1464 hwnd, 1464 (HMENU)NULL,1465 (HINSTANCE)NULL,1465 NULL, 1466 NULL, 1466 1467 NULL); 1467 1468 SendMessageA( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753)); … … 1469 1470 SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)infoPtr->currentYear ); 1470 1471 return TRUE; 1471 1472 1472 1473 } 1473 1474 if(hit == MCHT_TODAYLINK) { … … 1487 1488 MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel); 1488 1489 MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel); 1489 1490 1490 1491 SendMessageA(GetParent(hwnd), WM_NOTIFY, 1491 1492 (WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc); … … 1493 1494 MONTHCAL_CopyTime(&ht.st, &selArray[0]); 1494 1495 MONTHCAL_CopyTime(&ht.st, &selArray[1]); 1495 MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray); 1496 MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray); 1496 1497 1497 1498 /* redraw both old and new days if the selected day changed */ … … 1546 1547 return TRUE; 1547 1548 } 1548 if(hit == MCHT_CALENDARDATEPREV){ 1549 if(hit == MCHT_CALENDARDATEPREV){ 1549 1550 MONTHCAL_GoToPrevMonth(hwnd, infoPtr); 1550 1551 InvalidateRect(hwnd, NULL, FALSE); … … 1554 1555 nmhdr.idFrom = GetWindowLongA( hwnd, GWL_ID); 1555 1556 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)); 1557 1558 1558 1559 SendMessageA(GetParent(hwnd), WM_NOTIFY, … … 1564 1565 MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel); 1565 1566 MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel); 1566 1567 1567 1568 SendMessageA(GetParent(hwnd), WM_NOTIFY, 1568 1569 (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc); 1569 1570 1570 1571 /* redraw if necessary */ 1571 1572 if(redraw) 1572 1573 InvalidateRect(hwnd, NULL, FALSE); 1573 1574 1574 1575 return 0; 1575 1576 } … … 1586 1587 1587 1588 switch(wParam) { 1588 case MC_NEXTMONTHTIMER: 1589 case MC_NEXTMONTHTIMER: 1589 1590 redraw = TRUE; 1590 1591 MONTHCAL_GoToNextMonth(hwnd, infoPtr); … … 1618 1619 ht.pt.x = LOWORD(lParam); 1619 1620 ht.pt.y = HIWORD(lParam); 1620 1621 1621 1622 hit = MONTHCAL_HitTest(hwnd, (LPARAM)&ht); 1622 1623 1623 1624 /* not on the calendar date numbers? bail out */ 1624 1625 TRACE("hit:%x\n",hit); … … 1638 1639 if(infoPtr->firstSelDay==selArray[0].wDay) i=1; 1639 1640 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) { 1641 1642 /* 1st time we get here: selArray[0]=selArray[1]) */ 1642 1643 /* if we're still at the first selected date, return */ … … 1644 1645 if(selday<infoPtr->firstSelDay) i = 0; 1645 1646 } 1646 1647 1647 1648 if(abs(infoPtr->firstSelDay - selday) >= infoPtr->maxSelCount) { 1648 1649 if(selday>infoPtr->firstSelDay) … … 1651 1652 selday = infoPtr->firstSelDay - infoPtr->maxSelCount; 1652 1653 } 1653 1654 1654 1655 if(selArray[i].wDay!=selday) { 1655 1656 TRACE("newRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i); 1656 1657 1657 1658 selArray[i].wDay = selday; 1658 1659 … … 1712 1713 { 1713 1714 TRACE("\n"); 1714 1715 1715 1716 InvalidateRect(hwnd, NULL, FALSE); 1716 1717 … … 1769 1770 1770 1771 /* 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 1773 1774 */ 1774 1775 if(dwStyle & MCS_WEEKNUMBERS) … … 1776 1777 else 1777 1778 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; 1780 1781 infoPtr->left_offset = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) - (infoPtr->width_increment * xdiv); 1781 1782 infoPtr->top_offset = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) - (infoPtr->height_increment * 10.0); … … 1790 1791 rcDraw->bottom = rcDraw->top + 9 * infoPtr->textHeight + 5; 1791 1792 }*/ 1792 1793 1793 1794 /* calculate title area */ 1794 1795 title->top = rcClient->top; … … 1805 1806 next->right = title->right - 6; 1806 1807 next->left = next->right - (title->bottom - title->top); 1807 1808 1808 1809 /* titlemonth->left and right change based upon the current month */ 1809 1810 /* and are recalculated in refresh as the current month may change */ … … 1811 1812 titlemonth->top = titleyear->top = title->top + (infoPtr->height_increment)/2; 1812 1813 titlemonth->bottom = titleyear->bottom = title->bottom - (infoPtr->height_increment)/2; 1813 1814 1814 1815 /* setup the dimensions of the rectangle we draw the names of the */ 1815 1816 /* days of the week in */ 1816 1817 weeknumrect->left =infoPtr->left_offset; 1817 if(dwStyle & MCS_WEEKNUMBERS) 1818 if(dwStyle & MCS_WEEKNUMBERS) 1818 1819 weeknumrect->right=prev->right; 1819 1820 else … … 1823 1824 wdays->top = title->bottom ; 1824 1825 wdays->bottom = wdays->top + infoPtr->height_increment; 1825 1826 1826 1827 days->top = weeknumrect->top = wdays->bottom ; 1827 1828 days->bottom = weeknumrect->bottom = days->top + 6 * infoPtr->height_increment; 1828 1829 1829 1830 todayrect->left = rcClient->left; 1830 1831 todayrect->right = rcClient->right; … … 1832 1833 todayrect->bottom = days->bottom + infoPtr->height_increment; 1833 1834 1834 /* uncomment for excessive debugging 1835 /* uncomment for excessive debugging 1835 1836 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", 1836 1837 infoPtr->width_increment,infoPtr->height_increment, … … 1841 1842 todayrect->left,todayrect->right,todayrect->top,todayrect->bottom); 1842 1843 */ 1843 1844 1844 1845 /* restore the originally selected font */ 1845 SelectObject(hdc, currentFont); 1846 SelectObject(hdc, currentFont); 1846 1847 1847 1848 ReleaseDC(hwnd, hdc); … … 1850 1851 static LRESULT MONTHCAL_Size(HWND hwnd, int Width, int Height) 1851 1852 { 1852 TRACE("(hwnd=% x, width=%d, height=%d)\n", hwnd, Width, Height);1853 TRACE("(hwnd=%p, width=%d, height=%d)\n", hwnd, Width, Height); 1853 1854 1854 1855 MONTHCAL_UpdateSize(hwnd); … … 1868 1869 1869 1870 /* allocate memory for info structure */ 1870 #ifdef __WIN32OS2__1871 infoPtr =(MONTHCAL_INFO*)initControl(hwnd,sizeof(MONTHCAL_INFO));1872 #else1873 1871 infoPtr =(MONTHCAL_INFO*)COMCTL32_Alloc(sizeof(MONTHCAL_INFO)); 1874 #endif1875 1872 SetWindowLongA(hwnd, 0, (DWORD)infoPtr); 1876 1873 … … 1900 1897 infoPtr->maxSelCount = 7; 1901 1898 infoPtr->monthRange = 3; 1902 infoPtr->monthdayState = COMCTL32_Alloc 1899 infoPtr->monthdayState = COMCTL32_Alloc 1903 1900 (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 1904 1901 infoPtr->titlebk = GetSysColor(COLOR_ACTIVECAPTION); … … 1923 1920 1924 1921 /* free month calendar info data */ 1922 if(infoPtr->monthdayState) 1923 COMCTL32_Free(infoPtr->monthdayState); 1925 1924 COMCTL32_Free(infoPtr); 1926 1925 SetWindowLongA(hwnd, 0, 0); … … 1932 1931 MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 1933 1932 { 1934 TRACE("hwnd=% xmsg=%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); 1935 1934 if (!MONTHCAL_GetInfoPtr(hwnd) && (uMsg != WM_CREATE)) 1936 1935 return DefWindowProcA(hwnd, uMsg, wParam, lParam); … … 2037 2036 2038 2037 default: 2039 if (uMsg >= WM_USER)2038 if ((uMsg >= WM_USER) && (uMsg < WM_APP)) 2040 2039 ERR( "unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); 2041 #ifdef __WIN32OS2__2042 return defComCtl32ProcA(hwnd, uMsg, wParam, lParam);2043 #else2044 2040 return DefWindowProcA(hwnd, uMsg, wParam, lParam); 2045 #endif2046 2041 } 2047 2042 return 0; … … 2062 2057 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 2063 2058 wndClass.lpszClassName = MONTHCAL_CLASSA; 2064 2059 2065 2060 RegisterClassA(&wndClass); 2066 2061 } … … 2070 2065 MONTHCAL_Unregister(void) 2071 2066 { 2072 UnregisterClassA(MONTHCAL_CLASSA, (HINSTANCE)NULL);2073 } 2067 UnregisterClassA(MONTHCAL_CLASSA, NULL); 2068 } -
trunk/src/comctl32/nativefont.c
r8382 r10098 124 124 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 125 125 wndClass.lpszClassName = WC_NATIVEFONTCTLA; 126 126 127 127 RegisterClassA (&wndClass); 128 128 } … … 132 132 NATIVEFONT_Unregister (void) 133 133 { 134 UnregisterClassA (WC_NATIVEFONTCTLA, (HINSTANCE)NULL);134 UnregisterClassA (WC_NATIVEFONTCTLA, NULL); 135 135 } 136 -
trunk/src/comctl32/pager.c
r9370 r10098 837 837 838 838 /* set default settings */ 839 infoPtr->hwndChild = (HWND)NULL;839 infoPtr->hwndChild = NULL; 840 840 infoPtr->bNoResize = dwStyle & CCS_NORESIZE; 841 841 infoPtr->clrBk = GetSysColor(COLOR_BTNFACE); … … 898 898 DefWindowProcA (hwnd, WM_NCCALCSIZE, wParam, lParam); 899 899 900 TRACE("orig rect=(% d,%d)-(%d,%d)\n",900 TRACE("orig rect=(%ld,%ld)-(%ld,%ld)\n", 901 901 lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); 902 902 … … 913 913 scrollRange = infoPtr->nWidth - (rcmyw.right - rcmyw.left); 914 914 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", 916 916 infoPtr->nPos, scrollRange, infoPtr->nHeight, 917 917 rcmyw.left, rcmyw.top, … … 927 927 rbrc = wnrc; 928 928 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", 930 930 ltrc.left, ltrc.top, ltrc.right, ltrc.bottom, 931 931 rbrc.left, rbrc.top, rbrc.right, rbrc.bottom); … … 962 962 scrollRange = infoPtr->nHeight - (rcmyw.bottom - rcmyw.top); 963 963 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", 965 965 infoPtr->nPos, scrollRange, infoPtr->nHeight, 966 966 rcmyw.left, rcmyw.top, … … 987 987 rbrc = wnrc; 988 988 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", 990 990 ltrc.left, ltrc.top, ltrc.right, ltrc.bottom, 991 991 rbrc.left, rbrc.top, rbrc.right, rbrc.bottom); … … 999 999 if (infoPtr->BRbtnState && (lpRect->bottom - infoPtr->nButtonSize > lpRect->top)) 1000 1000 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", 1007 1004 hwnd, lpRect->right-lpRect->left, lpRect->bottom-lpRect->top, 1008 1005 lpRect->left, lpRect->top, … … 1233 1230 /* If in one of the buttons the capture and draw buttons */ 1234 1231 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", 1236 1233 hwnd, btnrect->left, btnrect->top, 1237 1234 btnrect->right, btnrect->bottom, … … 1604 1601 PAGER_Unregister (void) 1605 1602 { 1606 UnregisterClassA (WC_PAGESCROLLERA, (HINSTANCE)NULL);1607 } 1603 UnregisterClassA (WC_PAGESCROLLERA, NULL); 1604 } -
trunk/src/comctl32/progress.c
r9370 r10098 258 258 infoPtr->MaxVal = high; 259 259 PROGRESS_CoercePos(infoPtr); 260 InvalidateRect(infoPtr->Self, NULL, TRUE); 260 261 return res; 261 262 } … … 335 336 case PBM_SETPOS: 336 337 { 337 338 UINT oldVal; 338 339 oldVal = infoPtr->CurVal; 339 340 if(oldVal != wParam) { … … 431 432 VOID PROGRESS_Unregister (void) 432 433 { 433 UnregisterClassW (PROGRESS_CLASSW, (HINSTANCE)NULL);434 } 434 UnregisterClassW (PROGRESS_CLASSW, NULL); 435 } -
trunk/src/comctl32/propsheet.c
r9425 r10098 26 26 #include <string.h> 27 27 28 #define NONAMELESSUNION 29 #define NONAMELESSSTRUCT 28 30 #include "winbase.h" 29 31 #include "commctrl.h" … … 31 33 #include "winnls.h" 32 34 #include "comctl32.h" 33 #include "heap.h"34 35 35 36 #include "wine/debug.h" … … 113 114 #define MAX_BUTTONTEXT_LENGTH 64 114 115 115 #define PSH_WIZARD97_OLD 0x00002000116 #define PSH_WIZARD97_NEW 0x01000000117 116 #define INTRNL_ANY_WIZARD (PSH_WIZARD | PSH_WIZARD97_OLD | PSH_WIZARD97_NEW | PSH_WIZARD_LITE) 118 117 … … 120 119 * Prototypes 121 120 */ 122 static BOOLPROPSHEET_CreateDialog(PropSheetInfo* psInfo);121 static int PROPSHEET_CreateDialog(PropSheetInfo* psInfo); 123 122 static BOOL PROPSHEET_SizeMismatch(HWND hwndDlg, PropSheetInfo* psInfo); 124 123 static BOOL PROPSHEET_AdjustSize(HWND hwndDlg, PropSheetInfo* psInfo); … … 290 289 psInfo->hasHelp = dwFlags & PSH_HASHELP; 291 290 psInfo->hasApply = !(dwFlags & PSH_NOAPPLYNOW); 292 psInfo->useCallback = dwFlags & PSH_USECALLBACK;291 psInfo->useCallback = (dwFlags & PSH_USECALLBACK )&& (lppsh->pfnCallback); 293 292 psInfo->isModeless = dwFlags & PSH_MODELESS; 294 293 … … 341 340 psInfo->hasHelp = dwFlags & PSH_HASHELP; 342 341 psInfo->hasApply = !(dwFlags & PSH_NOAPPLYNOW); 343 psInfo->useCallback = dwFlags & PSH_USECALLBACK;342 psInfo->useCallback = (dwFlags & PSH_USECALLBACK) && (lppsh->pfnCallback); 344 343 psInfo->isModeless = dwFlags & PSH_MODELESS; 345 344 … … 554 553 * Creates the actual property sheet. 555 554 */ 556 BOOLPROPSHEET_CreateDialog(PropSheetInfo* psInfo)555 int PROPSHEET_CreateDialog(PropSheetInfo* psInfo) 557 556 { 558 557 LRESULT ret; … … 570 569 MAKEINTRESOURCEW(resID), 571 570 RT_DIALOGW))) 572 return FALSE;571 return -1; 573 572 574 573 if(!(template = (LPVOID)LoadResource(COMCTL32_hModule, hRes))) 575 return FALSE;574 return -1; 576 575 577 576 /* … … 583 582 584 583 if (!temp) 585 return FALSE;584 return -1; 586 585 587 586 memcpy(temp, template, resSize); … … 597 596 (LPARAM)psInfo); 598 597 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 } 604 606 605 607 COMCTL32_Free(temp); … … 623 625 */ 624 626 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, 626 628 rcOrigTab.right, rcOrigTab.bottom); 627 629 … … 635 637 636 638 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, 638 640 rcPage.right, rcPage.bottom); 639 641 … … 677 679 678 680 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, 680 682 rcPage.right, rcPage.bottom); 681 683 … … 748 750 rc.right -= rc.left; 749 751 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", 751 753 (DWORD)hwndTabCtrl, rc.right, rc.bottom); 752 754 SetWindowPos(hwndTabCtrl, 0, 0, 0, rc.right, rc.bottom, … … 755 757 GetClientRect(hwndTabCtrl, &rc); 756 758 757 TRACE("tab client rc % d %d %d %d\n",759 TRACE("tab client rc %ld %ld %ld %ld\n", 758 760 rc.left, rc.top, rc.right, rc.bottom); 759 761 … … 764 766 * Resize the property sheet. 765 767 */ 766 TRACE("setting dialog %08lx, rc (0,0)-(% d,%d)\n",768 TRACE("setting dialog %08lx, rc (0,0)-(%ld,%ld)\n", 767 769 (DWORD)hwndDlg, rc.right, rc.bottom); 768 770 SetWindowPos(hwndDlg, 0, 0, 0, rc.right, rc.bottom, … … 822 824 } 823 825 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); 825 827 TRACE(" constants padx=%d, pady=%d, butH=%d, lH=%d\n", 826 828 padding.x, padding.y, buttonHeight, lineHeight); … … 833 835 * Resize the property sheet. 834 836 */ 835 TRACE("setting dialog %08lx, rc (0,0)-(% d,%d)\n",837 TRACE("setting dialog %08lx, rc (0,0)-(%ld,%ld)\n", 836 838 (DWORD)hwndDlg, rc.right, rc.bottom); 837 839 SetWindowPos(hwndDlg, 0, 0, 0, rc.right, rc.bottom, … … 1425 1427 1426 1428 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", 1428 1430 (DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom, 1429 1431 pageWidth, pageHeight, padding.x, padding.y); … … 1441 1443 pageWidth = rc.right - rc.left; 1442 1444 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", 1444 1446 (DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom, 1445 1447 pageWidth, pageHeight); … … 1617 1619 HWND hwndPage; 1618 1620 PSHNOTIFY psn; 1619 LRESULT msgResult;1620 1621 PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, 1621 1622 PropSheetInfoStr); … … 1651 1652 if (hwndPage) 1652 1653 { 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 } 1656 1662 } 1657 1663 } … … 2385 2391 PropSheetInfo* psInfo = (PropSheetInfo*) GlobalAlloc(GPTR, 2386 2392 sizeof(PropSheetInfo)); 2387 inti, n;2393 UINT i, n; 2388 2394 BYTE* pByte; 2389 2395 … … 2429 2435 PropSheetInfo* psInfo = (PropSheetInfo*) GlobalAlloc(GPTR, 2430 2436 sizeof(PropSheetInfo)); 2431 inti, n;2437 UINT i, n; 2432 2438 BYTE* pByte; 2433 2439 -
trunk/src/comctl32/rebar.c
r9370 r10098 1228 1228 infoPtr->hwndSelf, infoPtr->dwStyle, 1229 1229 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 1232 1238 } 1233 1239 -
trunk/src/comctl32/smoothscroll.c
r7815 r10098 3 3 * 4 4 * 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 5 19 * 6 20 * TODO … … 12 26 #include "winerror.h" 13 27 #include "commctrl.h" 14 #include " debugtools.h"28 #include "wine/debug.h" 15 29 16 DEFAULT_DEBUG_CHANNEL(commctrl);30 WINE_DEFAULT_DEBUG_CHANNEL(commctrl); 17 31 18 32 static DWORD smoothscroll = 2; … … 98 112 } 99 113 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", 101 115 smooth->hwnd,flags,smooth->x2 102 116 ); -
trunk/src/comctl32/tab.c
r9469 r10098 59 59 INT tabHeight; /* height of the tab row */ 60 60 INT tabWidth; /* width of tabs */ 61 USHORT uHItemPadding; /* amount of horizontal padding, in pixels */ 62 USHORT uVItemPadding; /* amount of vertical padding, in pixels */ 61 63 HFONT hFont; /* handle to the current font */ 62 64 HCURSOR hcurArrow; /* handle to the current cursor */ … … 81 83 */ 82 84 #define SELECTED_TAB_OFFSET 2 83 #define HORIZONTAL_ITEM_PADDING 684 #define VERTICAL_ITEM_PADDING 385 85 #define ROUND_CORNER_SIZE 2 86 86 #define DISPLAY_AREA_PADDINGX 2 … … 173 173 iItem, ti->mask, ti->dwState, debugstr_w(ti->pszText), 174 174 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", 176 176 iItem, ti->lParam, ti->rect.left, ti->rect.top); 177 177 } … … 259 259 } 260 260 261 static LRESULT 262 TAB_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 261 272 /****************************************************************************** 262 273 * TAB_InternalGetItemRect … … 367 378 0); 368 379 } 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", 370 381 itemIndex, infoPtr->tabHeight, 371 382 itemRect->left, itemRect->top, itemRect->right, itemRect->bottom); … … 488 499 if (isVisible) 489 500 { 490 TRACE("invalidate (% d,%d)-(%d,%d)\n",501 TRACE("invalidate (%ld,%ld)-(%ld,%ld)\n", 491 502 selectedRect.left,selectedRect.top, 492 503 selectedRect.right,selectedRect.bottom); … … 987 998 controlPos.bottom - controlPos.top, 988 999 hwnd, 989 (HMENU)NULL,990 (HINSTANCE)NULL,1000 NULL, 1001 NULL, 991 1002 NULL); 992 1003 } … … 994 1005 { 995 1006 SetWindowPos(infoPtr->hwndUpDown, 996 (HWND)NULL,1007 NULL, 997 1008 controlPos.left, controlPos.top, 998 1009 controlPos.right - controlPos.left, … … 1100 1111 /* Take the highest between font or icon */ 1101 1112 if (fontMetrics.tmHeight > icon_height) 1102 item_height = fontMetrics.tmHeight ;1113 item_height = fontMetrics.tmHeight + 2; 1103 1114 else 1104 1115 item_height = icon_height; … … 1108 1119 * selected item + extra space for the selected item. 1109 1120 */ 1110 #ifdef __WIN32OS2__1111 //Code below doesn't always work1112 infoPtr->tabHeight = item_height + 2 * VERTICAL_ITEM_PADDING +1113 SELECTED_TAB_OFFSET;1114 #else1115 1121 infoPtr->tabHeight = item_height + SELECTED_TAB_OFFSET + 1116 1122 ((lStyle & TCS_BUTTONS) ? 2 : 1) * 1117 VERTICAL_ITEM_PADDING;1118 #endif 1123 infoPtr->uVItemPadding; 1124 1119 1125 TRACE("tabH=%d, tmH=%ld, iconh=%d\n", 1120 1126 infoPtr->tabHeight, fontMetrics.tmHeight, icon_height); 1121 1127 } 1122 1128 1123 TRACE("client right=% d\n", clientRect.right);1129 TRACE("client right=%ld\n", clientRect.right); 1124 1130 1125 1131 for (curItem = 0; curItem < infoPtr->uNumItem; curItem++) … … 1132 1138 infoPtr->items[curItem].rect.right = infoPtr->items[curItem].rect.left + 1133 1139 infoPtr->tabWidth + 1134 2 * HORIZONTAL_ITEM_PADDING;1140 2 * infoPtr->uHItemPadding; 1135 1141 } 1136 1142 else … … 1157 1163 infoPtr->items[curItem].rect.right = infoPtr->items[curItem].rect.left + 1158 1164 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", 1161 1167 debugstr_w(infoPtr->items[curItem].pszText), 1162 1168 infoPtr->items[curItem].rect.left, … … 1182 1188 infoPtr->items[curItem].rect.left = 0; 1183 1189 curItemRowCount++; 1184 TRACE("wrapping <%s>, l,r=% d,%d\n",1190 TRACE("wrapping <%s>, l,r=%ld,%ld\n", 1185 1191 debugstr_w(infoPtr->items[curItem].pszText), 1186 1192 infoPtr->items[curItem].rect.left, … … 1192 1198 1193 1199 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", 1195 1201 infoPtr->items[curItem].rect.top, 1196 1202 infoPtr->items[curItem].rect.left, … … 1256 1262 infoPtr->items[iItm].rect.left = 0; 1257 1263 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", 1259 1265 infoPtr->items[iItm].rect.right, 1260 1266 curItemLeftPos, clientRect.right, … … 1305 1311 curItemLeftPos = infoPtr->items[iItm].rect.right; 1306 1312 1307 TRACE("arranging <%s>, l,r=% d,%d, row=%d\n",1313 TRACE("arranging <%s>, l,r=%ld,%ld, row=%ld\n", 1308 1314 debugstr_w(infoPtr->items[iItm].pszText), 1309 1315 infoPtr->items[iItm].rect.left, … … 1353 1359 infoPtr->items[iIndex].rect.right += (iCount + 1) * widthDiff; 1354 1360 1355 TRACE("adjusting 1 <%s>, l,r=% d,%d\n",1361 TRACE("adjusting 1 <%s>, l,r=%ld,%ld\n", 1356 1362 debugstr_w(infoPtr->items[iIndex].pszText), 1357 1363 infoPtr->items[iIndex].rect.left, … … 1366 1372 infoPtr->items[iIndexStart].rect.right = clientRect.right - 4; 1367 1373 1368 TRACE("adjusting 2 <%s>, l,r=% d,%d\n",1374 TRACE("adjusting 2 <%s>, l,r=%ld,%ld\n", 1369 1375 debugstr_w(infoPtr->items[iIndexStart].pszText), 1370 1376 infoPtr->items[iIndexStart].rect.left, … … 1483 1489 comctl32_color.clrHighlight : comctl32_color.clrBtnText); 1484 1490 1485 /*1486 * Deflate the rectangle to acount for the padding1487 */1488 if(lStyle & TCS_VERTICAL)1489 InflateRect(drawRect, -VERTICAL_ITEM_PADDING, -HORIZONTAL_ITEM_PADDING);1490 else1491 InflateRect(drawRect, -HORIZONTAL_ITEM_PADDING, -VERTICAL_ITEM_PADDING);1492 1493 1491 1494 1492 /* … … 1512 1510 dis.itemID = iItem; 1513 1511 dis.itemAction = ODA_DRAWENTIRE; 1512 dis.itemState = 0; 1514 1513 if ( iItem == infoPtr->iSelected ) 1515 dis.itemState = ODS_SELECTED;1516 else1517 dis.itemState = 0;1514 dis.itemState |= ODS_SELECTED; 1515 if (infoPtr->uFocus == iItem) 1516 dis.itemState |= ODS_FOCUS; 1518 1517 dis.hwndItem = hwnd; /* */ 1519 1518 dis.hDC = hdc; 1520 dis.rcItem = *drawRect; /* */1519 CopyRect(&dis.rcItem,drawRect); 1521 1520 dis.itemData = infoPtr->items[iItem].lParam; 1522 1521 … … 1544 1543 RECT rcText; 1545 1544 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); 1546 1553 1547 1554 /* set rcImage to drawRect, we will use top & left in our ImageList_Draw call */ … … 1573 1580 1574 1581 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; 1576 1583 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", 1580 1587 debugstr_w(infoPtr->items[iItem].pszText), center_offset, 1581 1588 drawRect->left, drawRect->top, drawRect->right, drawRect->bottom, … … 1588 1595 /* right side of the tab, but the image still uses the left as its x position */ 1589 1596 /* 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); 1591 1598 } 1592 1599 else if(lStyle & TCS_VERTICAL) … … 1594 1601 rcImage.top = drawRect->bottom - cy - center_offset; 1595 1602 rcImage.left--; 1596 drawRect->bottom = rcImage.top - HORIZONTAL_ITEM_PADDING;1603 drawRect->bottom = rcImage.top - infoPtr->uHItemPadding; 1597 1604 } 1598 1605 else /* normal style, whether TCS_BOTTOM or not */ 1599 1606 { 1600 1607 rcImage.left = drawRect->left + center_offset + 3; 1601 drawRect->left = rcImage.left + cx + HORIZONTAL_ITEM_PADDING;1608 drawRect->left = rcImage.left + cx + infoPtr->uHItemPadding; 1602 1609 rcImage.top -= (lStyle & TCS_BOTTOM) ? 2 : 1; 1603 1610 } 1604 1611 1605 TRACE("drawing image=%d, left=% d, top=%d\n",1612 TRACE("drawing image=%d, left=%ld, top=%ld\n", 1606 1613 infoPtr->items[iItem].iImage, rcImage.left, rcImage.top-1); 1607 1614 ImageList_Draw … … 1861 1868 r.left += (1-ZZ); 1862 1869 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", 1864 1871 iItem, 1865 1872 fillRect.left,fillRect.top,fillRect.right,fillRect.bottom, … … 1905 1912 fillRect.right += (1-ZZ); 1906 1913 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", 1908 1915 iItem, 1909 1916 fillRect.left,fillRect.top,fillRect.right,fillRect.bottom, … … 1962 1969 r.top -= ZZ; 1963 1970 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", 1965 1972 iItem, 1966 1973 fillRect.left,fillRect.top,fillRect.right,fillRect.bottom, … … 2007 2014 fillRect.bottom += (1-ZZ); 2008 2015 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", 2010 2017 iItem, 2011 2018 fillRect.left,fillRect.top,fillRect.right,fillRect.bottom, … … 2102 2109 } 2103 2110 2104 TRACE("border=(% d,%d)-(%d,%d)\n",2111 TRACE("border=(%ld,%ld)-(%ld,%ld)\n", 2105 2112 rect.left, rect.top, rect.right, rect.bottom); 2106 2113 … … 2319 2326 TAB_INFO* infoPtr) 2320 2327 { 2321 RECT clientRect ;2328 RECT clientRect, r; 2322 2329 DWORD lStyle = GetWindowLongA(hwnd, GWL_STYLE); 2323 2330 INT lastRow = infoPtr->uNumRows - 1; … … 2353 2360 ((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) + 2; 2354 2361 } 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", 2357 2370 clientRect.left,clientRect.top, 2358 2371 clientRect.right,clientRect.bottom); 2372 2359 2373 InvalidateRect(hwnd, &clientRect, TRUE); 2360 2374 } … … 2368 2382 hdc = wParam== 0 ? BeginPaint (hwnd, &ps) : (HDC)wParam; 2369 2383 2370 TRACE("erase %d, rect=(% d,%d)-(%d,%d)\n",2384 TRACE("erase %d, rect=(%ld,%ld)-(%ld,%ld)\n", 2371 2385 ps.fErase, 2372 2386 ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right,ps.rcPaint.bottom); … … 2392 2406 2393 2407 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, 2395 2409 rect.top, rect.left, rect.bottom, rect.right); 2396 2410 … … 2467 2481 2468 2482 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, 2470 2484 rect.top, rect.left, rect.bottom, rect.right); 2471 2485 … … 2543 2557 { 2544 2558 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); 2547 2562 TRACE("was h=%d,w=%d, now h=%d,w=%d\n", 2548 2563 HIWORD(lResult), LOWORD(lResult), … … 2899 2914 infoPtr->uNumItem = 0; 2900 2915 infoPtr->uNumRows = 0; 2916 infoPtr->uHItemPadding = 6; 2917 infoPtr->uVItemPadding = 3; 2901 2918 infoPtr->hFont = 0; 2902 2919 infoPtr->items = 0; … … 2959 2976 infoPtr->tabHeight = fontMetrics.tmHeight + SELECTED_TAB_OFFSET + 2960 2977 ((dwStyle & TCS_BUTTONS) ? 2 : 1) * 2961 VERTICAL_ITEM_PADDING;2978 infoPtr->uVItemPadding; 2962 2979 2963 2980 /* Initialize the width of a tab. */ … … 3073 3090 3074 3091 case TCM_SETPADDING: 3075 FIXME("Unimplemented msg TCM_SETPADDING\n"); 3076 return 0; 3092 return TAB_SetPadding (hwnd, wParam, lParam); 3077 3093 3078 3094 case TCM_GETROWCOUNT: … … 3202 3218 wndClass.cbWndExtra = sizeof(TAB_INFO *); 3203 3219 wndClass.hCursor = LoadCursorA (0, IDC_ARROWA); 3204 wndClass.hbrBackground = (HBRUSH)NULL;3220 wndClass.hbrBackground = NULL; 3205 3221 wndClass.lpszClassName = WC_TABCONTROLA; 3206 3222 … … 3212 3228 TAB_Unregister (void) 3213 3229 { 3214 UnregisterClassA (WC_TABCONTROLA, (HINSTANCE)NULL);3215 } 3230 UnregisterClassA (WC_TABCONTROLA, NULL); 3231 } -
trunk/src/comctl32/toolbar.c
r9394 r10098 30 30 * 31 31 * TODO: 32 * - A little bug in TOOLBAR_DrawMasked()33 32 * - Button wrapping (under construction). 34 33 * - Messages. … … 97 96 typedef struct 98 97 { 98 HIMAGELIST himl; 99 INT id; 100 } IMLENTRY, *PIMLENTRY; 101 102 typedef struct 103 { 99 104 DWORD dwStructSize; /* size of TBBUTTON struct */ 100 105 INT nHeight; /* height of the toolbar */ … … 125 130 HFONT hFont; /* text font */ 126 131 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 */ 130 138 HWND hwndToolTip; /* handle to tool tip control */ 131 139 HWND hwndNotify; /* handle to the window that gets notifications */ … … 164 172 BOOL bVirtual; 165 173 BOOL bRemovable; 166 CHARtext[64];174 WCHAR text[64]; 167 175 } CUSTOMBUTTON, *PCUSTOMBUTTON; 168 176 … … 183 191 TBSTYLE_EX_HIDECLIPPEDBUTTONS) 184 192 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 199 static BOOL TOOLBAR_GetButtonInfo(TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb); 200 static BOOL TOOLBAR_IsButtonRemovable(TOOLBAR_INFO *infoPtr, int iItem, PCUSTOMBUTTON btnInfo); 201 static HIMAGELIST TOOLBAR_GetImageList(PIMLENTRY *pies, INT cies, INT id); 202 static PIMLENTRY TOOLBAR_GetImageListEntry(PIMLENTRY *pies, INT cies, INT id); 203 static VOID TOOLBAR_DeleteImageList(PIMLENTRY **pies, INT *cies); 204 static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id); 205 185 206 static LRESULT 186 207 TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam); … … 206 227 if (TRACE_ON(toolbar)){ 207 228 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); 210 231 TRACE("string %s\n", debugstr_w(TOOLBAR_GetText(infoPtr,bP))); 211 232 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", 213 234 btn_num, bP->idCommand, 214 235 (bP->bHot) ? "TRUE":"FALSE", bP->nRow, … … 309 330 ret, nmgd.dwMask, infoPtr->nNumBitmaps); 310 331 } 332 333 if (ret != I_IMAGENONE) 334 ret = GETIBITMAP(infoPtr, ret); 335 311 336 return ret; 312 337 } … … 316 341 TOOLBAR_IsValidBitmapIndex(TOOLBAR_INFO *infoPtr, INT index) 317 342 { 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)) 320 350 return TRUE; 321 351 else … … 444 474 InflateRect (&myrect, -2, 0); 445 475 446 TRACE("rect=(% d,%d)-(%d,%d)\n",476 TRACE("rect=(%ld,%ld)-(%ld,%ld)\n", 447 477 myrect.left, myrect.top, myrect.right, myrect.bottom); 448 478 … … 500 530 /* draw text */ 501 531 if (lpText) { 502 TRACE("string rect=(% d,%d)-(%d,%d)\n",532 TRACE("string rect=(%ld,%ld)-(%ld,%ld)\n", 503 533 rcText->left, rcText->top, rcText->right, rcText->bottom); 504 534 … … 543 573 HDC hdc, INT x, INT y) 544 574 { 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; 549 577 HBITMAP hbmMask; 550 HDC hdcImageList;551 578 HDC hdcMask; 552 579 … … 554 581 return; 555 582 583 ImageList_GetIconSize(himl, &cx, &cy); 584 556 585 /* create new dc's */ 557 hdcImageList = CreateCompatibleDC (0);558 586 hdcMask = CreateCompatibleDC (0); 559 587 560 588 /* create new bitmap */ 561 hbmMask = CreateBitmap ( himl->cx, himl->cy, 1, 1, NULL);589 hbmMask = CreateBitmap (cx, cy, 1, 1, NULL); 562 590 SelectObject (hdcMask, hbmMask); 563 591 564 592 /* 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); 570 594 571 595 /* draw the new mask */ 572 596 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); 575 598 576 599 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); 579 601 580 602 DeleteObject (hbmMask); 581 603 DeleteDC (hdcMask); 582 DeleteDC (hdcImageList);583 604 } 584 605 … … 613 634 DWORD ntfret; 614 635 INT offset; 636 HIMAGELIST himlDef; 615 637 616 638 if (btnPtr->fsState & TBSTATE_HIDDEN) … … 646 668 rcBitmap.top+=(infoPtr->nButtonHeight - infoPtr->nBitmapHeight) / 2; 647 669 648 TRACE("iBitmap: %d, start=(% d,%d) w=%d, h=%d\n",670 TRACE("iBitmap: %d, start=(%ld,%ld) w=%d, h=%d\n", 649 671 btnPtr->iBitmap, rcBitmap.left, rcBitmap.top, 650 672 infoPtr->nBitmapWidth, infoPtr->nBitmapHeight); … … 657 679 InflateRect (&rcText, -3, -3); 658 680 659 if ( infoPtr->himlDef&&681 if (GETDEFIMAGELIST(infoPtr, 0) && 660 682 TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { 661 683 /* The following test looked like this before … … 756 778 } 757 779 780 /* Determine index of image list */ 781 himlDef = GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr, btnPtr->iBitmap)); 782 758 783 /* disabled */ 759 784 if (!(btnPtr->fsState & TBSTATE_ENABLED)) { 785 HIMAGELIST himlDis = GETDISIMAGELIST(infoPtr, GETHIMLID(infoPtr, btnPtr->iBitmap)); 760 786 if (!(dwStyle & TBSTYLE_FLAT) && !(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES)) 761 787 { … … 773 799 } 774 800 775 if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDis,801 if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDis, 776 802 hdc, rcBitmap.left, rcBitmap.top, 777 803 ILD_NORMAL)) … … 804 830 TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top, COLOR_WINDOWFRAME); 805 831 806 TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,832 TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef, 807 833 hdc, rcBitmap.left+offset, rcBitmap.top+offset, 808 834 ILD_NORMAL); … … 827 853 TOOLBAR_DrawPattern (hdc, &rc); 828 854 829 TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,855 TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef, 830 856 hdc, rcBitmap.left+1, rcBitmap.top+1, 831 857 ILD_NORMAL); … … 888 914 889 915 if (btnPtr->bHot) { 916 HIMAGELIST himlHot = GETHOTIMAGELIST(infoPtr, 917 GETHIMLID(infoPtr, btnPtr->iBitmap)); 890 918 /* if hot, attempt to draw with himlHot, if fails, use himlDef */ 891 919 if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, 892 infoPtr->himlHot,920 himlHot, 893 921 hdc, rcBitmap.left, 894 922 rcBitmap.top, ILD_NORMAL)) 895 TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,923 TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef, 896 924 hdc, rcBitmap.left, rcBitmap.top, 897 925 ILD_NORMAL); 898 926 } 899 927 else 900 TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,928 TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef, 901 929 hdc, rcBitmap.left, rcBitmap.top, 902 930 ILD_NORMAL); … … 916 944 } 917 945 918 TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,946 TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef, 919 947 hdc, rcBitmap.left, rcBitmap.top, 920 948 ILD_NORMAL);} … … 953 981 /* if imagelist belongs to the app, it can be changed 954 982 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 } 957 989 958 990 TOOLBAR_DumpToolbar (infoPtr, __LINE__); … … 1408 1440 cx = sz.cx + 6 + 5 + 5; 1409 1441 if ((dwStyle & TBSTYLE_LIST) && 1410 (TOOLBAR_TestImageExist (infoPtr, btnPtr, infoPtr->himlDef)))1442 (TOOLBAR_TestImageExist (infoPtr, btnPtr, GETDEFIMAGELIST(infoPtr,0)))) 1411 1443 cx += infoPtr->nBitmapWidth; 1412 1444 } … … 1646 1678 if (custInfo) 1647 1679 { 1648 charBuffer[256];1680 WCHAR Buffer[256]; 1649 1681 int i = 0; 1650 1682 int index; … … 1658 1690 return FALSE; 1659 1691 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 1660 1699 /* add items to 'toolbar buttons' list and check if removable */ 1661 1700 for (i = 0; i < custInfo->tbInfo->nNumButtons; i++) 1662 1701 { 1663 1702 btnInfo = (PCUSTOMBUTTON)COMCTL32_Alloc(sizeof(CUSTOMBUTTON)); 1664 1665 1666 1667 LoadString A(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); 1668 1707 1669 1708 /* 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); 1674 1710 1675 1711 index = (int)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_ADDSTRING, 0, 0); … … 1683 1719 btnInfo->bVirtual = FALSE; 1684 1720 btnInfo->bRemovable = TRUE; 1685 LoadString A(COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64);1721 LoadStringW (COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64); 1686 1722 index = (int)SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)btnInfo); 1687 1723 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); … … 1691 1727 { 1692 1728 /* send TBN_GETBUTTONINFO notification */ 1729 NMTOOLBARW nmtb; 1693 1730 nmtb.iItem = i; 1694 1731 nmtb.pszText = Buffer; 1695 1732 nmtb.cchText = 256; 1696 1733 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)) 1698 1738 break; 1699 1739 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 : ""); 1701 1746 1702 1747 /* insert button into the apropriate list */ … … 1705 1750 { 1706 1751 btnInfo = (PCUSTOMBUTTON)COMCTL32_Alloc(sizeof(CUSTOMBUTTON)); 1707 memcpy (&btnInfo->btn, &nmtb.tbButton, sizeof(TBBUTTON));1708 1752 btnInfo->bVirtual = FALSE; 1709 1753 btnInfo->bRemovable = TRUE; 1710 if (!(nmtb.tbButton.fsStyle & TBSTYLE_SEP))1711 strcpy (btnInfo->text, nmtb.pszText);1712 1754 1713 1755 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); 1715 1758 } 1716 1759 else 1717 1760 { 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 } 1724 1776 } 1725 1777 } … … 1734 1786 btnInfo->bVirtual = TRUE; 1735 1787 btnInfo->bRemovable = FALSE; 1736 LoadString A(COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64);1788 LoadStringW (COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64); 1737 1789 index = (int)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)btnInfo); 1738 1790 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); … … 1882 1934 1883 1935 index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); 1936 1937 if (LB_ERR == index) 1938 break; 1939 1884 1940 TRACE("Remove: index %d\n", index); 1885 1941 1942 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, 1943 LB_GETITEMDATA, index, 0); 1944 1886 1945 /* 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)) 1890 1947 { 1891 1948 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); … … 1990 2047 { 1991 2048 LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam; 2049 DWORD dwStyle = GetWindowLongA (infoPtr->hwndSelf, GWL_STYLE); 1992 2050 RECT rcButton; 1993 2051 RECT rcText; … … 2032 2090 2033 2091 /* draw button */ 2092 if (!(dwStyle & TBSTYLE_FLAT)) 2034 2093 DrawEdge (lpdis->hDC, &rcButton, EDGE_RAISED, BF_RECT|BF_MIDDLE|BF_SOFT); 2035 2094 2036 2095 /* 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, 2041 2103 DT_LEFT | DT_VCENTER | DT_SINGLELINE); 2042 2104 … … 2082 2144 INT nIndex = 0, nButtons, nCount; 2083 2145 HBITMAP hbmLoad; 2146 HIMAGELIST himlDef; 2084 2147 2085 2148 TRACE("hwnd=%p wParam=%x lParam=%lx\n", hwnd, wParam, lParam); … … 2132 2195 } 2133 2196 2134 if (! (infoPtr->himlDef)) {2197 if (!infoPtr->cimlDef) { 2135 2198 /* create new default image list */ 2136 2199 TRACE ("creating default image list!\n"); 2137 2200 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); 2145 2216 2146 2217 /* Add bitmaps to the default image list */ 2147 if (lpAddBmp->hInst == (HINSTANCE)0)2218 if (lpAddBmp->hInst == NULL) 2148 2219 { 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); 2152 2248 } 2153 2249 else if (lpAddBmp->hInst == HINST_COMMCTRL) … … 2159 2255 hbmLoad = LoadBitmapA (COMCTL32_hModule, 2160 2256 MAKEINTRESOURCEA(IDB_STD_SMALL)); 2161 nIndex = ImageList_AddMasked ( infoPtr->himlDef,2257 nIndex = ImageList_AddMasked (himlDef, 2162 2258 hbmLoad, CLR_DEFAULT); 2163 2259 DeleteObject (hbmLoad); … … 2167 2263 hbmLoad = LoadBitmapA (COMCTL32_hModule, 2168 2264 MAKEINTRESOURCEA(IDB_STD_LARGE)); 2169 nIndex = ImageList_AddMasked ( infoPtr->himlDef,2265 nIndex = ImageList_AddMasked (himlDef, 2170 2266 hbmLoad, CLR_DEFAULT); 2171 2267 DeleteObject (hbmLoad); … … 2175 2271 hbmLoad = LoadBitmapA (COMCTL32_hModule, 2176 2272 MAKEINTRESOURCEA(IDB_VIEW_SMALL)); 2177 nIndex = ImageList_AddMasked ( infoPtr->himlDef,2273 nIndex = ImageList_AddMasked (himlDef, 2178 2274 hbmLoad, CLR_DEFAULT); 2179 2275 DeleteObject (hbmLoad); … … 2183 2279 hbmLoad = LoadBitmapA (COMCTL32_hModule, 2184 2280 MAKEINTRESOURCEA(IDB_VIEW_LARGE)); 2185 nIndex = ImageList_AddMasked ( infoPtr->himlDef,2281 nIndex = ImageList_AddMasked (himlDef, 2186 2282 hbmLoad, CLR_DEFAULT); 2187 2283 DeleteObject (hbmLoad); … … 2191 2287 hbmLoad = LoadBitmapA (COMCTL32_hModule, 2192 2288 MAKEINTRESOURCEA(IDB_HIST_SMALL)); 2193 nIndex = ImageList_AddMasked ( infoPtr->himlDef,2289 nIndex = ImageList_AddMasked (himlDef, 2194 2290 hbmLoad, CLR_DEFAULT); 2195 2291 DeleteObject (hbmLoad); … … 2199 2295 hbmLoad = LoadBitmapA (COMCTL32_hModule, 2200 2296 MAKEINTRESOURCEA(IDB_HIST_LARGE)); 2201 nIndex = ImageList_AddMasked ( infoPtr->himlDef,2297 nIndex = ImageList_AddMasked (himlDef, 2202 2298 hbmLoad, CLR_DEFAULT); 2203 2299 DeleteObject (hbmLoad); … … 2205 2301 2206 2302 default: 2207 nIndex = ImageList_GetImageCount ( infoPtr->himlDef);2303 nIndex = ImageList_GetImageCount (himlDef); 2208 2304 ERR ("invalid imagelist!\n"); 2209 2305 break; … … 2213 2309 { 2214 2310 hbmLoad = LoadBitmapA (lpAddBmp->hInst, (LPSTR)lpAddBmp->nID); 2215 nIndex = ImageList_AddMasked ( infoPtr->himlDef, hbmLoad, CLR_DEFAULT);2311 nIndex = ImageList_AddMasked (himlDef, hbmLoad, CLR_DEFAULT); 2216 2312 DeleteObject (hbmLoad); 2217 2313 } … … 2239 2335 if (nIndex != -1) 2240 2336 { 2241 INT imagecount = ImageList_GetImageCount( infoPtr->himlDef);2337 INT imagecount = ImageList_GetImageCount(himlDef); 2242 2338 2243 2339 if (infoPtr->nNumBitmaps + nButtons != imagecount) … … 2921 3017 lpTbb->fsState = btnPtr->fsState; 2922 3018 lpTbb->fsStyle = btnPtr->fsStyle; 3019 lpTbb->bReserved[0] = 0; 3020 lpTbb->bReserved[1] = 0; 2923 3021 lpTbb->dwData = btnPtr->dwData; 2924 3022 lpTbb->iString = btnPtr->iString; … … 3075 3173 TOOLBAR_GetDisabledImageList (HWND hwnd, WPARAM wParam, LPARAM lParam) 3076 3174 { 3077 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 3078 3079 return (LRESULT)infoPtr->himlDis; 3175 return (LRESULT)GETDISIMAGELIST(TOOLBAR_GetInfoPtr (hwnd), 0); 3080 3176 } 3081 3177 … … 3093 3189 TOOLBAR_GetHotImageList (HWND hwnd, WPARAM wParam, LPARAM lParam) 3094 3190 { 3095 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 3096 3097 return (LRESULT)infoPtr->himlHot; 3191 return (LRESULT)GETHOTIMAGELIST(TOOLBAR_GetInfoPtr (hwnd), 0); 3098 3192 } 3099 3193 … … 3115 3209 3116 3210 static LRESULT 3117 TOOLBAR_GetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam) 3118 { 3119 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 3120 3121 return (LRESULT)infoPtr->himlDef; 3211 TOOLBAR_GetDefImageList (HWND hwnd, WPARAM wParam, LPARAM lParam) 3212 { 3213 return (LRESULT) GETDEFIMAGELIST(TOOLBAR_GetInfoPtr(hwnd), 0); 3122 3214 } 3123 3215 … … 3168 3260 lpSize->cy = infoPtr->rcBound.bottom - infoPtr->rcBound.top; 3169 3261 3170 TRACE("maximum size % d x %d\n",3262 TRACE("maximum size %ld x %ld\n", 3171 3263 infoPtr->rcBound.right - infoPtr->rcBound.left, 3172 3264 infoPtr->rcBound.bottom - infoPtr->rcBound.top); … … 3680 3772 HBITMAP hBitmap; 3681 3773 int i = 0, nOldButtons = 0, pos = 0; 3774 HIMAGELIST himlDef = 0; 3682 3775 3683 3776 TRACE("hInstOld %p nIDOld %x hInstNew %p nIDNew %x nButtons %x\n", … … 3725 3818 infoPtr->nNumBitmaps = infoPtr->nNumBitmaps - nOldButtons + lpReplace->nButtons; 3726 3819 3727 /* ImageList_Replace(infoPtr->himlDef, pos, hBitmap, NULL); */ 3728 3729 3820 /* ImageList_Replace(GETDEFIMAGELIST(), pos, hBitmap, NULL); */ 3821 3822 3823 himlDef = GETDEFIMAGELIST(infoPtr, 0); 3730 3824 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 } 3735 3858 3736 3859 InvalidateRect(hwnd, NULL, FALSE); … … 3816 3939 { 3817 3940 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 3941 HIMAGELIST himlDef = GETDEFIMAGELIST(infoPtr, 0); 3818 3942 3819 3943 if ((LOWORD(lParam) <= 0) || (HIWORD(lParam)<=0)) … … 3829 3953 infoPtr->nBitmapHeight = (INT)HIWORD(lParam); 3830 3954 3955 3831 3956 /* 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; 3835 3960 } 3836 3961 … … 4020 4145 { 4021 4146 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 4147 HIMAGELIST himl = (HIMAGELIST)lParam; 4022 4148 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); 4032 4156 4033 4157 /* FIXME: redraw ? */ … … 4081 4205 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd); 4082 4206 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); 4091 4215 4092 4216 /* FIXME: redraw ? */ … … 4138 4262 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 4139 4263 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, 4152 4278 &infoPtr->nBitmapHeight); 4153 4279 TRACE("hwnd %p, new himl=%08x, count=%d, bitmap w=%d, h=%d\n", … … 4407 4533 4408 4534 infoPtr->iVersion = iVersion; 4535 4536 if (infoPtr->iVersion >= 5) 4537 TOOLBAR_SetUnicodeFormat(hwnd, (WPARAM)TRUE, (LPARAM)0); 4409 4538 4410 4539 return iOldVersion; … … 4497 4626 GetWindowRect(hwnd, &rc); 4498 4627 MapWindowPoints(0, hwndParent, (LPPOINT)&rc, 2); 4499 TRACE("mapped to (% d,%d)-(%d,%d)\n",4628 TRACE("mapped to (%ld,%ld)-(%ld,%ld)\n", 4500 4629 rc.left, rc.top, rc.right, rc.bottom); 4501 4630 lpsize->cx = max(rc.right-rc.left, … … 4617 4746 if (infoPtr->himlInt) 4618 4747 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); 4619 4752 4620 4753 /* delete default font */ … … 5312 5445 hdc = wParam==0 ? BeginPaint(hwnd, &ps) : (HDC)wParam; 5313 5446 5314 TRACE("psrect=(% d,%d)-(%d,%d)\n",5447 TRACE("psrect=(%ld,%ld)-(%ld,%ld)\n", 5315 5448 ps.rcPaint.left, ps.rcPaint.top, 5316 5449 ps.rcPaint.right, ps.rcPaint.bottom); … … 5568 5701 5569 5702 case TB_GETIMAGELIST: 5570 return TOOLBAR_Get ImageList (hwnd, wParam, lParam);5703 return TOOLBAR_GetDefImageList (hwnd, wParam, lParam); 5571 5704 5572 5705 /* case TB_GETINSERTMARK: */ /* 4.71 */ … … 5874 6007 TOOLBAR_Unregister (void) 5875 6008 { 5876 UnregisterClassA (TOOLBARCLASSNAMEA, (HINSTANCE)NULL); 5877 } 6009 UnregisterClassA (TOOLBARCLASSNAMEA, NULL); 6010 } 6011 6012 static 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 6044 static 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 6058 static 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 6080 static 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 6092 static 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 6123 static 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 2102 2102 return 0; 2103 2103 2104 #ifdef __WIN32OS2__2105 2104 if(infoPtr->hFont) DeleteObject (infoPtr->hFont); 2106 #endif2107 2105 2108 2106 infoPtr->hFont = CreateFontIndirectW(&lf);
Note:
See TracChangeset
for help on using the changeset viewer.