diff --git a/reactos/lib/comctl32/.cvsignore b/reactos/lib/comctl32/.cvsignore index 23f95f831d2..ef777e14fa3 100644 --- a/reactos/lib/comctl32/.cvsignore +++ b/reactos/lib/comctl32/.cvsignore @@ -18,5 +18,8 @@ idc_divider.cur idc_divideropen.cur idc_movebutton.cur idi_dragarrow.ico +idi_tt_error_sm.ico +idi_tt_info_sm.ico +idi_tt_warn_sm.ico idt_check.bmp comctl32.spec.def diff --git a/reactos/lib/comctl32/Makefile.in b/reactos/lib/comctl32/Makefile.in index 2218bd2982f..d83c626b0d2 100644 --- a/reactos/lib/comctl32/Makefile.in +++ b/reactos/lib/comctl32/Makefile.in @@ -52,6 +52,9 @@ RC_BINARIES = \ idc_divideropen.cur \ idc_movebutton.cur \ idi_dragarrow.ico \ + idi_tt_error_sm.ico \ + idi_tt_info_sm.ico \ + idi_tt_warn_sm.ico \ idt_check.bmp SUBDIRS = tests diff --git a/reactos/lib/comctl32/animate.c b/reactos/lib/comctl32/animate.c index a7c47e14e52..7142a64bc80 100644 --- a/reactos/lib/comctl32/animate.c +++ b/reactos/lib/comctl32/animate.c @@ -85,7 +85,7 @@ typedef struct HBITMAP hbmPrevFrame; } ANIMATE_INFO; -#define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongA(hWnd, 0)) +#define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongPtrW(hWnd, 0)) #define ANIMATE_COLOR_NONE 0xffffffff static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif) @@ -704,7 +704,7 @@ static LRESULT ANIMATE_OpenA(HWND hWnd, WPARAM wParam, LPARAM lParam) } if (!hInstance) - hInstance = (HINSTANCE)GetWindowLongA(hWnd, GWL_HINSTANCE); + hInstance = (HINSTANCE)GetWindowLongPtrW(hWnd, GWLP_HINSTANCE); if (HIWORD(lParam)) { TRACE("(\"%s\");\n", (LPSTR)lParam); @@ -794,13 +794,13 @@ static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam) } /* store crossref hWnd <-> info structure */ - SetWindowLongA(hWnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW(hWnd, 0, (DWORD_PTR)infoPtr); infoPtr->hwndSelf = hWnd; infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent; infoPtr->transparentColor = ANIMATE_COLOR_NONE; infoPtr->hbmPrevFrame = 0; - TRACE("Animate style=0x%08lx, parent=%08lx\n", GetWindowLongA(hWnd, GWL_STYLE), (DWORD)infoPtr->hwndNotify); + TRACE("Animate style=0x%08lx, parent=%p\n", GetWindowLongA(hWnd, GWL_STYLE), infoPtr->hwndNotify); InitializeCriticalSection(&infoPtr->cs); @@ -818,7 +818,7 @@ static LRESULT ANIMATE_Destroy(HWND hWnd, WPARAM wParam, LPARAM lParam) /* free animate info data */ Free(infoPtr); - SetWindowLongA(hWnd, 0, 0); + SetWindowLongPtrW(hWnd, 0, 0); return 0; } diff --git a/reactos/lib/comctl32/comboex.c b/reactos/lib/comctl32/comboex.c index 7f55192c646..7be3b27540d 100644 --- a/reactos/lib/comctl32/comboex.c +++ b/reactos/lib/comctl32/comboex.c @@ -122,7 +122,7 @@ typedef struct #define CBE_SEP 4 #define COMBOEX_SUBCLASS_PROP "CCComboEx32SubclassInfo" -#define COMBOEX_GetInfoPtr(hwnd) ((COMBOEX_INFO *)GetWindowLongW (hwnd, 0)) +#define COMBOEX_GetInfoPtr(hwnd) ((COMBOEX_INFO *)GetWindowLongPtrW (hwnd, 0)) /* Things common to the entire DLL */ @@ -400,14 +400,14 @@ static void COMBOEX_AdjustEditPos (COMBOEX_INFO *infoPtr) static void COMBOEX_ReSize (COMBOEX_INFO *infoPtr) { SIZE mysize; - UINT cy; + LONG cy; IMAGEINFO iinfo; COMBOEX_GetComboFontSize (infoPtr, &mysize); cy = mysize.cy + CBE_EXTRA; if (infoPtr->himl && ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo)) { cy = max (iinfo.rcImage.bottom - iinfo.rcImage.top, cy); - TRACE("upgraded height due to image: height=%d\n", cy); + TRACE("upgraded height due to image: height=%ld\n", cy); } SendMessageW (infoPtr->hwndSelf, CB_SETITEMHEIGHT, (WPARAM)-1, (LPARAM)cy); if (infoPtr->hwndCombo) { @@ -943,7 +943,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs) } infoPtr->NtfUnicode = (i == NFR_UNICODE); - SetWindowLongW (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* create combo box */ GetWindowRect(hwnd, &wnrc1); @@ -967,8 +967,8 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs) WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | GetWindowLongW (hwnd, GWL_STYLE), cs->y, cs->x, cs->cx, cs->cy, hwnd, - (HMENU) GetWindowLongW (hwnd, GWL_ID), - (HINSTANCE)GetWindowLongW (hwnd, GWL_HINSTANCE), NULL); + (HMENU) GetWindowLongPtrW (hwnd, GWLP_ID), + (HINSTANCE)GetWindowLongPtrW (hwnd, GWLP_HINSTANCE), NULL); /* * native does the following at this point according to trace: @@ -983,8 +983,8 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs) * data structure. */ SetPropA(infoPtr->hwndCombo, COMBOEX_SUBCLASS_PROP, hwnd); - infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongW(infoPtr->hwndCombo, - GWL_WNDPROC, (LONG)COMBOEX_ComboWndProc); + infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongPtrW(infoPtr->hwndCombo, + GWLP_WNDPROC, (DWORD_PTR)COMBOEX_ComboWndProc); infoPtr->font = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); @@ -997,8 +997,8 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs) WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_AUTOHSCROLL, 0, 0, 0, 0, /* will set later */ infoPtr->hwndCombo, - (HMENU) GetWindowLongW (hwnd, GWL_ID), - (HINSTANCE)GetWindowLongW (hwnd, GWL_HINSTANCE), NULL); + (HMENU) GetWindowLongPtrW (hwnd, GWLP_ID), + (HINSTANCE)GetWindowLongPtrW (hwnd, GWLP_HINSTANCE), NULL); /* native does the following at this point according to trace: * GetWindowThreadProcessId(hwndEdit,0) @@ -1012,8 +1012,8 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs) * data structure. */ SetPropA(infoPtr->hwndEdit, COMBOEX_SUBCLASS_PROP, hwnd); - infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongW(infoPtr->hwndEdit, - GWL_WNDPROC, (LONG)COMBOEX_EditWndProc); + infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongPtrW(infoPtr->hwndEdit, + GWLP_WNDPROC, (DWORD_PTR)COMBOEX_EditWndProc); infoPtr->font = (HFONT)SendMessageW(infoPtr->hwndCombo, WM_GETFONT, 0, 0); } @@ -1546,7 +1546,7 @@ static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr) /* free comboex info data */ Free (infoPtr); - SetWindowLongW (infoPtr->hwndSelf, 0, 0); + SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0); return 0; } @@ -1610,7 +1610,7 @@ static LRESULT COMBOEX_Size (COMBOEX_INFO *infoPtr, INT width, INT height) static LRESULT COMBOEX_WindowPosChanging (COMBOEX_INFO *infoPtr, WINDOWPOS *wp) { RECT cbx_wrect, cbx_crect, cb_wrect; - UINT width, height; + INT width, height; GetWindowRect (infoPtr->hwndSelf, &cbx_wrect); GetClientRect (infoPtr->hwndSelf, &cbx_crect); @@ -2263,6 +2263,10 @@ COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_WINDOWPOSCHANGING: return COMBOEX_WindowPosChanging (infoPtr, (WINDOWPOS *)lParam); + case WM_SETFOCUS: + SetFocus(infoPtr->hwndCombo); + return 0; + default: if ((uMsg >= WM_USER) && (uMsg < WM_APP)) ERR("unknown msg %04x wp=%08x lp=%08lx\n",uMsg,wParam,lParam); diff --git a/reactos/lib/comctl32/comctl32.h b/reactos/lib/comctl32/comctl32.h index a50855348c9..128f19bc1cc 100644 --- a/reactos/lib/comctl32/comctl32.h +++ b/reactos/lib/comctl32/comctl32.h @@ -112,6 +112,11 @@ extern HBRUSH COMCTL32_hPattern55AABrush; /* HOTKEY internal strings */ #define HKY_NONE 2048 +/* Tooltip icons */ +#define IDI_TT_INFO_SM 22 +#define IDI_TT_WARN_SM 25 +#define IDI_TT_ERROR_SM 28 + typedef struct { COLORREF clrBtnHighlight; /* COLOR_BTNHIGHLIGHT */ @@ -137,6 +142,7 @@ extern COMCTL32_SysColor comctl32_color; /* Internal function */ HWND COMCTL32_CreateToolTip (HWND); VOID COMCTL32_RefreshSysColors(void); +void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark, BOOL bHorizontal); INT Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen); BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc); @@ -145,17 +151,19 @@ BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc); #define WINE_FILEVERSIONSTR "5.80" /* Our internal stack structure of the window procedures to subclass */ +typedef struct _SUBCLASSPROCS { + SUBCLASSPROC subproc; + UINT_PTR id; + DWORD_PTR ref; + struct _SUBCLASSPROCS *next; +} SUBCLASSPROCS, *LPSUBCLASSPROCS; + typedef struct { - struct { - SUBCLASSPROC subproc; - UINT_PTR id; - DWORD_PTR ref; - } SubclassProcs[31]; - int stackpos; - int stacknum; - int wndprocrecursion; + SUBCLASSPROCS *SubclassProcs; + SUBCLASSPROCS *stackpos; WNDPROC origproc; + int running; } SUBCLASS_INFO, *LPSUBCLASS_INFO; /* undocumented functions */ diff --git a/reactos/lib/comctl32/comctl32undoc.c b/reactos/lib/comctl32/comctl32undoc.c index 8944c197257..3f2818f1f9b 100644 --- a/reactos/lib/comctl32/comctl32undoc.c +++ b/reactos/lib/comctl32/comctl32undoc.c @@ -631,7 +631,8 @@ INT WINAPI FindMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum) { LPWINEMRULIST mp = (LPWINEMRULIST)hList; - UINT i, ret; + INT ret; + UINT i; LPSTR dataA = NULL; if (!mp->extview.lpfnCompare) { diff --git a/reactos/lib/comctl32/comctl_Cn.rc b/reactos/lib/comctl32/comctl_Cn.rc index e33ba1adb19..3f547639b70 100644 --- a/reactos/lib/comctl32/comctl_Cn.rc +++ b/reactos/lib/comctl32/comctl_Cn.rc @@ -22,7 +22,7 @@ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "ÊôÐÔ " -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "È·¶¨", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP PUSHBUTTON "È¡Ïû", IDCANCEL,58,122,50,14 @@ -35,7 +35,7 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Wizard" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "½áÊø", IDC_FINISH_BUTTON,121,138,50,14 DEFPUSHBUTTON "ÏÂÒ»²½(&N) >", IDC_NEXT_BUTTON,121,138,50,14 @@ -51,7 +51,7 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "×Ô¶¨Ò幤¾ßÀ¸" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "¹Ø±Õ(&C)", IDCANCEL,308,6,44,14 PUSHBUTTON "ÖØÖÃ(&e)", IDC_RESET_BTN,308,23,44,14 diff --git a/reactos/lib/comctl32/comctl_Cs.rc b/reactos/lib/comctl32/comctl_Cs.rc new file mode 100644 index 00000000000..03bb7704629 --- /dev/null +++ b/reactos/lib/comctl32/comctl_Cs.rc @@ -0,0 +1,90 @@ +/* + * Copyright 1999 Eric Kohl + * + * Czech resources for comctl32 + * Copyright 2004 David Kredba + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE +CAPTION "Vlastnosti " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP + PUSHBUTTON "Storno", IDCANCEL,58,122,50,14 + PUSHBUTTON "&Pou¾ít", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED + PUSHBUTTON "Nápovìda", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP + CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114 +END + + +IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE +CAPTION "Prùvodce" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Dokonèit", IDC_FINISH_BUTTON,121,138,50,14 + DEFPUSHBUTTON "&Dal¹í >", IDC_NEXT_BUTTON,121,138,50,14 + PUSHBUTTON "< &Zpìt", IDC_BACK_BUTTON,71,138,50,14 + PUSHBUTTON "Storno", IDCANCEL,178,138,50,14 + PUSHBUTTON "Nápovìda", IDHELP,235,138,50,14,WS_GROUP + LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN + CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5 + LTEXT "", IDC_SUNKEN_LINEHEADER,0,35,290,1,SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE +END + + +IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Nastavení panelu" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "&Zavøít", IDCANCEL,308,6,44,14 + PUSHBUTTON "&Výchozí", IDC_RESET_BTN,308,23,44,14 + PUSHBUTTON "&Nápovìda", IDC_HELP_BTN,308,40,44,14 + PUSHBUTTON "Nahor&u", IDC_MOVEUP_BTN,308,74,44,14 + PUSHBUTTON "&Dolù", IDC_MOVEDN_BTN,308,91,44,14 + LTEXT "D&ostupná tlaèítka:", -1,4,5,84,10 + LISTBOX IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP + PUSHBUTTON "Pøid&at ->", IDOK, 131, 42, 44, 14 + PUSHBUTTON "<- Odeb&rat", IDC_REMOVE_BTN,131,62,44,14 + LTEXT "&Tlaèítka panelu:", -1,182,5,78,10 + LISTBOX IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP +END + +STRINGTABLE DISCARDABLE +{ + IDS_CLOSE "Zavøít" +} + +STRINGTABLE DISCARDABLE +{ + IDM_TODAY "Dnes:" + IDM_GOTODAY "Jdi na dne¹ek" +} + +STRINGTABLE DISCARDABLE +{ + IDS_SEPARATOR "Oddìlovaè" +} + +STRINGTABLE DISCARDABLE +{ + HKY_NONE "®ádný" +} diff --git a/reactos/lib/comctl32/comctl_De.rc b/reactos/lib/comctl32/comctl_De.rc index a0bfd539c21..ed5796f5f6c 100644 --- a/reactos/lib/comctl32/comctl_De.rc +++ b/reactos/lib/comctl32/comctl_De.rc @@ -42,7 +42,7 @@ STRINGTABLE DISCARDABLE IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Eigenschaften für " -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP PUSHBUTTON "A&bbrechen", IDCANCEL,58,122,50,14 @@ -55,7 +55,7 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Wizard" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Beenden", IDC_FINISH_BUTTON,121,138,50,14 DEFPUSHBUTTON "&Weiter >", IDC_NEXT_BUTTON,121,138,50,14 @@ -71,7 +71,7 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Toolbar einrichten" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Schließen", IDCANCEL,308,6,44,14 PUSHBUTTON "&Zurücksetzen", IDC_RESET_BTN,308,23,44,14 diff --git a/reactos/lib/comctl32/comctl_En.rc b/reactos/lib/comctl32/comctl_En.rc index 3b81be6ec83..8013281e40f 100644 --- a/reactos/lib/comctl32/comctl_En.rc +++ b/reactos/lib/comctl32/comctl_En.rc @@ -21,7 +21,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Properties for " -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP PUSHBUTTON "Cancel", IDCANCEL,58,122,50,14 @@ -34,7 +34,7 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Wizard" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "Finish", IDC_FINISH_BUTTON,121,138,50,14 DEFPUSHBUTTON "&Next >", IDC_NEXT_BUTTON,121,138,50,14 @@ -50,7 +50,7 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Customize Toolbar" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Close", IDCANCEL,308,6,44,14 PUSHBUTTON "R&eset", IDC_RESET_BTN,308,23,44,14 diff --git a/reactos/lib/comctl32/comctl_Es.rc b/reactos/lib/comctl32/comctl_Es.rc index d9af88755cf..ffc79124bac 100644 --- a/reactos/lib/comctl32/comctl_Es.rc +++ b/reactos/lib/comctl32/comctl_Es.rc @@ -21,7 +21,7 @@ LANGUAGE LANG_SPANISH, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Propiedades de " -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "Aceptar", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP PUSHBUTTON "Cancelar", IDCANCEL,58,122,50,14 @@ -34,7 +34,7 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Ayudante" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "Terminar", IDC_FINISH_BUTTON,121,138,50,14 DEFPUSHBUTTON "&Siguiente >", IDC_NEXT_BUTTON,121,138,50,14 @@ -50,7 +50,7 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Personalizar barra de herramientas" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Cerrar", IDCANCEL,308,6,44,14 PUSHBUTTON "R&estaurar", IDC_RESET_BTN,308,23,44,14 diff --git a/reactos/lib/comctl32/comctl_Fr.rc b/reactos/lib/comctl32/comctl_Fr.rc index 3b73558421d..086efcc53f5 100644 --- a/reactos/lib/comctl32/comctl_Fr.rc +++ b/reactos/lib/comctl32/comctl_Fr.rc @@ -25,7 +25,7 @@ LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Propriétés pour " -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP PUSHBUTTON "Annuler", IDCANCEL,58,122,50,14 @@ -38,7 +38,7 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Assistant" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "Terminer", IDC_FINISH_BUTTON,121,138,50,14 DEFPUSHBUTTON "&Suivant >", IDC_NEXT_BUTTON,121,138,50,14 @@ -54,7 +54,7 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Personnaliser la barre d'outils" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Fermer", IDCANCEL,308,6,44,14 PUSHBUTTON "&Réinitialiser", IDC_RESET_BTN,308,23,44,14 diff --git a/reactos/lib/comctl32/comctl_It.rc b/reactos/lib/comctl32/comctl_It.rc index 6af31bd1caf..1deee319ce9 100644 --- a/reactos/lib/comctl32/comctl_It.rc +++ b/reactos/lib/comctl32/comctl_It.rc @@ -22,7 +22,7 @@ LANGUAGE LANG_ITALIAN, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Proprietà per " -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP PUSHBUTTON "Annulla", IDCANCEL,58,122,50,14 @@ -35,7 +35,7 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Wizard" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "Fine", IDC_FINISH_BUTTON,121,138,50,14 DEFPUSHBUTTON "&Avanti >", IDC_NEXT_BUTTON,121,138,50,14 @@ -51,7 +51,7 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Personalitta la barra degli strumenti" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Chiudi", IDCANCEL,308,6,44,14 PUSHBUTTON "R&eimpostare", IDC_RESET_BTN,308,23,44,14 diff --git a/reactos/lib/comctl32/comctl_Ko.rc b/reactos/lib/comctl32/comctl_Ko.rc index 95d9dcc7280..c67ac8c5d8c 100644 --- a/reactos/lib/comctl32/comctl_Ko.rc +++ b/reactos/lib/comctl32/comctl_Ko.rc @@ -21,7 +21,7 @@ LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Properties for " -FONT 9, "MS Sans Serif" +FONT 9, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "È®ÀÎ", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP PUSHBUTTON "Ãë¼Ò", IDCANCEL,58,122,50,14 @@ -34,7 +34,7 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Wizard" -FONT 9, "MS Sans Serif" +FONT 9, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "Á¾·á", IDC_FINISH_BUTTON,121,138,50,14 DEFPUSHBUTTON "´ÙÀ½(&N) >", IDC_NEXT_BUTTON,121,138,50,14 @@ -50,7 +50,7 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Customize Toolbar" -FONT 9, "MS Sans Serif" +FONT 9, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "´Ý±â(&C)", IDCANCEL,308,6,44,14 PUSHBUTTON "´Ù½Ã(&e)", IDC_RESET_BTN,308,23,44,14 diff --git a/reactos/lib/comctl32/comctl_Nl.rc b/reactos/lib/comctl32/comctl_Nl.rc index 449828dba57..a5f19fa375e 100644 --- a/reactos/lib/comctl32/comctl_Nl.rc +++ b/reactos/lib/comctl32/comctl_Nl.rc @@ -23,7 +23,7 @@ LANGUAGE LANG_DUTCH, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Eigenschappen van " -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP PUSHBUTTON "Annuleren", IDCANCEL,58,122,50,14 @@ -36,7 +36,7 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Assistent" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "Beëindigen", IDC_FINISH_BUTTON,121,138,50,14 DEFPUSHBUTTON "&Volgende >", IDC_NEXT_BUTTON,121,138,50,14 @@ -52,7 +52,7 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Gereedschappenbalk aanpassen" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Afsluiten", IDCANCEL,308,6,44,14 PUSHBUTTON "&Reset", IDC_RESET_BTN,308,23,44,14 diff --git a/reactos/lib/comctl32/comctl_Pl.rc b/reactos/lib/comctl32/comctl_Pl.rc index 13b195dc700..95c7f02e9d1 100644 --- a/reactos/lib/comctl32/comctl_Pl.rc +++ b/reactos/lib/comctl32/comctl_Pl.rc @@ -22,7 +22,7 @@ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "W³aœciwoœci " -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP PUSHBUTTON "Anuluj", IDCANCEL,58,122,50,14 @@ -35,7 +35,7 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Kreator" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "Zakoñcz", IDC_FINISH_BUTTON,121,138,50,14 DEFPUSHBUTTON "&Dalej >", IDC_NEXT_BUTTON,121,138,50,14 @@ -51,7 +51,7 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Dostosowywanie paska narzêdzi" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Zamknij", IDCANCEL,308,6,44,14 PUSHBUTTON "Z&resetuj", IDC_RESET_BTN,308,23,44,14 diff --git a/reactos/lib/comctl32/comctl_Pt.rc b/reactos/lib/comctl32/comctl_Pt.rc index 34fb569a05e..29d3ebd4255 100644 --- a/reactos/lib/comctl32/comctl_Pt.rc +++ b/reactos/lib/comctl32/comctl_Pt.rc @@ -21,7 +21,7 @@ LANGUAGE LANG_PORTUGUESE, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Propriedades para " -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP PUSHBUTTON "Cancelar", IDCANCEL,58,122,50,14 @@ -34,7 +34,7 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Assistente" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "Finalizar", IDC_FINISH_BUTTON,121,138,50,14 DEFPUSHBUTTON "&Avançar >", IDC_NEXT_BUTTON,121,138,50,14 @@ -50,7 +50,7 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Personalizar barra de ferramentas" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Fechar", IDCANCEL,308,6,44,14 PUSHBUTTON "R&estaurar", IDC_RESET_BTN,308,23,44,14 diff --git a/reactos/lib/comctl32/comctl_Ru.rc b/reactos/lib/comctl32/comctl_Ru.rc index e48bc2e4519..bc06b26d1aa 100644 --- a/reactos/lib/comctl32/comctl_Ru.rc +++ b/reactos/lib/comctl32/comctl_Ru.rc @@ -23,7 +23,7 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Ñâîéñòâà äëÿ " -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP PUSHBUTTON "Îòìåíà", IDCANCEL,58,122,50,14 @@ -36,7 +36,7 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Ìàñòåð" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "Çàâåðøèòü", IDC_FINISH_BUTTON,121,138,50,14 DEFPUSHBUTTON "&Äàëåå >", IDC_NEXT_BUTTON,121,138,50,14 @@ -52,7 +52,7 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Íàñòðîéêà ïàíåëè èíñòðóìåíòîâ" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Çàêðûòü", IDCANCEL,308,6,44,14 PUSHBUTTON "Ñ&áðîñèòü", IDC_RESET_BTN,308,23,44,14 diff --git a/reactos/lib/comctl32/comctl_Si.rc b/reactos/lib/comctl32/comctl_Si.rc index 4ee4caf15a7..69c3f7f6f62 100644 --- a/reactos/lib/comctl32/comctl_Si.rc +++ b/reactos/lib/comctl32/comctl_Si.rc @@ -21,7 +21,7 @@ LANGUAGE LANG_SLOVENIAN, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Lastnosti" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "V redu", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP PUSHBUTTON "Preklièi", IDCANCEL,58,122,50,14 @@ -34,7 +34,7 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Èarovnik" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "Dokonèaj", IDC_FINISH_BUTTON,121,138,50,14 DEFPUSHBUTTON "Naprej >", IDC_NEXT_BUTTON,121,138,50,14 @@ -50,7 +50,7 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Prilagoditev orodne vrstice" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Zapri", IDCANCEL,308,6,44,14 PUSHBUTTON "Po&nastavi", IDC_RESET_BTN,308,23,44,14 diff --git a/reactos/lib/comctl32/comctl_Th.rc b/reactos/lib/comctl32/comctl_Th.rc index 56eb49b14b4..63e7366a66d 100644 --- a/reactos/lib/comctl32/comctl_Th.rc +++ b/reactos/lib/comctl32/comctl_Th.rc @@ -21,7 +21,7 @@ LANGUAGE LANG_THAI, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "¤Ø³ÊÁºÑµÔ¢Í§ " -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "µ¡Å§", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP PUSHBUTTON "¡àÅÔ¡", IDCANCEL,58,122,50,14 @@ -34,7 +34,7 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Wizard" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "·íÒãËéàÊÃç¨", IDC_FINISH_BUTTON,121,138,50,14 DEFPUSHBUTTON "µèÍä» >", IDC_NEXT_BUTTON,121,138,50,14 @@ -50,7 +50,7 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "»ÃѺáµè§á¶ºà¤Ã×èͧÁ×Í" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "»Ô´", IDCANCEL,308,6,44,14 PUSHBUTTON "á¡éÍÍ¡", IDC_RESET_BTN,308,23,44,14 diff --git a/reactos/lib/comctl32/comctl_Uk.rc b/reactos/lib/comctl32/comctl_Uk.rc index 54df0803bad..89467cdd0c1 100644 --- a/reactos/lib/comctl32/comctl_Uk.rc +++ b/reactos/lib/comctl32/comctl_Uk.rc @@ -23,7 +23,7 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Âëàñòèâîñò³ äëÿ " -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP PUSHBUTTON "&³äì³íà", IDCANCEL,58,122,50,14 @@ -36,7 +36,7 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Ìàñòåð" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Çàâåðøèòè", IDC_FINISH_BUTTON,121,138,50,14 DEFPUSHBUTTON "&Äàë³ >", IDC_NEXT_BUTTON,121,138,50,14 @@ -52,7 +52,7 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Íàñòðîéêà ïàíåë³ ³íñòðóìåíò³â" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Çàêðèòè", IDCANCEL,308,6,44,14 PUSHBUTTON "&Ñêèíóòè", IDC_RESET_BTN,308,23,44,14 diff --git a/reactos/lib/comctl32/commctrl.c b/reactos/lib/comctl32/commctrl.c index 12ed0e60f55..ad91b8a3d84 100644 --- a/reactos/lib/comctl32/commctrl.c +++ b/reactos/lib/comctl32/commctrl.c @@ -116,6 +116,7 @@ extern void TREEVIEW_Unregister(void); extern void UPDOWN_Register(void); extern void UPDOWN_Unregister(void); +LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); LPSTR COMCTL32_aSubclass = NULL; HMODULE COMCTL32_hModule = 0; @@ -831,9 +832,9 @@ CreateMappedBitmap (HINSTANCE hInstance, INT idBitmap, UINT wFlags, HGLOBAL hglb; HRSRC hRsrc; LPBITMAPINFOHEADER lpBitmap, lpBitmapInfo; - UINT nSize, nColorTableSize; + UINT nSize, nColorTableSize, iColor; RGBQUAD *pColorTable; - INT iColor, i, iMaps, nWidth, nHeight; + INT i, iMaps, nWidth, nHeight; HDC hdcScreen; HBITMAP hbm; LPCOLORMAP sysColorMap; @@ -1092,7 +1093,7 @@ BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uIDSubclass, DWORD_PTR dwRef) { LPSUBCLASS_INFO stack; - int n; + LPSUBCLASSPROCS proc; TRACE ("(%p, %p, %x, %lx)\n", hWnd, pfnSubclass, uIDSubclass, dwRef); @@ -1115,49 +1116,44 @@ BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, /* set window procedure to our own and save the current one */ if (IsWindowUnicode (hWnd)) - stack->origproc = (WNDPROC)SetWindowLongW (hWnd, GWL_WNDPROC, - (LONG)DefSubclassProc); + stack->origproc = (WNDPROC)SetWindowLongPtrW (hWnd, GWLP_WNDPROC, + (DWORD_PTR)COMCTL32_SubclassProc); else - stack->origproc = (WNDPROC)SetWindowLongA (hWnd, GWL_WNDPROC, - (LONG)DefSubclassProc); - } else { - WNDPROC current; - if (IsWindowUnicode (hWnd)) - current = (WNDPROC)GetWindowLongW (hWnd, GWL_WNDPROC); - else - current = (WNDPROC)GetWindowLongA (hWnd, GWL_WNDPROC); - - if (current != DefSubclassProc) { - ERR ("Application has subclassed with our procedure, then manually, then with us again. The current implementation can't handle this.\n"); - return FALSE; + stack->origproc = (WNDPROC)SetWindowLongPtrA (hWnd, GWLP_WNDPROC, + (DWORD_PTR)COMCTL32_SubclassProc); + } + else { + /* Check to see if we have called this function with the same uIDSubClass + * and pfnSubclass */ + proc = stack->SubclassProcs; + while (proc) { + if ((proc->id == uIDSubclass) && + (proc->subproc == pfnSubclass)) { + proc->ref = dwRef; + return TRUE; + } + proc = proc->next; } } - - /* Check to see if we have called this function with the same uIDSubClass - * and pfnSubclass */ - for (n = 0; n < stack->stacknum; n++) - if ((stack->SubclassProcs[n].id == uIDSubclass) && - (stack->SubclassProcs[n].subproc == pfnSubclass)) { - stack->SubclassProcs[n].ref = dwRef; - return TRUE; - } - - if (stack->stacknum >= 32) { - ERR ("We have a Subclass stack overflow, please increment size\n"); + + proc = HeapAlloc(GetProcessHeap(), 0, sizeof(SUBCLASSPROCS)); + if (!proc) { + ERR ("Failed to allocate subclass entry in stack\n"); + if (IsWindowUnicode (hWnd)) + SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); + else + SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); + HeapFree (GetProcessHeap (), 0, stack); + RemovePropA( hWnd, COMCTL32_aSubclass ); return FALSE; } - - memmove (&stack->SubclassProcs[1], &stack->SubclassProcs[0], - sizeof(stack->SubclassProcs[0]) * stack->stacknum); - - stack->stacknum++; - if (stack->wndprocrecursion) - stack->stackpos++; - - stack->SubclassProcs[0].subproc = pfnSubclass; - stack->SubclassProcs[0].ref = dwRef; - stack->SubclassProcs[0].id = uIDSubclass; + proc->subproc = pfnSubclass; + proc->ref = dwRef; + proc->id = uIDSubclass; + proc->next = stack->SubclassProcs; + stack->SubclassProcs = proc; + return TRUE; } @@ -1182,7 +1178,7 @@ BOOL WINAPI GetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uID, DWORD_PTR *pdwRef) { LPSUBCLASS_INFO stack; - int n; + LPSUBCLASSPROCS proc; TRACE ("(%p, %p, %x, %p)\n", hWnd, pfnSubclass, uID, pdwRef); @@ -1191,12 +1187,15 @@ BOOL WINAPI GetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, if (!stack) return FALSE; - for (n = 0; n < stack->stacknum; n++) - if ((stack->SubclassProcs[n].id == uID) && - (stack->SubclassProcs[n].subproc == pfnSubclass)) { - *pdwRef = stack->SubclassProcs[n].ref; + proc = stack->SubclassProcs; + while (proc) { + if ((proc->id == uID) && + (proc->subproc == pfnSubclass)) { + *pdwRef = proc->ref; return TRUE; } + proc = proc->next; + } return FALSE; } @@ -1220,7 +1219,9 @@ BOOL WINAPI GetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uID) { LPSUBCLASS_INFO stack; - int n; + LPSUBCLASSPROCS prevproc = NULL; + LPSUBCLASSPROCS proc; + BOOL ret = FALSE; TRACE ("(%p, %p, %x)\n", hWnd, pfnSubclass, uID); @@ -1229,40 +1230,81 @@ BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR u if (!stack) return FALSE; - if ((stack->stacknum == 1) && (stack->stackpos == 1) && - !stack->wndprocrecursion) { + proc = stack->SubclassProcs; + while (proc) { + if ((proc->id == uID) && + (proc->subproc == pfnSubclass)) { + + if (!prevproc) + stack->SubclassProcs = proc->next; + else + prevproc->next = proc->next; + + if (stack->stackpos == proc) + stack->stackpos = stack->stackpos->next; + + HeapFree (GetProcessHeap (), 0, proc); + ret = TRUE; + break; + } + prevproc = proc; + proc = proc->next; + } + + if (!stack->SubclassProcs && !stack->running) { TRACE("Last Subclass removed, cleaning up\n"); /* clean up our heap and reset the origional window procedure */ if (IsWindowUnicode (hWnd)) - SetWindowLongW (hWnd, GWL_WNDPROC, (LONG)stack->origproc); + SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); else - SetWindowLongA (hWnd, GWL_WNDPROC, (LONG)stack->origproc); + SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); HeapFree (GetProcessHeap (), 0, stack); RemovePropA( hWnd, COMCTL32_aSubclass ); - return TRUE; } - - for (n = stack->stacknum - 1; n >= 0; n--) - if ((stack->SubclassProcs[n].id == uID) && - (stack->SubclassProcs[n].subproc == pfnSubclass)) { - if (n != stack->stacknum) - /* Fill the hole in the stack */ - memmove (&stack->SubclassProcs[n], &stack->SubclassProcs[n + 1], - sizeof(stack->SubclassProcs[0]) * (stack->stacknum - n)); - stack->SubclassProcs[n].subproc = NULL; - stack->SubclassProcs[n].ref = 0; - stack->SubclassProcs[n].id = 0; - - stack->stacknum--; - if (n < stack->stackpos && stack->wndprocrecursion) - stack->stackpos--; - - return TRUE; - } - - return FALSE; + + return ret; } +/*********************************************************************** + * COMCTL32_SubclassProc (internal) + * + * Window procedure for all subclassed windows. + * Saves the current subclassing stack position to support nested messages + */ +LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + LPSUBCLASS_INFO stack; + LPSUBCLASSPROCS proc; + LRESULT ret; + + TRACE ("(%p, 0x%08x, 0x%08x, 0x%08lx)\n", hWnd, uMsg, wParam, lParam); + + stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); + if (!stack) { + ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd); + return 0; + } + + /* Save our old stackpos to properly handle nested messages */ + proc = stack->stackpos; + stack->stackpos = stack->SubclassProcs; + stack->running++; + ret = DefSubclassProc(hWnd, uMsg, wParam, lParam); + stack->running--; + stack->stackpos = proc; + + if (!stack->SubclassProcs) { + TRACE("Last Subclass removed, cleaning up\n"); + /* clean up our heap and reset the origional window procedure */ + if (IsWindowUnicode (hWnd)) + SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); + else + SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); + HeapFree (GetProcessHeap (), 0, stack); + RemovePropA( hWnd, COMCTL32_aSubclass ); + } + return ret; +} /*********************************************************************** * DefSubclassProc [COMCTL32.413] @@ -1284,6 +1326,8 @@ LRESULT WINAPI DefSubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar { LPSUBCLASS_INFO stack; LRESULT ret; + + TRACE ("(%p, 0x%08x, 0x%08x, 0x%08lx)\n", hWnd, uMsg, wParam, lParam); /* retrieve our little stack from the Properties */ stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); @@ -1292,41 +1336,19 @@ LRESULT WINAPI DefSubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar return 0; } - stack->wndprocrecursion++; - /* If we are at the end of stack then we have to call the original * window procedure */ - if (stack->stackpos == stack->stacknum) { + if (!stack->stackpos) { if (IsWindowUnicode (hWnd)) ret = CallWindowProcW (stack->origproc, hWnd, uMsg, wParam, lParam); else ret = CallWindowProcA (stack->origproc, hWnd, uMsg, wParam, lParam); } else { - stack->stackpos++; + LPSUBCLASSPROCS proc = stack->stackpos; + stack->stackpos = stack->stackpos->next; /* call the Subclass procedure from the stack */ - ret = stack->SubclassProcs[stack->stackpos - 1].subproc (hWnd, uMsg, wParam, lParam, - stack->SubclassProcs[stack->stackpos - 1].id, stack->SubclassProcs[stack->stackpos - 1].ref); - stack->stackpos--; - } - - /* We finished the recursion, so let's reinitalize the stack position to - * beginning */ - if ((--stack->wndprocrecursion) == 0) { - stack->stackpos = 0; - } - - /* If we removed the last entry in our stack while a window procedure was - * running then we have to clean up */ - if ((stack->stackpos == 0) && (stack->stacknum == 0)) { - TRACE("Last Subclass removed, cleaning up\n"); - /* clean up our heap and reset the origional window procedure */ - if (IsWindowUnicode (hWnd)) - SetWindowLongW (hWnd, GWL_WNDPROC, (LONG)stack->origproc); - else - SetWindowLongA (hWnd, GWL_WNDPROC, (LONG)stack->origproc); - HeapFree (GetProcessHeap (), 0, stack); - RemovePropA( hWnd, COMCTL32_aSubclass ); - return TRUE; + ret = proc->subproc (hWnd, uMsg, wParam, lParam, + proc->id, proc->ref); } return ret; @@ -1364,12 +1386,12 @@ COMCTL32_CreateToolTip(HWND hwndOwner) /* true owner can be different if hwndOwner is a child window */ HWND hwndTrueOwner = GetWindow(hwndToolTip, GW_OWNER); nmttc.hdr.hwndFrom = hwndTrueOwner; - nmttc.hdr.idFrom = GetWindowLongA(hwndTrueOwner, GWL_ID); + nmttc.hdr.idFrom = GetWindowLongPtrW(hwndTrueOwner, GWLP_ID); nmttc.hdr.code = NM_TOOLTIPSCREATED; nmttc.hwndToolTips = hwndToolTip; SendMessageA(GetParent(hwndTrueOwner), WM_NOTIFY, - (WPARAM)GetWindowLongA(hwndTrueOwner, GWL_ID), + (WPARAM)GetWindowLongPtrW(hwndTrueOwner, GWLP_ID), (LPARAM)&nmttc); } @@ -1410,3 +1432,56 @@ COMCTL32_RefreshSysColors(void) comctl32_color.clrInfoBk = GetSysColor (COLOR_INFOBK); comctl32_color.clrInfoText = GetSysColor (COLOR_INFOTEXT); } + +/*********************************************************************** + * COMCTL32_DrawInsertMark [NOT AN API] + * + * Draws an insertion mark (which looks similar to an 'I'). + * + * PARAMS + * hDC [I] Device context to draw onto. + * lpRect [I] Co-ordinates of insertion mark. + * clrInsertMark [I] Colour of the insertion mark. + * bHorizontal [I] True if insert mark should be drawn horizontally, + * vertical otherwise. + * + * RETURNS + * none + * + * NOTES + * Draws up to but not including the bottom co-ordinate when drawing + * vertically or the right co-ordinate when horizontal. + */ +void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark, BOOL bHorizontal) +{ + HPEN hPen = CreatePen(PS_SOLID, 1, clrInsertMark); + HPEN hOldPen; + static const DWORD adwPolyPoints[] = {4,4,4}; + LONG lCentre = (bHorizontal ? + lpRect->top + (lpRect->bottom - lpRect->top)/2 : + lpRect->left + (lpRect->right - lpRect->left)/2); + LONG l1 = (bHorizontal ? lpRect->left : lpRect->top); + LONG l2 = (bHorizontal ? lpRect->right : lpRect->bottom); + const POINT aptInsertMark[] = + { + /* top (V) or left (H) arrow */ + {lCentre , l1 + 2}, + {lCentre - 2, l1 }, + {lCentre + 3, l1 }, + {lCentre + 1, l1 + 2}, + /* middle line */ + {lCentre , l2 - 2}, + {lCentre , l1 - 1}, + {lCentre + 1, l1 - 1}, + {lCentre + 1, l2 - 2}, + /* bottom (V) or right (H) arrow */ + {lCentre , l2 - 3}, + {lCentre - 2, l2 - 1}, + {lCentre + 3, l2 - 1}, + {lCentre + 1, l2 - 3}, + }; + hOldPen = SelectObject(hDC, hPen); + PolyPolyline(hDC, aptInsertMark, adwPolyPoints, sizeof(adwPolyPoints)/sizeof(adwPolyPoints[0])); + SelectObject(hDC, hOldPen); + DeleteObject(hPen); +} diff --git a/reactos/lib/comctl32/datetime.c b/reactos/lib/comctl32/datetime.c index aab70245caa..85de9458f95 100644 --- a/reactos/lib/comctl32/datetime.c +++ b/reactos/lib/comctl32/datetime.c @@ -110,7 +110,7 @@ extern int MONTHCAL_MonthLength(int month, int year); #define DTHT_MCPOPUP 0x300 /* & DTHT_DATEFIELD 0 when DATETIME_KeyDown */ #define DTHT_GOTFOCUS 0x400 /* tests for date-fields */ -#define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO *)GetWindowLongA (hwnd, 0)) +#define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO *)GetWindowLongPtrW (hwnd, 0)) static BOOL DATETIME_SendSimpleNotify (HWND hwnd, UINT code); static BOOL DATETIME_SendDateTimeChangeNotify (HWND hwnd); @@ -256,7 +256,8 @@ DATETIME_SetMonthCalFont (HWND hwnd, WPARAM wParam, LPARAM lParam) static void DATETIME_UseFormat (DATETIME_INFO *infoPtr, const char *formattxt) { - int i,j,k,len; + unsigned int i; + int j,k,len; int *nrFields=& infoPtr->nrFields; TRACE ("%s\n",formattxt); @@ -267,7 +268,7 @@ DATETIME_UseFormat (DATETIME_INFO *infoPtr, const char *formattxt) len=strlen(allowedformatchars); k=0; - for (i=0; ihwndNotify, WM_NOTIFY, @@ -1221,14 +1222,14 @@ DATETIME_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) return 0; } - SetWindowLongA (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrA (hwnd, 0, (DWORD_PTR)infoPtr); if (dwStyle & DTS_SHOWNONE) { infoPtr->hwndCheckbut=CreateWindowExA (0,"button", 0, WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 2,2,13,13, hwnd, - 0, (HINSTANCE)GetWindowLongA (hwnd, GWL_HINSTANCE), 0); + 0, (HINSTANCE)GetWindowLongPtrW (hwnd, GWLP_HINSTANCE), 0); SendMessageA (infoPtr->hwndCheckbut, BM_SETCHECK, 1, 0); } @@ -1276,7 +1277,7 @@ DATETIME_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->hMonthCal = NULL; } Free (infoPtr); - SetWindowLongA( hwnd, 0, 0 ); /* clear infoPtr */ + SetWindowLongPtrA( hwnd, 0, 0 ); /* clear infoPtr */ return 0; } diff --git a/reactos/lib/comctl32/draglist.c b/reactos/lib/comctl32/draglist.c index 26411e9ad98..ca1fcc64edf 100644 --- a/reactos/lib/comctl32/draglist.c +++ b/reactos/lib/comctl32/draglist.c @@ -74,7 +74,7 @@ typedef struct _DRAGLISTDATA RECT last_drag_icon_rect; } DRAGLISTDATA; -static UINT uDragListMessage = 0; /* registered window message code */ +UINT uDragListMessage = 0; /* registered window message code */ static DWORD dwLastScrollTime = 0; static HICON hDragArrow = NULL; @@ -99,9 +99,10 @@ static inline void DragList_EndDrag(HWND hwnd, DRAGLISTDATA * data) { KillTimer(hwnd, DRAGLIST_TIMERID); ReleaseCapture(); - data->dragging = FALSE; /* clear any drag insert icon present */ InvalidateRect(GetParent(hwnd), &data->last_drag_icon_rect, TRUE); + /* clear data for next use */ + memset(data, 0, sizeof(*data)); } /*********************************************************************** @@ -118,8 +119,6 @@ DragList_SubclassWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, { case WM_LBUTTONDOWN: SetFocus(hwnd); - data->cursor = NULL; - SetRectEmpty(&data->last_drag_icon_rect); data->dragging = DragList_Notify(hwnd, DL_BEGINDRAG); if (data->dragging) { @@ -183,15 +182,6 @@ DragList_SubclassWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, } break; - case WM_SETCURSOR: - /* if app has told us to set a cursor then do so */ - if (data->dragging && data->cursor) - { - SetCursor(data->cursor); - return TRUE; - } - break; - case WM_GETDLGCODE: /* tell dialog boxes that we want to receive WM_KEYDOWN events * for keys like VK_ESCAPE */ diff --git a/reactos/lib/comctl32/flatsb.c b/reactos/lib/comctl32/flatsb.c index 0c69a326bbe..a7a1f0063f2 100644 --- a/reactos/lib/comctl32/flatsb.c +++ b/reactos/lib/comctl32/flatsb.c @@ -47,7 +47,7 @@ typedef struct DWORD dwDummy; /* just to keep the compiler happy ;-) */ } FLATSB_INFO, *LPFLATSB_INFO; -#define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)GetWindowLongA (hwnd, 0)) +#define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)GetWindowLongPtrW (hwnd, 0)) /*********************************************************************** diff --git a/reactos/lib/comctl32/header.c b/reactos/lib/comctl32/header.c index 0d592791075..cb4ec0b9757 100644 --- a/reactos/lib/comctl32/header.c +++ b/reactos/lib/comctl32/header.c @@ -92,7 +92,7 @@ typedef struct #define VERT_BORDER 3 #define DIVIDER_WIDTH 10 -#define HEADER_GetInfoPtr(hwnd) ((HEADER_INFO *)GetWindowLongA(hwnd,0)) +#define HEADER_GetInfoPtr(hwnd) ((HEADER_INFO *)GetWindowLongPtrW(hwnd,0)) inline static LRESULT @@ -108,8 +108,8 @@ static INT HEADER_OrderToIndex(HWND hwnd, WPARAM wParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); - INT i,iorder = (INT)wParam; - + INT iorder = (INT)wParam; + UINT i; if ((iorder <0) || iorder >infoPtr->uNumItem) return iorder; @@ -125,7 +125,8 @@ HEADER_SetItemBounds (HWND hwnd) HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); HEADER_ITEM *phdi; RECT rect; - int i, x; + unsigned int i; + int x; infoPtr->bRectsValid = TRUE; @@ -190,7 +191,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack) if (phdi->fmt & HDF_OWNERDRAW) { DRAWITEMSTRUCT dis; dis.CtlType = ODT_HEADER; - dis.CtlID = GetWindowLongA (hwnd, GWL_ID); + dis.CtlID = GetWindowLongPtrW (hwnd, GWLP_ID); dis.itemID = iItem; dis.itemAction = ODA_DRAWENTIRE; dis.itemState = phdi->bDown ? ODS_SELECTED : 0; @@ -354,7 +355,8 @@ HEADER_Refresh (HWND hwnd, HDC hdc) HFONT hFont, hOldFont; RECT rect; HBRUSH hbrBk; - INT i, x; + UINT i; + INT x; /* get rect for the bar, adjusted for the border */ GetClientRect (hwnd, &rect); @@ -401,7 +403,8 @@ HEADER_InternalHitTest (HWND hwnd, LPPOINT lpPt, UINT *pFlags, INT *pItem) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); RECT rect, rcTest; - INT iCount, width; + UINT iCount; + INT width; BOOL bNoWidth; GetClientRect (hwnd, &rect); @@ -542,7 +545,7 @@ HEADER_SendSimpleNotify (HWND hwnd, UINT code) NMHDR nmhdr; nmhdr.hwndFrom = hwnd; - nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID); + nmhdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); nmhdr.code = code; return (BOOL)SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, @@ -557,7 +560,7 @@ HEADER_SendHeaderNotify (HWND hwnd, UINT code, INT iItem, INT mask) HDITEMA nmitem; nmhdr.hdr.hwndFrom = hwnd; - nmhdr.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); + nmhdr.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); nmhdr.hdr.code = code; nmhdr.iItem = iItem; nmhdr.iButton = 0; @@ -586,7 +589,7 @@ HEADER_SendClickNotify (HWND hwnd, UINT code, INT iItem) NMHEADERA nmhdr; nmhdr.hdr.hwndFrom = hwnd; - nmhdr.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); + nmhdr.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); nmhdr.hdr.code = code; nmhdr.iItem = iItem; nmhdr.iButton = 0; @@ -814,7 +817,7 @@ HEADER_GetOrderArray(HWND hwnd, WPARAM wParam, LPARAM lParam) LPINT order = (LPINT) lParam; HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); - if ((int)wParam uNumItem) + if ((unsigned int)wParam uNumItem) return FALSE; for (i=0; i<(int)wParam; i++) *order++=HEADER_OrderToIndex(hwnd,i); @@ -829,7 +832,7 @@ HEADER_SetOrderArray(HWND hwnd, WPARAM wParam, LPARAM lParam) HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); HEADER_ITEM *lpItem; - if ((int)wParam uNumItem) + if ((unsigned int)wParam uNumItem) return FALSE; for (i=0; i<(int)wParam; i++) { @@ -856,10 +859,10 @@ HEADER_HitTest (HWND hwnd, WPARAM wParam, LPARAM lParam) HEADER_InternalHitTest (hwnd, &phti->pt, &phti->flags, &phti->iItem); - if (phti->flags == HHT_ONHEADER) - return phti->iItem; - else + if (phti->flags == HHT_NOWHERE) return -1; + else + return phti->iItem; } @@ -870,7 +873,8 @@ HEADER_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) HDITEMA *phdi = (HDITEMA*)lParam; INT nItem = (INT)wParam; HEADER_ITEM *lpItem; - INT len, i, iOrder; + INT len, iOrder; + UINT i; if ((phdi == NULL) || (nItem < 0)) return -1; @@ -971,7 +975,8 @@ HEADER_InsertItemW (HWND hwnd, WPARAM wParam, LPARAM lParam) HDITEMW *phdi = (HDITEMW*)lParam; INT nItem = (INT)wParam; HEADER_ITEM *lpItem; - INT len, i, iOrder; + INT len, iOrder; + UINT i; if ((phdi == NULL) || (nItem < 0)) return -1; @@ -1284,7 +1289,7 @@ HEADER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) HDC hdc; infoPtr = (HEADER_INFO *)Alloc (sizeof(HEADER_INFO)); - SetWindowLongA (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrA (hwnd, 0, (DWORD_PTR)infoPtr); infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent; infoPtr->uNumItem = 0; @@ -1335,7 +1340,7 @@ HEADER_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) ImageList_Destroy (infoPtr->himl); Free (infoPtr); - SetWindowLongA (hwnd, 0, 0); + SetWindowLongPtrA (hwnd, 0, 0); return 0; } @@ -1496,9 +1501,9 @@ HEADER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->items[infoPtr->iMoveItem].cxy = nWidth; } - HEADER_SendHeaderNotify(hwnd, HDN_ITEMCHANGINGA, infoPtr->iMoveItem, HDI_WIDTH); HEADER_SetItemBounds (hwnd); - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, NULL, TRUE); + HEADER_SendHeaderNotify(hwnd, HDN_ITEMCHANGEDA, infoPtr->iMoveItem, HDI_WIDTH); /* * } */ @@ -1571,7 +1576,7 @@ HEADER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) } else if (infoPtr->bTracking) { if (dwStyle & HDS_FULLDRAG) { - if (HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGINGA, infoPtr->iMoveItem, HDI_WIDTH)) + if (HEADER_SendHeaderNotify (hwnd, HDN_TRACKA, infoPtr->iMoveItem, HDI_WIDTH)) { nWidth = pt.x - infoPtr->items[infoPtr->iMoveItem].rect.left + infoPtr->xTrackOffset; if (nWidth < 0) @@ -1580,7 +1585,6 @@ HEADER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) HEADER_SendHeaderNotify(hwnd, HDN_ITEMCHANGEDA, infoPtr->iMoveItem, HDI_WIDTH); } HEADER_SetItemBounds (hwnd); - InvalidateRect(hwnd, NULL, FALSE); } else { hdc = GetDC (hwnd); diff --git a/reactos/lib/comctl32/hotkey.c b/reactos/lib/comctl32/hotkey.c index 1a6b1c754f4..5219cf79c24 100644 --- a/reactos/lib/comctl32/hotkey.c +++ b/reactos/lib/comctl32/hotkey.c @@ -51,7 +51,7 @@ typedef struct tagHOTKEY_INFO WCHAR strNone[15]; /* hope its long enough ... */ } HOTKEY_INFO; -#define HOTKEY_GetInfoPtr(hwnd) ((HOTKEY_INFO *)GetWindowLongA (hwnd, 0)) +#define HOTKEY_GetInfoPtr(hwnd) ((HOTKEY_INFO *)GetWindowLongPtrA (hwnd, 0)) static const WCHAR HOTKEY_plussep[] = { ' ', '+', ' ' }; @@ -217,7 +217,7 @@ HOTKEY_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) /* allocate memory for info structure */ infoPtr = (HOTKEY_INFO *)Alloc (sizeof(HOTKEY_INFO)); - SetWindowLongW (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize info structure */ infoPtr->HotKey = infoPtr->InvComb = infoPtr->InvMod = infoPtr->CurrMod = 0; @@ -242,7 +242,7 @@ HOTKEY_Destroy (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam) HWND hwnd = infoPtr->hwndSelf; /* free hotkey info data */ Free (infoPtr); - SetWindowLongW (hwnd, 0, 0); + SetWindowLongPtrW (hwnd, 0, 0); return 0; } diff --git a/reactos/lib/comctl32/imagelist.c b/reactos/lib/comctl32/imagelist.c index 579de3ffe1a..b14fdb7d693 100644 --- a/reactos/lib/comctl32/imagelist.c +++ b/reactos/lib/comctl32/imagelist.c @@ -3,7 +3,7 @@ * * Copyright 1998 Eric Kohl * Copyright 2000 Jason Mawdsley - * Copyright 2001 Michael Stefaniuc + * Copyright 2001, 2004 Michael Stefaniuc * Copyright 2001 Charles Loep for CodeWeavers * Copyright 2002 Dimitrie O. Paun * @@ -34,12 +34,6 @@ * - Add support for ILD_PRESERVEALPHA, ILD_SCALE, ILD_DPISCALE * - Add support for ILS_GLOW, ILS_SHADOW, ILS_SATURATE, ILS_ALPHA * - Thread-safe locking - * - * FIXME: - * - Hotspot handling still not correct. The Hotspot passed to BeginDrag - * is the offset of the image position relative to the actual mouse pointer - * position. However the Hotspot passed to SetDragCursorImage is the - * offset of the mouse messages sent to the application... */ #include @@ -76,10 +70,9 @@ typedef struct BOOL bShow; /* saved background */ HBITMAP hbmBg; - BOOL bHSPending; } INTERNALDRAG; -static INTERNALDRAG InternalDrag = { 0, 0, 0, 0, 0, 0, FALSE, 0, FALSE }; +static INTERNALDRAG InternalDrag = { 0, 0, 0, 0, 0, 0, FALSE, 0 }; static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT width, UINT height); @@ -424,7 +417,6 @@ ImageList_BeginDrag (HIMAGELIST himlTrack, INT iTrack, BitBlt (InternalDrag.himl->hdcMask, 0, 0, cx, cy, himlTrack->hdcMask, iTrack * cx, 0, SRCCOPY); InternalDrag.himl->cCurImage = 1; - InternalDrag.bHSPending = TRUE; return TRUE; } @@ -1279,7 +1271,6 @@ ImageList_EndDrag (void) InternalDrag.bShow = FALSE; DeleteObject(InternalDrag.hbmBg); InternalDrag.hbmBg = 0; - InternalDrag.bHSPending = FALSE; } @@ -2362,7 +2353,11 @@ ImageList_SetBkColor (HIMAGELIST himl, COLORREF clrBk) * Failure: FALSE * * NOTES - * When this function is called and the drag image is visible, a + * - The names dxHotspot, dyHotspot are misleading because they have nothing + * to do with a hotspot but are only the offset of the origin of the new + * image relative to the origin of the old image. + * + * - When this function is called and the drag image is visible, a * short flickering occurs but this matches the Win9x behavior. It is * possible to fix the flickering using code like in ImageList_DragMove. */ @@ -2372,7 +2367,6 @@ ImageList_SetDragCursorImage (HIMAGELIST himlDrag, INT iDrag, INT dxHotspot, INT dyHotspot) { HIMAGELIST himlTemp; - INT dx, dy; BOOL visible; if (!is_valid(InternalDrag.himl) || !is_valid(himlDrag)) @@ -2383,20 +2377,8 @@ ImageList_SetDragCursorImage (HIMAGELIST himlDrag, INT iDrag, visible = InternalDrag.bShow; - /* Calculate the offset between the origin of the old image and the - * origin of the second image. - * dxHotspot, dyHotspot is the offset of THE Hotspot (there is only one - * hotspot) to the origin of the second image. - * See M$DN for details */ - if(InternalDrag.bHSPending) { - dx = 0; - dy = 0; - InternalDrag.bHSPending = FALSE; - } else { - dx = InternalDrag.dxHotspot - dxHotspot; - dy = InternalDrag.dyHotspot - dyHotspot; - } - himlTemp = ImageList_Merge (InternalDrag.himl, 0, himlDrag, iDrag, dx, dy); + himlTemp = ImageList_Merge (InternalDrag.himl, 0, himlDrag, iDrag, + dxHotspot, dyHotspot); if (visible) { /* hide the drag image */ @@ -2412,13 +2394,6 @@ ImageList_SetDragCursorImage (HIMAGELIST himlDrag, INT iDrag, ImageList_Destroy (InternalDrag.himl); InternalDrag.himl = himlTemp; - /* update the InternalDragOffset, if the origin of the - * DragImage was changed by ImageList_Merge. */ - if (dx <= 0) - InternalDrag.dxHotspot = dxHotspot; - if (dy <= 0) - InternalDrag.dyHotspot = dyHotspot; - if (visible) { /* show the drag image */ ImageList_DragShowNolock(TRUE); diff --git a/reactos/lib/comctl32/ipaddress.c b/reactos/lib/comctl32/ipaddress.c index d1d52ce064e..7f754e56990 100644 --- a/reactos/lib/comctl32/ipaddress.c +++ b/reactos/lib/comctl32/ipaddress.c @@ -71,7 +71,7 @@ typedef struct #define POS_SELALL 3 #define IP_SUBCLASS_PROP "CCIP32SubclassInfo" -#define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO *)GetWindowLongW (hwnd, 0)) +#define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO *)GetWindowLongPtrW (hwnd, 0)) static LRESULT CALLBACK @@ -84,7 +84,7 @@ static LRESULT IPADDRESS_Notify (IPADDRESS_INFO *infoPtr, UINT command) TRACE("(command=%x)\n", command); return SendMessageW (infoPtr->Notify, WM_COMMAND, - MAKEWPARAM (GetWindowLongW (hwnd, GWL_ID), command), (LPARAM)hwnd); + MAKEWPARAM (GetWindowLongPtrW (hwnd, GWLP_ID), command), (LPARAM)hwnd); } static INT IPADDRESS_IPNotify (IPADDRESS_INFO *infoPtr, INT field, INT value) @@ -94,7 +94,7 @@ static INT IPADDRESS_IPNotify (IPADDRESS_INFO *infoPtr, INT field, INT value) TRACE("(field=%x, value=%d)\n", field, value); nmip.hdr.hwndFrom = infoPtr->Self; - nmip.hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID); + nmip.hdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID); nmip.hdr.code = IPN_FIELDCHANGED; nmip.iField = field; @@ -164,7 +164,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate) infoPtr = (IPADDRESS_INFO *)Alloc (sizeof(IPADDRESS_INFO)); if (!infoPtr) return -1; - SetWindowLongW (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); GetClientRect (hwnd, &rcClient); @@ -187,11 +187,11 @@ static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate) CreateWindowW (EDIT, NULL, WS_CHILD | WS_VISIBLE | ES_CENTER, edit.left, edit.top, edit.right - edit.left, edit.bottom - edit.top, hwnd, (HMENU) 1, - (HINSTANCE)GetWindowLongW(hwnd, GWL_HINSTANCE), NULL); + (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), NULL); SetPropA(part->EditHwnd, IP_SUBCLASS_PROP, hwnd); part->OrigProc = (WNDPROC) - SetWindowLongW (part->EditHwnd, GWL_WNDPROC, - (LONG)IPADDRESS_SubclassProc); + SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC, + (DWORD_PTR)IPADDRESS_SubclassProc); } return 0; @@ -206,10 +206,10 @@ static LRESULT IPADDRESS_Destroy (IPADDRESS_INFO *infoPtr) for (i = 0; i < 4; i++) { IPPART_INFO* part = &infoPtr->Part[i]; - SetWindowLongW (part->EditHwnd, GWL_WNDPROC, (LONG)part->OrigProc); + SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC, (DWORD_PTR)part->OrigProc); } - SetWindowLongW (infoPtr->Self, 0, 0); + SetWindowLongPtrW (infoPtr->Self, 0, 0); Free (infoPtr); return 0; } @@ -565,12 +565,12 @@ void IPADDRESS_Register (void) WNDCLASSW wndClass; ZeroMemory (&wndClass, sizeof(WNDCLASSW)); - wndClass.style = CS_GLOBALCLASS; - wndClass.lpfnWndProc = (WNDPROC)IPADDRESS_WindowProc; + wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; + wndClass.lpfnWndProc = IPADDRESS_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(IPADDRESS_INFO *); wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_IBEAM); - wndClass.hbrBackground = GetStockObject(WHITE_BRUSH); + wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wndClass.lpszClassName = WC_IPADDRESSW; RegisterClassW (&wndClass); diff --git a/reactos/lib/comctl32/listview.c b/reactos/lib/comctl32/listview.c index 704988b2b2b..69f8dea59cc 100644 --- a/reactos/lib/comctl32/listview.c +++ b/reactos/lib/comctl32/listview.c @@ -41,7 +41,7 @@ * Bugs * -- Expand large item in ICON mode when the cursor is flying over the icon or text. * -- Support CustonDraw options for _WIN32_IE >= 0x560 (see NMLVCUSTOMDRAW docs. - * -- in LISTVIEW_AddGroupSelection, se whould send LVN_ODSTATECHANGED + * -- in LISTVIEW_AddGroupSelection, we would send LVN_ODSTATECHANGED * -- LVA_SNAPTOGRID not implemented * -- LISTVIEW_ApproximateViewRect partially implemented * -- LISTVIEW_[GS]etColumnOrderArray stubs @@ -717,7 +717,7 @@ static LRESULT notify_hdr(LISTVIEW_INFO *infoPtr, INT code, LPNMHDR pnmh) TRACE("(code=%d)\n", code); pnmh->hwndFrom = infoPtr->hwndSelf; - pnmh->idFrom = GetWindowLongW(infoPtr->hwndSelf, GWL_ID); + pnmh->idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); pnmh->code = code; result = SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)pnmh->idFrom, (LPARAM)pnmh); @@ -1732,7 +1732,7 @@ static void LISTVIEW_ShowFocusRect(LISTVIEW_INFO *infoPtr, BOOL fShow) ZeroMemory(&dis, sizeof(dis)); dis.CtlType = ODT_LISTVIEW; - dis.CtlID = GetWindowLongW(infoPtr->hwndSelf, GWL_ID); + dis.CtlID = (UINT)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); dis.itemID = item.iItem; dis.itemAction = ODA_FOCUS; if (fShow) dis.itemState |= ODS_FOCUS; @@ -3691,7 +3691,7 @@ postpaint: */ static void LISTVIEW_RefreshOwnerDraw(LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, DWORD cdmode) { - UINT uID = GetWindowLongW(infoPtr->hwndSelf, GWL_ID); + UINT uID = (UINT)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); DWORD cditemmode = CDRF_DODEFAULT; NMLVCUSTOMDRAW nmlvcd; POINT Origin, Position; @@ -7380,7 +7380,7 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) infoPtr = (LISTVIEW_INFO *)Alloc(sizeof(LISTVIEW_INFO)); if (!infoPtr) return -1; - SetWindowLongW(hwnd, 0, (LONG)infoPtr); + SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr); infoPtr->hwndSelf = hwnd; infoPtr->dwStyle = lpcs->style; @@ -7725,7 +7725,7 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta) { UINT uView = infoPtr->dwStyle & LVS_TYPEMASK; INT gcWheelDelta = 0; - UINT pulScrollLines = 3; + INT pulScrollLines = 3; SCROLLINFO scrollInfo; TRACE("(wheelDelta=%d)\n", wheelDelta); @@ -8182,7 +8182,7 @@ static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr) if (infoPtr->hDefaultFont) DeleteObject(infoPtr->hDefaultFont); if (infoPtr->clrBk != CLR_NONE) DeleteObject(infoPtr->hBkBrush); - SetWindowLongW(infoPtr->hwndSelf, 0, 0); + SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0); /* free listview info pointer*/ Free(infoPtr); @@ -8774,7 +8774,7 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType, static LRESULT WINAPI LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongPtrW(hwnd, 0); TRACE("(uMsg=%x wParam=%x lParam=%lx)\n", uMsg, wParam, lParam); @@ -9382,7 +9382,7 @@ static LRESULT LISTVIEW_Command(LISTVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lP */ static LRESULT EditLblWndProcT(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL isW) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(GetParent(hwnd), 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongPtrW(GetParent(hwnd), 0); BOOL cancel = FALSE; TRACE("(hwnd=%p, uMsg=%x, wParam=%x, lParam=%lx, isW=%d)\n", @@ -9400,7 +9400,7 @@ static LRESULT EditLblWndProcT(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara { WNDPROC editProc = infoPtr->EditWndProc; infoPtr->EditWndProc = 0; - SetWindowLongW(hwnd, GWL_WNDPROC, (LONG)editProc); + SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (DWORD_PTR)editProc); return CallWindowProcT(editProc, hwnd, uMsg, wParam, lParam, isW); } @@ -9501,7 +9501,7 @@ static HWND CreateEditLabelT(LISTVIEW_INFO *infoPtr, LPCWSTR text, DWORD style, HDC hdc; HDC hOldFont=0; TEXTMETRICW textMetric; - HINSTANCE hinst = (HINSTANCE)GetWindowLongW(infoPtr->hwndSelf, GWL_HINSTANCE); + HINSTANCE hinst = (HINSTANCE)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_HINSTANCE); TRACE("(text=%s, ..., isW=%d)\n", debugtext_t(text, isW), isW); @@ -9532,8 +9532,8 @@ static HWND CreateEditLabelT(LISTVIEW_INFO *infoPtr, LPCWSTR text, DWORD style, if (!hedit) return 0; infoPtr->EditWndProc = (WNDPROC) - (isW ? SetWindowLongW(hedit, GWL_WNDPROC, (LONG)EditLblWndProcW) : - SetWindowLongA(hedit, GWL_WNDPROC, (LONG)EditLblWndProcA) ); + (isW ? SetWindowLongPtrW(hedit, GWLP_WNDPROC, (DWORD_PTR)EditLblWndProcW) : + SetWindowLongPtrA(hedit, GWLP_WNDPROC, (DWORD_PTR)EditLblWndProcA) ); SendMessageW(hedit, WM_SETFONT, (WPARAM)infoPtr->hFont, FALSE); diff --git a/reactos/lib/comctl32/monthcal.c b/reactos/lib/comctl32/monthcal.c index a7be319a7ba..0a56ac4bc2c 100644 --- a/reactos/lib/comctl32/monthcal.c +++ b/reactos/lib/comctl32/monthcal.c @@ -114,7 +114,7 @@ typedef struct static const int DayOfWeekTable[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; -#define MONTHCAL_GetInfoPtr(hwnd) ((MONTHCAL_INFO *)GetWindowLongA(hwnd, 0)) +#define MONTHCAL_GetInfoPtr(hwnd) ((MONTHCAL_INFO *)GetWindowLongPtrW(hwnd, 0)) /* helper functions */ @@ -1302,7 +1302,7 @@ static void MONTHCAL_GoToNextMonth(HWND hwnd, MONTHCAL_INFO *infoPtr) int i; nmds.nmhdr.hwndFrom = hwnd; - nmds.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); + nmds.nmhdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); nmds.nmhdr.code = MCN_GETDAYSTATE; nmds.cDayState = infoPtr->monthRange; nmds.prgDayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); @@ -1332,7 +1332,7 @@ static void MONTHCAL_GoToPrevMonth(HWND hwnd, MONTHCAL_INFO *infoPtr) int i; nmds.nmhdr.hwndFrom = hwnd; - nmds.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); + nmds.nmhdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); nmds.nmhdr.code = MCN_GETDAYSTATE; nmds.cDayState = infoPtr->monthRange; nmds.prgDayState = Alloc @@ -1491,7 +1491,7 @@ MONTHCAL_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_SetCurSel(hwnd,0,(LPARAM) &selArray); TRACE("MCHT_CALENDARDATE\n"); nmsc.nmhdr.hwndFrom = hwnd; - nmsc.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); + nmsc.nmhdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); nmsc.nmhdr.code = MCN_SELCHANGE; MONTHCAL_CopyTime(&infoPtr->minSel,&nmsc.stSelStart); MONTHCAL_CopyTime(&infoPtr->maxSel,&nmsc.stSelEnd); @@ -1559,7 +1559,7 @@ MONTHCAL_LButtonUp(HWND hwnd, WPARAM wParam, LPARAM lParam) return TRUE; } nmhdr.hwndFrom = hwnd; - nmhdr.idFrom = GetWindowLongA( hwnd, GWL_ID); + nmhdr.idFrom = GetWindowLongPtrW( hwnd, GWLP_ID); nmhdr.code = NM_RELEASEDCAPTURE; TRACE("Sent notification from %p to %p\n", hwnd, infoPtr->hwndNotify); @@ -1571,7 +1571,7 @@ MONTHCAL_LButtonUp(HWND hwnd, WPARAM wParam, LPARAM lParam) /* only send MCN_SELECT if currently displayed month's day was selected */ if(hit == MCHT_CALENDARDATE) { nmsc.nmhdr.hwndFrom = hwnd; - nmsc.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); + nmsc.nmhdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); nmsc.nmhdr.code = MCN_SELECT; MONTHCAL_CopyTime(&infoPtr->minSel, &nmsc.stSelStart); MONTHCAL_CopyTime(&infoPtr->maxSel, &nmsc.stSelEnd); @@ -1877,13 +1877,13 @@ MONTHCAL_Create(HWND hwnd, WPARAM wParam, LPARAM lParam) /* allocate memory for info structure */ infoPtr =(MONTHCAL_INFO*)Alloc(sizeof(MONTHCAL_INFO)); - SetWindowLongA(hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr); if(infoPtr == NULL) { ERR( "could not allocate info memory!\n"); return 0; } - if((MONTHCAL_INFO*)GetWindowLongA(hwnd, 0) != infoPtr) { + if((MONTHCAL_INFO*)GetWindowLongPtrW(hwnd, 0) != infoPtr) { ERR( "pointer assignment error!\n"); return 0; } @@ -1934,7 +1934,7 @@ MONTHCAL_Destroy(HWND hwnd, WPARAM wParam, LPARAM lParam) if(infoPtr->monthdayState) Free(infoPtr->monthdayState); Free(infoPtr); - SetWindowLongA(hwnd, 0, 0); + SetWindowLongPtrW(hwnd, 0, 0); return 0; } diff --git a/reactos/lib/comctl32/nativefont.c b/reactos/lib/comctl32/nativefont.c index a8ecff2b3a8..c5bee8b4fd9 100644 --- a/reactos/lib/comctl32/nativefont.c +++ b/reactos/lib/comctl32/nativefont.c @@ -45,7 +45,7 @@ typedef struct DWORD dwDummy; /* just to keep the compiler happy ;-) */ } NATIVEFONT_INFO; -#define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongA (hwnd, 0)) +#define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongPtrW (hwnd, 0)) static LRESULT @@ -55,7 +55,7 @@ NATIVEFONT_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) /* allocate memory for info structure */ infoPtr = (NATIVEFONT_INFO *)Alloc (sizeof(NATIVEFONT_INFO)); - SetWindowLongA (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize info structure */ @@ -75,7 +75,7 @@ NATIVEFONT_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) /* free comboex info data */ Free (infoPtr); - SetWindowLongA( hwnd, 0, 0 ); + SetWindowLongPtrW( hwnd, 0, 0 ); return 0; } diff --git a/reactos/lib/comctl32/pager.c b/reactos/lib/comctl32/pager.c index 535d70819c2..c050678b7c4 100644 --- a/reactos/lib/comctl32/pager.c +++ b/reactos/lib/comctl32/pager.c @@ -59,7 +59,7 @@ typedef struct INT direction; /* direction of the scroll, (e.g. PGF_SCROLLUP) */ } PAGER_INFO; -#define PAGER_GetInfoPtr(hwnd) ((PAGER_INFO *)GetWindowLongA(hwnd, 0)) +#define PAGER_GetInfoPtr(hwnd) ((PAGER_INFO *)GetWindowLongPtrW(hwnd, 0)) #define PAGER_IsHorizontal(hwnd) ((GetWindowLongA (hwnd, GWL_STYLE) & PGS_HORZ)) #define MIN_ARROW_WIDTH 8 @@ -330,12 +330,12 @@ PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth) NMPGCALCSIZE nmpgcs; ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE)); nmpgcs.hdr.hwndFrom = hwnd; - nmpgcs.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); + nmpgcs.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); nmpgcs.hdr.code = PGN_CALCSIZE; nmpgcs.dwFlag = getWidth ? PGF_CALCWIDTH : PGF_CALCHEIGHT; nmpgcs.iWidth = getWidth ? *size : 0; nmpgcs.iHeight = getWidth ? 0 : *size; - SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, + SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmpgcs.hdr.idFrom, (LPARAM)&nmpgcs); *size = getWidth ? nmpgcs.iWidth : nmpgcs.iHeight; @@ -515,7 +515,7 @@ PAGER_UpdateBtns(HWND hwnd, PAGER_INFO *infoPtr, } if (repaintBtns) - SendMessageA(hwnd, WM_NCPAINT, 0, 0); + SendMessageW(hwnd, WM_NCPAINT, 0, 0); } static LRESULT @@ -571,7 +571,7 @@ PAGER_HandleWindowPosChanging(HWND hwnd, WPARAM wParam, WINDOWPOS *winpos) return 0; } - DefWindowProcA (hwnd, WM_WINDOWPOSCHANGING, wParam, (LPARAM)winpos); + DefWindowProcW (hwnd, WM_WINDOWPOSCHANGING, wParam, (LPARAM)winpos); return 1; } @@ -643,8 +643,8 @@ PAGER_SetFixedHeight(HWND hwnd, PAGER_INFO* infoPtr) * this module), the native control does only the following: * * * * if (some condition) * - * PostMessageA(hwnd, EM_FMTLINES, 0, 0); * - * return DefWindowProcA(hwnd, PGM_RECALCSIZE, 0, 0); * + * PostMessageW(hwnd, EM_FMTLINES, 0, 0); * + * return DefWindowProcW(hwnd, PGM_RECALCSIZE, 0, 0); * * * * When we figure out what the "some condition" is we will * * implement that for the message processing. * @@ -777,7 +777,7 @@ PAGER_Scroll(HWND hwnd, INT dir) { ZeroMemory (&nmpgScroll, sizeof (NMPGSCROLL)); nmpgScroll.hdr.hwndFrom = hwnd; - nmpgScroll.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); + nmpgScroll.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); nmpgScroll.hdr.code = PGN_SCROLL; GetWindowRect(hwnd, &rcWnd); @@ -797,7 +797,7 @@ PAGER_Scroll(HWND hwnd, INT dir) } nmpgScroll.iScroll -= 2*infoPtr->nButtonSize; - SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, + SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmpgScroll.hdr.idFrom, (LPARAM)&nmpgScroll); TRACE("[%p] PGN_SCROLL returns iScroll=%d\n", hwnd, nmpgScroll.iScroll); @@ -830,7 +830,7 @@ PAGER_FmtLines(HWND hwnd) 0,0,infoPtr->nWidth,infoPtr->nHeight, 0); - return DefWindowProcA (hwnd, EM_FMTLINES, 0, 0); + return DefWindowProcW (hwnd, EM_FMTLINES, 0, 0); } static LRESULT @@ -841,7 +841,7 @@ PAGER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) /* allocate memory for info structure */ infoPtr = (PAGER_INFO *)Alloc (sizeof(PAGER_INFO)); - SetWindowLongA (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* set default settings */ infoPtr->hwndChild = NULL; @@ -882,7 +882,7 @@ PAGER_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); /* free pager info data */ Free (infoPtr); - SetWindowLongA (hwnd, 0, 0); + SetWindowLongPtrW (hwnd, 0, 0); return 0; } @@ -904,7 +904,7 @@ PAGER_NCCalcSize(HWND hwnd, WPARAM wParam, LPARAM lParam) * coordinates of the corresponding window's client area. */ - DefWindowProcA (hwnd, WM_NCCALCSIZE, wParam, lParam); + DefWindowProcW (hwnd, WM_NCCALCSIZE, wParam, lParam); TRACE("orig rect=(%ld,%ld)-(%ld,%ld)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); @@ -1029,7 +1029,7 @@ PAGER_NCPaint (HWND hwnd, WPARAM wParam, LPARAM lParam) if (dwStyle & WS_MINIMIZE) return 0; - DefWindowProcA (hwnd, WM_NCPAINT, wParam, lParam); + DefWindowProcW (hwnd, WM_NCPAINT, wParam, lParam); if (!(hdc = GetDCEx (hwnd, 0, DCX_USESTYLE | DCX_WINDOW))) return 0; @@ -1155,7 +1155,7 @@ PAGER_SetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam ) { PAGER_CaptureandTrack(infoPtr, hwnd); - SendMessageA(hwnd, WM_NCPAINT, 0, 0); + SendMessageW(hwnd, WM_NCPAINT, 0, 0); } return TRUE; @@ -1178,9 +1178,9 @@ PAGER_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam) NMHDR nmhdr; ZeroMemory (&nmhdr, sizeof (NMHDR)); nmhdr.hwndFrom = hwnd; - nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID); + nmhdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); nmhdr.code = NM_RELEASEDCAPTURE; - SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, + SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); } @@ -1253,7 +1253,7 @@ PAGER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) PAGER_DrawButton(hdc, infoPtr->clrBk, *btnrect, PAGER_IsHorizontal(hwnd), topLeft, btnstate); ReleaseDC(hwnd, hdc); - return DefWindowProcA (hwnd, WM_MOUSEMOVE, wParam, lParam); + return DefWindowProcW (hwnd, WM_MOUSEMOVE, wParam, lParam); } } @@ -1268,16 +1268,16 @@ PAGER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) NMHDR nmhdr; ZeroMemory (&nmhdr, sizeof (NMHDR)); nmhdr.hwndFrom = hwnd; - nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID); + nmhdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); nmhdr.code = NM_RELEASEDCAPTURE; - SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, + SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); } } if (IsWindow(hwnd)) KillTimer(hwnd, TIMERID1); } - return DefWindowProcA (hwnd, WM_MOUSEMOVE, wParam, lParam); + return DefWindowProcW (hwnd, WM_MOUSEMOVE, wParam, lParam); } static LRESULT @@ -1310,7 +1310,7 @@ PAGER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) } if (repaintBtns) - SendMessageA(hwnd, WM_NCPAINT, 0, 0); + SendMessageW(hwnd, WM_NCPAINT, 0, 0); switch(hit) { @@ -1417,7 +1417,7 @@ PAGER_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam) * pt.x=0; pt.y=0; ????? * MapWindowPoints(pager, parent, &pt, 1) * OffsetWindowOrgEx(hdc, pt.x, pt.y, &ptorg) - * SendMessageA(parent, WM_ERASEBKGND, hdc, 0) + * SendMessageW(parent, WM_ERASEBKGND, hdc, 0) * SetWindowOrgEx(hdc, 0, 0, 0) */ @@ -1426,7 +1426,7 @@ PAGER_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam) parent = GetParent(hwnd); MapWindowPoints(hwnd, parent, &pt, 1); OffsetWindowOrgEx (hdc, pt.x, pt.y, &ptorig); - SendMessageA (parent, WM_ERASEBKGND, wParam, lParam); + SendMessageW (parent, WM_ERASEBKGND, wParam, lParam); SetWindowOrgEx (hdc, ptorig.x, ptorig.y, 0); @@ -1475,7 +1475,7 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); if (!infoPtr && (uMsg != WM_CREATE)) - return DefWindowProcA (hwnd, uMsg, wParam, lParam); + return DefWindowProcW (hwnd, uMsg, wParam, lParam); switch (uMsg) { @@ -1551,7 +1551,7 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_MOUSEMOVE: if (infoPtr->bForward && infoPtr->hwndChild) - PostMessageA(infoPtr->hwndChild, WM_MOUSEMOVE, wParam, lParam); + PostMessageW(infoPtr->hwndChild, WM_MOUSEMOVE, wParam, lParam); return PAGER_MouseMove (hwnd, wParam, lParam); case WM_MOUSELEAVE: @@ -1578,10 +1578,10 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_NOTIFY: case WM_COMMAND: - return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam); + return SendMessageW (infoPtr->hwndNotify, uMsg, wParam, lParam); default: - return DefWindowProcA (hwnd, uMsg, wParam, lParam); + return DefWindowProcW (hwnd, uMsg, wParam, lParam); } return 0; @@ -1591,23 +1591,23 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) VOID PAGER_Register (void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; - ZeroMemory (&wndClass, sizeof(WNDCLASSA)); - wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS; - wndClass.lpfnWndProc = (WNDPROC)PAGER_WindowProc; + ZeroMemory (&wndClass, sizeof(WNDCLASSW)); + wndClass.style = CS_GLOBALCLASS; + wndClass.lpfnWndProc = PAGER_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(PAGER_INFO *); - wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW); - wndClass.hbrBackground = 0; - wndClass.lpszClassName = WC_PAGESCROLLERA; + wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW); + wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1); + wndClass.lpszClassName = WC_PAGESCROLLERW; - RegisterClassA (&wndClass); + RegisterClassW (&wndClass); } VOID PAGER_Unregister (void) { - UnregisterClassA (WC_PAGESCROLLERA, NULL); + UnregisterClassW (WC_PAGESCROLLERW, NULL); } diff --git a/reactos/lib/comctl32/progress.c b/reactos/lib/comctl32/progress.c index a63f42898a7..bd19b48dcc3 100644 --- a/reactos/lib/comctl32/progress.c +++ b/reactos/lib/comctl32/progress.c @@ -499,7 +499,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, TRACE("hwnd=%p msg=%04x wparam=%x lParam=%lx\n", hwnd, message, wParam, lParam); - infoPtr = (PROGRESS_INFO *)GetWindowLongW(hwnd, 0); + infoPtr = (PROGRESS_INFO *)GetWindowLongPtrW(hwnd, 0); if (!infoPtr && message != WM_CREATE) return DefWindowProcW( hwnd, message, wParam, lParam ); @@ -518,7 +518,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, /* allocate memory for info struct */ infoPtr = (PROGRESS_INFO *)Alloc (sizeof(PROGRESS_INFO)); if (!infoPtr) return -1; - SetWindowLongW (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize the info struct */ infoPtr->Self = hwnd; @@ -538,7 +538,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, case WM_DESTROY: TRACE("Progress Ctrl destruction, hwnd=%p\n", hwnd); Free (infoPtr); - SetWindowLongW(hwnd, 0, 0); + SetWindowLongPtrW(hwnd, 0, 0); return 0; case WM_GETFONT: diff --git a/reactos/lib/comctl32/propsheet.c b/reactos/lib/comctl32/propsheet.c index 0b04787f878..b562fb276a4 100644 --- a/reactos/lib/comctl32/propsheet.c +++ b/reactos/lib/comctl32/propsheet.c @@ -4,6 +4,7 @@ * Copyright 1998 Francis Beaudet * Copyright 1999 Thuy Nguyen * Copyright 2004 Maxime Bellenge + * Copyright 2004 Filip Navara * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,9 +20,42 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * This code was audited for completeness against the documented features + * of Comctl32.dll version 6.0 on Sep. 12, 2004, by Filip Navara. + * + * Unless otherwise noted, we believe this code to be complete, as per + * the specification mentioned above. + * If you discover missing features, or bugs, please note them below. + * * TODO: * - Tab order - * - Unicode property sheets + * - Wizard 97 header resizing + * - Enforcing of minimal wizard size + * - Messages: + * o PSM_GETRESULT + * o PSM_IDTOINDEX + * o PSM_INDEXTOID + * o PSM_INDEXTOPAGE + * o PSM_INSERTPAGE + * o PSM_PAGETOINDEX + * o PSM_RECALCPAGESIZES + * o PSM_SETHEADERSUBTITLE + * o PSM_SETHEADERTITLE + * - Notifications: + * o PSN_GETOBJECT + * o PSN_QUERYINITIALFOCUS + * o PSN_TRANSLATEACCELERATOR + * - Styles: + * o PSH_WIZARDHASFINISH + * o PSH_RTLREADING + * o PSH_WIZARDCONTEXTHELP + * o PSH_STRETCHWATERMARK + * o PSH_USEPAGELANG + * o PSH_NOCONTEXTHELP + * o PSH_USEPSTARTPAGE + * - Page styles: + * o PSP_USEFUSIONCONTEXT + * o PSP_USEREFPARENT */ #include @@ -97,8 +131,6 @@ typedef struct tagPropSheetInfo PropPageInfo* proppage; HFONT hFont; HFONT hFontBold; - int x; - int y; int width; int height; HIMAGELIST hImageList; @@ -125,6 +157,10 @@ const WCHAR PropSheetInfoStr[] = #define INTRNL_ANY_WIZARD (PSH_WIZARD | PSH_WIZARD97_OLD | PSH_WIZARD97_NEW | PSH_WIZARD_LITE) +/* Wizard metrics specified in DLUs */ +#define WIZARD_PADDING 7 +#define WIZARD_HEADER_HEIGHT 36 + /****************************************************************************** * Prototypes */ @@ -199,30 +235,19 @@ static VOID PROPSHEET_UnImplementedFlags(DWORD dwFlags) /* * unhandled header flags: - * PSH_DEFAULT 0x00000000 * PSH_WIZARDHASFINISH 0x00000010 * PSH_RTLREADING 0x00000800 * PSH_WIZARDCONTEXTHELP 0x00001000 - * PSH_WIZARD97 0x00002000 (pre IE 5) - * PSH_WATERMARK 0x00008000 - * PSH_USEHBMWATERMARK 0x00010000 - * PSH_USEHPLWATERMARK 0x00020000 * PSH_STRETCHWATERMARK 0x00040000 - * PSH_HEADER 0x00080000 - * PSH_USEHBMHEADER 0x00100000 * PSH_USEPAGELANG 0x00200000 - * PSH_WIZARD_LITE 0x00400000 also not in .h - * PSH_WIZARD97 0x01000000 (IE 5 and above) * PSH_NOCONTEXTHELP 0x02000000 also not in .h */ add_flag(PSH_WIZARDHASFINISH); add_flag(PSH_RTLREADING); add_flag(PSH_WIZARDCONTEXTHELP); - add_flag(PSH_WIZARD97_OLD); add_flag(PSH_STRETCHWATERMARK); add_flag(PSH_USEPAGELANG); - add_flag(PSH_WIZARD_LITE); add_flag(PSH_NOCONTEXTHELP); if (string[0] != '\0') FIXME("%s\n", string); @@ -234,13 +259,43 @@ static VOID PROPSHEET_UnImplementedFlags(DWORD dwFlags) * * Retrieve rect from tab control and map into the dialog for SetWindowPos */ -static void PROPSHEET_GetPageRect(const PropSheetInfo * psInfo, HWND hwndDlg, RECT *rc) +static void PROPSHEET_GetPageRect(const PropSheetInfo * psInfo, HWND hwndDlg, + RECT *rc, LPCPROPSHEETPAGEW ppshpage) { - HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL); + if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) { + HWND hwndChild; + RECT r; - GetClientRect(hwndTabCtrl, rc); - SendMessageW(hwndTabCtrl, TCM_ADJUSTRECT, FALSE, (LPARAM)rc); - MapWindowPoints(hwndTabCtrl, hwndDlg, (LPPOINT)rc, 2); + if (((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) && + (psInfo->ppshheader.dwFlags & PSH_HEADER) && + !(ppshpage->dwFlags & PSP_HIDEHEADER)) || + (psInfo->ppshheader.dwFlags & PSH_WIZARD)) + { + rc->left = rc->top = WIZARD_PADDING; + } + else + { + rc->left = rc->top = 0; + } + rc->right = psInfo->width - rc->left; + rc->bottom = psInfo->height - rc->top; + MapDialogRect(hwndDlg, rc); + + if ((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) && + (psInfo->ppshheader.dwFlags & PSH_HEADER) && + !(ppshpage->dwFlags & PSP_HIDEHEADER)) + { + hwndChild = GetDlgItem(hwndDlg, IDC_SUNKEN_LINEHEADER); + GetClientRect(hwndChild, &r); + MapWindowPoints(hwndChild, hwndDlg, (LPPOINT) &r, 2); + rc->top += r.bottom + 1; + } + } else { + HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL); + GetClientRect(hwndTabCtrl, rc); + SendMessageW(hwndTabCtrl, TCM_ADJUSTRECT, FALSE, (LPARAM)rc); + MapWindowPoints(hwndTabCtrl, hwndDlg, (LPPOINT)rc, 2); + } } /****************************************************************************** @@ -476,6 +531,23 @@ BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp, width = (WORD)*p; p++; height = (WORD)*p; p++; + /* Special calculation for interior wizard pages so the largest page is + * calculated correctly. We need to add all the padding and space occupied + * by the header so the width and height sums up to the whole wizard client + * area. */ + if ((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) && + (psInfo->ppshheader.dwFlags & PSH_HEADER) && + !(dwFlags & PSP_HIDEHEADER)) + { + height += 2 * WIZARD_PADDING + WIZARD_HEADER_HEIGHT; + width += 2 * WIZARD_PADDING; + } + if (psInfo->ppshheader.dwFlags & PSH_WIZARD) + { + height += 2 * WIZARD_PADDING; + width += 2 * WIZARD_PADDING; + } + /* remember the largest width and height */ if (width > psInfo->width) psInfo->width = width; @@ -683,8 +755,8 @@ static BOOL PROPSHEET_SizeMismatch(HWND hwndDlg, PropSheetInfo* psInfo) /* * Biggest page size. */ - rcPage.left = psInfo->x; - rcPage.top = psInfo->y; + rcPage.left = 0; + rcPage.top = 0; rcPage.right = psInfo->width; rcPage.bottom = psInfo->height; @@ -700,49 +772,6 @@ static BOOL PROPSHEET_SizeMismatch(HWND hwndDlg, PropSheetInfo* psInfo) return FALSE; } -/****************************************************************************** - * PROPSHEET_IsTooSmallWizard - * - * Verify that the default property sheet is big enough. - */ -static BOOL PROPSHEET_IsTooSmallWizard(HWND hwndDlg, PropSheetInfo* psInfo) -{ - RECT rcSheetRect, rcPage, rcLine, rcSheetClient; - HWND hwndLine = GetDlgItem(hwndDlg, IDC_SUNKEN_LINE); - PADDING_INFO padding = PROPSHEET_GetPaddingInfoWizard(hwndDlg, psInfo); - - GetClientRect(hwndDlg, &rcSheetClient); - GetWindowRect(hwndDlg, &rcSheetRect); - GetWindowRect(hwndLine, &rcLine); - - /* Remove the space below the sunken line */ - rcSheetClient.bottom -= (rcSheetRect.bottom - rcLine.top); - - /* Remove the buffer zone all around the edge */ - rcSheetClient.bottom -= (padding.y * 2); - rcSheetClient.right -= (padding.x * 2); - - /* - * Biggest page size. - */ - rcPage.left = psInfo->x; - rcPage.top = psInfo->y; - rcPage.right = psInfo->width; - rcPage.bottom = psInfo->height; - - MapDialogRect(hwndDlg, &rcPage); - TRACE("biggest page %ld %ld %ld %ld\n", rcPage.left, rcPage.top, - rcPage.right, rcPage.bottom); - - if (rcPage.right > rcSheetClient.right) - return TRUE; - - if (rcPage.bottom > rcSheetClient.bottom) - return TRUE; - - return FALSE; -} - /****************************************************************************** * PROPSHEET_AdjustSize * @@ -764,8 +793,8 @@ static BOOL PROPSHEET_AdjustSize(HWND hwndDlg, PropSheetInfo* psInfo) /* * Biggest page size. */ - rc.left = psInfo->x; - rc.top = psInfo->y; + rc.left = 0; + rc.top = 0; rc.right = psInfo->width; rc.bottom = psInfo->height; @@ -832,69 +861,33 @@ static BOOL PROPSHEET_AdjustSize(HWND hwndDlg, PropSheetInfo* psInfo) */ static BOOL PROPSHEET_AdjustSizeWizard(HWND hwndDlg, PropSheetInfo* psInfo) { - HWND hwndButton = GetDlgItem(hwndDlg, IDCANCEL); HWND hwndLine = GetDlgItem(hwndDlg, IDC_SUNKEN_LINE); - HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL); - RECT rc,tabRect; - int buttonHeight, lineHeight; - PADDING_INFO padding = PROPSHEET_GetPaddingInfoWizard(hwndDlg, psInfo); - RECT units; + RECT rc, lineRect, dialogRect; - /* Get the height of buttons */ - GetClientRect(hwndButton, &rc); - buttonHeight = rc.bottom; - - GetClientRect(hwndLine, &rc); - lineHeight = rc.bottom; - - /* retrieve the dialog units */ - units.left = units.right = 4; - units.top = units.bottom = 8; - MapDialogRect(hwndDlg, &units); - - /* - * Biggest page size. - */ - rc.left = psInfo->x; - rc.top = psInfo->y; + /* Biggest page size */ + rc.left = 0; + rc.top = 0; rc.right = psInfo->width; rc.bottom = psInfo->height; - MapDialogRect(hwndDlg, &rc); - GetClientRect(hwndTabCtrl,&tabRect); - - if ((rc.bottom - rc.top) < (tabRect.bottom - tabRect.top)) - { - rc.bottom = rc.top + tabRect.bottom - tabRect.top; - psInfo->height = MulDiv((rc.bottom - rc.top), 8, units.top); - } - - if ((rc.right - rc.left) < (tabRect.right - tabRect.left)) - { - rc.right = rc.left + tabRect.right - tabRect.left; - psInfo->width = MulDiv((rc.right - rc.left), 4, units.left); - } - TRACE("Biggest page %ld %ld %ld %ld\n", rc.left, rc.top, rc.right, rc.bottom); - TRACE(" constants padx=%d, pady=%d, butH=%d, lH=%d\n", - padding.x, padding.y, buttonHeight, lineHeight); - /* Make room */ - rc.right += (padding.x * 2); - rc.bottom += (buttonHeight + lineHeight); - if (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) - rc.bottom += (4 * padding.y); - else - rc.bottom += (5 * padding.y); + /* Add space for the buttons row */ + GetWindowRect(hwndLine, &lineRect); + MapWindowPoints(NULL, hwndDlg, (LPPOINT)&lineRect, 2); + GetClientRect(hwndDlg, &dialogRect); + rc.bottom += dialogRect.bottom - lineRect.top - 1; - /* - * Resize the property sheet. - */ + /* Convert the client coordinates to window coordinates */ + AdjustWindowRect(&rc, GetWindowLongW(hwndDlg, GWL_STYLE), FALSE); + + /* Resize the property sheet */ TRACE("setting dialog %08lx, rc (0,0)-(%ld,%ld)\n", (DWORD)hwndDlg, rc.right, rc.bottom); - SetWindowPos(hwndDlg, 0, 0, 0, rc.right, rc.bottom, + SetWindowPos(hwndDlg, 0, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); + return TRUE; } @@ -936,7 +929,7 @@ static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, PropSheetInfo* psInfo) y = rcSheet.bottom - (padding.y + buttonHeight); /* - * Position OK button. + * Position OK button and make it default. */ hwndButton = GetDlgItem(hwndParent, IDOK); @@ -945,6 +938,9 @@ static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, PropSheetInfo* psInfo) SetWindowPos(hwndButton, 0, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + SendMessageA(hwndParent, DM_SETDEFID, IDOK, 0); + + /* * Position Cancel button. */ @@ -1085,7 +1081,8 @@ static BOOL PROPSHEET_AdjustButtonsWizard(HWND hwndParent, else ShowWindow(hwndButton, SW_HIDE); - if (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) + if (psInfo->ppshheader.dwFlags & + (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW | PSH_WIZARD_LITE)) padding.x = 0; /* @@ -1095,7 +1092,6 @@ static BOOL PROPSHEET_AdjustButtonsWizard(HWND hwndParent, y = rcSheet.bottom - ((padding.y * 2) + buttonHeight + lineHeight); lineWidth = rcSheet.right - (padding.x * 2); - SetWindowPos(hwndLine, 0, x, y, lineWidth, 2, SWP_NOZORDER | SWP_NOACTIVATE); @@ -1249,6 +1245,29 @@ static BOOL PROPSHEET_CreateTabControl(HWND hwndParent, return TRUE; } + +/****************************************************************************** + * PROPSHEET_WizardSubclassProc + * + * Subclassing window procedure for wizard extrior pages to prevent drawing + * background and so drawing above the watermark. + */ +LRESULT CALLBACK +PROPSHEET_WizardSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uID, DWORD_PTR dwRef) +{ + switch (uMsg) + { + case WM_ERASEBKGND: + return TRUE; + + case WM_CTLCOLORSTATIC: + SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); + return (INT_PTR)GetSysColorBrush(COLOR_WINDOW); + } + + return DefSubclassProc(hwnd, uMsg, wParam, lParam); +} + /* * Get the size of an in-memory Template * @@ -1373,7 +1392,7 @@ static UINT GetTemplateSize(DLGTEMPLATE* pTemplate) p += lstrlenW( (LPCWSTR)p ) + 1; break; } - p += *p + 1; /* Skip extra data */ + p += *p / sizeof(WORD) + 1; /* Skip extra data */ --nrofitems; } @@ -1394,9 +1413,6 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent, { DLGTEMPLATE* pTemplate; HWND hwndPage; - RECT rc; - PADDING_INFO padding; - UINT pageWidth,pageHeight; DWORD resSize; LPVOID temp = NULL; @@ -1466,7 +1482,7 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent, if (((MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF) { - ((MyDLGTEMPLATEEX*)pTemplate)->style |= WS_CHILD | DS_CONTROL; + ((MyDLGTEMPLATEEX*)pTemplate)->style |= WS_CHILD | WS_TABSTOP | DS_CONTROL; ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~DS_MODALFRAME; ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_CAPTION; ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_SYSMENU; @@ -1474,10 +1490,12 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent, ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_DISABLED; ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_VISIBLE; ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_THICKFRAME; + + ((MyDLGTEMPLATEEX*)pTemplate)->exStyle |= WS_EX_CONTROLPARENT; } else { - pTemplate->style |= WS_CHILD | DS_CONTROL; + pTemplate->style |= WS_CHILD | WS_TABSTOP | DS_CONTROL; pTemplate->style &= ~DS_MODALFRAME; pTemplate->style &= ~WS_CAPTION; pTemplate->style &= ~WS_SYSMENU; @@ -1485,6 +1503,8 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent, pTemplate->style &= ~WS_DISABLED; pTemplate->style &= ~WS_VISIBLE; pTemplate->style &= ~WS_THICKFRAME; + + pTemplate->dwExtendedStyle |= WS_EX_CONTROLPARENT; } if (psInfo->proppage[index].useCallback) @@ -1509,67 +1529,13 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent, psInfo->proppage[index].hwndPage = hwndPage; - if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) { - int offsety = 0; - HWND hwndChild; - RECT r; - - rc.left = psInfo->x; - rc.top = psInfo->y; - rc.right = psInfo->width; - rc.bottom = psInfo->height; - - MapDialogRect(hwndParent, &rc); - - pageWidth = rc.right - rc.left; - pageHeight = rc.bottom - rc.top; - - padding = PROPSHEET_GetPaddingInfoWizard(hwndParent, psInfo); - TRACE("setting page %08lx, rc (%ld,%ld)-(%ld,%ld) w=%d, h=%d, padx=%d, pady=%d\n", - (DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom, - pageWidth, pageHeight, padding.x, padding.y); - - if (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD) && - psInfo->ppshheader.dwFlags & PSH_HEADER) - { - if ((ppshpage->dwFlags & PSP_USEHEADERTITLE) && - (HIWORD(ppshpage->pszHeaderTitle) == 0)) - { - /* FIXME: load title string into ppshpage->pszHeaderTitle */ - } - - if ((ppshpage->dwFlags & PSP_USEHEADERSUBTITLE) && - (HIWORD(ppshpage->pszHeaderSubTitle) == 0)) - { - /* FIXME: load title string into ppshpage->pszHeaderSubTitle */ - } - - hwndChild = GetDlgItem(hwndParent, IDC_SUNKEN_LINEHEADER); - - GetClientRect(hwndChild, &r); - MapWindowPoints(hwndChild, hwndParent, (LPPOINT) &r, 2); - offsety = (ppshpage->dwFlags & PSP_HIDEHEADER)?0:r.bottom + 1; - } - - SetWindowPos(hwndPage, HWND_TOP, - rc.left + padding.x/2, - rc.top + padding.y/2 + offsety, - pageWidth, pageHeight - offsety, 0); - } - else { - /* - * Ask the Tab control to reduce the client rectangle to that - * it has available. - */ - PROPSHEET_GetPageRect(psInfo, hwndParent, &rc); - pageWidth = rc.right - rc.left; - pageHeight = rc.bottom - rc.top; - TRACE("setting page %08lx, rc (%ld,%ld)-(%ld,%ld) w=%d, h=%d\n", - (DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom, - pageWidth, pageHeight); - SetWindowPos(hwndPage, HWND_TOP, - rc.left, rc.top, - pageWidth, pageHeight, 0); + /* Subclass exterior wizard pages */ + if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) && + (psInfo->ppshheader.dwFlags & PSH_WATERMARK) && + (ppshpage->dwFlags & PSP_HIDEHEADER)) + { + SetWindowSubclass(hwndPage, PROPSHEET_WizardSubclassProc, 1, + (DWORD_PTR)ppshpage); } return TRUE; @@ -1624,13 +1590,14 @@ static BOOL PROPSHEET_ShowPage(HWND hwndDlg, int index, PropSheetInfo * psInfo) return TRUE; } + ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage; if (psInfo->proppage[index].hwndPage == 0) { - ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage; PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppshpage); } - if ((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) == 0) + if ((psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) && + (ppshpage->dwFlags & PSP_USETITLE)) { PROPSHEET_SetTitleW(hwndDlg, psInfo->ppshheader.dwFlags, psInfo->proppage[index].pszText); @@ -1658,11 +1625,11 @@ static BOOL PROPSHEET_ShowPage(HWND hwndDlg, int index, PropSheetInfo * psInfo) ShowWindow(hwndLineHeader, SW_HIDE); else ShowWindow(hwndLineHeader, SW_SHOW); - - InvalidateRgn(hwndDlg, NULL, TRUE); - UpdateWindow(hwndDlg); } + InvalidateRgn(hwndDlg, NULL, TRUE); + UpdateWindow(hwndDlg); + return TRUE; } @@ -2090,6 +2057,8 @@ static BOOL PROPSHEET_SetCurSel(HWND hwndDlg, while (1) { int result; PSHNOTIFY psn; + RECT rc; + LPCPROPSHEETPAGEW ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage; if (hwndTabControl) SendMessageW(hwndTabControl, TCM_SETCURSEL, index, 0); @@ -2100,10 +2069,22 @@ static BOOL PROPSHEET_SetCurSel(HWND hwndDlg, psn.lParam = 0; if (!psInfo->proppage[index].hwndPage) { - LPCPROPSHEETPAGEW ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage; PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppshpage); } + /* Resize the property sheet page to the fit in the Tab control + * (for regular property sheets) or to fit in the client area (for + * wizards). + * NOTE: The resizing happens every time the page is selected and + * not only when it's created (some applications depend on it). */ + PROPSHEET_GetPageRect(psInfo, hwndDlg, &rc, ppshpage); + TRACE("setting page %p, rc (%ld,%ld)-(%ld,%ld) w=%ld, h=%ld\n", + psInfo->proppage[index].hwndPage, rc.left, rc.top, rc.right, rc.bottom, + rc.right - rc.left, rc.bottom - rc.top); + SetWindowPos(psInfo->proppage[index].hwndPage, HWND_TOP, + rc.left, rc.top, + rc.right - rc.left, rc.bottom - rc.top, 0); + result = SendMessageW(psInfo->proppage[index].hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); if (!result) break; @@ -2411,6 +2392,15 @@ static BOOL PROPSHEET_RemovePage(HWND hwndDlg, else if (index < psInfo->active_page) psInfo->active_page--; + /* Unsubclass the page dialog window */ + if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD) && + (psInfo->ppshheader.dwFlags & PSH_WATERMARK) && + ((PROPSHEETPAGEW*)psInfo->proppage[index].hpage)->dwFlags & PSP_HIDEHEADER)) + { + RemoveWindowSubclass(psInfo->proppage[index].hwndPage, + PROPSHEET_WizardSubclassProc, 1); + } + /* Destroy page dialog window */ DestroyWindow(psInfo->proppage[index].hwndPage); @@ -2671,6 +2661,15 @@ static void PROPSHEET_CleanUp(HWND hwndDlg) { PROPSHEETPAGEA* psp = (PROPSHEETPAGEA*)psInfo->proppage[i].hpage; + /* Unsubclass the page dialog window */ + if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) && + (psInfo->ppshheader.dwFlags & PSH_WATERMARK) && + (psp->dwFlags & PSP_HIDEHEADER)) + { + RemoveWindowSubclass(psInfo->proppage[i].hwndPage, + PROPSHEET_WizardSubclassProc, 1); + } + if(psInfo->proppage[i].hwndPage) DestroyWindow(psInfo->proppage[i].hwndPage); @@ -2910,7 +2909,7 @@ BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage) HeapFree(GetProcessHeap(), 0, (LPVOID)psp->u2.pszIcon); if ((psp->dwFlags & PSP_USETITLE) && HIWORD( psp->pszTitle )) - HeapFree(GetProcessHeap(), 0, (LPVOID)psp->pszTitle); + HeapFree(GetProcessHeap(), 0, (LPVOID)psp->pszTitle); Free(hPropPage); @@ -3050,8 +3049,10 @@ static LRESULT PROPSHEET_Paint(HWND hwnd) HPALETTE hOldPal = 0; int offsety = 0; HBRUSH hbr; - RECT r; + RECT r, rzone; LPCPROPSHEETPAGEW ppshpage; + WCHAR szBuffer[256]; + int nLength; hdc = BeginPaint(hwnd, &ps); if (!hdc) return 1; @@ -3066,18 +3067,17 @@ static LRESULT PROPSHEET_Paint(HWND hwnd) (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) && (psInfo->ppshheader.dwFlags & PSH_HEADER) ) { - RECT rzone; HWND hwndLineHeader = GetDlgItem(hwnd, IDC_SUNKEN_LINEHEADER); HFONT hOldFont; COLORREF clrOld = 0; int oldBkMode = 0; hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u5.hbmHeader); - hOldFont = SelectObject(hdc, psInfo->hFontBold); + hOldFont = SelectObject(hdc, psInfo->hFontBold); GetClientRect(hwndLineHeader, &r); MapWindowPoints(hwndLineHeader, hwnd, (LPPOINT) &r, 2); - SetRect(&rzone, 0, 0, r.right, r.top - 1); + SetRect(&rzone, 0, 0, r.right + 1, r.top - 1); GetObjectA(psInfo->ppshheader.u5.hbmHeader, sizeof(BITMAP), (LPVOID)&bm); @@ -3103,52 +3103,80 @@ static LRESULT PROPSHEET_Paint(HWND hwnd) } DeleteObject(hbr); } - } - else - { - hbr = CreateSolidBrush(GetSysColor(COLOR_WINDOW)); - FillRect(hdc, &rzone, hbr); - DeleteObject(hbr); - } - - clrOld = SetTextColor (hdc, 0x00000000); - oldBkMode = SetBkMode (hdc, TRANSPARENT); - if (ppshpage->dwFlags & PSP_USEHEADERTITLE) { - SetRect(&r, 20, 10, rzone.right - bm.bmWidth, 18); - if (psInfo->unicode) - DrawTextW(hdc, (LPWSTR)ppshpage->pszHeaderTitle, - -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); - else - DrawTextA(hdc, (LPCSTR)ppshpage->pszHeaderTitle, - -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); - } - - if (ppshpage->dwFlags & PSP_USEHEADERSUBTITLE) { - SelectObject(hdc, psInfo->hFont); - SetRect(&r, 40, 25, rzone.right - bm.bmWidth, 43); - if (psInfo->unicode) - DrawTextW(hdc, (LPWSTR)ppshpage->pszHeaderSubTitle, - -1, &r, DT_LEFT | DT_SINGLELINE); - else - DrawTextA(hdc, (LPCSTR)ppshpage->pszHeaderSubTitle, - -1, &r, DT_LEFT | DT_SINGLELINE); - } - - if (psInfo->ppshheader.dwFlags & PSH_WIZARD97_OLD) - { + /* Draw the header itself. */ BitBlt(hdc, 0, 0, bm.bmWidth, min(bm.bmHeight, rzone.bottom), hdcSrc, 0, 0, SRCCOPY); } else { - BitBlt(hdc, rzone.right - bm.bmWidth, - (rzone.bottom - bm.bmHeight) / 2, + hbr = GetSysColorBrush(COLOR_WINDOW); + FillRect(hdc, &rzone, hbr); + + /* Draw the header bitmap. It's always centered like a + * common 49 x 49 bitmap. */ + BitBlt(hdc, rzone.right - 49 - ((rzone.bottom - 49) / 2), + (rzone.bottom - 49) / 2, bm.bmWidth, bm.bmHeight, hdcSrc, 0, 0, SRCCOPY); + + /* NOTE: Native COMCTL32 draws a white stripe over the bitmap + * if its height is smaller than 49 pixels. Because the reason + * for this bug is unknown the current code doesn't try to + * replicate it. */ } + clrOld = SetTextColor (hdc, 0x00000000); + oldBkMode = SetBkMode (hdc, TRANSPARENT); + + if (ppshpage->dwFlags & PSP_USEHEADERTITLE) { + SetRect(&r, 20, 10, 0, 0); + if (HIWORD(ppshpage->pszHeaderTitle)) + { + if (psInfo->unicode) + DrawTextW(hdc, (LPWSTR)ppshpage->pszHeaderTitle, + -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); + else + DrawTextA(hdc, (LPCSTR)ppshpage->pszHeaderTitle, + -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); + } + else + { + nLength = LoadStringW(ppshpage->hInstance, (UINT)ppshpage->pszHeaderTitle, + szBuffer, 256); + if (nLength != 0) + { + DrawTextW(hdc, szBuffer, nLength, + &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); + } + } + } + + if (ppshpage->dwFlags & PSP_USEHEADERSUBTITLE) { + SelectObject(hdc, psInfo->hFont); + SetRect(&r, 40, 25, rzone.right - 69, rzone.bottom); + if (HIWORD(ppshpage->pszHeaderTitle)) + { + if (psInfo->unicode) + DrawTextW(hdc, (LPWSTR)ppshpage->pszHeaderSubTitle, + -1, &r, DT_LEFT | DT_SINGLELINE); + else + DrawTextA(hdc, (LPCSTR)ppshpage->pszHeaderSubTitle, + -1, &r, DT_LEFT | DT_SINGLELINE); + } + else + { + nLength = LoadStringW(ppshpage->hInstance, (UINT)ppshpage->pszHeaderSubTitle, + szBuffer, 256); + if (nLength != 0) + { + DrawTextW(hdc, szBuffer, nLength, + &r, DT_LEFT | DT_SINGLELINE); + } + } + } + offsety = rzone.bottom + 2; SetTextColor(hdc, clrOld); @@ -3157,7 +3185,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd) SelectObject(hdcSrc, hbmp); } - if ( ((psInfo->active_page == 0) || (psInfo->active_page == psInfo->nPages - 1)) && + if ( (ppshpage->dwFlags & PSP_HIDEHEADER) && (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) && (psInfo->ppshheader.dwFlags & PSH_WATERMARK) ) { @@ -3166,6 +3194,14 @@ static LRESULT PROPSHEET_Paint(HWND hwnd) GetClientRect(hwndLine, &r); MapWindowPoints(hwndLine, hwnd, (LPPOINT) &r, 2); + rzone.left = 0; + rzone.top = 0; + rzone.right = r.right; + rzone.bottom = r.top - 1; + + hbr = GetSysColorBrush(COLOR_WINDOW); + FillRect(hdc, &rzone, hbr); + GetObjectA(psInfo->ppshheader.u4.hbmWatermark, sizeof(BITMAP), (LPVOID)&bm); hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u4.hbmWatermark); @@ -3225,11 +3261,11 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) /* * psInfo->hwnd is not being used by WINE code - it exists * for compatibility with "real" Windoze. The same about - * SetWindowLong - WINE is only using the PropSheetInfoStr + * SetWindowLongPtr - WINE is only using the PropSheetInfoStr * property. */ psInfo->hwnd = hwnd; - SetWindowLongW(hwnd,DWL_USER,(LONG)psInfo); + SetWindowLongPtrW(hwnd, DWLP_USER, (DWORD_PTR)psInfo); /* set up the Next and Back buttons by default */ PROPSHEET_SetWizButtons(hwnd, PSWIZB_BACK|PSWIZB_NEXT); @@ -3276,11 +3312,8 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) { ShowWindow(hwndTabCtrl, SW_HIDE); - if (PROPSHEET_IsTooSmallWizard(hwnd, psInfo)) - { - PROPSHEET_AdjustSizeWizard(hwnd, psInfo); - PROPSHEET_AdjustButtonsWizard(hwnd, psInfo); - } + PROPSHEET_AdjustSizeWizard(hwnd, psInfo); + PROPSHEET_AdjustButtonsWizard(hwnd, psInfo); } else { @@ -3363,7 +3396,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if(pnmh->code == TCN_SELCHANGING) { BOOL bRet = PROPSHEET_CanSetCurSel(hwnd); - SetWindowLongW(hwnd, DWL_MSGRESULT, !bRet); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, !bRet); return TRUE; } @@ -3379,7 +3412,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (psInfo->activeValid && psInfo->active_page != -1) hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; - SetWindowLongW(hwnd, DWL_MSGRESULT, (LONG)hwndPage); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, (DWORD_PTR)hwndPage); return TRUE; } @@ -3396,7 +3429,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL); - SetWindowLongW(hwnd, DWL_MSGRESULT, (LONG)hwndTabCtrl); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, (DWORD_PTR)hwndTabCtrl); return TRUE; } @@ -3414,7 +3447,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) (HPROPSHEETPAGE)lParam); } - SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); return TRUE; } @@ -3462,7 +3495,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { BOOL msgResult = PROPSHEET_Apply(hwnd, 0); - SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); return TRUE; } @@ -3471,7 +3504,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT msgResult = PROPSHEET_QuerySiblings(hwnd, wParam, lParam); - SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); return TRUE; } @@ -3488,7 +3521,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) BOOL msgResult = PROPSHEET_AddPage(hwnd, (HPROPSHEETPAGE)lParam); - SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); return TRUE; } @@ -3500,7 +3533,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case PSM_ISDIALOGMESSAGE: { BOOL msgResult = PROPSHEET_IsDialogMessage(hwnd, (LPMSG)lParam); - SetWindowLongA(hwnd, DWL_MSGRESULT, msgResult); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); return TRUE; } @@ -3527,7 +3560,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case PSM_INSERTPAGE: { BOOL msgResult = PROPSHEET_InsertPage(hwnd, (HPROPSHEETPAGE)wParam, (HPROPSHEETPAGE)lParam); - SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); return TRUE; } @@ -3550,56 +3583,56 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case PSM_HWNDTOINDEX: { LRESULT msgResult = PROPSHEET_HwndToIndex(hwnd, (HWND)wParam); - SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); return TRUE; } case PSM_INDEXTOHWND: { LRESULT msgResult = PROPSHEET_IndexToHwnd(hwnd, (int)wParam); - SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); return TRUE; } case PSM_PAGETOINDEX: { LRESULT msgResult = PROPSHEET_PageToIndex(hwnd, (HPROPSHEETPAGE)wParam); - SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); return TRUE; } case PSM_INDEXTOPAGE: { LRESULT msgResult = PROPSHEET_IndexToPage(hwnd, (int)wParam); - SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); return TRUE; } case PSM_IDTOINDEX: { LRESULT msgResult = PROPSHEET_IdToIndex(hwnd, (int)lParam); - SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); return TRUE; } case PSM_INDEXTOID: { LRESULT msgResult = PROPSHEET_IndexToId(hwnd, (int)wParam); - SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); return TRUE; } case PSM_GETRESULT: { LRESULT msgResult = PROPSHEET_GetResult(hwnd); - SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); return TRUE; } case PSM_RECALCPAGESIZES: { LRESULT msgResult = PROPSHEET_RecalcPageSizes(hwnd); - SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); return TRUE; } diff --git a/reactos/lib/comctl32/rebar.c b/reactos/lib/comctl32/rebar.c index bd552e1eefd..d93cf59ad87 100644 --- a/reactos/lib/comctl32/rebar.c +++ b/reactos/lib/comctl32/rebar.c @@ -333,7 +333,7 @@ typedef struct else b->rcBand.left += (i); } while(0) -#define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongA (hwnd, 0)) +#define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongPtrW (hwnd, 0)) /* "constant values" retrieved when DLL was initialized */ @@ -751,8 +751,8 @@ REBAR_AdjustBands (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend, /* start and end bands are *not* hidden */ { REBAR_BAND *lpBand; - UINT x, xsep, extra, curwidth, fudge; - INT i, last_adjusted; + UINT xsep, extra, curwidth, fudge; + INT x, i, last_adjusted; TRACE("start=%u, end=%u, max x=%d, max y=%d\n", rowstart, rowend, maxx, mcy); @@ -3841,7 +3841,7 @@ REBAR_Destroy (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) DeleteObject (infoPtr->hcurVert); DeleteObject (infoPtr->hcurDrag); if(infoPtr->hDefaultFont) DeleteObject (infoPtr->hDefaultFont); - SetWindowLongA (infoPtr->hwndSelf, 0, 0); + SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0); /* free rebar info data */ Free (infoPtr); @@ -4124,7 +4124,7 @@ REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) /* allocate memory for info structure */ infoPtr = (REBAR_INFO *)Alloc (sizeof(REBAR_INFO)); - SetWindowLongA (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize info structure - initial values are 0 */ infoPtr->clrBk = CLR_NONE; diff --git a/reactos/lib/comctl32/rsrc.rc b/reactos/lib/comctl32/rsrc.rc index 5903d7560dc..f86bda1b4fc 100644 --- a/reactos/lib/comctl32/rsrc.rc +++ b/reactos/lib/comctl32/rsrc.rc @@ -1106,6 +1106,84 @@ IDI_DRAGARROW ICON LOADONCALL DISCARDABLE idi_dragarrow.ico } */ +/* BINRES idi_tt_info_sm.ico */ +IDI_TT_INFO_SM ICON LOADONCALL DISCARDABLE idi_tt_info_sm.ico +/* { + '00 00 01 00 01 00 10 10 10 00 00 00 00 00 28 01' + '00 00 16 00 00 00 28 00 00 00 10 00 00 00 20 00' + '00 00 01 00 04 00 00 00 00 00 C0 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 80 00 00 80 00 00 00 80 80 00 80 00' + '00 00 80 00 80 00 80 80 00 00 C0 C0 C0 00 80 80' + '80 00 00 00 FF 00 00 FF 00 00 00 FF FF 00 FF 00' + '00 00 FF 00 FF 00 FF FF 00 00 FF FF FF 00 00 00' + '00 00 08 80 00 00 00 00 00 08 00 80 00 00 00 00' + '08 80 F0 80 00 00 00 00 80 0F F0 88 00 00 00 00' + '0F FF FF 00 80 00 00 0F FF FF FF FF 08 00 08 FF' + 'FC CC CC FF F0 80 8F FF FF 8C CF FF FF 08 8F FF' + 'FF 8C CF FF FF 08 8F FF FF 8C CF FF FF 08 8F FF' + 'F8 CC CF FF FF 00 8F FF FF FF FF FF FF 00 08 FF' + 'FF 8C CF FF F0 00 00 8F FF CC CF FF 00 00 00 08' + '8F FF FF 00 00 00 00 00 08 88 88 00 00 00 FF 9F' + '00 00 FE 1F 00 00 F8 1F 00 00 F0 0F 00 00 E0 07' + '00 00 C0 03 00 00 80 01 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 01 00 00 00 01 00 00 80 03' + '00 00 C0 07 00 00 E0 0F 00 00 F8 3F 00 00' +} */ + + +/* BINRES idi_tt_warn_sm.ico */ +IDI_TT_WARN_SM ICON LOADONCALL DISCARDABLE idi_tt_warn_sm.ico +/* { + '00 00 01 00 01 00 10 10 10 00 00 00 00 00 28 01' + '00 00 16 00 00 00 28 00 00 00 10 00 00 00 20 00' + '00 00 01 00 04 00 00 00 00 00 C0 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 80 00 00 80 00 00 00 80 80 00 80 00' + '00 00 80 00 80 00 80 80 00 00 C0 C0 C0 00 80 80' + '80 00 00 00 FF 00 00 FF 00 00 00 FF FF 00 FF 00' + '00 00 FF 00 FF 00 FF FF 00 00 FF FF FF 00 03 33' + '33 33 33 33 33 33 00 00 00 00 00 00 00 03 0B BB' + 'BB BB BB BB BB 03 00 BB BB 30 3B BB B0 30 00 BB' + 'BB 30 3B BB B0 30 00 0B BB BB BB BB 03 00 00 0B' + 'BB B0 BB BB 03 00 00 00 BB 30 3B B0 30 00 00 00' + 'BB 00 0B B0 30 00 00 00 0B 00 0B 03 00 00 00 00' + '0B B0 BB 03 00 00 00 00 00 BB B0 30 00 00 00 00' + '00 BB B0 30 00 00 00 00 00 0B 03 00 00 00 00 00' + '00 0B 03 00 00 00 00 00 00 00 30 00 00 00 80 00' + '00 00 00 00 00 00 00 00 00 00 80 01 00 00 80 01' + '00 00 C0 03 00 00 C0 03 00 00 E0 07 00 00 E0 07' + '00 00 F0 0F 00 00 F0 0F 00 00 F8 1F 00 00 F8 1F' + '00 00 FC 3F 00 00 FC 3F 00 00 FE 7F 00 00' +} */ + + +/* BINRES idi_tt_error_sm.ico */ +IDI_TT_ERROR_SM ICON LOADONCALL DISCARDABLE idi_tt_error_sm.ico +/* { + '00 00 01 00 01 00 10 10 10 00 00 00 00 00 28 01' + '00 00 16 00 00 00 28 00 00 00 10 00 00 00 20 00' + '00 00 01 00 04 00 00 00 00 00 C0 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 80 00 00 80 00 00 00 80 80 00 80 00' + '00 00 80 00 80 00 80 80 00 00 C0 C0 C0 00 80 80' + '80 00 00 00 FF 00 00 FF 00 00 00 FF FF 00 FF 00' + '00 00 FF 00 FF 00 FF FF 00 00 FF FF FF 00 00 00' + '08 88 88 80 00 00 00 08 81 11 11 88 80 00 00 01' + '19 99 99 11 88 00 00 19 99 99 99 99 18 80 01 99' + 'F9 99 99 F9 91 80 01 9F FF 99 9F FF 91 88 19 99' + 'FF F9 FF F9 99 18 19 99 9F FF FF 99 99 18 19 99' + '99 FF F9 99 99 18 19 99 9F FF FF 99 99 10 19 99' + 'FF F9 FF F9 99 10 01 9F FF 99 9F FF 91 00 01 99' + 'F9 99 99 F9 91 00 00 19 99 99 99 99 10 00 00 01' + '19 99 99 11 00 00 00 00 01 11 11 00 00 00 F8 1F' + '00 00 E0 07 00 00 E0 03 00 00 C0 01 00 00 80 01' + '00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 01 00 00 00 01 00 00 80 03 00 00 80 03' + '00 00 C0 07 00 00 E0 0F 00 00 F8 3F 00 00' +} */ + + /* * Everything specific to any language goes * in one of the specific files. @@ -1115,6 +1193,7 @@ IDI_DRAGARROW ICON LOADONCALL DISCARDABLE idi_dragarrow.ico */ #include "comctl_Cn.rc" +#include "comctl_Cs.rc" #include "comctl_De.rc" #include "comctl_En.rc" #include "comctl_Es.rc" diff --git a/reactos/lib/comctl32/status.c b/reactos/lib/comctl32/status.c index 636021adf2f..b083d02860d 100644 --- a/reactos/lib/comctl32/status.c +++ b/reactos/lib/comctl32/status.c @@ -91,7 +91,7 @@ typedef struct #define VERT_BORDER 2 #define HORZ_GAP 2 -#define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongW (hwnd, 0)) +#define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongPtrW (hwnd, 0)) /* prototype */ static void @@ -165,7 +165,7 @@ STATUSBAR_DrawPart (HDC hdc, const STATUSWINDOWPART *part, const STATUSWINDOWINF { DRAWITEMSTRUCT dis; - dis.CtlID = GetWindowLongW (infoPtr->Self, GWL_ID); + dis.CtlID = GetWindowLongPtrW (infoPtr->Self, GWLP_ID); dis.itemID = itemID; dis.hwndItem = infoPtr->Self; dis.hDC = hdc; @@ -777,7 +777,7 @@ STATUSBAR_Simple (STATUSWINDOWINFO *infoPtr, BOOL simple) /* send notification */ nmhdr.hwndFrom = infoPtr->Self; - nmhdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID); + nmhdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID); nmhdr.code = SBN_SIMPLEMODECHANGE; SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr); InvalidateRect(infoPtr->Self, NULL, FALSE); @@ -807,7 +807,7 @@ STATUSBAR_WMDestroy (STATUSWINDOWINFO *infoPtr) if (infoPtr->hwndToolTip) DestroyWindow (infoPtr->hwndToolTip); - SetWindowLongW(infoPtr->Self, 0, 0); + SetWindowLongPtrW(infoPtr->Self, 0, 0); Free (infoPtr); return 0; } @@ -826,7 +826,7 @@ STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate) TRACE("\n"); infoPtr = (STATUSWINDOWINFO*)Alloc (sizeof(STATUSWINDOWINFO)); if (!infoPtr) goto create_fail; - SetWindowLongW (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); infoPtr->Self = hwnd; infoPtr->Notify = lpCreate->hwndParent; @@ -908,13 +908,13 @@ STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate) CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, 0, - (HINSTANCE)GetWindowLongW(hwnd, GWL_HINSTANCE), NULL); + (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), NULL); if (infoPtr->hwndToolTip) { NMTOOLTIPSCREATED nmttc; nmttc.hdr.hwndFrom = hwnd; - nmttc.hdr.idFrom = GetWindowLongW (hwnd, GWL_ID); + nmttc.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); nmttc.hdr.code = NM_TOOLTIPSCREATED; nmttc.hwndToolTips = infoPtr->hwndToolTip; @@ -1106,7 +1106,7 @@ STATUSBAR_SendNotify (HWND hwnd, UINT code) TRACE("code %04x\n", code); nmhdr.hwndFrom = hwnd; - nmhdr.idFrom = GetWindowLongW (hwnd, GWL_ID); + nmhdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); nmhdr.code = code; SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr); return 0; @@ -1270,11 +1270,11 @@ STATUS_Register (void) ZeroMemory (&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW; - wndClass.lpfnWndProc = (WNDPROC)StatusWindowProc; + wndClass.lpfnWndProc = StatusWindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(STATUSWINDOWINFO *); wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW); - wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); + wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wndClass.lpszClassName = STATUSCLASSNAMEW; RegisterClassW (&wndClass); diff --git a/reactos/lib/comctl32/syslink.c b/reactos/lib/comctl32/syslink.c index fa396fc977e..d8e7a29ddd5 100644 --- a/reactos/lib/comctl32/syslink.c +++ b/reactos/lib/comctl32/syslink.c @@ -34,6 +34,7 @@ #include "winnls.h" #include "commctrl.h" #include "comctl32.h" +#include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(progress); @@ -375,7 +376,7 @@ CheckParameter: /* Copy the tag parameters */ if(lpID != NULL) { - nc = min(lenId, lstrlenW(lpID)); + nc = min(lenId, strlenW(lpID)); nc = min(nc, MAX_LINKID_TEXT); Last->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); if(Last->u.Link.szID != NULL) @@ -388,7 +389,7 @@ CheckParameter: Last->u.Link.szID = NULL; if(lpUrl != NULL) { - nc = min(lenUrl, lstrlenW(lpUrl)); + nc = min(lenUrl, strlenW(lpUrl)); nc = min(nc, L_MAX_URL_LENGTH); Last->u.Link.szUrl = SYSLINK_Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR)); if(Last->u.Link.szUrl != NULL) @@ -455,7 +456,7 @@ CheckParameter: /* Copy the tag parameters */ if(lpID != NULL) { - nc = min(lenId, lstrlenW(lpID)); + nc = min(lenId, strlenW(lpID)); nc = min(nc, MAX_LINKID_TEXT); Last->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); if(Last->u.Link.szID != NULL) @@ -468,7 +469,7 @@ CheckParameter: Last->u.Link.szID = NULL; if(lpUrl != NULL) { - nc = min(lenUrl, lstrlenW(lpUrl)); + nc = min(lenUrl, strlenW(lpUrl)); nc = min(nc, L_MAX_URL_LENGTH); Last->u.Link.szUrl = SYSLINK_Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR)); if(Last->u.Link.szUrl != NULL) @@ -1223,7 +1224,7 @@ static LRESULT SYSLINK_SendParentNotify (SYSLINK_INFO *infoPtr, UINT code, PDOC_ NMLINK nml; nml.hdr.hwndFrom = infoPtr->Self; - nml.hdr.idFrom = GetWindowLongW(infoPtr->Self, GWL_ID); + nml.hdr.idFrom = GetWindowLongPtrW(infoPtr->Self, GWLP_ID); nml.hdr.code = code; nml.item.mask = 0; @@ -1465,7 +1466,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message, TRACE("hwnd=%p msg=%04x wparam=%x lParam=%lx\n", hwnd, message, wParam, lParam); - infoPtr = (SYSLINK_INFO *)GetWindowLongW(hwnd, 0); + infoPtr = (SYSLINK_INFO *)GetWindowLongPtrW(hwnd, 0); if (!infoPtr && message != WM_CREATE) return DefWindowProcW( hwnd, message, wParam, lParam ); @@ -1618,7 +1619,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message, /* allocate memory for info struct */ infoPtr = (SYSLINK_INFO *)SYSLINK_Alloc (sizeof(SYSLINK_INFO)); if (!infoPtr) return -1; - SetWindowLongW (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize the info struct */ infoPtr->Self = hwnd; @@ -1639,7 +1640,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message, TRACE("SysLink Ctrl destruction, hwnd=%p\n", hwnd); SYSLINK_ClearDoc(infoPtr); SYSLINK_Free (infoPtr); - SetWindowLongW(hwnd, 0, 0); + SetWindowLongPtrW(hwnd, 0, 0); return 0; default: diff --git a/reactos/lib/comctl32/tab.c b/reactos/lib/comctl32/tab.c index 011b629a0d9..fd0e2c9d48c 100644 --- a/reactos/lib/comctl32/tab.c +++ b/reactos/lib/comctl32/tab.c @@ -112,7 +112,7 @@ typedef struct #define FLAT_BTN_SPACINGX 8 #define DEFAULT_TAB_WIDTH 96 -#define TAB_GetInfoPtr(hwnd) ((TAB_INFO *)GetWindowLongA(hwnd,0)) +#define TAB_GetInfoPtr(hwnd) ((TAB_INFO *)GetWindowLongPtrW(hwnd,0)) /****************************************************************************** * Hot-tracking timer constants @@ -136,10 +136,10 @@ TAB_SendSimpleNotify (HWND hwnd, UINT code) NMHDR nmhdr; nmhdr.hwndFrom = hwnd; - nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); + nmhdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); nmhdr.code = code; - return (BOOL) SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, + return (BOOL) SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM) nmhdr.idFrom, (LPARAM) &nmhdr); } @@ -157,7 +157,7 @@ TAB_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg, msg.pt.x = LOWORD(GetMessagePos ()); msg.pt.y = HIWORD(GetMessagePos ()); - SendMessageA (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg); + SendMessageW (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg); } static void @@ -514,7 +514,7 @@ static LRESULT TAB_FocusChanging( /* * Don't otherwise disturb normal behavior. */ - return DefWindowProcA (hwnd, uMsg, wParam, lParam); + return DefWindowProcW (hwnd, uMsg, wParam, lParam); } static INT TAB_InternalHitTest ( @@ -917,7 +917,7 @@ static LRESULT TAB_OnHScroll( TAB_RecalcHotTrack(hwnd, NULL, NULL, NULL); TAB_InvalidateTabArea(hwnd, infoPtr); - SendMessageA(infoPtr->hwndUpDown, UDM_SETPOS, 0, + SendMessageW(infoPtr->hwndUpDown, UDM_SETPOS, 0, MAKELONG(infoPtr->leftmostVisible, 0)); } @@ -1033,7 +1033,7 @@ static void TAB_SetupScrolling( ShowWindow(infoPtr->hwndUpDown, SW_HIDE); } if (infoPtr->hwndUpDown) - SendMessageA(infoPtr->hwndUpDown, UDM_SETRANGE32, 0, maxRange); + SendMessageW(infoPtr->hwndUpDown, UDM_SETRANGE32, 0, maxRange); } /****************************************************************************** @@ -1051,7 +1051,7 @@ static void TAB_SetItemBounds (HWND hwnd) TAB_INFO* infoPtr = TAB_GetInfoPtr(hwnd); LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); TEXTMETRICA fontMetrics; - INT curItem; + UINT curItem; INT curItemLeftPos; INT curItemRowCount; HFONT hFont, hOldFont; @@ -1243,8 +1243,8 @@ static void TAB_SetItemBounds (HWND hwnd) /* Arrange all tabs evenly if style says so */ if (!(lStyle & TCS_RAGGEDRIGHT) && ((lStyle & TCS_MULTILINE) || (lStyle & TCS_VERTICAL)) && (infoPtr->uNumItem > 0)) { - INT tabPerRow,remTab; - INT iRow,iItm; + INT tabPerRow,remTab,iRow; + UINT iItm; INT iCount=0; /* @@ -1637,10 +1637,18 @@ TAB_DrawItemInterior DRAWITEMSTRUCT dis; UINT id; + drawRect->top += 2; + drawRect->right -= 1; + if ( iItem == infoPtr->iSelected ) + { + drawRect->right -= 1; + drawRect->left += 1; + } + /* * get the control id */ - id = GetWindowLongA( hwnd, GWL_ID ); + id = (UINT)GetWindowLongPtrW( hwnd, GWLP_ID ); /* * put together the DRAWITEMSTRUCT @@ -1663,7 +1671,7 @@ TAB_DrawItemInterior /* * send the draw message */ - SendMessageA( infoPtr->hwndNotify, WM_DRAWITEM, (WPARAM)id, (LPARAM)&dis ); + SendMessageW( infoPtr->hwndNotify, WM_DRAWITEM, (WPARAM)id, (LPARAM)&dis ); } else { @@ -2278,29 +2286,6 @@ TAB_SetRedraw (HWND hwnd, WPARAM wParam) return 0; } -static LRESULT TAB_EraseBackground( - HWND hwnd, - HDC givenDC) -{ - HDC hdc; - RECT clientRect; - - HBRUSH brush = CreateSolidBrush(comctl32_color.clrBtnFace); - - hdc = givenDC ? givenDC : GetDC(hwnd); - - GetClientRect(hwnd, &clientRect); - - FillRect(hdc, &clientRect, brush); - - if (givenDC==0) - ReleaseDC(hwnd, hdc); - - DeleteObject(brush); - - return 0; -} - /****************************************************************************** * TAB_EnsureSelectionVisible * @@ -2333,7 +2318,7 @@ static void TAB_EnsureSelectionVisible( if (newselected != iTargetRow) { - INT i; + UINT i; if(lStyle & TCS_VERTICAL) { for (i=0; i < infoPtr->uNumItem; i++) @@ -2379,7 +2364,8 @@ static void TAB_EnsureSelectionVisible( else { RECT r; - INT width, i; + INT width; + UINT i; /* Calculate the part of the client area that is visible */ GetClientRect(hwnd, &r); @@ -2411,7 +2397,7 @@ static void TAB_EnsureSelectionVisible( if (infoPtr->leftmostVisible != iOrigLeftmostVisible) TAB_RecalcHotTrack(hwnd, NULL, NULL, NULL); - SendMessageA(infoPtr->hwndUpDown, UDM_SETPOS, 0, + SendMessageW(infoPtr->hwndUpDown, UDM_SETPOS, 0, MAKELONG(infoPtr->leftmostVisible, 0)); } @@ -2494,10 +2480,6 @@ TAB_Paint (HWND hwnd, WPARAM wParam) TRACE("erase %d, rect=(%ld,%ld)-(%ld,%ld)\n", ps.fErase, ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right,ps.rcPaint.bottom); - - if (ps.fErase) - TAB_EraseBackground (hwnd, hdc); - } else { hdc = (HDC)wParam; } @@ -3122,12 +3104,12 @@ TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) NMTOOLTIPSCREATED nmttc; nmttc.hdr.hwndFrom = hwnd; - nmttc.hdr.idFrom = GetWindowLongA(hwnd, GWL_ID); + nmttc.hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); nmttc.hdr.code = NM_TOOLTIPSCREATED; nmttc.hwndToolTips = infoPtr->hwndToolTip; - SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, - (WPARAM)GetWindowLongA(hwnd, GWL_ID), (LPARAM)&nmttc); + SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, + (WPARAM)GetWindowLongPtrW(hwnd, GWLP_ID), (LPARAM)&nmttc); } } @@ -3165,7 +3147,7 @@ static LRESULT TAB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) { TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); - INT iItem; + UINT iItem; if (!infoPtr) return 0; @@ -3218,7 +3200,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) TRACE("hwnd=%p msg=%x wParam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam); if (!TAB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE)) - return DefWindowProcA (hwnd, uMsg, wParam, lParam); + return DefWindowProcW (hwnd, uMsg, wParam, lParam); switch (uMsg) { @@ -3344,7 +3326,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TAB_LButtonUp (hwnd, wParam, lParam); case WM_NOTIFY: - return SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, wParam, lParam); + return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, wParam, lParam); case WM_RBUTTONDOWN: return TAB_RButtonDown (hwnd, wParam, lParam); @@ -3352,9 +3334,6 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_MOUSEMOVE: return TAB_MouseMove (hwnd, wParam, lParam); - case WM_ERASEBKGND: - return TAB_EraseBackground (hwnd, (HDC)wParam); - case WM_PAINT: return TAB_Paint (hwnd, wParam); @@ -3389,7 +3368,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if ((uMsg >= WM_USER) && (uMsg < WM_APP)) WARN("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); - return DefWindowProcA(hwnd, uMsg, wParam, lParam); + return DefWindowProcW(hwnd, uMsg, wParam, lParam); } return 0; @@ -3399,23 +3378,23 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) VOID TAB_Register (void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; - ZeroMemory (&wndClass, sizeof(WNDCLASSA)); + ZeroMemory (&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; - wndClass.lpfnWndProc = (WNDPROC)TAB_WindowProc; + wndClass.lpfnWndProc = TAB_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(TAB_INFO *); - wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW); - wndClass.hbrBackground = NULL; - wndClass.lpszClassName = WC_TABCONTROLA; + wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW); + wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1); + wndClass.lpszClassName = WC_TABCONTROLW; - RegisterClassA (&wndClass); + RegisterClassW (&wndClass); } VOID TAB_Unregister (void) { - UnregisterClassA (WC_TABCONTROLA, NULL); + UnregisterClassW (WC_TABCONTROLW, NULL); } diff --git a/reactos/lib/comctl32/toolbar.c b/reactos/lib/comctl32/toolbar.c index e77e59aeaa3..a2781eb1995 100644 --- a/reactos/lib/comctl32/toolbar.c +++ b/reactos/lib/comctl32/toolbar.c @@ -42,12 +42,9 @@ * - TBSTYLE_REGISTERDROP * - TBSTYLE_EX_DOUBLEBUFFER * - Messages: - * - TB_GETINSERTMARK - * - TB_GETINSERTMARKCOLOR * - TB_GETMETRICS * - TB_GETOBJECT * - TB_INSERTMARKHITTEST - * - TB_SETINSERTMARK * - TB_SETMETRICS * - Notifications: * - NM_CHAR @@ -58,11 +55,6 @@ * - Button wrapping (under construction). * - Fix TB_SETROWS. * - iListGap custom draw support. - * - Customization dialog: - * - Minor buglet in 'available buttons' list: - * Buttons are not listed in MS-like order. MS seems to use a single - * internal list to store the button information of both listboxes. - * - Drag list support. * * Testing: * - Run tests using Waite Group Windows95 API Bible Volume 2. @@ -126,6 +118,7 @@ typedef struct INT nHeight; /* height of the toolbar */ INT nWidth; /* width of the toolbar */ RECT client_rect; + RECT rcBound; /* bounding rectangle */ INT nButtonHeight; INT nButtonWidth; INT nBitmapHeight; @@ -139,8 +132,6 @@ typedef struct INT nNumBitmaps; /* number of bitmaps */ INT nNumStrings; /* number of strings */ INT nNumBitmapInfos; - BOOL bUnicode; /* ASCII (FALSE) or Unicode (TRUE)? */ - BOOL bCaptured; /* mouse captured? */ INT nButtonDown; /* toolbar button being pressed or -1 if none */ INT nButtonDrag; /* toolbar button being dragged or -1 if none */ INT nOldHit; @@ -168,6 +159,8 @@ typedef struct BOOL bNtfUnicode; /* TRUE if NOTIFYs use {W} */ BOOL bDoRedraw; /* Redraw status */ BOOL bDragOutSent; /* has TBN_DRAGOUT notification been sent for this drag? */ + BOOL bUnicode; /* ASCII (FALSE) or Unicode (TRUE)? */ + BOOL bCaptured; /* mouse captured? */ DWORD dwStyle; /* regular toolbar style */ DWORD dwExStyle; /* extended toolbar style */ DWORD dwDTFlags; /* DrawText flags */ @@ -175,10 +168,10 @@ typedef struct COLORREF clrInsertMark; /* insert mark color */ COLORREF clrBtnHighlight; /* color for Flat Separator */ COLORREF clrBtnShadow; /* color for Flag Separator */ - RECT rcBound; /* bounding rectangle */ INT iVersion; LPWSTR pszTooltipText; /* temporary store for a string > 80 characters * for TTN_GETDISPINFOW notification */ + TBINSERTMARK tbim; /* info on insertion mark */ TBUTTON_INFO *buttons; /* pointer to button array */ LPWSTR *strings; /* pointer to string array */ TBITMAP_INFO *bitmaps; @@ -212,6 +205,7 @@ typedef enum #define BOTTOM_BORDER 2 #define DDARROW_WIDTH 11 #define ARROW_HEIGHT 3 +#define INSERTMARK_WIDTH 2 /* gap between border of button and text/image */ #define OFFSET_X 1 @@ -219,6 +213,8 @@ typedef enum /* how wide to treat the bitmap if it isn't present */ #define LIST_IMAGE_ABSENT_WIDTH 2 +#define TOOLBAR_NOWHERE (-1) + #define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongPtrW(hwnd,0)) #define TOOLBAR_HasText(x, y) (TOOLBAR_GetText(x, y) ? TRUE : FALSE) #define TOOLBAR_HasDropDownArrows(exStyle) ((exStyle & TBSTYLE_EX_DRAWDDARROWS) ? TRUE : FALSE) @@ -247,6 +243,7 @@ static PIMLENTRY TOOLBAR_GetImageListEntry(PIMLENTRY *pies, INT cies, INT id); static VOID TOOLBAR_DeleteImageList(PIMLENTRY **pies, INT *cies); static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id); static LRESULT TOOLBAR_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam); +static void TOOLBAR_SetHotItemEx (TOOLBAR_INFO *infoPtr, INT nHit, DWORD dwReason); static LRESULT TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam); @@ -890,7 +887,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc) rcText.left += GetSystemMetrics(SM_CXEDGE) + OFFSET_X; rcText.right -= GetSystemMetrics(SM_CXEDGE) + OFFSET_X; if (GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr,btnPtr->iBitmap)) && - TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) + TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { if (dwStyle & TBSTYLE_LIST) rcText.left += infoPtr->nBitmapWidth + TOOLBAR_GetListTextOffset(infoPtr, infoPtr->iListGap); @@ -901,8 +898,9 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc) if (dwStyle & TBSTYLE_LIST) rcText.left += LIST_IMAGE_ABSENT_WIDTH + TOOLBAR_GetListTextOffset(infoPtr, infoPtr->iListGap); - if (btnPtr->fsState & (TBSTATE_PRESSED | TBSTATE_CHECKED)) - OffsetRect (&rcText, 1, 1); + if (!(infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) && + (btnPtr->fsState & (TBSTATE_PRESSED | TBSTATE_CHECKED))) + OffsetRect(&rcText, 1, 1); } /* Initialize fields in all cases, because we use these later @@ -1095,6 +1093,20 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, PAINTSTRUCT* ps) TOOLBAR_DrawButton (hwnd, btnPtr, hdc); } + /* draw insert mark if required */ + if (infoPtr->tbim.iButton != -1) + { + RECT rcButton = infoPtr->buttons[infoPtr->tbim.iButton].rect; + RECT rcInsertMark; + rcInsertMark.top = rcButton.top; + rcInsertMark.bottom = rcButton.bottom; + if (infoPtr->tbim.dwFlags & TBIMHT_AFTER) + rcInsertMark.left = rcInsertMark.right = rcButton.right; + else + rcInsertMark.left = rcInsertMark.right = rcButton.left - INSERTMARK_WIDTH; + COMCTL32_DrawInsertMark(hdc, &rcInsertMark, infoPtr->clrInsertMark, FALSE); + } + if (infoPtr->bBtnTranspnt && (oldBKmode != TRANSPARENT)) SetBkMode (hdc, oldBKmode); @@ -1661,7 +1673,7 @@ TOOLBAR_InternalHitTest (HWND hwnd, LPPOINT lpPt) } TRACE(" NOWHERE!\n"); - return -1; + return TOOLBAR_NOWHERE; } @@ -1751,6 +1763,290 @@ TOOLBAR_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg, SendMessageA (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg); } +/* keeps available button list box sorted by button id */ +static void TOOLBAR_Cust_InsertAvailButton(HWND hwnd, PCUSTOMBUTTON btnInfoNew) +{ + int i; + int count; + PCUSTOMBUTTON btnInfo; + HWND hwndAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX); + + ERR("button %s, idCommand %d\n", debugstr_w(btnInfoNew->text), btnInfoNew->btn.idCommand); + + count = SendMessageA(hwndAvail, LB_GETCOUNT, 0, 0); + + /* position 0 is always separator */ + for (i = 1; i < count; i++) + { + btnInfo = (PCUSTOMBUTTON)SendMessageA(hwndAvail, LB_GETITEMDATA, i, 0); + if (btnInfoNew->btn.idCommand < btnInfo->btn.idCommand) + { + i = SendMessageA(hwndAvail, LB_INSERTSTRING, i, 0); + SendMessageA(hwndAvail, LB_SETITEMDATA, i, (LPARAM)btnInfoNew); + return; + } + } + /* id higher than all others add to end */ + i = SendMessageA(hwndAvail, LB_ADDSTRING, 0, 0); + SendMessageA(hwndAvail, LB_SETITEMDATA, i, (LPARAM)btnInfoNew); +} + +static void TOOLBAR_Cust_MoveButton(PCUSTDLG_INFO custInfo, HWND hwnd, INT nIndexFrom, INT nIndexTo) +{ + NMTOOLBARA nmtb; + + TRACE("index from %d, index to %d\n", nIndexFrom, nIndexTo); + + if (nIndexFrom == nIndexTo) + return; + + /* send TBN_QUERYINSERT notification */ + nmtb.iItem = nIndexFrom; /* FIXME: this doesn't look right */ + if (TOOLBAR_SendNotify((NMHDR *)&nmtb, custInfo->tbInfo, TBN_QUERYINSERT)) + { + PCUSTOMBUTTON btnInfo; + NMHDR hdr; + HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX); + int count = SendMessageA(hwndList, LB_GETCOUNT, 0, 0); + + btnInfo = (PCUSTOMBUTTON)SendMessageA(hwndList, LB_GETITEMDATA, nIndexFrom, 0); + + SendMessageA(hwndList, LB_DELETESTRING, nIndexFrom, 0); + SendMessageA(hwndList, LB_INSERTSTRING, nIndexTo, 0); + SendMessageA(hwndList, LB_SETITEMDATA, nIndexTo, (LPARAM)btnInfo); + SendMessageA(hwndList, LB_SETCURSEL, nIndexTo, 0); + + if (nIndexTo <= 0) + EnableWindow(GetDlgItem(hwnd,IDC_MOVEUP_BTN), FALSE); + else + EnableWindow(GetDlgItem(hwnd,IDC_MOVEUP_BTN), TRUE); + + /* last item is always separator, so -2 instead of -1 */ + if (nIndexTo >= (count - 2)) + EnableWindow(GetDlgItem(hwnd,IDC_MOVEDN_BTN), FALSE); + else + EnableWindow(GetDlgItem(hwnd,IDC_MOVEDN_BTN), TRUE); + + SendMessageA(custInfo->tbHwnd, TB_DELETEBUTTON, nIndexFrom, 0); + SendMessageA(custInfo->tbHwnd, TB_INSERTBUTTONA, nIndexTo, (LPARAM)&(btnInfo->btn)); + + TOOLBAR_SendNotify(&hdr, custInfo->tbInfo, TBN_TOOLBARCHANGE); + } +} + +static void TOOLBAR_Cust_AddButton(PCUSTDLG_INFO custInfo, HWND hwnd, INT nIndexAvail, INT nIndexTo) +{ + NMTOOLBARA nmtb; + + TRACE("Add: nIndexAvail %d, nIndexTo %d\n", nIndexAvail, nIndexTo); + + /* send TBN_QUERYINSERT notification */ + nmtb.iItem = nIndexAvail; /* FIXME: this doesn't look right */ + if (TOOLBAR_SendNotify((NMHDR *)&nmtb, custInfo->tbInfo, TBN_QUERYINSERT)) + { + PCUSTOMBUTTON btnInfo; + NMHDR hdr; + HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX); + HWND hwndAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX); + int count = SendMessageA(hwndAvail, LB_GETCOUNT, 0, 0); + + btnInfo = (PCUSTOMBUTTON)SendMessageA(hwndAvail, LB_GETITEMDATA, nIndexAvail, 0); + + if (nIndexAvail != 0) /* index == 0 indicates separator */ + { + /* remove from 'available buttons' list */ + SendMessageA(hwndAvail, LB_DELETESTRING, nIndexAvail, 0); + if (nIndexAvail == count-1) + SendMessageA(hwndAvail, LB_SETCURSEL, nIndexAvail-1 , 0); + else + SendMessageA(hwndAvail, LB_SETCURSEL, nIndexAvail , 0); + } + else + { + PCUSTOMBUTTON btnNew; + + /* duplicate 'separator' button */ + btnNew = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON)); + memcpy(btnNew, btnInfo, sizeof(CUSTOMBUTTON)); + btnInfo = btnNew; + } + + /* insert into 'toolbar button' list */ + SendMessageA(hwndList, LB_INSERTSTRING, nIndexTo, 0); + SendMessageA(hwndList, LB_SETITEMDATA, nIndexTo, (LPARAM)btnInfo); + + SendMessageA(custInfo->tbHwnd, TB_INSERTBUTTONA, nIndexTo, (LPARAM)&(btnInfo->btn)); + + TOOLBAR_SendNotify(&hdr, custInfo->tbInfo, TBN_TOOLBARCHANGE); + } +} + +static void TOOLBAR_Cust_RemoveButton(PCUSTDLG_INFO custInfo, HWND hwnd, INT index) +{ + PCUSTOMBUTTON btnInfo; + HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX); + + TRACE("Remove: index %d\n", index); + + btnInfo = (PCUSTOMBUTTON)SendMessageA(hwndList, LB_GETITEMDATA, index, 0); + + /* send TBN_QUERYDELETE notification */ + if (TOOLBAR_IsButtonRemovable(custInfo->tbInfo, index, btnInfo)) + { + NMHDR hdr; + + SendMessageA(hwndList, LB_DELETESTRING, index, 0); + SendMessageA(hwndList, LB_SETCURSEL, index , 0); + + SendMessageA(custInfo->tbHwnd, TB_DELETEBUTTON, index, 0); + + /* insert into 'available button' list */ + if (!(btnInfo->btn.fsStyle & BTNS_SEP)) + TOOLBAR_Cust_InsertAvailButton(hwnd, btnInfo); + else + Free(btnInfo); + + TOOLBAR_SendNotify(&hdr, custInfo->tbInfo, TBN_TOOLBARCHANGE); + } +} + +/* drag list notification function for toolbar buttons list box */ +static LRESULT TOOLBAR_Cust_ToolbarDragListNotification(PCUSTDLG_INFO custInfo, HWND hwnd, DRAGLISTINFO *pDLI) +{ + HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX); + switch (pDLI->uNotification) + { + case DL_BEGINDRAG: + { + INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE); + INT nCount = SendMessageA(hwndList, LB_GETCOUNT, 0, 0); + /* no dragging for last item (separator) */ + if (nCurrentItem >= (nCount - 1)) return FALSE; + return TRUE; + } + case DL_DRAGGING: + { + INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE); + INT nCount = SendMessageA(hwndList, LB_GETCOUNT, 0, 0); + /* no dragging past last item (separator) */ + if ((nCurrentItem >= 0) && (nCurrentItem < (nCount - 1))) + { + DrawInsert(hwnd, hwndList, nCurrentItem); + /* FIXME: native uses "move button" cursor */ + return DL_COPYCURSOR; + } + + /* not over toolbar buttons list */ + if (nCurrentItem < 0) + { + POINT ptWindow = pDLI->ptCursor; + HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX); + MapWindowPoints(NULL, hwnd, &ptWindow, 1); + /* over available buttons list? */ + if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail) + /* FIXME: native uses "move button" cursor */ + return DL_COPYCURSOR; + } + /* clear drag arrow */ + DrawInsert(hwnd, hwndList, -1); + return DL_STOPCURSOR; + } + case DL_DROPPED: + { + INT nIndexTo = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE); + INT nIndexFrom = SendMessageA(hwndList, LB_GETCURSEL, 0, 0); + INT nCount = SendMessageA(hwndList, LB_GETCOUNT, 0, 0); + if ((nIndexTo >= 0) && (nIndexTo < (nCount - 1))) + { + /* clear drag arrow */ + DrawInsert(hwnd, hwndList, -1); + /* move item */ + TOOLBAR_Cust_MoveButton(custInfo, hwnd, nIndexFrom, nIndexTo); + } + /* not over toolbar buttons list */ + if (nIndexTo < 0) + { + POINT ptWindow = pDLI->ptCursor; + HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX); + MapWindowPoints(NULL, hwnd, &ptWindow, 1); + /* over available buttons list? */ + if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail) + TOOLBAR_Cust_RemoveButton(custInfo, hwnd, nIndexFrom); + } + break; + } + case DL_CANCELDRAG: + /* Clear drag arrow */ + DrawInsert(hwnd, hwndList, -1); + break; + } + + return 0; +} + +/* drag list notification function for available buttons list box */ +static LRESULT TOOLBAR_Cust_AvailDragListNotification(PCUSTDLG_INFO custInfo, HWND hwnd, DRAGLISTINFO *pDLI) +{ + HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX); + switch (pDLI->uNotification) + { + case DL_BEGINDRAG: + { + INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE); + INT nCount = SendMessageA(hwndList, LB_GETCOUNT, 0, 0); + /* no dragging for last item (separator) */ + if (nCurrentItem >= (nCount - 1)) return FALSE; + return TRUE; + } + case DL_DRAGGING: + { + INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE); + INT nCount = SendMessageA(hwndList, LB_GETCOUNT, 0, 0); + /* no dragging past last item (separator) */ + if ((nCurrentItem >= 0) && (nCurrentItem < (nCount - 1))) + { + DrawInsert(hwnd, hwndList, nCurrentItem); + /* FIXME: native uses "move button" cursor */ + return DL_COPYCURSOR; + } + + /* not over toolbar buttons list */ + if (nCurrentItem < 0) + { + POINT ptWindow = pDLI->ptCursor; + HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX); + MapWindowPoints(NULL, hwnd, &ptWindow, 1); + /* over available buttons list? */ + if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail) + /* FIXME: native uses "move button" cursor */ + return DL_COPYCURSOR; + } + /* clear drag arrow */ + DrawInsert(hwnd, hwndList, -1); + return DL_STOPCURSOR; + } + case DL_DROPPED: + { + INT nIndexTo = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE); + INT nCount = SendMessageA(hwndList, LB_GETCOUNT, 0, 0); + INT nIndexFrom = SendDlgItemMessageA(hwnd, IDC_AVAILBTN_LBOX, LB_GETCURSEL, 0, 0); + if ((nIndexTo >= 0) && (nIndexTo < (nCount - 1))) + { + /* clear drag arrow */ + DrawInsert(hwnd, hwndList, -1); + /* add item */ + TOOLBAR_Cust_AddButton(custInfo, hwnd, nIndexFrom, nIndexTo); + } + } + case DL_CANCELDRAG: + /* Clear drag arrow */ + DrawInsert(hwnd, hwndList, -1); + break; + } + return 0; +} + +extern UINT uDragListMessage; /*********************************************************************** * TOOLBAR_CustomizeDialogProc @@ -1851,10 +2147,6 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) btnInfo = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON)); btnInfo->bVirtual = FALSE; btnInfo->bRemovable = TRUE; - - index = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, 0); - SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, - LB_SETITEMDATA, index, (LPARAM)btnInfo); } else { @@ -1874,6 +2166,9 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) infoPtr->strings[nmtb.tbButton.iString]); } } + + if (index == -1) + TOOLBAR_Cust_InsertAvailButton(hwnd, btnInfo); } SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMHEIGHT, 0, infoPtr->nBitmapHeight + 8); @@ -1895,6 +2190,9 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index, 0); SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETTOPINDEX, index, 0); + MakeDragList(GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX)); + MakeDragList(GetDlgItem(hwnd, IDC_AVAILBTN_LBOX)); + /* set focus and disable buttons */ PostMessageA (hwnd, WM_USER, 0, 0); } @@ -1963,117 +2261,26 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case IDC_MOVEUP_BTN: { - PCUSTOMBUTTON btnInfo; - int index; - int count; - - count = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCOUNT, 0, 0); - index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); - TRACE("Move up: index %d\n", index); - - /* send TBN_QUERYINSERT notification */ - nmtb.iItem = index; - - if (TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, - TBN_QUERYINSERT)) - { - NMHDR hdr; - - btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); - - SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_DELETESTRING, index, 0); - SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_INSERTSTRING, index-1, 0); - SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index-1, (LPARAM)btnInfo); - SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index-1 , 0); - - if (index <= 1) - EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), FALSE); - else if (index >= (count - 3)) - EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), TRUE); - - SendMessageA (custInfo->tbHwnd, TB_DELETEBUTTON, index, 0); - SendMessageA (custInfo->tbHwnd, TB_INSERTBUTTONA, index-1, (LPARAM)&(btnInfo->btn)); - - TOOLBAR_SendNotify(&hdr, infoPtr, TBN_TOOLBARCHANGE); - } + int index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); + TOOLBAR_Cust_MoveButton(custInfo, hwnd, index, index-1); } break; case IDC_MOVEDN_BTN: /* move down */ { - PCUSTOMBUTTON btnInfo; - int index; - int count; - - count = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCOUNT, 0, 0); - index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); - TRACE("Move up: index %d\n", index); - - /* send TBN_QUERYINSERT notification */ - nmtb.iItem = index; - if (TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, - TBN_QUERYINSERT)) - { - NMHDR hdr; - - btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); - - /* move button down */ - SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_DELETESTRING, index, 0); - SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_INSERTSTRING, index+1, 0); - SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index+1, (LPARAM)btnInfo); - SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index+1 , 0); - - if (index == 0) - EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), TRUE); - else if (index >= (count - 3)) - EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), FALSE); - - SendMessageA (custInfo->tbHwnd, TB_DELETEBUTTON, index, 0); - SendMessageA (custInfo->tbHwnd, TB_INSERTBUTTONA, index+1, (LPARAM)&(btnInfo->btn)); - - TOOLBAR_SendNotify(&hdr, infoPtr, TBN_TOOLBARCHANGE); - } + int index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); + TOOLBAR_Cust_MoveButton(custInfo, hwnd, index, index+1); } break; case IDC_REMOVE_BTN: /* remove button */ { - PCUSTOMBUTTON btnInfo; - int index; - - index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); + int index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); if (LB_ERR == index) break; - TRACE("Remove: index %d\n", index); - - btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, - LB_GETITEMDATA, index, 0); - - /* send TBN_QUERYDELETE notification */ - if (TOOLBAR_IsButtonRemovable(infoPtr, index, btnInfo)) - { - NMHDR hdr; - - btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); - SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_DELETESTRING, index, 0); - SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index , 0); - - SendMessageA (custInfo->tbHwnd, TB_DELETEBUTTON, index, 0); - - /* insert into 'available button' list */ - if (!(btnInfo->btn.fsStyle & BTNS_SEP)) - { - index = (int)SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, 0); - SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); - } - else - Free (btnInfo); - - TOOLBAR_SendNotify(&hdr, infoPtr, TBN_TOOLBARCHANGE); - } + TOOLBAR_Cust_RemoveButton(custInfo, hwnd, index); } break; case IDC_HELP_BTN: @@ -2086,49 +2293,12 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case IDOK: /* Add button */ { int index; - int count; + int indexto; - count = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETCOUNT, 0, 0); - index = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETCURSEL, 0, 0); - TRACE("Add: index %d\n", index); + index = SendDlgItemMessageA(hwnd, IDC_AVAILBTN_LBOX, LB_GETCURSEL, 0, 0); + indexto = SendDlgItemMessageA(hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); - /* send TBN_QUERYINSERT notification */ - nmtb.iItem = index; - if (TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, - TBN_QUERYINSERT)) - { - NMHDR hdr; - - btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETITEMDATA, index, 0); - - if (index != 0) - { - /* remove from 'available buttons' list */ - SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_DELETESTRING, index, 0); - if (index == count-1) - SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETCURSEL, index-1 , 0); - else - SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETCURSEL, index , 0); - } - else - { - PCUSTOMBUTTON btnNew; - - /* duplicate 'separator' button */ - btnNew = (PCUSTOMBUTTON)Alloc (sizeof(CUSTOMBUTTON)); - memcpy (btnNew, btnInfo, sizeof(CUSTOMBUTTON)); - btnInfo = btnNew; - } - - /* insert into 'toolbar button' list */ - index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); - SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_INSERTSTRING, index, 0); - SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); - - SendMessageA (custInfo->tbHwnd, TB_INSERTBUTTONA, index, (LPARAM)&(btnInfo->btn)); - - TOOLBAR_SendNotify(&hdr, infoPtr, TBN_TOOLBARCHANGE); - } + TOOLBAR_Cust_AddButton(custInfo, hwnd, index, indexto); } break; @@ -2247,7 +2417,24 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return FALSE; default: - return FALSE; + if (uDragListMessage && (uMsg == uDragListMessage)) + { + if (wParam == IDC_TOOLBARBTN_LBOX) + { + LRESULT res = TOOLBAR_Cust_ToolbarDragListNotification( + custInfo, hwnd, (DRAGLISTINFO *)lParam); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, res); + return TRUE; + } + else if (wParam == IDC_AVAILBTN_LBOX) + { + LRESULT res = TOOLBAR_Cust_AvailDragListNotification( + custInfo, hwnd, (DRAGLISTINFO *)lParam); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, res); + return TRUE; + } + } + return FALSE; } } @@ -3370,8 +3557,29 @@ TOOLBAR_GetDefImageList (HWND hwnd, WPARAM wParam, LPARAM lParam) } -/* << TOOLBAR_GetInsertMark >> */ -/* << TOOLBAR_GetInsertMarkColor >> */ +static LRESULT +TOOLBAR_GetInsertMark (HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); + TBINSERTMARK *lptbim = (TBINSERTMARK*)lParam; + + TRACE("hwnd = %p, lptbim = %p\n", hwnd, lptbim); + + *lptbim = infoPtr->tbim; + + return 0; +} + + +static LRESULT +TOOLBAR_GetInsertMarkColor (HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); + + TRACE("hwnd = %p\n", hwnd); + + return (LRESULT)infoPtr->clrInsertMark; +} static LRESULT @@ -3949,6 +4157,8 @@ TOOLBAR_MarkButton (HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); INT nIndex; + DWORD oldState; + TBUTTON_INFO *btnPtr; TRACE("hwnd = %p, wParam = %d, lParam = 0x%08lx\n", hwnd, wParam, lParam); @@ -3956,10 +4166,16 @@ TOOLBAR_MarkButton (HWND hwnd, WPARAM wParam, LPARAM lParam) if (nIndex == -1) return FALSE; + btnPtr = &infoPtr->buttons[nIndex]; + oldState = btnPtr->fsState; + if (LOWORD(lParam)) - infoPtr->buttons[nIndex].fsState |= TBSTATE_MARKED; + btnPtr->fsState |= TBSTATE_MARKED; else - infoPtr->buttons[nIndex].fsState &= ~TBSTATE_MARKED; + btnPtr->fsState &= ~TBSTATE_MARKED; + + if(oldState != btnPtr->fsState) + InvalidateRect(hwnd, &btnPtr->rect, TRUE); return TRUE; } @@ -4232,8 +4448,12 @@ TOOLBAR_SetAnchorHighlight (HWND hwnd, WPARAM wParam) TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); BOOL bOldAnchor = infoPtr->bAnchor; + TRACE("hwnd=%p, bAnchor = %s\n", hwnd, wParam ? "TRUE" : "FALSE"); + infoPtr->bAnchor = (BOOL)wParam; + /* Native does not remove the hot effect from an already hot button */ + return (LRESULT)bOldAnchor; } @@ -4498,6 +4718,8 @@ TOOLBAR_SetDrawTextFlags (HWND hwnd, WPARAM wParam, LPARAM lParam) TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); DWORD dwTemp; + TRACE("hwnd = %p, dwMask = 0x%08lx, dwDTFlags = 0x%08lx\n", hwnd, (DWORD)wParam, (DWORD)lParam); + dwTemp = infoPtr->dwDTFlags; infoPtr->dwDTFlags = (infoPtr->dwDTFlags & (DWORD)wParam) | (DWORD)lParam; @@ -4573,7 +4795,7 @@ TOOLBAR_SetHotItemEx (TOOLBAR_INFO *infoPtr, INT nHit, DWORD dwReason) NMTBHOTITEM nmhotitem; TBUTTON_INFO *btnPtr = NULL, *oldBtnPtr = NULL; LRESULT no_highlight; - + /* Remove the effect of an old hot button if the button was drawn with the hot button effect */ if(infoPtr->nHotItem >= 0) @@ -4617,14 +4839,19 @@ TOOLBAR_SetHotItem (HWND hwnd, WPARAM wParam) TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd); INT nOldHotItem = infoPtr->nHotItem; + TRACE("hwnd = %p, nHit = %d\n", hwnd, (INT)wParam); + if ((INT) wParam < 0 || (INT)wParam > infoPtr->nNumButtons) - wParam = -2; + wParam = -1; + + /* NOTE: an application can still remove the hot item even if anchor + * highlighting is enabled */ if (infoPtr->dwStyle & TBSTYLE_FLAT) TOOLBAR_SetHotItemEx(infoPtr, wParam, HICF_OTHER); if (nOldHotItem < 0) - return -1; + return -1; return (LRESULT)nOldHotItem; } @@ -4681,7 +4908,33 @@ TOOLBAR_SetIndent (HWND hwnd, WPARAM wParam, LPARAM lParam) } -/* << TOOLBAR_SetInsertMark >> */ +static LRESULT +TOOLBAR_SetInsertMark (HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); + TBINSERTMARK *lptbim = (TBINSERTMARK*)lParam; + + TRACE("hwnd = %p, lptbim = { %d, 0x%08lx}\n", hwnd, lptbim->iButton, lptbim->dwFlags); + + if ((lptbim->dwFlags & ~TBIMHT_AFTER) != 0) + { + FIXME("Unrecognized flag(s): 0x%08lx\n", (lptbim->dwFlags & ~TBIMHT_AFTER)); + return 0; + } + + if ((lptbim->iButton == -1) || + ((lptbim->iButton < infoPtr->nNumButtons) && + (lptbim->iButton >= 0))) + { + infoPtr->tbim = *lptbim; + /* FIXME: don't need to update entire toolbar */ + InvalidateRect(hwnd, NULL, TRUE); + } + else + ERR("Invalid button index %d\n", lptbim->iButton); + + return 0; +} static LRESULT @@ -4691,7 +4944,8 @@ TOOLBAR_SetInsertMarkColor (HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->clrInsertMark = (COLORREF)lParam; - /* FIXME : redraw ??*/ + /* FIXME: don't need to update entire toolbar */ + InvalidateRect(hwnd, NULL, TRUE); return 0; } @@ -4981,6 +5235,9 @@ TOOLBAR_Unkwn45E (HWND hwnd, WPARAM wParam, LPARAM lParam) if ((INT) wParam < 0 || (INT)wParam > infoPtr->nNumButtons) wParam = -1; + /* NOTE: an application can still remove the hot item even if anchor + * highlighting is enabled */ + TOOLBAR_SetHotItemEx(infoPtr, wParam, lParam); GetFocus(); @@ -5002,7 +5259,6 @@ static LRESULT TOOLBAR_Unkwn460(HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->iListGap = (INT)wParam; - TOOLBAR_CalcToolbar(hwnd); InvalidateRect(hwnd, NULL, TRUE); return 0; @@ -5126,6 +5382,7 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->szPadding.cy = 2*(GetSystemMetrics(SM_CYEDGE)+OFFSET_Y); infoPtr->iListGap = infoPtr->szPadding.cx / 2; infoPtr->dwStyle = dwStyle; + infoPtr->tbim.iButton = -1; GetClientRect(hwnd, &infoPtr->client_rect); TOOLBAR_NotifyFormat(infoPtr, (WPARAM)hwnd, (LPARAM)NF_REQUERY); @@ -5214,6 +5471,10 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam) INT ret = FALSE; DWORD ntfret; + /* the app has told us not to redraw the toolbar */ + if (!infoPtr->bDoRedraw) + return FALSE; + if (infoPtr->dwStyle & TBSTYLE_CUSTOMERASE) { ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW)); tbcd.nmcd.dwDrawStage = CDDS_PREERASE; @@ -5267,7 +5528,7 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam) case CDRF_SKIPDEFAULT: return TRUE; default: - FIXME("[%p] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n", + FIXME("[%p] response %ld not handled to NM_CUSTOMDRAW (CDDS_POSTERASE)\n", hwnd, ntfret); } } @@ -5311,6 +5572,7 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) POINT pt; INT nHit; NMTOOLBARA nmtb; + NMMOUSE nmmouse; BOOL bDragKeyPressed; TRACE("\n"); @@ -5391,7 +5653,8 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) GetCursorPos(&pt); ScreenToClient(hwnd, &pt); nHit = TOOLBAR_InternalHitTest(hwnd, &pt); - TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE); + if (!infoPtr->bAnchor || (nHit >= 0)) + TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE); /* remove any left mouse button down or double-click messages * so that we can get a toggle effect on the button */ @@ -5431,6 +5694,23 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_BEGINDRAG); } + nmmouse.dwHitInfo = nHit; + + /* !!! Undocumented - sends NM_LDOWN with the NMMOUSE structure. */ + if (nmmouse.dwHitInfo < 0) + nmmouse.dwItemSpec = -1; + else + { + nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand; + nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData; + } + + ClientToScreen(hwnd, &pt); + nmmouse.pt = pt; + + if (!TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_LDOWN)) + return DefWindowProcW(hwnd, WM_LBUTTONDOWN, wParam, lParam); + return 0; } @@ -5455,7 +5735,8 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) pt.y = (INT)HIWORD(lParam); nHit = TOOLBAR_InternalHitTest (hwnd, &pt); - TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE); + if (!infoPtr->bAnchor || (nHit >= 0)) + TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE); if (infoPtr->nButtonDrag >= 0) { RECT rcClient; @@ -5578,16 +5859,27 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) { SendMessageA (infoPtr->hwndNotify, WM_COMMAND, MAKEWPARAM(infoPtr->buttons[nHit].idCommand, 0), (LPARAM)hwnd); - - /* !!! Undocumented - toolbar at 4.71 level and above sends - * either NM_RCLICK or NM_CLICK with the NMMOUSE structure. - * Only NM_RCLICK is documented. - */ - nmmouse.dwItemSpec = btnPtr->idCommand; - nmmouse.dwItemData = btnPtr->dwData; - TOOLBAR_SendNotify ((NMHDR *) &nmmouse, infoPtr, NM_CLICK); - } + } } + + /* !!! Undocumented - toolbar at 4.71 level and above sends + * NM_CLICK with the NMMOUSE structure. */ + nmmouse.dwHitInfo = nHit; + + if (nmmouse.dwHitInfo < 0) + nmmouse.dwItemSpec = -1; + else + { + nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand; + nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData; + } + + ClientToScreen(hwnd, &pt); + nmmouse.pt = pt; + + if (!TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_CLICK)) + return DefWindowProcW(hwnd, WM_LBUTTONUP, wParam, lParam); + return 0; } @@ -5612,9 +5904,10 @@ TOOLBAR_RButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam) } ClientToScreen(hwnd, &pt); - memcpy(&nmmouse.pt, &pt, sizeof(POINT)); + nmmouse.pt = pt; - TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_RCLICK); + if (!TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_RCLICK)) + return DefWindowProcW(hwnd, WM_RBUTTONUP, wParam, lParam); return 0; } @@ -5623,26 +5916,10 @@ static LRESULT TOOLBAR_RButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); + NMHDR nmhdr; - NMMOUSE nmmouse; - POINT pt; - - pt.x = LOWORD(lParam); - pt.y = HIWORD(lParam); - - nmmouse.dwHitInfo = TOOLBAR_InternalHitTest(hwnd, &pt); - - if (nmmouse.dwHitInfo < 0) - nmmouse.dwItemSpec = -1; - else { - nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand; - nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData; - } - - ClientToScreen(hwnd, &pt); - memcpy(&nmmouse.pt, &pt, sizeof(POINT)); - - TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_RDBLCLK); + if (!TOOLBAR_SendNotify(&nmhdr, infoPtr, NM_RDBLCLK)) + return DefWindowProcW(hwnd, WM_RBUTTONDBLCLK, wParam, lParam); return 0; } @@ -5676,9 +5953,10 @@ TOOLBAR_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam) hotBtnPtr = &infoPtr->buttons[infoPtr->nOldHit]; - /* don't remove hot effects when in drop-down */ - if (infoPtr->nOldHit < 0 || !hotBtnPtr->bDropDownPressed) - TOOLBAR_SetHotItemEx(infoPtr, -1, HICF_MOUSE); + /* don't remove hot effects when in anchor highlighting mode or when a + * drop-down button is pressed */ + if (!infoPtr->bAnchor && (infoPtr->nOldHit < 0 || !hotBtnPtr->bDropDownPressed)) + TOOLBAR_SetHotItemEx(infoPtr, TOOLBAR_NOWHERE, HICF_MOUSE); if (infoPtr->nOldHit < 0) return TRUE; @@ -5749,7 +6027,8 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) nHit = TOOLBAR_InternalHitTest (hwnd, &pt); - TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE); + if (!infoPtr->bAnchor || (nHit >= 0)) + TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE); if (infoPtr->nOldHit != nHit) { @@ -5928,7 +6207,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm { WCHAR wszBuffer[INFOTIPSIZE+1]; NMTBGETINFOTIPW tbgit; - int len; /* in chars */ + unsigned int len; /* in chars */ wszBuffer[0] = '\0'; wszBuffer[INFOTIPSIZE] = '\0'; @@ -5966,7 +6245,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm { CHAR szBuffer[INFOTIPSIZE+1]; NMTBGETINFOTIPA tbgit; - int len; /* in chars */ + unsigned int len; /* in chars */ szBuffer[0] = '\0'; szBuffer[INFOTIPSIZE] = '\0'; @@ -6007,7 +6286,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm !(infoPtr->buttons[index].fsStyle & BTNS_SHOWTEXT)) { LPWSTR pszText = TOOLBAR_GetText(infoPtr, &infoPtr->buttons[index]); - int len = pszText ? strlenW(pszText) : 0; + unsigned int len = pszText ? strlenW(pszText) : 0; TRACE("using button hidden text %s\n", debugstr_w(pszText)); @@ -6447,8 +6726,11 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case TB_GETIMAGELIST: return TOOLBAR_GetDefImageList (hwnd, wParam, lParam); -/* case TB_GETINSERTMARK: */ /* 4.71 */ -/* case TB_GETINSERTMARKCOLOR: */ /* 4.71 */ + case TB_GETINSERTMARK: + return TOOLBAR_GetInsertMark (hwnd, wParam, lParam); + + case TB_GETINSERTMARKCOLOR: + return TOOLBAR_GetInsertMarkColor (hwnd, wParam, lParam); case TB_GETITEMRECT: return TOOLBAR_GetItemRect (hwnd, wParam, lParam); @@ -6590,7 +6872,8 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case TB_SETINDENT: return TOOLBAR_SetIndent (hwnd, wParam, lParam); -/* case TB_SETINSERTMARK: */ /* 4.71 */ + case TB_SETINSERTMARK: + return TOOLBAR_SetInsertMark (hwnd, wParam, lParam); case TB_SETINSERTMARKCOLOR: return TOOLBAR_SetInsertMarkColor (hwnd, wParam, lParam); diff --git a/reactos/lib/comctl32/tooltips.c b/reactos/lib/comctl32/tooltips.c index dd20b138903..cbdb3ed7439 100644 --- a/reactos/lib/comctl32/tooltips.c +++ b/reactos/lib/comctl32/tooltips.c @@ -2,6 +2,7 @@ * Tool tip control * * Copyright 1998, 1999 Eric Kohl + * Copyright 2004 Robert Shearman * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,10 +18,26 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * This code was audited for completeness against the documented features + * of Comctl32.dll version 6.0 on Sep. 08, 2004, by Robert Shearman. + * + * Unless otherwise noted, we believe this code to be complete, as per + * the specification mentioned above. + * If you discover missing features or bugs please note them below. + * * TODO: * - Custom draw support. - * - Balloon tips. - * - Messages. + * - Animation. + * - Links. + * - Messages: + * o TTM_ADJUSTRECT + * o TTM_GETTITLEA + * o TTM_GETTTILEW + * o TTM_POPUP + * - Styles: + * o TTS_NOANIMATE + * o TTS_NOFADE + * o TTS_CLOSE * * Testing: * - Run tests using Waite Group Windows95 API Bible Volume 2. @@ -87,6 +104,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(tooltips); +static HICON hTooltipIcons[TTI_ERROR+1]; + typedef struct { UINT uFlags; @@ -109,6 +128,7 @@ typedef struct COLORREF clrBk; COLORREF clrText; HFONT hFont; + HFONT hTitleFont; INT xTrackPos; INT yTrackPos; INT nMaxTipWidth; @@ -120,6 +140,8 @@ typedef struct INT nInitialTime; RECT rcMargin; BOOL bToolBelow; + LPWSTR pszTitle; + HICON hTitleIcon; TTTOOL_INFO *tools; } TOOLTIPS_INFO; @@ -129,7 +151,7 @@ typedef struct #define ID_TIMERLEAVE 3 /* tool leave timer */ -#define TOOLTIPS_GetInfoPtr(hWindow) ((TOOLTIPS_INFO *)GetWindowLongA (hWindow, 0)) +#define TOOLTIPS_GetInfoPtr(hWindow) ((TOOLTIPS_INFO *)GetWindowLongPtrW (hWindow, 0)) /* offsets from window edge to start of text */ #define NORMAL_TEXT_MARGIN 2 @@ -141,11 +163,44 @@ typedef struct #define BALLOON_STEMWIDTH 10 #define BALLOON_STEMINDENT 20 -LRESULT CALLBACK +#define BALLOON_ICON_TITLE_SPACING 8 /* horizontal spacing between icon and title */ +#define BALLOON_TITLE_TEXT_SPACING 8 /* vertical spacing between icon/title and main text */ +#define ICON_HEIGHT 16 +#define ICON_WIDTH 16 + +static LRESULT CALLBACK TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR dwRef); -static VOID +inline static UINT_PTR +TOOLTIPS_GetTitleIconIndex(HICON hIcon) +{ + UINT i; + for (i = 0; i <= TTI_ERROR; i++) + if (hTooltipIcons[i] == hIcon) + return i; + return (UINT_PTR)hIcon; +} + +static void +TOOLTIPS_InitSystemSettings (TOOLTIPS_INFO *infoPtr) +{ + NONCLIENTMETRICSW nclm; + + infoPtr->clrBk = GetSysColor (COLOR_INFOBK); + infoPtr->clrText = GetSysColor (COLOR_INFOTEXT); + + DeleteObject (infoPtr->hFont); + nclm.cbSize = sizeof(nclm); + SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0); + infoPtr->hFont = CreateFontIndirectW (&nclm.lfStatusFont); + + DeleteObject (infoPtr->hTitleFont); + nclm.lfStatusFont.lfWeight = FW_BOLD; + infoPtr->hTitleFont = CreateFontIndirectW (&nclm.lfStatusFont); +} + +static void TOOLTIPS_Refresh (HWND hwnd, HDC hdc) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(hwnd); @@ -165,6 +220,9 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc) hBrush = CreateSolidBrush(infoPtr->clrBk); + oldBkMode = SetBkMode (hdc, TRANSPARENT); + SetTextColor (hdc, infoPtr->clrText); + if (dwStyle & TTS_BALLOON) { /* create a region to store result into */ @@ -176,13 +234,6 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc) FillRgn(hdc, hRgn, hBrush); DeleteObject(hBrush); hBrush = NULL; - - /* calculate text rectangle */ - rc.left += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.left); - rc.top += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.top); - rc.right -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.right); - rc.bottom -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.bottom); - if(infoPtr->bToolBelow) rc.top += BALLOON_STEMHEIGHT; } else { @@ -190,7 +241,41 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc) FillRect(hdc, &rc, hBrush); DeleteObject(hBrush); hBrush = NULL; + } + if ((dwStyle & TTS_BALLOON) || infoPtr->pszTitle) + { + /* calculate text rectangle */ + rc.left += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.left); + rc.top += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.top); + rc.right -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.right); + rc.bottom -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.bottom); + if(infoPtr->bToolBelow) rc.top += BALLOON_STEMHEIGHT; + + if (infoPtr->pszTitle) + { + RECT rcTitle = {rc.left, rc.top, rc.right, rc.bottom}; + int height; + BOOL icon_present; + + /* draw icon */ + icon_present = infoPtr->hTitleIcon && + DrawIconEx(hdc, rc.left, rc.top, infoPtr->hTitleIcon, + ICON_WIDTH, ICON_HEIGHT, 0, NULL, DI_NORMAL); + if (icon_present) + rcTitle.left += ICON_WIDTH + BALLOON_ICON_TITLE_SPACING; + + rcTitle.bottom = rc.top + ICON_HEIGHT; + + /* draw title text */ + hOldFont = SelectObject (hdc, infoPtr->hTitleFont); + height = DrawTextW(hdc, infoPtr->pszTitle, -1, &rcTitle, DT_BOTTOM | DT_SINGLELINE | DT_NOPREFIX); + SelectObject (hdc, hOldFont); + rc.top += height + BALLOON_TITLE_TEXT_SPACING; + } + } + else + { /* calculate text rectangle */ rc.left += (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.left); rc.top += (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.top); @@ -198,12 +283,8 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc) rc.bottom -= (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.bottom); } - /* already drawn the background; don't need to draw it again - * when drawing text */ - oldBkMode = SetBkMode (hdc, TRANSPARENT); - SetTextColor (hdc, infoPtr->clrText); - hOldFont = SelectObject (hdc, infoPtr->hFont); /* draw text */ + hOldFont = SelectObject (hdc, infoPtr->hFont); DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags); /* be polite and reset the things we changed in the dc */ SelectObject (hdc, hOldFont); @@ -318,12 +399,12 @@ static void TOOLTIPS_GetDispInfoW(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO } } -static VOID +static void TOOLTIPS_GetTipText (HWND hwnd, TOOLTIPS_INFO *infoPtr, INT nTool) { TTTOOL_INFO *toolPtr = &infoPtr->tools[nTool]; - if (HIWORD((UINT)toolPtr->lpszText) == 0) { + if (HIWORD((UINT)toolPtr->lpszText) == 0 && toolPtr->hinst) { /* load a resource */ TRACE("load res string %p %x\n", toolPtr->hinst, (int)toolPtr->lpszText); @@ -351,7 +432,7 @@ TOOLTIPS_GetTipText (HWND hwnd, TOOLTIPS_INFO *infoPtr, INT nTool) } -static VOID +static void TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize) { HDC hdc; @@ -359,6 +440,7 @@ TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize) DWORD style = GetWindowLongW(hwnd, GWL_STYLE); UINT uFlags = DT_EXTERNALLEADING | DT_CALCRECT; RECT rc = {0, 0, 0, 0}; + SIZE title = {0, 0}; if (infoPtr->nMaxTipWidth > -1) { rc.right = infoPtr->nMaxTipWidth; @@ -369,16 +451,32 @@ TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize) TRACE("%s\n", debugstr_w(infoPtr->szTipText)); hdc = GetDC (hwnd); + if (infoPtr->pszTitle) + { + RECT rcTitle = {0, 0, 0, 0}; + TRACE("title %s\n", debugstr_w(infoPtr->pszTitle)); + if (infoPtr->hTitleIcon) + { + title.cx = ICON_WIDTH; + title.cy = ICON_HEIGHT; + } + if (title.cx != 0) title.cx += BALLOON_ICON_TITLE_SPACING; + hOldFont = SelectObject (hdc, infoPtr->hTitleFont); + DrawTextW(hdc, infoPtr->pszTitle, -1, &rcTitle, DT_SINGLELINE | DT_NOPREFIX | DT_CALCRECT); + SelectObject (hdc, hOldFont); + title.cy = max(title.cy, rcTitle.bottom - rcTitle.top) + BALLOON_TITLE_TEXT_SPACING; + title.cx += (rcTitle.right - rcTitle.left); + } hOldFont = SelectObject (hdc, infoPtr->hFont); DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags); SelectObject (hdc, hOldFont); ReleaseDC (hwnd, hdc); - if (style & TTS_BALLOON) + if ((style & TTS_BALLOON) || infoPtr->pszTitle) { - lpSize->cx = rc.right - rc.left + 2*BALLOON_TEXT_MARGIN + + lpSize->cx = max(rc.right - rc.left, title.cx) + 2*BALLOON_TEXT_MARGIN + infoPtr->rcMargin.left + infoPtr->rcMargin.right; - lpSize->cy = rc.bottom - rc.top + 2*BALLOON_TEXT_MARGIN + + lpSize->cy = title.cy + rc.bottom - rc.top + 2*BALLOON_TEXT_MARGIN + infoPtr->rcMargin.bottom + infoPtr->rcMargin.top + BALLOON_STEMHEIGHT; } @@ -392,7 +490,7 @@ TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize) } -static VOID +static void TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr) { TTTOOL_INFO *toolPtr; @@ -583,7 +681,7 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr) } -static VOID +static void TOOLTIPS_Hide (HWND hwnd, TOOLTIPS_INFO *infoPtr) { TTTOOL_INFO *toolPtr; @@ -610,7 +708,7 @@ TOOLTIPS_Hide (HWND hwnd, TOOLTIPS_INFO *infoPtr) } -static VOID +static void TOOLTIPS_TrackShow (HWND hwnd, TOOLTIPS_INFO *infoPtr) { TTTOOL_INFO *toolPtr; @@ -708,7 +806,7 @@ TOOLTIPS_TrackShow (HWND hwnd, TOOLTIPS_INFO *infoPtr) } -static VOID +static void TOOLTIPS_TrackHide (HWND hwnd, TOOLTIPS_INFO *infoPtr) { TTTOOL_INFO *toolPtr; @@ -1056,7 +1154,8 @@ TOOLTIPS_AddToolW (HWND hwnd, WPARAM wParam, LPARAM lParam) } -static void TOOLTIPS_DelToolCommon (HWND hwnd, TOOLTIPS_INFO *infoPtr, INT nTool) +static void +TOOLTIPS_DelToolCommon (HWND hwnd, TOOLTIPS_INFO *infoPtr, INT nTool) { TTTOOL_INFO *toolPtr; @@ -1720,6 +1819,10 @@ TOOLTIPS_RelayEvent (HWND hwnd, WPARAM wParam, LPARAM lParam) KillTimer(hwnd, ID_TIMERPOP); SetTimer(hwnd, ID_TIMERPOP, infoPtr->nAutoPopTime, 0); TRACE("timer 2 restarted\n"); + } else if(infoPtr->nTool != -1 && infoPtr->bActive) { + /* previous show attempt didn't result in tooltip so try again */ + SetTimer(hwnd, ID_TIMERSHOW, infoPtr->nInitialTime, 0); + TRACE("timer 1 started!\n"); } break; } @@ -1819,6 +1922,56 @@ TOOLTIPS_SetTipTextColor (HWND hwnd, WPARAM wParam, LPARAM lParam) } +static LRESULT +TOOLTIPS_SetTitleA (HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd); + LPCSTR pszTitle = (LPCSTR)lParam; + UINT uTitleIcon = (UINT)wParam; + UINT size; + + TRACE("hwnd = %p, title = %s, icon = %p\n", hwnd, pszTitle, (void*)uTitleIcon); + + size = sizeof(WCHAR)*MultiByteToWideChar(CP_ACP, 0, pszTitle, -1, NULL, 0); + infoPtr->pszTitle = Alloc(size); + if (!infoPtr->pszTitle) + return FALSE; + MultiByteToWideChar(CP_ACP, 0, pszTitle, -1, infoPtr->pszTitle, size/sizeof(WCHAR)); + if (uTitleIcon <= TTI_ERROR) + infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon]; + else + infoPtr->hTitleIcon = CopyIcon((HICON)wParam); + + return TRUE; +} + + +static LRESULT +TOOLTIPS_SetTitleW (HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd); + LPCWSTR pszTitle = (LPCWSTR)lParam; + UINT uTitleIcon = (UINT)wParam; + UINT size; + + TRACE("hwnd = %p, title = %s, icon = %p\n", hwnd, debugstr_w(pszTitle), (void*)uTitleIcon); + + size = (strlenW(pszTitle)+1)*sizeof(WCHAR); + infoPtr->pszTitle = Alloc(size); + if (!infoPtr->pszTitle) + return FALSE; + memcpy(infoPtr->pszTitle, pszTitle, size); + if (uTitleIcon <= TTI_ERROR) + infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon]; + else + infoPtr->hTitleIcon = CopyIcon((HICON)wParam); + + TRACE("icon = %p\n", infoPtr->hTitleIcon); + + return TRUE; +} + + static LRESULT TOOLTIPS_SetToolInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam) { @@ -1907,7 +2060,7 @@ TOOLTIPS_SetToolInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam) TRACE("set string id %x!\n", (INT)lpToolInfo->lpszText); toolPtr->lpszText = lpToolInfo->lpszText; } - else if (lpToolInfo->lpszText) { + else { if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW) toolPtr->lpszText = LPSTR_TEXTCALLBACKW; else { @@ -1927,6 +2080,16 @@ TOOLTIPS_SetToolInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam) if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOW)) toolPtr->lParam = lpToolInfo->lParam; + if (infoPtr->nCurrentTool == nTool) + { + TOOLTIPS_GetTipText (hwnd, infoPtr, infoPtr->nCurrentTool); + + if (infoPtr->szTipText[0] == 0) + TOOLTIPS_Hide(hwnd, infoPtr); + else + TOOLTIPS_Show (hwnd, infoPtr); + } + return 0; } @@ -2120,27 +2283,23 @@ static LRESULT TOOLTIPS_Create (HWND hwnd, const CREATESTRUCTW *lpcs) { TOOLTIPS_INFO *infoPtr; - NONCLIENTMETRICSA nclm; /* allocate memory for info structure */ infoPtr = (TOOLTIPS_INFO *)Alloc (sizeof(TOOLTIPS_INFO)); - SetWindowLongA (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize info structure */ infoPtr->bActive = TRUE; infoPtr->bTrackActive = FALSE; - infoPtr->clrBk = GetSysColor (COLOR_INFOBK); - infoPtr->clrText = GetSysColor (COLOR_INFOTEXT); - - nclm.cbSize = sizeof(NONCLIENTMETRICSA); - SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0); - infoPtr->hFont = CreateFontIndirectA (&nclm.lfStatusFont); infoPtr->nMaxTipWidth = -1; infoPtr->nTool = -1; infoPtr->nCurrentTool = -1; infoPtr->nTrackTool = -1; + /* initialize colours and fonts */ + TOOLTIPS_InitSystemSettings(infoPtr); + TOOLTIPS_SetDelayTime(hwnd, TTDT_AUTOMATIC, 0L); SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE); @@ -2154,7 +2313,7 @@ TOOLTIPS_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd); TTTOOL_INFO *toolPtr; - INT i; + UINT i; /* free tools */ if (infoPtr->tools) { @@ -2182,12 +2341,19 @@ TOOLTIPS_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) Free (infoPtr->tools); } - /* delete font */ + /* free title string */ + Free (infoPtr->pszTitle); + /* free title icon if not a standard one */ + if (TOOLTIPS_GetTitleIconIndex(infoPtr->hTitleIcon) > TTI_ERROR) + DeleteObject(infoPtr->hTitleIcon); + + /* delete fonts */ DeleteObject (infoPtr->hFont); + DeleteObject (infoPtr->hTitleFont); /* free tool tips info data */ Free (infoPtr); - SetWindowLongA(hwnd, 0, 0); + SetWindowLongPtrW(hwnd, 0, 0); return 0; } @@ -2285,9 +2451,13 @@ TOOLTIPS_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam) if(!GetObjectW((HFONT)wParam, sizeof(lf), &lf)) return 0; - if(infoPtr->hFont) DeleteObject (infoPtr->hFont); + DeleteObject (infoPtr->hFont); infoPtr->hFont = CreateFontIndirectW(&lf); + DeleteObject (infoPtr->hTitleFont); + lf.lfWeight = FW_BOLD; + infoPtr->hTitleFont = CreateFontIndirectW(&lf); + if ((LOWORD(lParam)) & (infoPtr->nCurrentTool != -1)) { FIXME("full redraw needed!\n"); } @@ -2388,21 +2558,14 @@ static LRESULT TOOLTIPS_WinIniChange (HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd); - NONCLIENTMETRICSA nclm; - infoPtr->clrBk = GetSysColor (COLOR_INFOBK); - infoPtr->clrText = GetSysColor (COLOR_INFOTEXT); - - DeleteObject (infoPtr->hFont); - nclm.cbSize = sizeof(NONCLIENTMETRICSA); - SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0); - infoPtr->hFont = CreateFontIndirectA (&nclm.lfStatusFont); + TOOLTIPS_InitSystemSettings (infoPtr); return 0; } -LRESULT CALLBACK +static LRESULT CALLBACK TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uID, DWORD_PTR dwRef) { MSG msg; @@ -2530,6 +2693,12 @@ TOOLTIPS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case TTM_SETTIPTEXTCOLOR: return TOOLTIPS_SetTipTextColor (hwnd, wParam, lParam); + case TTM_SETTITLEA: + return TOOLTIPS_SetTitleA (hwnd, wParam, lParam); + + case TTM_SETTITLEW: + return TOOLTIPS_SetTitleW (hwnd, wParam, lParam); + case TTM_SETTOOLINFOA: return TOOLTIPS_SetToolInfoA (hwnd, wParam, lParam); @@ -2568,12 +2737,11 @@ TOOLTIPS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_GETFONT: return TOOLTIPS_GetFont (hwnd, wParam, lParam); - case WM_GETTEXT: - return TOOLTIPS_OnWMGetText (hwnd, wParam, lParam); - - case WM_GETTEXTLENGTH: - return TOOLTIPS_OnWMGetTextLength (hwnd, wParam, lParam); + case WM_GETTEXT: + return TOOLTIPS_OnWMGetText (hwnd, wParam, lParam); + case WM_GETTEXTLENGTH: + return TOOLTIPS_OnWMGetTextLength (hwnd, wParam, lParam); case WM_LBUTTONDOWN: case WM_LBUTTONUP: @@ -2630,11 +2798,22 @@ TOOLTIPS_Register (void) wndClass.lpszClassName = TOOLTIPS_CLASSA; RegisterClassA (&wndClass); + + hTooltipIcons[TTI_NONE] = NULL; + hTooltipIcons[TTI_INFO] = LoadImageW(COMCTL32_hModule, + (LPCWSTR)MAKEINTRESOURCE(IDI_TT_INFO_SM), IMAGE_ICON, 0, 0, 0); + hTooltipIcons[TTI_WARNING] = LoadImageW(COMCTL32_hModule, + (LPCWSTR)MAKEINTRESOURCE(IDI_TT_WARN_SM), IMAGE_ICON, 0, 0, 0); + hTooltipIcons[TTI_ERROR] = LoadImageW(COMCTL32_hModule, + (LPCWSTR)MAKEINTRESOURCE(IDI_TT_ERROR_SM), IMAGE_ICON, 0, 0, 0); } VOID TOOLTIPS_Unregister (void) { + int i; + for (i = 0; i < TTI_ERROR+1; i++) + DeleteObject(hTooltipIcons[i]); UnregisterClassA (TOOLTIPS_CLASSA, NULL); } diff --git a/reactos/lib/comctl32/trackbar.c b/reactos/lib/comctl32/trackbar.c index 01924648d15..c18463caa9d 100644 --- a/reactos/lib/comctl32/trackbar.c +++ b/reactos/lib/comctl32/trackbar.c @@ -112,7 +112,7 @@ static LRESULT notify_hdr(TRACKBAR_INFO *infoPtr, INT code, LPNMHDR pnmh) TRACE("(code=%d)\n", code); pnmh->hwndFrom = infoPtr->hwndSelf; - pnmh->idFrom = GetWindowLongW(infoPtr->hwndSelf, GWL_ID); + pnmh->idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); pnmh->code = code; result = SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)pnmh->idFrom, (LPARAM)pnmh); @@ -563,7 +563,8 @@ TRACKBAR_DrawTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, int flags) static void TRACKBAR_DrawTics (TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle) { - int i, ticFlags = dwStyle & 0x0f; + unsigned int i; + int ticFlags = dwStyle & 0x0f; LOGPEN ticPen = { PS_SOLID, {1, 0}, GetSysColor (COLOR_3DDKSHADOW) }; HPEN hOldPen, hTicPen; @@ -809,7 +810,7 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdcDst) ZeroMemory(&nmcd, sizeof(nmcd)); nmcd.hdr.hwndFrom = infoPtr->hwndSelf; - nmcd.hdr.idFrom = GetWindowLongW (infoPtr->hwndSelf, GWL_ID); + nmcd.hdr.idFrom = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID); nmcd.hdr.code = NM_CUSTOMDRAW; nmcd.hdc = hdc; @@ -1339,7 +1340,7 @@ TRACKBAR_Create (HWND hwnd, LPCREATESTRUCTW lpcs) infoPtr = (TRACKBAR_INFO *)Alloc (sizeof(TRACKBAR_INFO)); if (!infoPtr) return -1; - SetWindowLongW (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* set default values */ infoPtr->hwndSelf = hwnd; @@ -1401,7 +1402,7 @@ TRACKBAR_Destroy (TRACKBAR_INFO *infoPtr) DestroyWindow (infoPtr->hwndToolTip); Free (infoPtr); - SetWindowLongW (infoPtr->hwndSelf, 0, 0); + SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0); return 0; } @@ -1635,7 +1636,7 @@ TRACKBAR_KeyUp (TRACKBAR_INFO *infoPtr, INT nVirtKey, DWORD lKeyData) static LRESULT WINAPI TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - TRACKBAR_INFO *infoPtr = (TRACKBAR_INFO *)GetWindowLongW (hwnd, 0); + TRACKBAR_INFO *infoPtr = (TRACKBAR_INFO *)GetWindowLongPtrW (hwnd, 0); TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hwnd, uMsg, wParam, lParam); @@ -1815,11 +1816,11 @@ void TRACKBAR_Register (void) ZeroMemory (&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS; - wndClass.lpfnWndProc = (WNDPROC)TRACKBAR_WindowProc; + wndClass.lpfnWndProc = TRACKBAR_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(TRACKBAR_INFO *); wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW); - wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); + wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wndClass.lpszClassName = TRACKBAR_CLASSW; RegisterClassW (&wndClass); diff --git a/reactos/lib/comctl32/treeview.c b/reactos/lib/comctl32/treeview.c index da9001d1b68..3a26add59ee 100644 --- a/reactos/lib/comctl32/treeview.c +++ b/reactos/lib/comctl32/treeview.c @@ -225,7 +225,7 @@ static void TREEVIEW_VerifyTree(TREEVIEW_INFO *infoPtr); static TREEVIEW_INFO * TREEVIEW_GetInfoPtr(HWND hwnd) { - return (TREEVIEW_INFO *)GetWindowLongW(hwnd, 0); + return (TREEVIEW_INFO *)GetWindowLongPtrW(hwnd, 0); } /* Don't call this. Nothing wants an item index. */ @@ -458,7 +458,7 @@ TREEVIEW_SendSimpleNotify(TREEVIEW_INFO *infoPtr, UINT code) TRACE("%d\n", code); nmhdr.hwndFrom = hwnd; - nmhdr.idFrom = GetWindowLongW(hwnd, GWL_ID); + nmhdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); nmhdr.code = get_notifycode(infoPtr, code); return (BOOL)TREEVIEW_SendRealNotify(infoPtr, @@ -513,7 +513,7 @@ TREEVIEW_SendTreeviewNotify(TREEVIEW_INFO *infoPtr, UINT code, UINT action, ZeroMemory(&nmhdr, sizeof(NMTREEVIEWA)); nmhdr.hdr.hwndFrom = hwnd; - nmhdr.hdr.idFrom = GetWindowLongW(hwnd, GWL_ID); + nmhdr.hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); nmhdr.hdr.code = get_notifycode(infoPtr, code); nmhdr.action = action; @@ -547,7 +547,7 @@ TREEVIEW_SendTreeviewDnDNotify(TREEVIEW_INFO *infoPtr, UINT code, TRACE("code:%d dragitem:%p\n", code, dragItem); nmhdr.hdr.hwndFrom = hwnd; - nmhdr.hdr.idFrom = GetWindowLongW(hwnd, GWL_ID); + nmhdr.hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); nmhdr.hdr.code = get_notifycode(infoPtr, code); nmhdr.action = 0; nmhdr.itemNew.mask = TVIF_STATE | TVIF_PARAM | TVIF_HANDLE; @@ -576,7 +576,7 @@ TREEVIEW_SendCustomDrawNotify(TREEVIEW_INFO *infoPtr, DWORD dwDrawStage, nmcd = &nmcdhdr.nmcd; nmcd->hdr.hwndFrom = hwnd; - nmcd->hdr.idFrom = GetWindowLongW(hwnd, GWL_ID); + nmcd->hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); nmcd->hdr.code = NM_CUSTOMDRAW; nmcd->dwDrawStage = dwDrawStage; nmcd->hdc = hdc; @@ -620,7 +620,7 @@ TREEVIEW_SendCustomDrawItemNotify(TREEVIEW_INFO *infoPtr, HDC hdc, nmcd = &nmcdhdr.nmcd; nmcd->hdr.hwndFrom = hwnd; - nmcd->hdr.idFrom = GetWindowLongW(hwnd, GWL_ID); + nmcd->hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); nmcd->hdr.code = NM_CUSTOMDRAW; nmcd->dwDrawStage = dwDrawStage; nmcd->hdc = hdc; @@ -653,7 +653,7 @@ TREEVIEW_BeginLabelEditNotify(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *editItem) BOOL ret; tvdi.hdr.hwndFrom = hwnd; - tvdi.hdr.idFrom = GetWindowLongW(hwnd, GWL_ID); + tvdi.hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); tvdi.hdr.code = get_notifycode(infoPtr, TVN_BEGINLABELEDITW); TREEVIEW_TVItemFromItem(infoPtr, TVIF_HANDLE | TVIF_STATE | TVIF_PARAM | TVIF_TEXT, @@ -680,7 +680,7 @@ TREEVIEW_UpdateDispInfo(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem, if (mask == 0) return; callback.hdr.hwndFrom = hwnd; - callback.hdr.idFrom = GetWindowLongW(hwnd, GWL_ID); + callback.hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); callback.hdr.code = get_notifycode(infoPtr, TVN_GETDISPINFOW); /* 'state' always contains valid value, as well as 'lParam'. @@ -3463,7 +3463,7 @@ TREEVIEW_EditLabel(TREEVIEW_INFO *infoPtr, HTREEITEM hItem) HWND hwndEdit; SIZE sz; TREEVIEW_ITEM *editItem = hItem; - HINSTANCE hinst = (HINSTANCE)GetWindowLongW(hwnd, GWL_HINSTANCE); + HINSTANCE hinst = (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE); HDC hdc; HFONT hOldFont=0; TEXTMETRICW textMetric; @@ -3530,8 +3530,8 @@ TREEVIEW_EditLabel(TREEVIEW_INFO *infoPtr, HTREEITEM hItem) SendMessageW(hwndEdit, WM_SETFONT, (WPARAM)TREEVIEW_FontForItem(infoPtr, editItem), FALSE); - infoPtr->wpEditOrig = (WNDPROC)SetWindowLongW(hwndEdit, GWL_WNDPROC, - (DWORD) + infoPtr->wpEditOrig = (WNDPROC)SetWindowLongPtrW(hwndEdit, GWLP_WNDPROC, + (DWORD_PTR) TREEVIEW_Edit_SubclassProc); if (TREEVIEW_BeginLabelEditNotify(infoPtr, editItem)) @@ -3566,7 +3566,7 @@ TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel) return FALSE; tvdi.hdr.hwndFrom = hwnd; - tvdi.hdr.idFrom = GetWindowLongW(hwnd, GWL_ID); + tvdi.hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); tvdi.hdr.code = get_notifycode(infoPtr, TVN_ENDLABELEDITW); tvdi.item.mask = 0; tvdi.item.hItem = editedItem; @@ -4190,7 +4190,7 @@ static INT TREEVIEW_ProcessLetterKeys( if (!hwnd || !charCode || !keyData) return 0; - infoPtr=(TREEVIEW_INFO*)GetWindowLongW(hwnd, 0); + infoPtr=(TREEVIEW_INFO*)GetWindowLongPtrW(hwnd, 0); if (!infoPtr) return 0; @@ -4436,8 +4436,7 @@ TREEVIEW_SetFirstVisible(TREEVIEW_INFO *infoPtr, SetScrollPos(infoPtr->hwnd, SB_VERT, newFirstVisible->visibleOrder, TRUE); - ScrollWindow(infoPtr->hwnd, 0, scroll, NULL, NULL); - UpdateWindow(infoPtr->hwnd); + ScrollWindowEx(infoPtr->hwnd, 0, scroll, NULL, NULL, NULL, NULL, SW_ERASE | SW_INVALIDATE); } } } @@ -4634,6 +4633,7 @@ TREEVIEW_MouseWheel(TREEVIEW_INFO *infoPtr, WPARAM wParam) static LRESULT TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) { + static const WCHAR szDisplayW[] = { 'D','I','S','P','L','A','Y','\0' }; RECT rcClient; TREEVIEW_INFO *infoPtr; @@ -4647,7 +4647,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) return 0; } - SetWindowLongW(hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr); infoPtr->hwnd = hwnd; infoPtr->dwStyle = GetWindowLongW(hwnd, GWL_STYLE); @@ -4737,7 +4737,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) infoPtr->himlState = ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 3, 0); - hdcScreen = CreateDCA("DISPLAY", NULL, NULL, NULL); + hdcScreen = CreateDCW(szDisplayW, NULL, NULL, NULL); /* Create a coloured bitmap compatible with the screen depth because checkboxes are not black&white */ @@ -4785,11 +4785,11 @@ TREEVIEW_Destroy(TREEVIEW_INFO *infoPtr) /* Restore original wndproc */ if (infoPtr->hwndEdit) - SetWindowLongW(infoPtr->hwndEdit, GWL_WNDPROC, - (LONG)infoPtr->wpEditOrig); + SetWindowLongPtrW(infoPtr->hwndEdit, GWLP_WNDPROC, + (DWORD_PTR)infoPtr->wpEditOrig); /* Deassociate treeview from the window before doing anything drastic. */ - SetWindowLongW(infoPtr->hwnd, 0, (LONG)NULL); + SetWindowLongPtrW(infoPtr->hwnd, 0, (DWORD_PTR)NULL); DeleteObject(infoPtr->hBoldFont); Free(infoPtr); diff --git a/reactos/lib/comctl32/updown.c b/reactos/lib/comctl32/updown.c index 2e26d776760..72a5c6c936f 100644 --- a/reactos/lib/comctl32/updown.c +++ b/reactos/lib/comctl32/updown.c @@ -95,7 +95,7 @@ typedef struct #define BUDDY_UPDOWN_HWND "buddyUpDownHWND" #define BUDDY_SUPERCLASS_WNDPROC "buddySupperClassWndProc" -#define UPDOWN_GetInfoPtr(hwnd) ((UPDOWN_INFO *)GetWindowLongA (hwnd,0)) +#define UPDOWN_GetInfoPtr(hwnd) ((UPDOWN_INFO *)GetWindowLongPtrW (hwnd,0)) #define COUNT_OF(a) (sizeof(a)/sizeof(a[0])) static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action); @@ -491,7 +491,7 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud) when we reset the upDown ctrl buddy to another buddy because it is not good to break the window proc chain. */ if (!GetPropA(bud, BUDDY_SUPERCLASS_WNDPROC)) { - baseWndProc = (WNDPROC)SetWindowLongW(bud, GWL_WNDPROC, (LPARAM)UPDOWN_Buddy_SubclassProc); + baseWndProc = (WNDPROC)SetWindowLongPtrW(bud, GWLP_WNDPROC, (LPARAM)UPDOWN_Buddy_SubclassProc); SetPropA(bud, BUDDY_SUPERCLASS_WNDPROC, (HANDLE)baseWndProc); } } @@ -572,7 +572,7 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action) ni.iPos = infoPtr->CurVal; ni.iDelta = delta; ni.hdr.hwndFrom = infoPtr->Self; - ni.hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID); + ni.hdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID); ni.hdr.code = UDN_DELTAPOS; if (!SendMessageW(infoPtr->Notify, WM_NOTIFY, (WPARAM)ni.hdr.idFrom, (LPARAM)&ni)) { /* Parent said: OK to adjust */ @@ -623,7 +623,7 @@ static BOOL UPDOWN_CancelMode (UPDOWN_INFO *infoPtr) if (GetCapture() == infoPtr->Self) { NMHDR hdr; hdr.hwndFrom = infoPtr->Self; - hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID); + hdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID); hdr.code = NM_RELEASEDCAPTURE; SendMessageW(infoPtr->Notify, WM_NOTIFY, hdr.idFrom, (LPARAM)&hdr); ReleaseCapture(); @@ -725,7 +725,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, case WM_CREATE: SetWindowLongW (hwnd, GWL_STYLE, dwStyle & ~WS_BORDER); infoPtr = (UPDOWN_INFO*)Alloc (sizeof(UPDOWN_INFO)); - SetWindowLongW (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize the info struct */ infoPtr->Self = hwnd; @@ -753,7 +753,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, if(infoPtr->Buddy) RemovePropA(infoPtr->Buddy, BUDDY_UPDOWN_HWND); Free (infoPtr); - SetWindowLongW (hwnd, 0, 0); + SetWindowLongPtrW (hwnd, 0, 0); TRACE("UpDown Ctrl destruction, hwnd=%p\n", hwnd); break; @@ -958,11 +958,11 @@ void UPDOWN_Register(void) ZeroMemory( &wndClass, sizeof( WNDCLASSW ) ); wndClass.style = CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW; - wndClass.lpfnWndProc = (WNDPROC)UpDownWindowProc; + wndClass.lpfnWndProc = UpDownWindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(UPDOWN_INFO*); wndClass.hCursor = LoadCursorW( 0, (LPWSTR)IDC_ARROW ); - wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); + wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wndClass.lpszClassName = UPDOWN_CLASSW; RegisterClassW( &wndClass );