Autosyncing with Wine HEAD
authorThe Wine Synchronizer <winesync@svn.reactos.org>
Wed, 25 Apr 2007 08:19:27 +0000 (08:19 +0000)
committerThe Wine Synchronizer <winesync@svn.reactos.org>
Wed, 25 Apr 2007 08:19:27 +0000 (08:19 +0000)
svn path=/trunk/; revision=26492

28 files changed:
reactos/dll/win32/comctl32/animate.c
reactos/dll/win32/comctl32/comboex.c
reactos/dll/win32/comctl32/comctl32_ros.diff
reactos/dll/win32/comctl32/comctl32undoc.c
reactos/dll/win32/comctl32/commctrl.c
reactos/dll/win32/comctl32/datetime.c
reactos/dll/win32/comctl32/header.c
reactos/dll/win32/comctl32/hotkey.c
reactos/dll/win32/comctl32/imagelist.c
reactos/dll/win32/comctl32/imagelist.h
reactos/dll/win32/comctl32/ipaddress.c
reactos/dll/win32/comctl32/listview.c
reactos/dll/win32/comctl32/monthcal.c
reactos/dll/win32/comctl32/pager.c
reactos/dll/win32/comctl32/progress.c
reactos/dll/win32/comctl32/propsheet.c
reactos/dll/win32/comctl32/rebar.c
reactos/dll/win32/comctl32/smoothscroll.c
reactos/dll/win32/comctl32/status.c
reactos/dll/win32/comctl32/string.c
reactos/dll/win32/comctl32/syslink.c
reactos/dll/win32/comctl32/tab.c
reactos/dll/win32/comctl32/theme_combo.c
reactos/dll/win32/comctl32/toolbar.c
reactos/dll/win32/comctl32/tooltips.c
reactos/dll/win32/comctl32/trackbar.c
reactos/dll/win32/comctl32/treeview.c
reactos/dll/win32/comctl32/updown.c

index 5089549..9f9151d 100644 (file)
@@ -93,14 +93,14 @@ typedef struct
 
 #define ANIMATE_COLOR_NONE     0xffffffff
 
-static void ANIMATE_Notify(ANIMATE_INFO *infoPtr, UINT notif)
+static void ANIMATE_Notify(const ANIMATE_INFO *infoPtr, UINT notif)
 {
     SendMessageW(infoPtr->hwndNotify, WM_COMMAND,
                 MAKEWPARAM(GetDlgCtrlID(infoPtr->hwndSelf), notif),
                 (LPARAM)infoPtr->hwndSelf);
 }
 
-static BOOL ANIMATE_LoadResW(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPWSTR lpName)
+static BOOL ANIMATE_LoadResW(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPCWSTR lpName)
 {
     static const WCHAR aviW[] = { 'A', 'V', 'I', 0 };
     HRSRC      hrsrc;
@@ -217,7 +217,7 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
     infoPtr->transparentColor = ANIMATE_COLOR_NONE;
 }
 
-static void ANIMATE_TransparentBlt(ANIMATE_INFO *infoPtr, HDC hdcDest, HDC hdcSource)
+static void ANIMATE_TransparentBlt(ANIMATE_INFO const *infoPtr, HDC hdcDest, HDC hdcSource)
 {
     HDC hdcMask;
     HBITMAP hbmMask;
@@ -251,8 +251,8 @@ static void ANIMATE_TransparentBlt(ANIMATE_INFO *infoPtr, HDC hdcDest, HDC hdcSo
 
 static BOOL ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
 {
-    void *pBitmapData;
-    LPBITMAPINFO pBitmapInfo;
+    void const *pBitmapData;
+    BITMAPINFO const *pBitmapInfo;
     HDC hdcMem;
     HBITMAP hbmOld;
     int nOffsetX = 0;
@@ -772,7 +772,7 @@ static BOOL ANIMATE_Stop(ANIMATE_INFO *infoPtr)
 }
 
 
-static BOOL ANIMATE_Create(HWND hWnd, LPCREATESTRUCTW lpcs)
+static BOOL ANIMATE_Create(HWND hWnd, const CREATESTRUCTW *lpcs)
 {
     static const WCHAR msvfw32W[] = { 'm', 's', 'v', 'f', 'w', '3', '2', '.', 'd', 'l', 'l', 0 };
     ANIMATE_INFO *infoPtr;
@@ -825,7 +825,7 @@ static LRESULT ANIMATE_Destroy(ANIMATE_INFO *infoPtr)
 }
 
 
-static BOOL ANIMATE_EraseBackground(ANIMATE_INFO *infoPtr, HDC hdc)
+static BOOL ANIMATE_EraseBackground(ANIMATE_INFO const *infoPtr, HDC hdc)
 {
     RECT rect;
     HBRUSH hBrush = 0;
@@ -843,7 +843,7 @@ static BOOL ANIMATE_EraseBackground(ANIMATE_INFO *infoPtr, HDC hdc)
 }
 
 
-static LRESULT ANIMATE_StyleChanged(ANIMATE_INFO *infoPtr, WPARAM wStyleType, LPSTYLESTRUCT lpss)
+static LRESULT ANIMATE_StyleChanged(ANIMATE_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
 {
     TRACE("(styletype=%x, styleOld=0x%08x, styleNew=0x%08x)\n",
           wStyleType, lpss->styleOld, lpss->styleNew);
index 58bcb97..64e7b12 100644 (file)
@@ -135,23 +135,23 @@ static LRESULT WINAPI COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam,
 static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr);
 typedef INT (WINAPI *cmp_func_t)(LPCWSTR, LPCWSTR);
 
-inline static BOOL is_textW(LPCWSTR str)
+static inline BOOL is_textW(LPCWSTR str)
 {
     return str && str != LPSTR_TEXTCALLBACKW;
 }
 
-inline static BOOL is_textA(LPCSTR str)
+static inline BOOL is_textA(LPCSTR str)
 {
     return str && str != LPSTR_TEXTCALLBACKA;
 }
 
-inline static LPCSTR debugstr_txt(LPCWSTR str)
+static inline LPCSTR debugstr_txt(LPCWSTR str)
 {
     if (str == LPSTR_TEXTCALLBACKW) return "(callback)";
     return debugstr_w(str);
 }
 
-static void COMBOEX_DumpItem (CBE_ITEMDATA *item)
+static void COMBOEX_DumpItem (CBE_ITEMDATA const *item)
 {
     TRACE("item %p - mask=%08x, pszText=%p, cchTM=%d, iImage=%d\n",
           item, item->mask, item->pszText, item->cchTextMax, item->iImage);
@@ -162,7 +162,7 @@ static void COMBOEX_DumpItem (CBE_ITEMDATA *item)
 }
 
 
-static void COMBOEX_DumpInput (COMBOBOXEXITEMW *input)
+static void COMBOEX_DumpInput (COMBOBOXEXITEMW const *input)
 {
     TRACE("input - mask=%08x, iItem=%d, pszText=%p, cchTM=%d, iImage=%d\n",
           input->mask, input->iItem, input->pszText, input->cchTextMax,
@@ -174,13 +174,13 @@ static void COMBOEX_DumpInput (COMBOBOXEXITEMW *input)
 }
 
 
-inline static CBE_ITEMDATA *get_item_data(COMBOEX_INFO *infoPtr, INT index)
+static inline CBE_ITEMDATA *get_item_data(COMBOEX_INFO *infoPtr, INT index)
 {
     return (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, CB_GETITEMDATA,
                                         (WPARAM)index, 0);
 }
 
-inline static cmp_func_t get_cmp_func(COMBOEX_INFO *infoPtr)
+static inline cmp_func_t get_cmp_func(COMBOEX_INFO const *infoPtr)
 {
     return infoPtr->dwExtStyle & CBES_EX_CASESENSITIVE ? lstrcmpW : lstrcmpiW;
 }
@@ -283,11 +283,11 @@ static void COMBOEX_FreeText (CBE_ITEMDATA *item)
 }
 
 
-static INT COMBOEX_GetIndex(COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
+static INT COMBOEX_GetIndex(COMBOEX_INFO const *infoPtr, CBE_ITEMDATA const *item)
 {
-    CBE_ITEMDATA *moving;
+    CBE_ITEMDATA const *moving;
     INT index;
-    
+
     moving = infoPtr->items;
     index = infoPtr->nb_items - 1;
 
@@ -493,7 +493,7 @@ static CBE_ITEMDATA * COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT index)
 }
 
 
-static inline BOOL COMBOEX_HasEdit(COMBOEX_INFO *infoPtr)
+static inline BOOL COMBOEX_HasEdit(COMBOEX_INFO const *infoPtr)
 {
     return infoPtr->hwndEdit ? TRUE : FALSE;
 }
@@ -530,7 +530,7 @@ static UINT COMBOEX_GetListboxText(COMBOEX_INFO *infoPtr, int n, LPWSTR buf)
 
 static INT COMBOEX_DeleteItem (COMBOEX_INFO *infoPtr, INT index)
 {
-    CBE_ITEMDATA *item;
+    CBE_ITEMDATA const *item;
 
     TRACE("(index=%d)\n", index);
 
@@ -601,14 +601,14 @@ static BOOL COMBOEX_GetItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA *cit)
 }
 
 
-inline static BOOL COMBOEX_HasEditChanged (COMBOEX_INFO *infoPtr)
+static inline BOOL COMBOEX_HasEditChanged (COMBOEX_INFO const *infoPtr)
 {
     return COMBOEX_HasEdit(infoPtr) &&
           (infoPtr->flags & WCBE_EDITHASCHANGED) == WCBE_EDITHASCHANGED;
 }
 
 
-static INT COMBOEX_InsertItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit)
+static INT COMBOEX_InsertItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW const *cit)
 {
     INT index;
     CBE_ITEMDATA *item;
@@ -693,7 +693,7 @@ static INT COMBOEX_InsertItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit)
 }
 
 
-static INT COMBOEX_InsertItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA *cit)
+static INT COMBOEX_InsertItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA const *cit)
 {
     COMBOBOXEXITEMW citW;
     LPWSTR wstr = NULL;
@@ -817,7 +817,7 @@ static BOOL COMBOEX_SetItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit)
     return TRUE;
 }
 
-static BOOL COMBOEX_SetItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA *cit)
+static BOOL COMBOEX_SetItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA const *cit)
 {
     COMBOBOXEXITEMW citW;
     LPWSTR wstr = NULL;
@@ -875,7 +875,8 @@ COMBOEX_FindStringExact (COMBOEX_INFO *infoPtr, INT start, LPCWSTR str)
 
 static DWORD_PTR COMBOEX_GetItemData (COMBOEX_INFO *infoPtr, INT index)
 {
-    CBE_ITEMDATA *item1, *item2;
+    CBE_ITEMDATA const *item1;
+    CBE_ITEMDATA const *item2;
     DWORD_PTR ret = 0;
 
     item1 = get_item_data(infoPtr, index);
@@ -914,7 +915,8 @@ static INT COMBOEX_SetCursel (COMBOEX_INFO *infoPtr, INT index)
 
 static DWORD_PTR COMBOEX_SetItemData (COMBOEX_INFO *infoPtr, INT index, DWORD_PTR data)
 {
-    CBE_ITEMDATA *item1, *item2;
+    CBE_ITEMDATA *item1;
+    CBE_ITEMDATA const *item2;
 
     item1 = get_item_data(infoPtr, index);
     if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) {
@@ -933,7 +935,7 @@ static DWORD_PTR COMBOEX_SetItemData (COMBOEX_INFO *infoPtr, INT index, DWORD_PT
 }
 
 
-static INT COMBOEX_SetItemHeight (COMBOEX_INFO *infoPtr, INT index, UINT height)
+static INT COMBOEX_SetItemHeight (COMBOEX_INFO const *infoPtr, INT index, UINT height)
 {
     RECT cb_wrect, cbx_wrect, cbx_crect;
 
@@ -967,7 +969,7 @@ static INT COMBOEX_SetItemHeight (COMBOEX_INFO *infoPtr, INT index, UINT height)
 /* ***  WM_xxx message support  *** */
 
 
-static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs)
+static LRESULT COMBOEX_Create (HWND hwnd, CREATESTRUCTA const *cs)
 {
     static const WCHAR COMBOBOX[] = { 'C', 'o', 'm', 'b', 'o', 'B', 'o', 'x', 0 };
     static const WCHAR EDIT[] = { 'E', 'D', 'I', 'T', 0 };
@@ -1287,7 +1289,7 @@ static LRESULT COMBOEX_Command (COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lPa
 }
 
 
-static BOOL COMBOEX_WM_DeleteItem (COMBOEX_INFO *infoPtr, DELETEITEMSTRUCT *dis)
+static BOOL COMBOEX_WM_DeleteItem (COMBOEX_INFO *infoPtr, DELETEITEMSTRUCT const *dis)
 {
     CBE_ITEMDATA *item, *olditem;
     NMCOMBOBOXEXW nmcit;
@@ -1333,7 +1335,7 @@ static BOOL COMBOEX_WM_DeleteItem (COMBOEX_INFO *infoPtr, DELETEITEMSTRUCT *dis)
 }
 
 
-static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis)
+static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *dis)
 {
     static const WCHAR nil[] = { 0 };
     CBE_ITEMDATA *item = 0;
@@ -1606,7 +1608,7 @@ static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr)
 }
 
 
-static LRESULT COMBOEX_MeasureItem (COMBOEX_INFO *infoPtr, MEASUREITEMSTRUCT *mis)
+static LRESULT COMBOEX_MeasureItem (COMBOEX_INFO const *infoPtr, MEASUREITEMSTRUCT *mis)
 {
     static const WCHAR strW[] = { 'W', 0 };
     SIZE mysize;
index d4b993e..5809ac4 100644 (file)
@@ -2,7 +2,7 @@ Index: listview.c
 ===================================================================
 --- listview.c (revision 23123)
 +++ listview.c (working copy)
-@@ -3804,9 +3804,8 @@
+@@ -3805,9 +3805,8 @@
      if (himl && lvItem.iImage >= 0 && !IsRectEmpty(&rcIcon))
      {
          TRACE("iImage=%d\n", lvItem.iImage);
@@ -18,7 +18,7 @@ Index: propsheet.c
 ===================================================================
 --- propsheet.c        (revision 25766)
 +++ propsheet.c        (working copy)
-@@ -2429,6 +2429,28 @@
+@@ -2434,6 +2434,28 @@
    return FALSE;
  }
  
@@ -47,7 +47,7 @@ Index: propsheet.c
  /******************************************************************************
   *            PROPSHEET_SetWizButtons
   *
-@@ -2451,17 +2473,6 @@
+@@ -2456,17 +2478,6 @@
    EnableWindow(hwndNext, FALSE);
    EnableWindow(hwndFinish, FALSE);
  
@@ -65,7 +65,7 @@ Index: propsheet.c
    if (dwFlags & PSWIZB_BACK)
      EnableWindow(hwndBack, TRUE);
  
-@@ -2491,6 +2502,32 @@
+@@ -2496,6 +2507,32 @@
    }
    else if (!(dwFlags & PSWIZB_DISABLEDFINISH))
      EnableWindow(hwndFinish, TRUE);
index 7ef2c33..d17436f 100644 (file)
@@ -380,7 +380,7 @@ void WINAPI FreeMRUList (HANDLE hMRUList)
 INT WINAPI FindMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData,
                         LPINT lpRegNum)
 {
-    LPWINEMRULIST mp = (LPWINEMRULIST)hList;
+    const WINEMRULIST *mp = (LPWINEMRULIST)hList;
     INT ret;
     UINT i;
     LPSTR dataA = NULL;
@@ -726,7 +726,7 @@ static HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp)
  *
  * See CreateMRUListLazyA.
  */
-HANDLE WINAPI CreateMRUListLazyW (LPCREATEMRULISTW lpcml, DWORD dwParam2,
+HANDLE WINAPI CreateMRUListLazyW (const CREATEMRULISTW *lpcml, DWORD dwParam2,
                                   DWORD dwParam3, DWORD dwParam4)
 {
     LPWINEMRULIST mp;
@@ -760,7 +760,7 @@ HANDLE WINAPI CreateMRUListLazyW (LPCREATEMRULISTW lpcml, DWORD dwParam2,
  * RETURNS
  *     Handle to MRU list.
  */
-HANDLE WINAPI CreateMRUListLazyA (LPCREATEMRULISTA lpcml, DWORD dwParam2,
+HANDLE WINAPI CreateMRUListLazyA (const CREATEMRULISTA *lpcml, DWORD dwParam2,
                                   DWORD dwParam3, DWORD dwParam4)
 {
     LPWINEMRULIST mp;
@@ -787,7 +787,7 @@ HANDLE WINAPI CreateMRUListLazyA (LPCREATEMRULISTA lpcml, DWORD dwParam2,
  *
  * See CreateMRUListA.
  */
-HANDLE WINAPI CreateMRUListW (LPCREATEMRULISTW lpcml)
+HANDLE WINAPI CreateMRUListW (const CREATEMRULISTW *lpcml)
 {
     return CreateMRUListLazyW(lpcml, 0, 0, 0);
 }
@@ -803,7 +803,7 @@ HANDLE WINAPI CreateMRUListW (LPCREATEMRULISTW lpcml)
  * RETURNS
  *     Handle to MRU list.
  */
-HANDLE WINAPI CreateMRUListA (LPCREATEMRULISTA lpcml)
+HANDLE WINAPI CreateMRUListA (const CREATEMRULISTA *lpcml)
 {
      return CreateMRUListLazyA (lpcml, 0, 0, 0);
 }
@@ -830,8 +830,8 @@ HANDLE WINAPI CreateMRUListA (LPCREATEMRULISTA lpcml)
 INT WINAPI EnumMRUListW (HANDLE hList, INT nItemPos, LPVOID lpBuffer,
                          DWORD nBufferSize)
 {
-    LPWINEMRULIST mp = (LPWINEMRULIST) hList;
-    LPWINEMRUITEM witem;
+    const WINEMRULIST *mp = (LPWINEMRULIST) hList;
+    const WINEMRUITEM *witem;
     INT desired, datasize;
 
     if (nItemPos >= mp->cursize) return -1;
@@ -855,7 +855,7 @@ INT WINAPI EnumMRUListW (HANDLE hList, INT nItemPos, LPVOID lpBuffer,
 INT WINAPI EnumMRUListA (HANDLE hList, INT nItemPos, LPVOID lpBuffer,
                          DWORD nBufferSize)
 {
-    LPWINEMRULIST mp = (LPWINEMRULIST) hList;
+    const WINEMRULIST *mp = (LPWINEMRULIST) hList;
     LPWINEMRUITEM witem;
     INT desired, datasize;
     DWORD lenA;
@@ -1019,7 +1019,7 @@ typedef struct tagNOTIFYDATA
  * DoNotify [Internal]
  */
 
-static LRESULT DoNotify (LPNOTIFYDATA lpNotify, UINT uCode, LPNMHDR lpHdr)
+static LRESULT DoNotify (const NOTIFYDATA *lpNotify, UINT uCode, LPNMHDR lpHdr)
 {
     NMHDR nmhdr;
     LPNMHDR lpNmh = NULL;
index 9cfdc9b..97810b3 100644 (file)
@@ -29,8 +29,6 @@
  *
  * TODO
  *   -- implement GetMUILanguage + InitMUILanguage
- *   -- LibMain => DLLMain ("DLLMain takes over the functionality of both the
- *                           LibMain and the WEP function.", MSDN)
  *   -- finish NOTES for MenuHelp, GetEffectiveClientRect and GetStatusTextW
  *   -- FIXMEs + BUGS (search for them)
  *
@@ -129,13 +127,20 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
            /* Get all the colors at DLL load */
            COMCTL32_RefreshSysColors();
 
-            /* register all Win95 common control classes */
+            /* like comctl32 5.82+ register all the common control classes */
             ANIMATE_Register ();
+            COMBOEX_Register ();
+            DATETIME_Register ();
             FLATSB_Register ();
             HEADER_Register ();
             HOTKEY_Register ();
+            IPADDRESS_Register ();
             LISTVIEW_Register ();
+            MONTHCAL_Register ();
+            NATIVEFONT_Register ();
+            PAGER_Register ();
             PROGRESS_Register ();
+            REBAR_Register ();
             STATUS_Register ();
             SYSLINK_Register ();
             TAB_Register ();
@@ -373,10 +378,10 @@ ShowHideMenuCtl (HWND hwnd, UINT_PTR uFlags, LPINT lpInfo)
  */
 
 VOID WINAPI
-GetEffectiveClientRect (HWND hwnd, LPRECT lpRect, LPINT lpInfo)
+GetEffectiveClientRect (HWND hwnd, LPRECT lpRect, const INT *lpInfo)
 {
     RECT rcCtrl;
-    INT  *lpRun;
+    const INT *lpRun;
     HWND hwndCtrl;
 
     TRACE("(%p %p %p)\n",
@@ -421,7 +426,7 @@ GetEffectiveClientRect (HWND hwnd, LPRECT lpRect, LPINT lpInfo)
  *     (will be written ...)
  */
 
-void WINAPI DrawStatusTextW (HDC hdc, LPRECT lprc, LPCWSTR text, UINT style)
+void WINAPI DrawStatusTextW (HDC hdc, LPCRECT lprc, LPCWSTR text, UINT style)
 {
     RECT r = *lprc;
     UINT border = BDR_SUNKENOUTER;
@@ -470,7 +475,7 @@ void WINAPI DrawStatusTextW (HDC hdc, LPRECT lprc, LPCWSTR text, UINT style)
  *     No return value.
  */
 
-void WINAPI DrawStatusTextA (HDC hdc, LPRECT lprc, LPCSTR text, UINT style)
+void WINAPI DrawStatusTextA (HDC hdc, LPCRECT lprc, LPCSTR text, UINT style)
 {
     INT len;
     LPWSTR textW = NULL;
@@ -593,9 +598,8 @@ CreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy,
  *     No return values.
  *
  * NOTES
- *     This function is just a dummy.
- *     The Win95 controls are registered at the DLL's initialization.
- *     To register other controls InitCommonControlsEx() must be used.
+ *     This function is just a dummy - all the controls are registered at
+ *     the DLL's initialization. See InitCommonContolsEx for details.
  */
 
 VOID WINAPI
@@ -617,81 +621,24 @@ InitCommonControls (void)
  *     Failure: FALSE
  *
  * NOTES
- *     Only the additional common controls are registered by this function.
- *     The Win95 controls are registered at the DLL's initialization.
- *
- * FIXME
- *     implement the following control classes:
- *       ICC_LINK_CLASS
- *       ICC_STANDARD_CLASSES
+ *     Probaly all versions of comctl32 initializes the Win95 controls in DllMain
+ *     during DLL initializaiton. Starting from comctl32 v5.82 all the controls
+ *     are initialized there. We follow this behaviour and this function is just
+ *     a dummy.
+ *
+ *     Note: when writing programs under Windows, if you don't call any function
+ *     from comctl32 the linker may not link this DLL. If InitCommonControlsEx
+ *     was the only comctl32 function you were calling and you remove it you may
+ *     have a false impression that InitCommonControlsEx actually did something.
  */
 
 BOOL WINAPI
 InitCommonControlsEx (const INITCOMMONCONTROLSEX *lpInitCtrls)
 {
-    INT cCount;
-    DWORD dwMask;
-
-    if (!lpInitCtrls)
-       return FALSE;
-    if (lpInitCtrls->dwSize != sizeof(INITCOMMONCONTROLSEX))
-       return FALSE;
+    if (!lpInitCtrls || lpInitCtrls->dwSize != sizeof(INITCOMMONCONTROLSEX))
+        return FALSE;
 
     TRACE("(0x%08x)\n", lpInitCtrls->dwICC);
-
-    for (cCount = 0; cCount < 32; cCount++) {
-       dwMask = 1 << cCount;
-       if (!(lpInitCtrls->dwICC & dwMask))
-           continue;
-
-       switch (lpInitCtrls->dwICC & dwMask) {
-           /* dummy initialization */
-           case ICC_ANIMATE_CLASS:
-           case ICC_BAR_CLASSES:
-           case ICC_LISTVIEW_CLASSES:
-           case ICC_TREEVIEW_CLASSES:
-           case ICC_TAB_CLASSES:
-           case ICC_UPDOWN_CLASS:
-           case ICC_PROGRESS_CLASS:
-           case ICC_HOTKEY_CLASS:
-               break;
-
-           /* advanced classes - not included in Win95 */
-           case ICC_DATE_CLASSES:
-               MONTHCAL_Register ();
-               DATETIME_Register ();
-               break;
-
-           case ICC_USEREX_CLASSES:
-               COMBOEX_Register ();
-               break;
-
-           case ICC_COOL_CLASSES:
-               REBAR_Register ();
-               break;
-
-           case ICC_INTERNET_CLASSES:
-               IPADDRESS_Register ();
-               break;
-
-           case ICC_PAGESCROLLER_CLASS:
-               PAGER_Register ();
-               break;
-
-           case ICC_NATIVEFNTCTL_CLASS:
-               NATIVEFONT_Register ();
-               break;
-
-           case ICC_LINK_CLASS:
-               SYSLINK_Register ();
-               break;
-
-           default:
-               FIXME("Unknown class! dwICC=0x%X\n", dwMask);
-               break;
-       }
-    }
-
     return TRUE;
 }
 
@@ -739,19 +686,21 @@ CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
 
        /* set bitmap and button size */
        /*If CreateToolbarEx receives 0, windows sets default values*/
-       if (dxBitmap <= 0)
+       if (dxBitmap < 0)
            dxBitmap = 16;
-       if (dyBitmap <= 0)
-           dyBitmap = 15;
-       SendMessageW (hwndTB, TB_SETBITMAPSIZE, 0,
-                     MAKELPARAM((WORD)dxBitmap, (WORD)dyBitmap));
+       if (dyBitmap < 0)
+           dyBitmap = 16;
+       if (dxBitmap == 0 || dyBitmap == 0)
+           dxBitmap = dyBitmap = 16;
+       SendMessageW(hwndTB, TB_SETBITMAPSIZE, 0, MAKELPARAM(dxBitmap, dyBitmap));
 
-       if (dxButton <= 0)
-           dxButton = 24;
-       if (dyButton <= 0)
-           dyButton = 22;
-       SendMessageW (hwndTB, TB_SETBUTTONSIZE, 0,
-                     MAKELPARAM((WORD)dxButton, (WORD)dyButton));
+       if (dxButton < 0)
+           dxButton = dxBitmap;
+       if (dyButton < 0)
+           dyButton = dyBitmap;
+       /* TB_SETBUTTONSIZE -> TB_SETBITMAPSIZE bug introduced for Windows compatibility */
+       if (dxButton != 0 && dyButton != 0)
+            SendMessageW(hwndTB, TB_SETBITMAPSIZE, 0, MAKELPARAM(dxButton, dyButton));
 
 
        /* add bitmaps */
@@ -795,7 +744,8 @@ CreateMappedBitmap (HINSTANCE hInstance, INT_PTR idBitmap, UINT wFlags,
 {
     HGLOBAL hglb;
     HRSRC hRsrc;
-    LPBITMAPINFOHEADER lpBitmap, lpBitmapInfo;
+    const BITMAPINFOHEADER *lpBitmap;
+    LPBITMAPINFOHEADER lpBitmapInfo;
     UINT nSize, nColorTableSize, iColor;
     RGBQUAD *pColorTable;
     INT i, iMaps, nWidth, nHeight;
@@ -871,7 +821,7 @@ CreateMappedBitmap (HINSTANCE hInstance, INT_PTR idBitmap, UINT wFlags,
     if (hbm) {
        HDC hdcDst = CreateCompatibleDC (hdcScreen);
        HBITMAP hbmOld = SelectObject (hdcDst, hbm);
-       LPBYTE lpBits = (LPBYTE)(lpBitmap + 1);
+       const BYTE *lpBits = (const BYTE *)(lpBitmap + 1);
        lpBits += nColorTableSize * sizeof(RGBQUAD);
        StretchDIBits (hdcDst, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,
                         lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS,
@@ -1139,8 +1089,8 @@ BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass,
 BOOL WINAPI GetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass,
                               UINT_PTR uID, DWORD_PTR *pdwRef)
 {
-   LPSUBCLASS_INFO stack;
-   LPSUBCLASSPROCS proc;
+   const SUBCLASS_INFO *stack;
+   const SUBCLASSPROCS *proc;
 
    TRACE ("(%p, %p, %x, %p)\n", hWnd, pfnSubclass, uID, pdwRef);
 
@@ -1306,7 +1256,7 @@ LRESULT WINAPI DefSubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
       else
          ret = CallWindowProcA (stack->origproc, hWnd, uMsg, wParam, lParam);
    } else {
-      LPSUBCLASSPROCS proc = stack->stackpos;
+      const SUBCLASSPROCS *proc = stack->stackpos;
       stack->stackpos = stack->stackpos->next; 
       /* call the Subclass procedure from the stack */
       ret = proc->subproc (hWnd, uMsg, wParam, lParam,
@@ -1541,7 +1491,7 @@ static inline int IsDelimiter(WCHAR c)
     return FALSE;
 }
 
-static int CALLBACK PathWordBreakProc(LPWSTR lpch, int ichCurrent, int cch, int code)
+static int CALLBACK PathWordBreakProc(LPCWSTR lpch, int ichCurrent, int cch, int code)
 {
     if (code == WB_ISDELIMITER)
         return IsDelimiter(lpch[ichCurrent]);
index 08e0d58..4cc124d 100644 (file)
@@ -129,15 +129,15 @@ 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 */
 
-static BOOL DATETIME_SendSimpleNotify (DATETIME_INFO *infoPtr, UINT code);
-static BOOL DATETIME_SendDateTimeChangeNotify (DATETIME_INFO *infoPtr);
+static BOOL DATETIME_SendSimpleNotify (const DATETIME_INFO *infoPtr, UINT code);
+static BOOL DATETIME_SendDateTimeChangeNotify (const DATETIME_INFO *infoPtr);
 extern void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to);
 static const WCHAR allowedformatchars[] = {'d', 'h', 'H', 'm', 'M', 's', 't', 'y', 'X', '\'', 0};
 static const int maxrepetition [] = {4,2,2,2,4,2,2,4,-1,-1};
 
 
 static DWORD
-DATETIME_GetSystemTime (DATETIME_INFO *infoPtr, SYSTEMTIME *lprgSysTimeArray)
+DATETIME_GetSystemTime (const DATETIME_INFO *infoPtr, SYSTEMTIME *lprgSysTimeArray)
 {
     if (!lprgSysTimeArray) return GDT_NONE;
 
@@ -152,7 +152,7 @@ DATETIME_GetSystemTime (DATETIME_INFO *infoPtr, SYSTEMTIME *lprgSysTimeArray)
 
 
 static BOOL
-DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, SYSTEMTIME *lprgSysTimeArray)
+DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, const SYSTEMTIME *lprgSysTimeArray)
 {
     if (!lprgSysTimeArray) return 0;
 
@@ -160,26 +160,28 @@ DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, SYSTEMTIME *lprgSysT
           lprgSysTimeArray->wYear, lprgSysTimeArray->wMonth, lprgSysTimeArray->wDay,
           lprgSysTimeArray->wHour, lprgSysTimeArray->wMinute, lprgSysTimeArray->wSecond);
 
-    if (lprgSysTimeArray->wYear < 1601 || lprgSysTimeArray->wYear > 30827 ||
-       lprgSysTimeArray->wMonth < 1 || lprgSysTimeArray->wMonth > 12 ||
-       lprgSysTimeArray->wDayOfWeek > 6 ||
-       lprgSysTimeArray->wDay < 1 || lprgSysTimeArray->wDay > 31 ||
-       lprgSysTimeArray->wHour > 23 ||
-       lprgSysTimeArray->wMinute > 59 ||
-       lprgSysTimeArray->wSecond > 59 ||
-       lprgSysTimeArray->wMilliseconds > 999
-       )
-      return 0;
-
     if (flag == GDT_VALID) {
+      if (lprgSysTimeArray->wYear < 1601 || lprgSysTimeArray->wYear > 30827 ||
+          lprgSysTimeArray->wMonth < 1 || lprgSysTimeArray->wMonth > 12 ||
+          lprgSysTimeArray->wDayOfWeek > 6 ||
+          lprgSysTimeArray->wDay < 1 || lprgSysTimeArray->wDay > 31 ||
+          lprgSysTimeArray->wHour > 23 ||
+          lprgSysTimeArray->wMinute > 59 ||
+          lprgSysTimeArray->wSecond > 59 ||
+          lprgSysTimeArray->wMilliseconds > 999
+          )
+        return 0;
+
         infoPtr->dateValid = TRUE;
         MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date);
         SendMessageW (infoPtr->hMonthCal, MCM_SETCURSEL, 0, (LPARAM)(&infoPtr->date));
         SendMessageW (infoPtr->hwndCheckbut, BM_SETCHECK, BST_CHECKED, 0);
-    } else if (flag == GDT_NONE) {
+    } else if ((infoPtr->dwStyle & DTS_SHOWNONE) && (flag == GDT_NONE)) {
         infoPtr->dateValid = FALSE;
         SendMessageW (infoPtr->hwndCheckbut, BM_SETCHECK, BST_UNCHECKED, 0);
     }
+    else
+        return 0;
 
     InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     return TRUE;
@@ -279,7 +281,7 @@ DATETIME_SetFormatW (DATETIME_INFO *infoPtr, LPCWSTR lpszFormat)
     DATETIME_UseFormat (infoPtr, lpszFormat);
     InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
 
-    return infoPtr->nrFields;
+    return 1;
 }
 
 
@@ -302,7 +304,7 @@ DATETIME_SetFormatA (DATETIME_INFO *infoPtr, LPCSTR lpszFormat)
 
 
 static void
-DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, LPWSTR result, int resultSize)
+DATETIME_ReturnTxt (const DATETIME_INFO *infoPtr, int count, LPWSTR result, int resultSize)
 {
     static const WCHAR fmt_dW[] = { '%', 'd', 0 };
     static const WCHAR fmt__2dW[] = { '%', '.', '2', 'd', 0 };
@@ -523,7 +525,7 @@ DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number, int delta)
 
 
 static void
-DATETIME_ReturnFieldWidth (DATETIME_INFO *infoPtr, HDC hdc, int count, SHORT *fieldWidthPtr)
+DATETIME_ReturnFieldWidth (const DATETIME_INFO *infoPtr, HDC hdc, int count, SHORT *fieldWidthPtr)
 {
     /* fields are a fixed width, determined by the largest possible string */
     /* presumably, these widths should be language dependent */
@@ -675,7 +677,7 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc)
 
 
 static INT
-DATETIME_HitTest (DATETIME_INFO *infoPtr, POINT pt)
+DATETIME_HitTest (const DATETIME_INFO *infoPtr, POINT pt)
 {
     int i;
 
@@ -733,7 +735,7 @@ DATETIME_LButtonDown (DATETIME_INFO *infoPtr, WORD wKey, INT x, INT y)
         if(IsWindowVisible(infoPtr->hMonthCal)) {
             ShowWindow(infoPtr->hMonthCal, SW_HIDE);
         } else {
-            SYSTEMTIME *lprgSysTimeArray = &infoPtr->date;
+            const SYSTEMTIME *lprgSysTimeArray = &infoPtr->date;
             TRACE("update calendar %04d/%02d/%02d\n", 
             lprgSysTimeArray->wYear, lprgSysTimeArray->wMonth, lprgSysTimeArray->wDay);
             SendMessageW(infoPtr->hMonthCal, MCM_SETCURSEL, 0, (LPARAM)(&infoPtr->date));
@@ -814,7 +816,7 @@ DATETIME_Enable (DATETIME_INFO *infoPtr, BOOL bEnable)
 
 
 static LRESULT
-DATETIME_EraseBackground (DATETIME_INFO *infoPtr, HDC hdc)
+DATETIME_EraseBackground (const DATETIME_INFO *infoPtr, HDC hdc)
 {
     HBRUSH hBrush, hSolidBrush = NULL;
     RECT   rc;
@@ -1042,7 +1044,7 @@ DATETIME_KillFocus (DATETIME_INFO *infoPtr, HWND lostFocus)
 
 
 static LRESULT
-DATETIME_NCCreate (HWND hwnd, LPCREATESTRUCTW lpcs)
+DATETIME_NCCreate (HWND hwnd, const CREATESTRUCTW *lpcs)
 {
     DWORD dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
     /* force control to have client edge */
@@ -1070,7 +1072,7 @@ DATETIME_SetFocus (DATETIME_INFO *infoPtr, HWND lostFocus)
 
 
 static BOOL
-DATETIME_SendDateTimeChangeNotify (DATETIME_INFO *infoPtr)
+DATETIME_SendDateTimeChangeNotify (const DATETIME_INFO *infoPtr)
 {
     NMDATETIMECHANGE dtdtc;
 
@@ -1087,7 +1089,7 @@ DATETIME_SendDateTimeChangeNotify (DATETIME_INFO *infoPtr)
 
 
 static BOOL
-DATETIME_SendSimpleNotify (DATETIME_INFO *infoPtr, UINT code)
+DATETIME_SendSimpleNotify (const DATETIME_INFO *infoPtr, UINT code)
 {
     NMHDR nmhdr;
 
@@ -1140,7 +1142,7 @@ DATETIME_Size (DATETIME_INFO *infoPtr, WORD flags, INT width, INT height)
 
 
 static LRESULT 
-DATETIME_StyleChanged(DATETIME_INFO *infoPtr, WPARAM wStyleType, LPSTYLESTRUCT lpss)
+DATETIME_StyleChanged(DATETIME_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
 {
     static const WCHAR buttonW[] = { 'b', 'u', 't', 't', 'o', 'n', 0 };
 
@@ -1185,7 +1187,7 @@ DATETIME_SetFont (DATETIME_INFO *infoPtr, HFONT font, BOOL repaint)
 
 
 static LRESULT
-DATETIME_Create (HWND hwnd, LPCREATESTRUCTW lpcs)
+DATETIME_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
 {
     static const WCHAR SysMonthCal32W[] = { 'S', 'y', 's', 'M', 'o', 'n', 't', 'h', 'C', 'a', 'l', '3', '2', 0 };
     DATETIME_INFO *infoPtr = (DATETIME_INFO *)Alloc (sizeof(DATETIME_INFO));
index 4907fdf..b80ef74 100644 (file)
@@ -108,12 +108,12 @@ typedef struct
 static BOOL HEADER_PrepareCallbackItems(HWND hwnd, INT iItem, INT reqMask);
 static void HEADER_FreeCallbackItems(HEADER_ITEM *lpItem);
 static LRESULT HEADER_SendNotify(HWND hwnd, UINT code, NMHDR *hdr);
-static LRESULT HEADER_SendCtrlCustomDraw(HWND hwnd, DWORD dwDrawStage, HDC hdc, RECT *rect);
+static LRESULT HEADER_SendCtrlCustomDraw(HWND hwnd, DWORD dwDrawStage, HDC hdc, const RECT *rect);
 
 static const WCHAR themeClass[] = {'H','e','a','d','e','r',0};
 static WCHAR emptyString[] = {0};
 
-static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, UINT mask, HDITEMW *phdi, BOOL fUnicode)
+static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, UINT mask, const HDITEMW *phdi, BOOL fUnicode)
 {
     if (mask & HDI_UNSUPPORTED_FIELDS)
         FIXME("unsupported header fields %x\n", (mask & HDI_UNSUPPORTED_FIELDS));
@@ -161,7 +161,7 @@ static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, UINT mask, HDITEMW *
     }
 }
 
-inline static LRESULT
+static inline LRESULT
 HEADER_IndexToOrder (HWND hwnd, INT iItem)
 {
     HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
@@ -182,7 +182,7 @@ HEADER_OrderToIndex(HWND hwnd, WPARAM wParam)
 }
 
 static void
-HEADER_ChangeItemOrder(HEADER_INFO *infoPtr, INT iItem, INT iNewOrder)
+HEADER_ChangeItemOrder(const HEADER_INFO *infoPtr, INT iItem, INT iNewOrder)
 {
     HEADER_ITEM *lpItem = &infoPtr->items[iItem];
     INT i, nMin, nMax;
@@ -257,7 +257,7 @@ HEADER_Size (HWND hwnd, WPARAM wParam)
     return 0;
 }
 
-static void HEADER_GetHotDividerRect(HWND hwnd, HEADER_INFO *infoPtr, RECT *r)
+static void HEADER_GetHotDividerRect(HWND hwnd, const HEADER_INFO *infoPtr, RECT *r)
 {
     INT iDivider = infoPtr->iHotDivider;
     if (infoPtr->uNumItem > 0)
@@ -588,7 +588,7 @@ HEADER_RefreshItem (HWND hwnd, HDC hdc, INT iItem)
 
 
 static void
-HEADER_InternalHitTest (HWND hwnd, LPPOINT lpPt, UINT *pFlags, INT *pItem)
+HEADER_InternalHitTest (HWND hwnd, const POINT *lpPt, UINT *pFlags, INT *pItem)
 {
     HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     RECT rect, rcTest;
@@ -740,8 +740,8 @@ HEADER_DrawTrackLine (HWND hwnd, HDC hdc, INT x)
  * 
  * NOTE: We depend on HDITEMA and HDITEMW having the same structure
  */
-static void HEADER_CopyHDItemForNotify(HEADER_INFO *infoPtr, HDITEMW *dest,
-    HDITEMW *src, BOOL fSourceUnicode, LPVOID *ppvScratch)
+static void HEADER_CopyHDItemForNotify(const HEADER_INFO *infoPtr, HDITEMW *dest,
+    const HDITEMW *src, BOOL fSourceUnicode, LPVOID *ppvScratch)
 {
     *ppvScratch = NULL;
     *dest = *src;
@@ -794,7 +794,7 @@ HEADER_SendSimpleNotify (HWND hwnd, UINT code)
 }
 
 static LRESULT
-HEADER_SendCtrlCustomDraw(HWND hwnd, DWORD dwDrawStage, HDC hdc, RECT *rect)
+HEADER_SendCtrlCustomDraw(HWND hwnd, DWORD dwDrawStage, HDC hdc, const RECT *rect)
 {
     NMCUSTOMDRAW nm;
     nm.dwDrawStage = dwDrawStage;
@@ -979,6 +979,7 @@ HEADER_CreateDragImage (HWND hwnd, WPARAM wParam)
     HDC hMemoryDC;
     HDC hDeviceDC;
     int height, width;
+    HFONT hFont;
     
     if (wParam < 0 || wParam >= infoPtr->uNumItem)
         return FALSE;
@@ -996,6 +997,8 @@ HEADER_CreateDragImage (HWND hwnd, WPARAM wParam)
     ReleaseDC(NULL, hDeviceDC);
     hOldBitmap = SelectObject(hMemoryDC, hMemory);
     SetViewportOrgEx(hMemoryDC, -lpItem->rect.left, -lpItem->rect.top, NULL);
+    hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject(SYSTEM_FONT);
+    SelectObject(hMemoryDC, hFont);
 
     GetClientRect(hwnd, &rc);
     lCDFlags = HEADER_SendCtrlCustomDraw(hwnd, CDDS_PREPAINT, hMemoryDC, &rc);
@@ -1178,7 +1181,7 @@ HEADER_GetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 HEADER_GetItemCount (HWND hwnd)
 {
     HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
@@ -1239,7 +1242,7 @@ HEADER_SetOrderArray(HWND hwnd, WPARAM wParam, LPARAM lParam)
     return TRUE;
 }
 
-inline static LRESULT
+static inline LRESULT
 HEADER_GetUnicodeFormat (HWND hwnd)
 {
     HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
@@ -1262,7 +1265,7 @@ HEADER_HitTest (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-HEADER_InsertItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
+HEADER_InsertItemT (HWND hwnd, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
 {
     HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HEADER_ITEM *lpItem;
@@ -1394,7 +1397,7 @@ HEADER_SetBitmapMargin(HWND hwnd, WPARAM wParam)
 }
 
 static LRESULT
-HEADER_SetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
+HEADER_SetItemT (HWND hwnd, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
 {
     HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HEADER_ITEM *lpItem;
@@ -1432,7 +1435,7 @@ HEADER_SetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
     return TRUE;
 }
 
-inline static LRESULT
+static inline LRESULT
 HEADER_SetUnicodeFormat (HWND hwnd, WPARAM wParam)
 {
     HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
@@ -1532,7 +1535,7 @@ HEADER_GetFont (HWND hwnd)
 
 
 static BOOL
-HEADER_IsDragDistance(HEADER_INFO *infoPtr, POINT *pt)
+HEADER_IsDragDistance(const HEADER_INFO *infoPtr, const POINT *pt)
 {
     /* Windows allows for a mouse movement before starting the drag. We use the
      * SM_CXDOUBLECLICK/SM_CYDOUBLECLICK as that distance.
index aa6ca4c..a24a678 100644 (file)
@@ -63,7 +63,7 @@ static LRESULT HOTKEY_SetFont (HOTKEY_INFO *infoPtr, HFONT hFont, BOOL redraw);
 #define IsOnlySet(flags) (infoPtr->CurrMod == (flags))
 
 static BOOL
-HOTKEY_IsCombInv(HOTKEY_INFO *infoPtr)
+HOTKEY_IsCombInv(const HOTKEY_INFO *infoPtr)
 {
     TRACE("(infoPtr=%p)\n", infoPtr);
     if((infoPtr->InvComb & HKCOMB_NONE) && !infoPtr->CurrMod)
@@ -197,7 +197,7 @@ HOTKEY_Paint(HOTKEY_INFO *infoPtr, HDC hdc)
 }
 
 static LRESULT
-HOTKEY_GetHotKey(HOTKEY_INFO *infoPtr)
+HOTKEY_GetHotKey(const HOTKEY_INFO *infoPtr)
 {
     TRACE("(infoPtr=%p) Modifiers: 0x%x, Virtual Key: %d\n", infoPtr, 
           HIBYTE(infoPtr->HotKey), LOBYTE(infoPtr->HotKey));
@@ -226,7 +226,7 @@ HOTKEY_SetRules(HOTKEY_INFO *infoPtr, WORD invComb, WORD invMod)
 
 
 static LRESULT
-HOTKEY_Create (HOTKEY_INFO *infoPtr, LPCREATESTRUCTW lpcs)
+HOTKEY_Create (HOTKEY_INFO *infoPtr, const CREATESTRUCTW *lpcs)
 {
     infoPtr->hwndNotify = lpcs->hwndParent;
 
@@ -248,7 +248,7 @@ HOTKEY_Destroy (HOTKEY_INFO *infoPtr)
 
 
 static LRESULT
-HOTKEY_EraseBackground (HOTKEY_INFO *infoPtr, HDC hdc)
+HOTKEY_EraseBackground (const HOTKEY_INFO *infoPtr, HDC hdc)
 {
     HBRUSH hBrush, hSolidBrush = NULL;
     RECT   rc;
@@ -274,8 +274,8 @@ HOTKEY_EraseBackground (HOTKEY_INFO *infoPtr, HDC hdc)
 }
 
 
-inline static LRESULT
-HOTKEY_GetFont (HOTKEY_INFO *infoPtr)
+static inline LRESULT
+HOTKEY_GetFont (const HOTKEY_INFO *infoPtr)
 {
     return (LRESULT)infoPtr->hFont;
 }
@@ -393,7 +393,7 @@ HOTKEY_KillFocus (HOTKEY_INFO *infoPtr, HWND receiveFocus)
 
 
 static LRESULT
-HOTKEY_LButtonDown (HOTKEY_INFO *infoPtr)
+HOTKEY_LButtonDown (const HOTKEY_INFO *infoPtr)
 {
     if (!(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & WS_DISABLED))
         SetFocus (infoPtr->hwndSelf);
@@ -402,8 +402,8 @@ HOTKEY_LButtonDown (HOTKEY_INFO *infoPtr)
 }
 
 
-inline static LRESULT
-HOTKEY_NCCreate (HWND hwnd, LPCREATESTRUCTW lpcs)
+static inline LRESULT
+HOTKEY_NCCreate (HWND hwnd, const CREATESTRUCTW *lpcs)
 {
     HOTKEY_INFO *infoPtr;
     DWORD dwExStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);
index 0e314dd..0c23d19 100644 (file)
@@ -608,7 +608,7 @@ ImageList_Create (INT cx, INT cy, UINT flags,
     himl->cx        = cx;
     himl->cy        = cy;
     himl->flags     = flags;
-    himl->cMaxImage = cInitial + cGrow;
+    himl->cMaxImage = cInitial + 1;
     himl->cInitial  = cInitial;
     himl->cGrow     = cGrow;
     himl->clrFg     = CLR_DEFAULT;
@@ -2037,14 +2037,15 @@ HIMAGELIST WINAPI ImageList_Read (LPSTREAM pstm)
  * RETURNS
  *     Success: TRUE
  *     Failure: FALSE
+ *
+ * FIXME: as the image list storage test shows, native comctl32 simply shifts
+ * images without creating a new bitmap.
  */
-
 BOOL WINAPI
 ImageList_Remove (HIMAGELIST himl, INT i)
 {
     HBITMAP hbmNewImage, hbmNewMask;
     HDC     hdcBmp;
-    INT     nCount;
     SIZE    sz;
 
     TRACE("(himl=%p i=%d)\n", himl, i);
@@ -2060,6 +2061,8 @@ ImageList_Remove (HIMAGELIST himl, INT i)
     }
 
     if (i == -1) {
+        INT nCount;
+
         /* remove all */
        if (himl->cCurImage == 0) {
            /* remove all on empty ImageList is allowed */
@@ -2067,7 +2070,7 @@ ImageList_Remove (HIMAGELIST himl, INT i)
            return TRUE;
        }
 
-        himl->cMaxImage = himl->cInitial + himl->cGrow;
+        himl->cMaxImage = himl->cInitial + himl->cGrow - 1;
         himl->cCurImage = 0;
         for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++)
              himl->nOvlIdx[nCount] = -1;
@@ -2091,16 +2094,12 @@ ImageList_Remove (HIMAGELIST himl, INT i)
         TRACE("Remove single image! %d\n", i);
 
         /* create new bitmap(s) */
-        nCount = (himl->cCurImage + himl->cGrow - 1);
-
         TRACE(" - Number of images: %d / %d (Old/New)\n",
                  himl->cCurImage, himl->cCurImage - 1);
-        TRACE(" - Max. number of images: %d / %d (Old/New)\n",
-                 himl->cMaxImage, himl->cCurImage + himl->cGrow - 1);
 
-        hbmNewImage = ImageList_CreateImage(himl->hdcImage, himl, nCount, himl->cx);
+        hbmNewImage = ImageList_CreateImage(himl->hdcImage, himl, himl->cMaxImage, himl->cx);
 
-        imagelist_get_bitmap_size(himl, nCount, himl->cx, &sz );
+        imagelist_get_bitmap_size(himl, himl->cMaxImage, himl->cx, &sz );
         if (himl->hbmMask)
             hbmNewMask = CreateBitmap (sz.cx, sz.cy, 1, 1, NULL);
         else
@@ -2126,13 +2125,13 @@ ImageList_Remove (HIMAGELIST himl, INT i)
             TRACE("Post image copy!\n");
 
             SelectObject (hdcBmp, hbmNewImage);
-            imagelist_copy_images( himl, himl->hdcImage, hdcBmp, i,
-                                   (himl->cCurImage - i - 1), i - 1 );
+            imagelist_copy_images( himl, himl->hdcImage, hdcBmp, i + 1,
+                                   (himl->cCurImage - i), i );
 
             if (himl->hbmMask) {
                 SelectObject (hdcBmp, hbmNewMask);
-                imagelist_copy_images( himl, himl->hdcMask, hdcBmp, i,
-                                       (himl->cCurImage - i - 1), i - 1 );
+                imagelist_copy_images( himl, himl->hdcMask, hdcBmp, i + 1,
+                                       (himl->cCurImage - i), i );
             }
         }
 
@@ -2149,7 +2148,6 @@ ImageList_Remove (HIMAGELIST himl, INT i)
         }
 
         himl->cCurImage--;
-        himl->cMaxImage = himl->cCurImage + himl->cGrow;
     }
 
     return TRUE;
@@ -2515,7 +2513,7 @@ ImageList_SetIconSize (HIMAGELIST himl, INT cx, INT cy)
        return FALSE;
 
     /* remove all images */
-    himl->cMaxImage = himl->cInitial + himl->cGrow;
+    himl->cMaxImage = himl->cInitial + 1;
     himl->cCurImage = 0;
     himl->cx        = cx;
     himl->cy        = cy;
@@ -2690,7 +2688,7 @@ _write_bitmap(HBITMAP hBitmap, LPSTREAM pstm)
 
     /* setup BITMAPFILEHEADER */
     bmfh->bfType      = (('M' << 8) | 'B');
-    bmfh->bfSize      = 0;
+    bmfh->bfSize      = offBits;
     bmfh->bfReserved1 = 0;
     bmfh->bfReserved2 = 0;
     bmfh->bfOffBits   = offBits;
index a3c0b1e..cd72f38 100644 (file)
@@ -27,8 +27,6 @@
 #include "winbase.h"
 #include "wingdi.h"
 
-#include "pshpack1.h"
-
 /* the ones with offsets at the end are the same as in Windows */
 struct _IMAGELIST
 {
@@ -60,6 +58,7 @@ struct _IMAGELIST
 #define IMAGELIST_MAGIC 0x53414D58
 
 /* Header used by ImageList_Read() and ImageList_Write() */
+#include "pshpack2.h"
 typedef struct _ILHEAD
 {
     USHORT     usMagic;
@@ -73,6 +72,6 @@ typedef struct _ILHEAD
     WORD       flags;
     SHORT      ovls[4];
 } ILHEAD;
-
 #include "poppack.h"
+
 #endif  /* __WINE_IMAGELIST_H */
index 0ccb347..36682ae 100644 (file)
@@ -77,7 +77,7 @@ static const WCHAR IP_SUBCLASS_PROP[] =
 static LRESULT CALLBACK
 IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 
-static LRESULT IPADDRESS_Notify (IPADDRESS_INFO *infoPtr, UINT command)
+static LRESULT IPADDRESS_Notify (const IPADDRESS_INFO *infoPtr, UINT command)
 {
     HWND hwnd = infoPtr->Self;
 
@@ -87,7 +87,7 @@ static LRESULT IPADDRESS_Notify (IPADDRESS_INFO *infoPtr, UINT command)
              MAKEWPARAM (GetWindowLongPtrW (hwnd, GWLP_ID), command), (LPARAM)hwnd);
 }
 
-static INT IPADDRESS_IPNotify (IPADDRESS_INFO *infoPtr, INT field, INT value)
+static INT IPADDRESS_IPNotify (const IPADDRESS_INFO *infoPtr, INT field, INT value)
 {
     NMIPADDRESS nmip;
 
@@ -109,7 +109,7 @@ static INT IPADDRESS_IPNotify (IPADDRESS_INFO *infoPtr, INT field, INT value)
 }
 
 
-static int IPADDRESS_GetPartIndex(IPADDRESS_INFO *infoPtr, HWND hwnd)
+static int IPADDRESS_GetPartIndex(const IPADDRESS_INFO *infoPtr, HWND hwnd)
 {
     int i;
 
@@ -123,7 +123,7 @@ static int IPADDRESS_GetPartIndex(IPADDRESS_INFO *infoPtr, HWND hwnd)
 }
 
 
-static LRESULT IPADDRESS_Draw (IPADDRESS_INFO *infoPtr, HDC hdc)
+static LRESULT IPADDRESS_Draw (const IPADDRESS_INFO *infoPtr, HDC hdc)
 {
     static const WCHAR dotW[] = { '.', 0 };
     RECT rect, rcPart;
@@ -165,7 +165,7 @@ static LRESULT IPADDRESS_Draw (IPADDRESS_INFO *infoPtr, HDC hdc)
 }
 
 
-static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate)
+static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate)
 {
     static const WCHAR EDIT[] = { 'E', 'd', 'i', 't', 0 };
     IPADDRESS_INFO *infoPtr;
@@ -246,7 +246,7 @@ static LRESULT IPADDRESS_Enable (IPADDRESS_INFO *infoPtr, BOOL enabled)
 }
 
 
-static LRESULT IPADDRESS_Paint (IPADDRESS_INFO *infoPtr, HDC hdc)
+static LRESULT IPADDRESS_Paint (const IPADDRESS_INFO *infoPtr, HDC hdc)
 {
     PAINTSTRUCT ps;
 
@@ -261,7 +261,7 @@ static LRESULT IPADDRESS_Paint (IPADDRESS_INFO *infoPtr, HDC hdc)
 }
 
 
-static BOOL IPADDRESS_IsBlank (IPADDRESS_INFO *infoPtr)
+static BOOL IPADDRESS_IsBlank (const IPADDRESS_INFO *infoPtr)
 {
     int i;
 
@@ -274,7 +274,7 @@ static BOOL IPADDRESS_IsBlank (IPADDRESS_INFO *infoPtr)
 }
 
 
-static int IPADDRESS_GetAddress (IPADDRESS_INFO *infoPtr, LPDWORD ip_address)
+static int IPADDRESS_GetAddress (const IPADDRESS_INFO *infoPtr, LPDWORD ip_address)
 {
     WCHAR field[5];
     int i, invalid = 0;
@@ -308,7 +308,7 @@ static BOOL IPADDRESS_SetRange (IPADDRESS_INFO *infoPtr, int index, WORD range)
 }
 
 
-static void IPADDRESS_ClearAddress (IPADDRESS_INFO *infoPtr)
+static void IPADDRESS_ClearAddress (const IPADDRESS_INFO *infoPtr)
 {
     WCHAR nil[1] = { 0 };
     int i;
@@ -320,7 +320,7 @@ static void IPADDRESS_ClearAddress (IPADDRESS_INFO *infoPtr)
 }
 
 
-static LRESULT IPADDRESS_SetAddress (IPADDRESS_INFO *infoPtr, DWORD ip_address)
+static LRESULT IPADDRESS_SetAddress (const IPADDRESS_INFO *infoPtr, DWORD ip_address)
 {
     WCHAR buf[20];
     static const WCHAR fmt[] = { '%', 'd', 0 };
@@ -329,7 +329,7 @@ static LRESULT IPADDRESS_SetAddress (IPADDRESS_INFO *infoPtr, DWORD ip_address)
     TRACE("\n");
 
     for (i = 3; i >= 0; i--) {
-       IPPART_INFO* part = &infoPtr->Part[i];
+       const IPPART_INFO* part = &infoPtr->Part[i];
         int value = ip_address & 0xff;
        if ( (value >= part->LowerLimit) && (value <= part->UpperLimit) ) {
            wsprintfW (buf, fmt, value);
@@ -343,7 +343,7 @@ static LRESULT IPADDRESS_SetAddress (IPADDRESS_INFO *infoPtr, DWORD ip_address)
 }
 
 
-static void IPADDRESS_SetFocusToField (IPADDRESS_INFO *infoPtr, INT index)
+static void IPADDRESS_SetFocusToField (const IPADDRESS_INFO *infoPtr, INT index)
 {
     TRACE("(index=%d)\n", index);
 
@@ -353,9 +353,9 @@ static void IPADDRESS_SetFocusToField (IPADDRESS_INFO *infoPtr, INT index)
 }
 
 
-static BOOL IPADDRESS_ConstrainField (IPADDRESS_INFO *infoPtr, int currentfield)
+static BOOL IPADDRESS_ConstrainField (const IPADDRESS_INFO *infoPtr, int currentfield)
 {
-    IPPART_INFO *part = &infoPtr->Part[currentfield];
+    const IPPART_INFO *part = &infoPtr->Part[currentfield];
     WCHAR field[10];
     static const WCHAR fmt[] = { '%', 'd', 0 };
     int curValue, newValue;
@@ -383,7 +383,7 @@ static BOOL IPADDRESS_ConstrainField (IPADDRESS_INFO *infoPtr, int currentfield)
 }
 
 
-static BOOL IPADDRESS_GotoNextField (IPADDRESS_INFO *infoPtr, int cur, int sel)
+static BOOL IPADDRESS_GotoNextField (const IPADDRESS_INFO *infoPtr, int cur, int sel)
 {
     TRACE("\n");
 
@@ -391,7 +391,7 @@ static BOOL IPADDRESS_GotoNextField (IPADDRESS_INFO *infoPtr, int cur, int sel)
        IPADDRESS_ConstrainField(infoPtr, cur);
 
        if(cur < 3) {
-           IPPART_INFO *next = &infoPtr->Part[cur + 1];
+           const IPPART_INFO *next = &infoPtr->Part[cur + 1];
            int start = 0, end = 0;
             SetFocus (next->EditHwnd);
            if (sel != POS_DEFAULT) {
index a80c518..3aa2bca 100644 (file)
@@ -411,33 +411,33 @@ static const WCHAR themeClass[] = {'L','i','s','t','V','i','e','w',0};
 /*
  * forward declarations
  */
-static BOOL LISTVIEW_GetItemT(LISTVIEW_INFO *, LPLVITEMW, BOOL);
-static void LISTVIEW_GetItemBox(LISTVIEW_INFO *, INT, LPRECT);
-static void LISTVIEW_GetItemOrigin(LISTVIEW_INFO *, INT, LPPOINT);
-static BOOL LISTVIEW_GetItemPosition(LISTVIEW_INFO *, INT, LPPOINT);
-static BOOL LISTVIEW_GetItemRect(LISTVIEW_INFO *, INT, LPRECT);
-static INT LISTVIEW_GetLabelWidth(LISTVIEW_INFO *, INT);
-static void LISTVIEW_GetOrigin(LISTVIEW_INFO *, LPPOINT);
-static BOOL LISTVIEW_GetViewRect(LISTVIEW_INFO *, LPRECT);
+static BOOL LISTVIEW_GetItemT(const LISTVIEW_INFO *, LPLVITEMW, BOOL);
+static void LISTVIEW_GetItemBox(const LISTVIEW_INFO *, INT, LPRECT);
+static void LISTVIEW_GetItemOrigin(const LISTVIEW_INFO *, INT, LPPOINT);
+static BOOL LISTVIEW_GetItemPosition(const LISTVIEW_INFO *, INT, LPPOINT);
+static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *, INT, LPRECT);
+static INT LISTVIEW_GetLabelWidth(const LISTVIEW_INFO *, INT);
+static void LISTVIEW_GetOrigin(const LISTVIEW_INFO *, LPPOINT);
+static BOOL LISTVIEW_GetViewRect(const LISTVIEW_INFO *, LPRECT);
 static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *, INT);
-static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *, const LVITEMW *, BOOL);
-static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *);
+static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *, LVITEMW *, BOOL);
+static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *);
 static void LISTVIEW_SetSelection(LISTVIEW_INFO *, INT);
 static void LISTVIEW_UpdateSize(LISTVIEW_INFO *);
 static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *, INT, BOOL);
-static LRESULT LISTVIEW_Command(LISTVIEW_INFO *, WPARAM, LPARAM);
+static LRESULT LISTVIEW_Command(const LISTVIEW_INFO *, WPARAM, LPARAM);
 static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *, PFNLVCOMPARE, LPARAM);
-static INT LISTVIEW_GetStringWidthT(LISTVIEW_INFO *, LPCWSTR, BOOL);
+static INT LISTVIEW_GetStringWidthT(const LISTVIEW_INFO *, LPCWSTR, BOOL);
 static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *, INT);
-static UINT LISTVIEW_GetItemState(LISTVIEW_INFO *, INT, UINT);
+static UINT LISTVIEW_GetItemState(const LISTVIEW_INFO *, INT, UINT);
 static BOOL LISTVIEW_SetItemState(LISTVIEW_INFO *, INT, const LVITEMW *);
 static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *, INT, INT, HWND);
 static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *, INT, INT, HWND);
-static INT LISTVIEW_GetTopIndex(LISTVIEW_INFO *);
+static INT LISTVIEW_GetTopIndex(const LISTVIEW_INFO *);
 static BOOL LISTVIEW_EnsureVisible(LISTVIEW_INFO *, INT, BOOL);
 static HWND CreateEditLabelT(LISTVIEW_INFO *, LPCWSTR, DWORD, INT, INT, INT, INT, BOOL);
 static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *, INT, HIMAGELIST);
-static INT LISTVIEW_HitTest(LISTVIEW_INFO *, LPLVHITTESTINFO, BOOL, BOOL);
+static INT LISTVIEW_HitTest(const LISTVIEW_INFO *, LPLVHITTESTINFO, BOOL, BOOL);
 
 /******** Text handling functions *************************************/
 
@@ -499,7 +499,7 @@ static inline void textfreeT(LPWSTR wstr, BOOL isW)
  * dest is a pointer to a Unicode string
  * src is a pointer to a string (Unicode if isW, ANSI if !isW)
  */
-static BOOL textsetptrT(LPWSTR *dest, LPWSTR src, BOOL isW)
+static BOOL textsetptrT(LPWSTR *dest, LPCWSTR src, BOOL isW)
 {
     BOOL bResult = TRUE;
     
@@ -720,13 +720,13 @@ static inline LPCSTR debugscrollcode(int nScrollCode)
 
 /******** Notification functions i************************************/
 
-static LRESULT notify_forward_header(LISTVIEW_INFO *infoPtr, const NMHEADERW *lpnmh)
+static LRESULT notify_forward_header(const LISTVIEW_INFO *infoPtr, const NMHEADERW *lpnmh)
 {
     return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY,
                         (WPARAM)lpnmh->hdr.idFrom, (LPARAM)lpnmh);
 }
 
-static LRESULT notify_hdr(LISTVIEW_INFO *infoPtr, INT code, LPNMHDR pnmh)
+static LRESULT notify_hdr(const LISTVIEW_INFO *infoPtr, INT code, LPNMHDR pnmh)
 {
     LRESULT result;
     
@@ -743,7 +743,7 @@ static LRESULT notify_hdr(LISTVIEW_INFO *infoPtr, INT code, LPNMHDR pnmh)
     return result;
 }
 
-static inline BOOL notify(LISTVIEW_INFO *infoPtr, INT code)
+static inline BOOL notify(const LISTVIEW_INFO *infoPtr, INT code)
 {
     NMHDR nmh;
     HWND hwnd = infoPtr->hwndSelf;
@@ -751,7 +751,7 @@ static inline BOOL notify(LISTVIEW_INFO *infoPtr, INT code)
     return IsWindow(hwnd);
 }
 
-static inline void notify_itemactivate(LISTVIEW_INFO *infoPtr, LVHITTESTINFO *htInfo)
+static inline void notify_itemactivate(const LISTVIEW_INFO *infoPtr, const LVHITTESTINFO *htInfo)
 {
     NMITEMACTIVATE nmia;
     LVITEMW item;
@@ -783,13 +783,13 @@ static inline void notify_itemactivate(LISTVIEW_INFO *infoPtr, LVHITTESTINFO *ht
     notify_hdr(infoPtr, LVN_ITEMACTIVATE, (LPNMHDR)&nmia);
 }
 
-static inline LRESULT notify_listview(LISTVIEW_INFO *infoPtr, INT code, LPNMLISTVIEW plvnm)
+static inline LRESULT notify_listview(const LISTVIEW_INFO *infoPtr, INT code, LPNMLISTVIEW plvnm)
 {
     TRACE("(code=%d, plvnm=%s)\n", code, debugnmlistview(plvnm));
     return notify_hdr(infoPtr, code, (LPNMHDR)plvnm);
 }
 
-static BOOL notify_click(LISTVIEW_INFO *infoPtr,  INT code, LVHITTESTINFO *lvht)
+static BOOL notify_click(const LISTVIEW_INFO *infoPtr, INT code, const LVHITTESTINFO *lvht)
 {
     NMLISTVIEW nmlv;
     LVITEMW item;
@@ -808,7 +808,7 @@ static BOOL notify_click(LISTVIEW_INFO *infoPtr,  INT code, LVHITTESTINFO *lvht)
     return IsWindow(hwnd);
 }
 
-static BOOL notify_deleteitem(LISTVIEW_INFO *infoPtr, INT nItem)
+static BOOL notify_deleteitem(const LISTVIEW_INFO *infoPtr, INT nItem)
 {
     NMLISTVIEW nmlv;
     LVITEMW item;
@@ -848,7 +848,7 @@ static int get_ansi_notification(INT unicodeNotificationCode)
   pdi : dispinfo structure (can be unicode or ansi)
   isW : TRUE if dispinfo is Unicode
 */
-static BOOL notify_dispinfoT(LISTVIEW_INFO *infoPtr, INT notificationCode, LPNMLVDISPINFOW pdi, BOOL isW)
+static BOOL notify_dispinfoT(const LISTVIEW_INFO *infoPtr, INT notificationCode, LPNMLVDISPINFOW pdi, BOOL isW)
 {
     BOOL bResult = FALSE;
     BOOL convertToAnsi = FALSE, convertToUnicode = FALSE;
@@ -913,7 +913,7 @@ static BOOL notify_dispinfoT(LISTVIEW_INFO *infoPtr, INT notificationCode, LPNML
     return bResult;
 }
 
-static void customdraw_fill(NMLVCUSTOMDRAW *lpnmlvcd, LISTVIEW_INFO *infoPtr, HDC hdc, 
+static void customdraw_fill(NMLVCUSTOMDRAW *lpnmlvcd, const LISTVIEW_INFO *infoPtr, HDC hdc,
                            const RECT *rcBounds, const LVITEMW *lplvItem)
 {
     ZeroMemory(lpnmlvcd, sizeof(NMLVCUSTOMDRAW));
@@ -930,7 +930,7 @@ static void customdraw_fill(NMLVCUSTOMDRAW *lpnmlvcd, LISTVIEW_INFO *infoPtr, HD
     lpnmlvcd->nmcd.lItemlParam = lplvItem->lParam;
 }
 
-static inline DWORD notify_customdraw (LISTVIEW_INFO *infoPtr, DWORD dwDrawStage, NMLVCUSTOMDRAW *lpnmlvcd)
+static inline DWORD notify_customdraw (const LISTVIEW_INFO *infoPtr, DWORD dwDrawStage, NMLVCUSTOMDRAW *lpnmlvcd)
 {
     BOOL isForItem = (lpnmlvcd->nmcd.dwItemSpec != 0);
     DWORD result;
@@ -944,7 +944,7 @@ static inline DWORD notify_customdraw (LISTVIEW_INFO *infoPtr, DWORD dwDrawStage
     return result;
 }
 
-static void prepaint_setup (LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRAW *lpnmlvcd)
+static void prepaint_setup (const LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRAW *lpnmlvcd)
 {
     if (lpnmlvcd->clrTextBk == CLR_DEFAULT)
         lpnmlvcd->clrTextBk = comctl32_color.clrWindow;
@@ -977,7 +977,7 @@ static void prepaint_setup (LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRAW *lpn
     SetTextColor(hdc, lpnmlvcd->clrText);
 }
 
-static inline DWORD notify_postpaint (LISTVIEW_INFO *infoPtr, NMLVCUSTOMDRAW *lpnmlvcd)
+static inline DWORD notify_postpaint (const LISTVIEW_INFO *infoPtr, NMLVCUSTOMDRAW *lpnmlvcd)
 {
     return notify_customdraw(infoPtr, CDDS_POSTPAINT, lpnmlvcd);
 }
@@ -1141,7 +1141,7 @@ end:
     return (i->nItem = i->nSpecial) != -1;
 }
 
-static RANGE iterator_range(ITERATOR* i)
+static RANGE iterator_range(const ITERATOR *i)
 {
     RANGE range;
 
@@ -1160,7 +1160,7 @@ static RANGE iterator_range(ITERATOR* i)
 /***
  * Releases resources associated with this ierator.
  */
-static inline void iterator_destroy(ITERATOR* i)
+static inline void iterator_destroy(const ITERATOR *i)
 {
     ranges_destroy(i->ranges);
 }
@@ -1200,7 +1200,7 @@ static inline BOOL iterator_rangesitems(ITERATOR* i, RANGES ranges)
 /***
  * Creates an iterator over the items which intersect lprc.
  */
-static BOOL iterator_frameditems(ITERATOR* i, LISTVIEW_INFO* infoPtr, const RECT *lprc)
+static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, const RECT *lprc)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     RECT frame = *lprc, rcItem, rcTemp;
@@ -1285,7 +1285,7 @@ static BOOL iterator_frameditems(ITERATOR* i, LISTVIEW_INFO* infoPtr, const RECT
 /***
  * Creates an iterator over the items which intersect the visible region of hdc.
  */
-static BOOL iterator_visibleitems(ITERATOR *i, LISTVIEW_INFO *infoPtr, HDC  hdc)
+static BOOL iterator_visibleitems(ITERATOR *i, const LISTVIEW_INFO *infoPtr, HDC  hdc)
 {
     POINT Origin, Position;
     RECT rcItem, rcClip;
@@ -1343,7 +1343,7 @@ static inline LRESULT CallWindowProcT(WNDPROC proc, HWND hwnd, UINT uMsg,
     else return CallWindowProcA(proc, hwnd, uMsg, wParam, lParam);
 }
 
-static inline BOOL is_autoarrange(LISTVIEW_INFO *infoPtr)
+static inline BOOL is_autoarrange(const LISTVIEW_INFO *infoPtr)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     
@@ -1353,7 +1353,7 @@ static inline BOOL is_autoarrange(LISTVIEW_INFO *infoPtr)
 
 /******** Internal API functions ************************************/
 
-static inline COLUMN_INFO * LISTVIEW_GetColumnInfo(LISTVIEW_INFO *infoPtr, INT nSubItem)
+static inline COLUMN_INFO * LISTVIEW_GetColumnInfo(const LISTVIEW_INFO *infoPtr, INT nSubItem)
 {
     static COLUMN_INFO mainItem;
 
@@ -1362,31 +1362,31 @@ static inline COLUMN_INFO * LISTVIEW_GetColumnInfo(LISTVIEW_INFO *infoPtr, INT n
     return (COLUMN_INFO *)DPA_GetPtr(infoPtr->hdpaColumns, nSubItem);
 }
        
-static inline void LISTVIEW_GetHeaderRect(LISTVIEW_INFO *infoPtr, INT nSubItem, RECT *lprc)
+static inline void LISTVIEW_GetHeaderRect(const LISTVIEW_INFO *infoPtr, INT nSubItem, LPRECT lprc)
 {
     *lprc = LISTVIEW_GetColumnInfo(infoPtr, nSubItem)->rcHeader;
 }
        
-static inline BOOL LISTVIEW_GetItemW(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem)
+static inline BOOL LISTVIEW_GetItemW(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem)
 {
     return LISTVIEW_GetItemT(infoPtr, lpLVItem, TRUE);
 }
 
 /* Listview invalidation functions: use _only_ these functions to invalidate */
 
-static inline BOOL is_redrawing(LISTVIEW_INFO *infoPtr)
+static inline BOOL is_redrawing(const LISTVIEW_INFO *infoPtr)
 {
     return infoPtr->bRedraw;
 }
 
-static inline void LISTVIEW_InvalidateRect(LISTVIEW_INFO *infoPtr, const RECT* rect)
+static inline void LISTVIEW_InvalidateRect(const LISTVIEW_INFO *infoPtr, const RECT* rect)
 {
     if(!is_redrawing(infoPtr)) return; 
     TRACE(" invalidating rect=%s\n", wine_dbgstr_rect(rect));
     InvalidateRect(infoPtr->hwndSelf, rect, TRUE);
 }
 
-static inline void LISTVIEW_InvalidateItem(LISTVIEW_INFO *infoPtr, INT nItem)
+static inline void LISTVIEW_InvalidateItem(const LISTVIEW_INFO *infoPtr, INT nItem)
 {
     RECT rcBox;
 
@@ -1395,7 +1395,7 @@ static inline void LISTVIEW_InvalidateItem(LISTVIEW_INFO *infoPtr, INT nItem)
     LISTVIEW_InvalidateRect(infoPtr, &rcBox);
 }
 
-static inline void LISTVIEW_InvalidateSubItem(LISTVIEW_INFO *infoPtr, INT nItem, INT nSubItem)
+static inline void LISTVIEW_InvalidateSubItem(const LISTVIEW_INFO *infoPtr, INT nItem, INT nSubItem)
 {
     POINT Origin, Position;
     RECT rcBox;
@@ -1411,12 +1411,12 @@ static inline void LISTVIEW_InvalidateSubItem(LISTVIEW_INFO *infoPtr, INT nItem,
     LISTVIEW_InvalidateRect(infoPtr, &rcBox);
 }
 
-static inline void LISTVIEW_InvalidateList(LISTVIEW_INFO *infoPtr)
+static inline void LISTVIEW_InvalidateList(const LISTVIEW_INFO *infoPtr)
 {
     LISTVIEW_InvalidateRect(infoPtr, NULL);
 }
 
-static inline void LISTVIEW_InvalidateColumn(LISTVIEW_INFO *infoPtr, INT nColumn)
+static inline void LISTVIEW_InvalidateColumn(const LISTVIEW_INFO *infoPtr, INT nColumn)
 {
     RECT rcCol;
     
@@ -1437,7 +1437,7 @@ static inline void LISTVIEW_InvalidateColumn(LISTVIEW_INFO *infoPtr, INT nColumn
  * RETURN:
  * Number of items per row.
  */
-static inline INT LISTVIEW_GetCountPerRow(LISTVIEW_INFO *infoPtr)
+static inline INT LISTVIEW_GetCountPerRow(const LISTVIEW_INFO *infoPtr)
 {
     INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left;
 
@@ -1455,7 +1455,7 @@ static inline INT LISTVIEW_GetCountPerRow(LISTVIEW_INFO *infoPtr)
  * RETURN:
  * Number of items per column.
  */
-static inline INT LISTVIEW_GetCountPerColumn(LISTVIEW_INFO *infoPtr)
+static inline INT LISTVIEW_GetCountPerColumn(const LISTVIEW_INFO *infoPtr)
 {
     INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top;
 
@@ -1605,7 +1605,7 @@ static INT LISTVIEW_ProcessLetterKeys(LISTVIEW_INFO *infoPtr, WPARAM charCode, L
  * RETURNS
  * None.
  */
-static void LISTVIEW_UpdateHeaderSize(LISTVIEW_INFO *infoPtr, INT nNewScrollPos)
+static void LISTVIEW_UpdateHeaderSize(const LISTVIEW_INFO *infoPtr, INT nNewScrollPos)
 {
     RECT winRect;
     POINT point[2];
@@ -1638,7 +1638,7 @@ static void LISTVIEW_UpdateHeaderSize(LISTVIEW_INFO *infoPtr, INT nNewScrollPos)
  * RETURN:
  * None
  */
-static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr)
+static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     SCROLLINFO horzInfo, vertInfo;
@@ -1741,7 +1741,7 @@ static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr)
  * RETURN:
  * None
  */
-static void LISTVIEW_ShowFocusRect(LISTVIEW_INFO *infoPtr, BOOL fShow)
+static void LISTVIEW_ShowFocusRect(const LISTVIEW_INFO *infoPtr, BOOL fShow)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     HDC hdc;
@@ -1800,7 +1800,7 @@ done:
 /***
  * Invalidates all visible selected items.
  */
-static void LISTVIEW_InvalidateSelectedItems(LISTVIEW_INFO *infoPtr)
+static void LISTVIEW_InvalidateSelectedItems(const LISTVIEW_INFO *infoPtr)
 {
     ITERATOR i; 
    
@@ -1831,7 +1831,7 @@ static void LISTVIEW_InvalidateSelectedItems(LISTVIEW_INFO *infoPtr)
  * RETURN:
  *   None.
  */
-static void LISTVIEW_GetItemOrigin(LISTVIEW_INFO *infoPtr, INT nItem, LPPOINT lpptPosition)
+static void LISTVIEW_GetItemOrigin(const LISTVIEW_INFO *infoPtr, INT nItem, LPPOINT lpptPosition)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
 
@@ -1897,7 +1897,7 @@ static void LISTVIEW_GetItemOrigin(LISTVIEW_INFO *infoPtr, INT nItem, LPPOINT lp
  * RETURN:
  *   None.
  */
-static void LISTVIEW_GetItemMetrics(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
+static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
                                    LPRECT lprcBox, LPRECT lprcSelectBox,
                                    LPRECT lprcIcon, LPRECT lprcStateIcon, LPRECT lprcLabel)
 {
@@ -1980,7 +1980,7 @@ static void LISTVIEW_GetItemMetrics(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVI
                 (!lpColumnInfo || lpLVItem->iSubItem == 0 || (lpColumnInfo->fmt & LVCFMT_IMAGE) ||
                  ((infoPtr->dwLvExStyle & LVS_EX_SUBITEMIMAGES) && lpLVItem->iImage != I_IMAGECALLBACK)))
                Icon.right += infoPtr->iconSize.cx;
-           Icon.bottom = Icon.top + infoPtr->nItemHeight;
+           Icon.bottom = Icon.top + infoPtr->iconSize.cy;
        }
        if(lprcIcon) *lprcIcon = Icon;
        TRACE("    - icon=%s\n", wine_dbgstr_rect(&Icon));
@@ -2130,7 +2130,7 @@ calc_label:
  * RETURN:
  *   None.
  */
-static void LISTVIEW_GetItemBox(LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lprcBox)
+static void LISTVIEW_GetItemBox(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lprcBox)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
@@ -2228,7 +2228,7 @@ static void LISTVIEW_NextIconPosLeft(LISTVIEW_INFO *infoPtr, LPPOINT lpPos)
  *   Success: TRUE
  *   Failure: FALSE
  */
-static BOOL LISTVIEW_MoveIconTo(LISTVIEW_INFO *infoPtr, INT nItem, const POINT *lppt, BOOL isNew)
+static BOOL LISTVIEW_MoveIconTo(const LISTVIEW_INFO *infoPtr, INT nItem, const POINT *lppt, BOOL isNew)
 {
     POINT old;
     
@@ -2311,7 +2311,7 @@ static BOOL LISTVIEW_Arrange(LISTVIEW_INFO *infoPtr, INT nAlignCode)
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static void LISTVIEW_GetAreaRect(LISTVIEW_INFO *infoPtr, LPRECT lprcView)
+static void LISTVIEW_GetAreaRect(const LISTVIEW_INFO *infoPtr, LPRECT lprcView)
 {
     INT i, x, y;
 
@@ -2362,7 +2362,7 @@ static void LISTVIEW_GetAreaRect(LISTVIEW_INFO *infoPtr, LPRECT lprcView)
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static BOOL LISTVIEW_GetViewRect(LISTVIEW_INFO *infoPtr, LPRECT lprcView)
+static BOOL LISTVIEW_GetViewRect(const LISTVIEW_INFO *infoPtr, LPRECT lprcView)
 {
     POINT ptOrigin;
 
@@ -2418,7 +2418,7 @@ static SUBITEM_INFO* LISTVIEW_GetSubItemPtr(HDPA hdpaSubItems, INT nSubItem)
  * RETURN:
  *  The desired item width.
  */
-static INT LISTVIEW_CalculateItemWidth(LISTVIEW_INFO *infoPtr)
+static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT nItemWidth = 0;
@@ -2463,7 +2463,7 @@ static INT LISTVIEW_CalculateItemWidth(LISTVIEW_INFO *infoPtr)
  * RETURN:
  *  The desired item height.
  */
-static INT LISTVIEW_CalculateItemHeight(LISTVIEW_INFO *infoPtr)
+static INT LISTVIEW_CalculateItemHeight(const LISTVIEW_INFO *infoPtr)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT nItemHeight;
@@ -2919,7 +2919,7 @@ static inline BOOL LISTVIEW_DeselectAll(LISTVIEW_INFO *infoPtr)
  * RETURN:
  * Number of items selected.
  */
-static INT LISTVIEW_GetSelectedCount(LISTVIEW_INFO *infoPtr)
+static INT LISTVIEW_GetSelectedCount(const LISTVIEW_INFO *infoPtr)
 {
     INT nSelectedCount = 0;
 
@@ -2966,7 +2966,7 @@ static inline BOOL LISTVIEW_SetItemFocus(LISTVIEW_INFO *infoPtr, INT nItem)
 }
 
 /* Helper function for LISTVIEW_ShiftIndices *only* */
-static INT shift_item(LISTVIEW_INFO *infoPtr, INT nShiftItem, INT nItem, INT direction)
+static INT shift_item(const LISTVIEW_INFO *infoPtr, INT nShiftItem, INT nItem, INT direction)
 {
     if (nShiftItem < nItem) return nShiftItem;
 
@@ -3228,7 +3228,7 @@ static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem)
   return bResult;
 }
 
-static BOOL LISTVIEW_GetItemAtPt(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, POINT pt)
+static BOOL LISTVIEW_GetItemAtPt(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, POINT pt)
 {
     LVHITTESTINFO lvHitTestInfo;
 
@@ -3513,7 +3513,7 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static BOOL set_sub_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL isW, BOOL *bChanged)
+static BOOL set_sub_item(const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL isW, BOOL *bChanged)
 {
     HDPA hdpaSubItems;
     SUBITEM_INFO *lpSubItem;
@@ -3590,7 +3590,7 @@ static BOOL set_sub_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL i
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL isW)
+static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, LVITEMW *lpLVItem, BOOL isW)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     HWND hwndSelf = infoPtr->hwndSelf;
@@ -3606,7 +3606,7 @@ static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, B
     if ((lpLVItem->mask & LVIF_TEXT) && is_textW(lpLVItem->pszText))
     {
        pszText = lpLVItem->pszText;
-       ((LVITEMW *)lpLVItem)->pszText = textdupTtoW(lpLVItem->pszText, isW);
+       lpLVItem->pszText = textdupTtoW(lpLVItem->pszText, isW);
     }
 
     /* actually set the fields */
@@ -3634,7 +3634,7 @@ static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, B
     if (pszText)
     {
        textfreeT(lpLVItem->pszText, isW);
-       ((LVITEMW *)lpLVItem)->pszText = pszText;
+       lpLVItem->pszText = pszText;
     }
 
     return bResult;
@@ -3650,7 +3650,7 @@ static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, B
  * RETURN:
  * item index
  */
-static INT LISTVIEW_GetTopIndex(LISTVIEW_INFO *infoPtr)
+static INT LISTVIEW_GetTopIndex(const LISTVIEW_INFO *infoPtr)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT nItem = 0;
@@ -3694,7 +3694,7 @@ static INT LISTVIEW_GetTopIndex(LISTVIEW_INFO *infoPtr)
  *   Success: TRUE
  *   Failure: FALSE
  */
-static inline BOOL LISTVIEW_FillBkgnd(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *lprcBox)
+static inline BOOL LISTVIEW_FillBkgnd(const LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *lprcBox)
 {
     if (!infoPtr->hBkBrush) return FALSE;
 
@@ -3723,9 +3723,10 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
 {
     UINT uFormat, uView = infoPtr->dwStyle & LVS_TYPEMASK;
     WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
-    static const WCHAR szCallback[] = { '(', 'c', 'a', 'l', 'l', 'b', 'a', 'c', 'k', ')', 0 };
+    static WCHAR szCallback[] = { '(', 'c', 'a', 'l', 'l', 'b', 'a', 'c', 'k', ')', 0 };
     DWORD cdsubitemmode = CDRF_DODEFAULT;
-    RECT *lprcFocus, rcSelect, rcBox, rcIcon, rcLabel, rcStateIcon;
+    LPRECT lprcFocus;
+    RECT rcSelect, rcBox, rcIcon, rcLabel, rcStateIcon;
     NMLVCUSTOMDRAW nmlvcd;
     HIMAGELIST himl;
     LVITEMW lvItem;
@@ -3747,7 +3748,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
     if (!LISTVIEW_GetItemW(infoPtr, &lvItem)) return FALSE;
     if (nSubItem > 0 && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)) 
        lvItem.state = LISTVIEW_GetItemState(infoPtr, nItem, LVIS_SELECTED);
-    if (lvItem.pszText == LPSTR_TEXTCALLBACKW) lvItem.pszText = (LPWSTR)szCallback;
+    if (lvItem.pszText == LPSTR_TEXTCALLBACKW) lvItem.pszText = szCallback;
     TRACE("   lvItem=%s\n", debuglvitem_t(&lvItem, TRUE));
 
     /* now check if we need to update the focus rectangle */
@@ -3870,7 +3871,7 @@ postpaint:
  * RETURN:
  * None
  */
-static void LISTVIEW_RefreshOwnerDraw(LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, DWORD cdmode)
+static void LISTVIEW_RefreshOwnerDraw(const LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, DWORD cdmode)
 {
     UINT uID = (UINT)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
     DWORD cditemmode = CDRF_DODEFAULT;
@@ -4045,7 +4046,7 @@ static void LISTVIEW_RefreshList(LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, D
  * RETURN:
  * NoneX
  */
-static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, RECT *prcErase)
+static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcErase)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     COLORREF oldTextColor = 0, oldBkColor = 0, oldClrTextBk, oldClrText;
@@ -4189,7 +4190,7 @@ enddraw:
  * RETURN:
  * Returns a DWORD. The width in the low word and the height in high word.
  */
-static DWORD LISTVIEW_ApproximateViewRect(LISTVIEW_INFO *infoPtr, INT nItemCount,
+static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nItemCount,
                                             WORD wWidth, WORD wHeight)
 {
   UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
@@ -4896,7 +4897,7 @@ static BOOL LISTVIEW_EnsureVisible(LISTVIEW_INFO *infoPtr, INT nItem, BOOL bPart
  *   SUCCESS : index of item
  *   FAILURE : -1
  */
-static INT LISTVIEW_FindItemW(LISTVIEW_INFO *infoPtr, INT nStart,
+static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart,
                               const LVFINDINFOW *lpFindInfo)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
@@ -5027,7 +5028,7 @@ again:
  *   SUCCESS : index of item
  *   FAILURE : -1
  */
-static INT LISTVIEW_FindItemA(LISTVIEW_INFO *infoPtr, INT nStart,
+static INT LISTVIEW_FindItemA(const LISTVIEW_INFO *infoPtr, INT nStart,
                               const LVFINDINFOA *lpFindInfo)
 {
     BOOL hasText = lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL);
@@ -5053,7 +5054,7 @@ static INT LISTVIEW_FindItemA(LISTVIEW_INFO *infoPtr, INT nStart,
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-/* static BOOL LISTVIEW_GetBkImage(LISTVIEW_INFO *infoPtr, LPLVBKIMAGE lpBkImage)   */
+/* static BOOL LISTVIEW_GetBkImage(const LISTVIEW_INFO *infoPtr, LPLVBKIMAGE lpBkImage)   */
 /* {   */
 /*   FIXME (listview, "empty stub!\n"); */
 /*   return FALSE;   */
@@ -5074,7 +5075,7 @@ static INT LISTVIEW_FindItemA(LISTVIEW_INFO *infoPtr, INT nStart,
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static BOOL LISTVIEW_GetColumnT(LISTVIEW_INFO *infoPtr, INT nColumn, LPLVCOLUMNW lpColumn, BOOL isW)
+static BOOL LISTVIEW_GetColumnT(const LISTVIEW_INFO *infoPtr, INT nColumn, LPLVCOLUMNW lpColumn, BOOL isW)
 {
     COLUMN_INFO *lpColumnInfo;
     HDITEMW hdi;
@@ -5116,7 +5117,7 @@ static BOOL LISTVIEW_GetColumnT(LISTVIEW_INFO *infoPtr, INT nColumn, LPLVCOLUMNW
 }
 
 
-static BOOL LISTVIEW_GetColumnOrderArray(LISTVIEW_INFO *infoPtr, INT iCount, LPINT lpiArray)
+static BOOL LISTVIEW_GetColumnOrderArray(const LISTVIEW_INFO *infoPtr, INT iCount, LPINT lpiArray)
 {
     INT i;
 
@@ -5142,7 +5143,7 @@ static BOOL LISTVIEW_GetColumnOrderArray(LISTVIEW_INFO *infoPtr, INT iCount, LPI
  *   SUCCESS : column width
  *   FAILURE : zero
  */
-static INT LISTVIEW_GetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn)
+static INT LISTVIEW_GetColumnWidth(const LISTVIEW_INFO *infoPtr, INT nColumn)
 {
     INT nColumnWidth = 0;
     RECT rcHeader;
@@ -5178,7 +5179,7 @@ static INT LISTVIEW_GetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn)
  * RETURN:
  * Number of fully visible items.
  */
-static INT LISTVIEW_GetCountPerPage(LISTVIEW_INFO *infoPtr)
+static INT LISTVIEW_GetCountPerPage(const LISTVIEW_INFO *infoPtr)
 {
     switch (infoPtr->dwStyle & LVS_TYPEMASK)
     {
@@ -5206,7 +5207,7 @@ static INT LISTVIEW_GetCountPerPage(LISTVIEW_INFO *infoPtr)
  *   SUCCESS : image list handle
  *   FAILURE : NULL
  */
-static HIMAGELIST LISTVIEW_GetImageList(LISTVIEW_INFO *infoPtr, INT nImageList)
+static HIMAGELIST LISTVIEW_GetImageList(const LISTVIEW_INFO *infoPtr, INT nImageList)
 {
     switch (nImageList)
     {
@@ -5246,7 +5247,7 @@ static HIMAGELIST LISTVIEW_GetImageList(LISTVIEW_INFO *infoPtr, INT nImageList)
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static BOOL LISTVIEW_GetItemT(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL isW)
+static BOOL LISTVIEW_GetItemT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL isW)
 {
     ITEMHDR callbackHdr = { LPSTR_TEXTCALLBACKW, I_IMAGECALLBACK };
     NMLVDISPINFOW dispInfo;
@@ -5490,7 +5491,7 @@ static BOOL LISTVIEW_GetItemT(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL i
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static BOOL LISTVIEW_GetItemExtT(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL isW)
+static BOOL LISTVIEW_GetItemExtT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL isW)
 {
     LPWSTR pszText;
     BOOL bResult;
@@ -5523,7 +5524,7 @@ static BOOL LISTVIEW_GetItemExtT(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOO
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static BOOL LISTVIEW_GetItemPosition(LISTVIEW_INFO *infoPtr, INT nItem, LPPOINT lpptPosition)
+static BOOL LISTVIEW_GetItemPosition(const LISTVIEW_INFO *infoPtr, INT nItem, LPPOINT lpptPosition)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     POINT Origin;
@@ -5609,7 +5610,7 @@ static BOOL LISTVIEW_GetItemPosition(LISTVIEW_INFO *infoPtr, INT nItem, LPPOINT
  *   is the one with the focus.  Ensure that the control's record of which
  *   item has the focus agrees with the items' records.
  */
-static BOOL LISTVIEW_GetItemRect(LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lprc)
+static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lprc)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
@@ -5700,7 +5701,7 @@ static BOOL LISTVIEW_GetItemRect(LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lprc)
  *     TRUE: success
  *     FALSE: failure
  */
-static BOOL LISTVIEW_GetSubItemRect(LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lprc)
+static BOOL LISTVIEW_GetSubItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lprc)
 {
     POINT Position;
     LVITEMW lvItem;
@@ -5758,7 +5759,7 @@ static BOOL LISTVIEW_GetSubItemRect(LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lp
  *   SUCCESS : string width (in pixels)
  *   FAILURE : zero
  */
-static INT LISTVIEW_GetLabelWidth(LISTVIEW_INFO *infoPtr, INT nItem)
+static INT LISTVIEW_GetLabelWidth(const LISTVIEW_INFO *infoPtr, INT nItem)
 {
     WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
     LVITEMW lvItem;
@@ -5786,7 +5787,7 @@ static INT LISTVIEW_GetLabelWidth(LISTVIEW_INFO *infoPtr, INT nItem)
  * RETURN:
  * Horizontal + vertical spacing
  */
-static LONG LISTVIEW_GetItemSpacing(LISTVIEW_INFO *infoPtr, BOOL bSmall)
+static LONG LISTVIEW_GetItemSpacing(const LISTVIEW_INFO *infoPtr, BOOL bSmall)
 {
   LONG lResult;
 
@@ -5816,7 +5817,7 @@ static LONG LISTVIEW_GetItemSpacing(LISTVIEW_INFO *infoPtr, BOOL bSmall)
  * RETURN:
  * State specified by the mask.
  */
-static UINT LISTVIEW_GetItemState(LISTVIEW_INFO *infoPtr, INT nItem, UINT uMask)
+static UINT LISTVIEW_GetItemState(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uMask)
 {
     LVITEMW lvItem;
 
@@ -5845,7 +5846,7 @@ static UINT LISTVIEW_GetItemState(LISTVIEW_INFO *infoPtr, INT nItem, UINT uMask)
  *   SUCCESS : string length
  *   FAILURE : 0
  */
-static INT LISTVIEW_GetItemTextT(LISTVIEW_INFO *infoPtr, INT nItem, LPLVITEMW lpLVItem, BOOL isW)
+static INT LISTVIEW_GetItemTextT(const LISTVIEW_INFO *infoPtr, INT nItem, LPLVITEMW lpLVItem, BOOL isW)
 {
     if (!lpLVItem || nItem < 0 || nItem >= infoPtr->nItemCount) return 0;
 
@@ -5869,7 +5870,7 @@ static INT LISTVIEW_GetItemTextT(LISTVIEW_INFO *infoPtr, INT nItem, LPLVITEMW lp
  *   SUCCESS : item index
  *   FAILURE : -1
  */
-static INT LISTVIEW_GetNextItem(LISTVIEW_INFO *infoPtr, INT nItem, UINT uFlags)
+static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uFlags)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     UINT uMask = 0;
@@ -6073,7 +6074,7 @@ static INT LISTVIEW_GetNextItem(LISTVIEW_INFO *infoPtr, INT nItem, UINT uFlags)
  * RETURN:
  *   None.
  */
-static void LISTVIEW_GetOrigin(LISTVIEW_INFO *infoPtr, LPPOINT lpptOrigin)
+static void LISTVIEW_GetOrigin(const LISTVIEW_INFO *infoPtr, LPPOINT lpptOrigin)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT nHorzPos = 0, nVertPos = 0;
@@ -6115,7 +6116,7 @@ static void LISTVIEW_GetOrigin(LISTVIEW_INFO *infoPtr, LPPOINT lpptOrigin)
  *   SUCCESS : string width (in pixels)
  *   FAILURE : zero
  */
-static INT LISTVIEW_GetStringWidthT(LISTVIEW_INFO *infoPtr, LPCWSTR lpszText, BOOL isW)
+static INT LISTVIEW_GetStringWidthT(const LISTVIEW_INFO *infoPtr, LPCWSTR lpszText, BOOL isW)
 {
     SIZE stringSize;
     
@@ -6155,7 +6156,7 @@ static INT LISTVIEW_GetStringWidthT(LISTVIEW_INFO *infoPtr, LPCWSTR lpszText, BO
  *   SUCCESS : item index
  *   FAILURE : -1
  */
-static INT LISTVIEW_HitTest(LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, BOOL subitem, BOOL select)
+static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, BOOL subitem, BOOL select)
 {
     WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
@@ -6290,7 +6291,7 @@ static INT WINAPI LISTVIEW_InsertCompare(  LPVOID first, LPVOID second,  LPARAM
     INT cmpv = textcmpWT(lv_first->hdr.pszText, lv_second->hdr.pszText, TRUE); 
 
     /* if we're sorting descending, negate the return value */
-    return (((LISTVIEW_INFO *)lParam)->dwStyle & LVS_SORTDESCENDING) ? -cmpv : cmpv;
+    return (((const LISTVIEW_INFO *)lParam)->dwStyle & LVS_SORTDESCENDING) ? -cmpv : cmpv;
 }
 
 /***
@@ -6441,7 +6442,7 @@ fail:
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static BOOL LISTVIEW_RedrawItems(LISTVIEW_INFO *infoPtr, INT nFirst, INT nLast)
+static BOOL LISTVIEW_RedrawItems(const LISTVIEW_INFO *infoPtr, INT nFirst, INT nLast)
 {
     INT i;
  
@@ -6541,7 +6542,8 @@ static BOOL LISTVIEW_SetBkColor(LISTVIEW_INFO *infoPtr, COLORREF clrBk)
 /* LISTVIEW_SetBkImage */
 
 /*** Helper for {Insert,Set}ColumnT *only* */
-static void column_fill_hditem(LISTVIEW_INFO *infoPtr, HDITEMW *lphdi, INT nColumn, const LVCOLUMNW *lpColumn, BOOL isW)
+static void column_fill_hditem(const LISTVIEW_INFO *infoPtr, HDITEMW *lphdi, INT nColumn,
+                               const LVCOLUMNW *lpColumn, BOOL isW)
 {
     if (lpColumn->mask & LVCF_FMT)
     {
@@ -6715,7 +6717,7 @@ fail:
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static BOOL LISTVIEW_SetColumnT(LISTVIEW_INFO *infoPtr, INT nColumn,
+static BOOL LISTVIEW_SetColumnT(const LISTVIEW_INFO *infoPtr, INT nColumn,
                                 const LVCOLUMNW *lpColumn, BOOL isW)
 {
     HDITEMW hdi, hdiget;
@@ -6768,7 +6770,7 @@ static BOOL LISTVIEW_SetColumnT(LISTVIEW_INFO *infoPtr, INT nColumn,
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static BOOL LISTVIEW_SetColumnOrderArray(LISTVIEW_INFO *infoPtr, INT iCount, const INT *lpiArray)
+static BOOL LISTVIEW_SetColumnOrderArray(const LISTVIEW_INFO *infoPtr, INT iCount, const INT *lpiArray)
 {
   FIXME("iCount %d lpiArray %p\n", iCount, lpiArray);
 
@@ -6897,7 +6899,7 @@ static BOOL LISTVIEW_SetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn, INT cx)
  * Creates the checkbox imagelist.  Helper for LISTVIEW_SetExtendedListViewStyle
  *
  */
-static HIMAGELIST LISTVIEW_CreateCheckBoxIL(LISTVIEW_INFO *infoPtr)
+static HIMAGELIST LISTVIEW_CreateCheckBoxIL(const LISTVIEW_INFO *infoPtr)
 {
     HDC hdc_wnd, hdc;
     HBITMAP hbm_im, hbm_mask, hbm_orig;
@@ -7648,7 +7650,7 @@ static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare,
  *   SUCCESS : 0
  *   FAILURE : something else
  */
-static LRESULT LISTVIEW_ThemeChanged(LISTVIEW_INFO *infoPtr)
+static LRESULT LISTVIEW_ThemeChanged(const LISTVIEW_INFO *infoPtr)
 {
     HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
     CloseThemeData(theme);
@@ -7696,7 +7698,7 @@ static BOOL LISTVIEW_Update(LISTVIEW_INFO *infoPtr, INT nItem)
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static BOOL LISTVIEW_DrawTrackLine(LISTVIEW_INFO *infoPtr)
+static BOOL LISTVIEW_DrawTrackLine(const LISTVIEW_INFO *infoPtr)
 {
     HPEN hOldPen;
     HDC hdc;
@@ -7893,7 +7895,7 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
  *   Success: 0
  *   Failure: -1
  */
-static LRESULT LISTVIEW_Destroy(LISTVIEW_INFO *infoPtr)
+static LRESULT LISTVIEW_Destroy(const LISTVIEW_INFO *infoPtr)
 {
     HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
     CloseThemeData(theme);
@@ -7912,7 +7914,7 @@ static LRESULT LISTVIEW_Destroy(LISTVIEW_INFO *infoPtr)
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static BOOL LISTVIEW_Enable(LISTVIEW_INFO *infoPtr, BOOL bEnable)
+static BOOL LISTVIEW_Enable(const LISTVIEW_INFO *infoPtr, BOOL bEnable)
 {
     if (infoPtr->dwStyle & LVS_OWNERDRAWFIXED)
         InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
@@ -7931,7 +7933,7 @@ static BOOL LISTVIEW_Enable(LISTVIEW_INFO *infoPtr, BOOL bEnable)
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static inline BOOL LISTVIEW_EraseBkgnd(LISTVIEW_INFO *infoPtr, HDC hdc)
+static inline BOOL LISTVIEW_EraseBkgnd(const LISTVIEW_INFO *infoPtr, HDC hdc)
 {
     RECT rc;
 
@@ -8776,7 +8778,7 @@ static LRESULT LISTVIEW_HeaderNotification(LISTVIEW_INFO *infoPtr, const NMHEADE
  *  TRUE  - frame was painted
  *  FALSE - call default window proc
  */
-static BOOL LISTVIEW_NCPaint(LISTVIEW_INFO *infoPtr, HRGN region)
+static BOOL LISTVIEW_NCPaint(const LISTVIEW_INFO *infoPtr, HRGN region)
 {
     HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
     HDC dc;
@@ -8917,7 +8919,7 @@ static LRESULT LISTVIEW_PrintClient(LISTVIEW_INFO *infoPtr, HDC hdc, DWORD optio
  * RETURN:
  * Zero
  */
-static LRESULT LISTVIEW_RButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
+static LRESULT LISTVIEW_RButtonDblClk(const LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
 {
     LVHITTESTINFO lvHitTestInfo;
     
@@ -9039,7 +9041,7 @@ static LRESULT LISTVIEW_RButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT
  * TRUE if cursor is set
  * FALSE otherwise
  */
-static BOOL LISTVIEW_SetCursor(LISTVIEW_INFO *infoPtr, HWND hwnd, UINT nHittest, UINT wMouseMsg)
+static BOOL LISTVIEW_SetCursor(const LISTVIEW_INFO *infoPtr, HWND hwnd, UINT nHittest, UINT wMouseMsg)
 {
     LVHITTESTINFO lvHitTestInfo;
 
@@ -9909,7 +9911,7 @@ void LISTVIEW_Unregister(void)
  * RETURN:
  *   Zero.
  */
-static LRESULT LISTVIEW_Command(LISTVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT LISTVIEW_Command(const LISTVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     switch (HIWORD(wParam))
     {
index ded5c5c..3341626 100644 (file)
@@ -94,6 +94,7 @@ typedef struct
                         /* control moves when user clicks a scroll button */
     int                visible;        /* # of months visible */
     int                firstDay;       /* Start month calendar with firstDay's day */
+    int                firstDayHighWord;    /* High word only used externally */
     int                monthRange;
     MONTHDAYSTATE *monthdayState;
     SYSTEMTIME todaysDate;
@@ -189,7 +190,7 @@ static int MONTHCAL_CalculateDayOfWeek(DWORD day, DWORD month, DWORD year)
 /* From a given point, calculate the row (weekpos), column(daypos)
    and day in the calendar. day== 0 mean the last day of tha last month
 */
-static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y,
+static int MONTHCAL_CalcDayFromPos(const MONTHCAL_INFO *infoPtr, int x, int y,
                                   int *daypos,int *weekpos)
 {
   int retval, firstDay;
@@ -214,7 +215,7 @@ static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y,
 /* day is the day of the month, 1 == 1st day of the month */
 /* sets x and y to be the position of the day */
 /* x == day, y == week where(0,0) == firstDay, 1st week */
-static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month,
+static void MONTHCAL_CalcDayXY(const MONTHCAL_INFO *infoPtr, int day, int month,
                                  int *x, int *y)
 {
   int firstDay, prevMonth;
@@ -243,7 +244,7 @@ static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month,
 
 
 /* x: column(day), y: row(week) */
-static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y)
+static void MONTHCAL_CalcDayRect(const MONTHCAL_INFO *infoPtr, RECT *r, int x, int y)
 {
   r->left = infoPtr->days.left + x * infoPtr->width_increment;
   r->right = r->left + infoPtr->width_increment;
@@ -255,7 +256,7 @@ static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y)
 /* sets the RECT struct r to the rectangle around the day and month */
 /* day is the day value of the month(1 == 1st), month is the month */
 /* value(january == 1, december == 12) */
-static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr,
+static inline void MONTHCAL_CalcPosFromDay(const MONTHCAL_INFO *infoPtr,
                                             int day, int month, RECT *r)
 {
   int x, y;
@@ -267,7 +268,7 @@ static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr,
 
 /* day is the day in the month(1 == 1st of the month) */
 /* month is the month value(1 == january, 12 == december) */
-static void MONTHCAL_CircleDay(MONTHCAL_INFO *infoPtr, HDC hdc, int day, int month)
+static void MONTHCAL_CircleDay(const MONTHCAL_INFO *infoPtr, HDC hdc, int day, int month)
 {
   HPEN hRedPen = CreatePen(PS_SOLID, 2, RGB(255, 0, 0));
   HPEN hOldPen2 = SelectObject(hdc, hRedPen);
@@ -318,7 +319,7 @@ static void MONTHCAL_CircleDay(MONTHCAL_INFO *infoPtr, HDC hdc, int day, int mon
 }
 
 
-static void MONTHCAL_DrawDay(MONTHCAL_INFO *infoPtr, HDC hdc, int day, int month,
+static void MONTHCAL_DrawDay(const MONTHCAL_INFO *infoPtr, HDC hdc, int day, int month,
                              int x, int y, int bold)
 {
   static const WCHAR fmtW[] = { '%','d',0 };
@@ -387,7 +388,7 @@ static void MONTHCAL_DrawDay(MONTHCAL_INFO *infoPtr, HDC hdc, int day, int month
 }
 
 
-static void paint_button (MONTHCAL_INFO *infoPtr, HDC hdc, BOOL btnNext, 
+static void paint_button (const MONTHCAL_INFO *infoPtr, HDC hdc, BOOL btnNext,
                           BOOL pressed, RECT* r)
 {
     HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
@@ -426,7 +427,7 @@ static void paint_button (MONTHCAL_INFO *infoPtr, HDC hdc, BOOL btnNext,
 }
 
 
-static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps)
+static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT *ps)
 {
   static const WCHAR todayW[] = { 'T','o','d','a','y',':',0 };
   static const WCHAR fmt1W[] = { '%','s',' ','%','l','d',0 };
@@ -773,7 +774,7 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps)
 
 
 static LRESULT
-MONTHCAL_GetMinReqRect(MONTHCAL_INFO *infoPtr, LPARAM lParam)
+MONTHCAL_GetMinReqRect(const MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
   LPRECT lpRect = (LPRECT) lParam;
 
@@ -796,7 +797,7 @@ MONTHCAL_GetMinReqRect(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 
 
 static LRESULT
-MONTHCAL_GetColor(MONTHCAL_INFO *infoPtr, WPARAM wParam)
+MONTHCAL_GetColor(const MONTHCAL_INFO *infoPtr, WPARAM wParam)
 {
   TRACE("\n");
 
@@ -859,7 +860,7 @@ MONTHCAL_SetColor(MONTHCAL_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-MONTHCAL_GetMonthDelta(MONTHCAL_INFO *infoPtr)
+MONTHCAL_GetMonthDelta(const MONTHCAL_INFO *infoPtr)
 {
   TRACE("\n");
 
@@ -883,9 +884,9 @@ MONTHCAL_SetMonthDelta(MONTHCAL_INFO *infoPtr, WPARAM wParam)
 
 
 static LRESULT
-MONTHCAL_GetFirstDayOfWeek(MONTHCAL_INFO *infoPtr)
+MONTHCAL_GetFirstDayOfWeek(const MONTHCAL_INFO *infoPtr)
 {
-  return infoPtr->firstDay;
+  return MAKELONG(infoPtr->firstDay, infoPtr->firstDayHighWord);
 }
 
 
@@ -896,26 +897,39 @@ MONTHCAL_GetFirstDayOfWeek(MONTHCAL_INFO *infoPtr)
 static LRESULT
 MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
-  int prev = infoPtr->firstDay;
+  int prev = MAKELONG(infoPtr->firstDay, infoPtr->firstDayHighWord);
+  int localFirstDay;
   WCHAR buf[40];
 
   TRACE("day %ld\n", lParam);
 
-  if((lParam >= 0) && (lParam < 7)) {
-    infoPtr->firstDay = (int)lParam;
+  GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, buf, countof(buf));
+  TRACE("%s %d\n", debugstr_w(buf), strlenW(buf));
+
+  localFirstDay = atoiW(buf);
+
+  if(lParam == -1)
+  {
+    infoPtr->firstDay = localFirstDay;
+    infoPtr->firstDayHighWord = FALSE;
+  }
+  else if(lParam >= 7)
+  {
+    infoPtr->firstDay = localFirstDay;
+    infoPtr->firstDayHighWord = TRUE;
   }
   else
-    {
-      GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, buf, countof(buf));
-      TRACE("%s %d\n", debugstr_w(buf), strlenW(buf));
-      infoPtr->firstDay = (atoiW(buf)+1)%7;
-    }
+  {
+    infoPtr->firstDay = lParam;
+    infoPtr->firstDayHighWord = TRUE;
+  }
+
   return prev;
 }
 
 
 static LRESULT
-MONTHCAL_GetMonthRange(MONTHCAL_INFO *infoPtr)
+MONTHCAL_GetMonthRange(const MONTHCAL_INFO *infoPtr)
 {
   TRACE("\n");
 
@@ -924,7 +938,7 @@ MONTHCAL_GetMonthRange(MONTHCAL_INFO *infoPtr)
 
 
 static LRESULT
-MONTHCAL_GetMaxTodayWidth(MONTHCAL_INFO *infoPtr)
+MONTHCAL_GetMaxTodayWidth(const MONTHCAL_INFO *infoPtr)
 {
   return(infoPtr->todayrect.right - infoPtr->todayrect.left);
 }
@@ -999,7 +1013,7 @@ MONTHCAL_GetRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-MONTHCAL_SetDayState(MONTHCAL_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+MONTHCAL_SetDayState(const MONTHCAL_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
 {
   int i, iMonths = (int)wParam;
@@ -1014,7 +1028,7 @@ MONTHCAL_SetDayState(MONTHCAL_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 }
 
 static LRESULT
-MONTHCAL_GetCurSel(MONTHCAL_INFO *infoPtr, LPARAM lParam)
+MONTHCAL_GetCurSel(const MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
   SYSTEMTIME *lpSel = (SYSTEMTIME *) lParam;
 
@@ -1053,7 +1067,7 @@ MONTHCAL_SetCurSel(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 
 
 static LRESULT
-MONTHCAL_GetMaxSelCount(MONTHCAL_INFO *infoPtr)
+MONTHCAL_GetMaxSelCount(const MONTHCAL_INFO *infoPtr)
 {
   return infoPtr->maxSelCount;
 }
@@ -1073,7 +1087,7 @@ MONTHCAL_SetMaxSelCount(MONTHCAL_INFO *infoPtr, WPARAM wParam)
 
 
 static LRESULT
-MONTHCAL_GetSelRange(MONTHCAL_INFO *infoPtr, LPARAM lParam)
+MONTHCAL_GetSelRange(const MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
   SYSTEMTIME *lprgSysTimeArray = (SYSTEMTIME *) lParam;
 
@@ -1119,7 +1133,7 @@ MONTHCAL_SetSelRange(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 
 
 static LRESULT
-MONTHCAL_GetToday(MONTHCAL_INFO *infoPtr, LPARAM lParam)
+MONTHCAL_GetToday(const MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
   SYSTEMTIME *lpToday = (SYSTEMTIME *) lParam;
 
@@ -1150,7 +1164,7 @@ MONTHCAL_SetToday(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 
 
 static LRESULT
-MONTHCAL_HitTest(MONTHCAL_INFO *infoPtr, LPARAM lParam)
+MONTHCAL_HitTest(const MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
   PMCHITTESTINFO lpht = (PMCHITTESTINFO)lParam;
   UINT x,y;
@@ -1689,7 +1703,7 @@ MONTHCAL_Paint(MONTHCAL_INFO *infoPtr, WPARAM wParam)
 
 
 static LRESULT
-MONTHCAL_KillFocus(MONTHCAL_INFO *infoPtr)
+MONTHCAL_KillFocus(const MONTHCAL_INFO *infoPtr)
 {
   TRACE("\n");
 
@@ -1700,7 +1714,7 @@ MONTHCAL_KillFocus(MONTHCAL_INFO *infoPtr)
 
 
 static LRESULT
-MONTHCAL_SetFocus(MONTHCAL_INFO *infoPtr)
+MONTHCAL_SetFocus(const MONTHCAL_INFO *infoPtr)
 {
   TRACE("\n");
 
@@ -1817,7 +1831,7 @@ static LRESULT MONTHCAL_Size(MONTHCAL_INFO *infoPtr, int Width, int Height)
   return 0;
 }
 
-static LRESULT MONTHCAL_GetFont(MONTHCAL_INFO *infoPtr)
+static LRESULT MONTHCAL_GetFont(const MONTHCAL_INFO *infoPtr)
 {
     return (LRESULT)infoPtr->hFont;
 }
@@ -1843,7 +1857,7 @@ static LRESULT MONTHCAL_SetFont(MONTHCAL_INFO *infoPtr, HFONT hFont, BOOL redraw
 }
 
 /* update theme after a WM_THEMECHANGED message */
-static LRESULT theme_changed (MONTHCAL_INFO* infoPtr)
+static LRESULT theme_changed (const MONTHCAL_INFO* infoPtr)
 {
     HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
     CloseThemeData (theme);
@@ -1875,6 +1889,7 @@ MONTHCAL_Create(HWND hwnd, WPARAM wParam, LPARAM lParam)
   /* FIXME: calculate systemtime ->> localtime(substract timezoneinfo) */
 
   GetLocalTime(&infoPtr->todaysDate);
+  infoPtr->firstDayHighWord = FALSE;
   MONTHCAL_SetFirstDayOfWeek(infoPtr, (LPARAM)-1);
   infoPtr->currentMonth = infoPtr->todaysDate.wMonth;
   infoPtr->currentYear = infoPtr->todaysDate.wYear;
index 04fb6d2..5fccc49 100644 (file)
@@ -93,7 +93,7 @@ typedef struct
 #define REPEAT_DELAY     50
 
 static void
-PAGER_GetButtonRects(PAGER_INFO* infoPtr, RECT* prcTopLeft, RECT* prcBottomRight, BOOL bClientCoords)
+PAGER_GetButtonRects(const PAGER_INFO* infoPtr, RECT* prcTopLeft, RECT* prcBottomRight, BOOL bClientCoords)
 {
     RECT rcWindow;
     GetWindowRect (infoPtr->hwndSelf, &rcWindow);
@@ -299,7 +299,7 @@ PAGER_ForwardMouse (PAGER_INFO* infoPtr, BOOL bFwd)
 }
 
 static inline LRESULT
-PAGER_GetButtonState (PAGER_INFO* infoPtr, INT btn)
+PAGER_GetButtonState (const PAGER_INFO* infoPtr, INT btn)
 {
     LRESULT btnState = PGF_INVISIBLE;
     TRACE("[%p]\n", infoPtr->hwndSelf);
@@ -314,35 +314,35 @@ PAGER_GetButtonState (PAGER_INFO* infoPtr, INT btn)
 
 
 static inline INT
-PAGER_GetPos(PAGER_INFO *infoPtr)
+PAGER_GetPos(const PAGER_INFO *infoPtr)
 {
     TRACE("[%p] returns %d\n", infoPtr->hwndSelf, infoPtr->nPos);
     return infoPtr->nPos;
 }
 
 static inline INT
-PAGER_GetButtonSize(PAGER_INFO *infoPtr)
+PAGER_GetButtonSize(const PAGER_INFO *infoPtr)
 {
     TRACE("[%p] returns %d\n", infoPtr->hwndSelf, infoPtr->nButtonSize);
     return infoPtr->nButtonSize;
 }
 
 static inline INT
-PAGER_GetBorder(PAGER_INFO *infoPtr)
+PAGER_GetBorder(const PAGER_INFO *infoPtr)
 {
     TRACE("[%p] returns %d\n", infoPtr->hwndSelf, infoPtr->nBorder);
     return infoPtr->nBorder;
 }
 
 static inline COLORREF
-PAGER_GetBkColor(PAGER_INFO *infoPtr)
+PAGER_GetBkColor(const PAGER_INFO *infoPtr)
 {
     TRACE("[%p] returns %06x\n", infoPtr->hwndSelf, infoPtr->clrBk);
     return infoPtr->clrBk;
 }
 
 static void
-PAGER_CalcSize (PAGER_INFO *infoPtr, INT* size, BOOL getWidth)
+PAGER_CalcSize (const PAGER_INFO *infoPtr, INT* size, BOOL getWidth)
 {
     NMPGCALCSIZE nmpgcs;
     ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE));
@@ -783,7 +783,7 @@ PAGER_Scroll(PAGER_INFO* infoPtr, INT dir)
 }
 
 static LRESULT
-PAGER_FmtLines(PAGER_INFO *infoPtr)
+PAGER_FmtLines(const PAGER_INFO *infoPtr)
 {
     /* initiate NCCalcSize to resize client wnd and get size */
     SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0,
@@ -798,7 +798,7 @@ PAGER_FmtLines(PAGER_INFO *infoPtr)
 }
 
 static LRESULT
-PAGER_Create (HWND hwnd, LPCREATESTRUCTW lpcs)
+PAGER_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
 {
     PAGER_INFO *infoPtr;
 
@@ -898,7 +898,7 @@ PAGER_NCCalcSize(PAGER_INFO* infoPtr, WPARAM wParam, LPRECT lpRect)
 }
 
 static LRESULT
-PAGER_NCPaint (PAGER_INFO* infoPtr, HRGN hRgn)
+PAGER_NCPaint (const PAGER_INFO* infoPtr, HRGN hRgn)
 {
     RECT rcBottomRight, rcTopLeft;
     HDC hdc;
@@ -923,7 +923,7 @@ PAGER_NCPaint (PAGER_INFO* infoPtr, HRGN hRgn)
 }
 
 static INT
-PAGER_HitTest (PAGER_INFO* infoPtr, const POINT * pt)
+PAGER_HitTest (const PAGER_INFO* infoPtr, const POINT * pt)
 {
     RECT clientRect, rcTopLeft, rcBottomRight;
     POINT ptWindow;
@@ -955,7 +955,7 @@ PAGER_HitTest (PAGER_INFO* infoPtr, const POINT * pt)
 }
 
 static LRESULT
-PAGER_NCHitTest (PAGER_INFO* infoPtr, INT x, INT y)
+PAGER_NCHitTest (const PAGER_INFO* infoPtr, INT x, INT y)
 {
     POINT pt;
     INT nHit;
@@ -1203,7 +1203,7 @@ PAGER_Timer (PAGER_INFO* infoPtr, INT nTimerId)
 }
 
 static LRESULT
-PAGER_EraseBackground (PAGER_INFO* infoPtr, HDC hdc)
+PAGER_EraseBackground (const PAGER_INFO* infoPtr, HDC hdc)
 {
     POINT pt, ptorig;
     HWND parent;
@@ -1237,7 +1237,7 @@ PAGER_Size (PAGER_INFO* infoPtr, INT type, INT x, INT y)
 
 
 static LRESULT 
-PAGER_StyleChanged(PAGER_INFO *infoPtr, WPARAM wStyleType, LPSTYLESTRUCT lpss)
+PAGER_StyleChanged(PAGER_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
 {
     DWORD oldStyle = infoPtr->dwStyle;
 
index 7acf71b..5f29fc8 100644 (file)
@@ -65,7 +65,7 @@ typedef struct
 #define ID_MARQUEE_TIMER  1
 
 /* Helper to obtain size of a progress bar chunk ("led"). */
-static inline int get_led_size ( PROGRESS_INFO *infoPtr, LONG style,
+static inline int get_led_size ( const PROGRESS_INFO *infoPtr, LONG style,
                                  const RECT* rect )
 {
     HTHEME theme = GetWindowTheme (infoPtr->Self);
@@ -83,7 +83,7 @@ static inline int get_led_size ( PROGRESS_INFO *infoPtr, LONG style,
 }
 
 /* Helper to obtain gap between progress bar chunks */
-static inline int get_led_gap ( PROGRESS_INFO *infoPtr )
+static inline int get_led_gap ( const PROGRESS_INFO *infoPtr )
 {
     HTHEME theme = GetWindowTheme (infoPtr->Self);
     if (theme)
@@ -121,7 +121,7 @@ static inline int get_bar_size( LONG style, const RECT* rect )
 }
 
 /* Compute the pixel position of a progress value */
-static inline int get_bar_position( PROGRESS_INFO *infoPtr, LONG style,
+static inline int get_bar_position( const PROGRESS_INFO *infoPtr, LONG style,
                                     const RECT* rect, INT value )
 {
     return MulDiv (value - infoPtr->MinVal, get_bar_size (style, rect),
@@ -134,7 +134,7 @@ static inline int get_bar_position( PROGRESS_INFO *infoPtr, LONG style,
  * Don't be too clever about invalidating the progress bar.
  * InstallShield depends on this simple behaviour.
  */
-static void PROGRESS_Invalidate( PROGRESS_INFO *infoPtr, INT old, INT new )
+static void PROGRESS_Invalidate( const PROGRESS_INFO *infoPtr, INT old, INT new )
 {
     InvalidateRect( infoPtr->Self, NULL, old > new );
 }
index 7738898..8168895 100644 (file)
@@ -167,7 +167,7 @@ static BOOL PROPSHEET_SetCurSel(HWND hwndDlg,
                                 int index,
                                 int skipdir,
                                 HPROPSHEETPAGE hpage);
-static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, PropSheetInfo* psInfo);
+static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, const PropSheetInfo* psInfo);
 static PADDING_INFO PROPSHEET_GetPaddingInfoWizard(HWND hwndDlg, const PropSheetInfo* psInfo);
 static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID);
 
@@ -252,7 +252,7 @@ static void PROPSHEET_GetPageRect(const PropSheetInfo * psInfo, HWND hwndDlg,
  *
  * Find page index corresponding to page resource id.
  */
-static INT PROPSHEET_FindPageByResId(PropSheetInfo * psInfo, LRESULT resId)
+static INT PROPSHEET_FindPageByResId(const PropSheetInfo * psInfo, LRESULT resId)
 {
    INT i;
 
@@ -700,7 +700,7 @@ static INT_PTR PROPSHEET_CreateDialog(PropSheetInfo* psInfo)
  *     Verify that the tab control and the "largest" property sheet page dlg. template
  *     match in size.
  */
-static BOOL PROPSHEET_SizeMismatch(HWND hwndDlg, PropSheetInfo* psInfo)
+static BOOL PROPSHEET_SizeMismatch(HWND hwndDlg, const PropSheetInfo* psInfo)
 {
   HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
   RECT rcOrigTab, rcPage;
@@ -819,7 +819,7 @@ static BOOL PROPSHEET_AdjustSize(HWND hwndDlg, PropSheetInfo* psInfo)
  *
  * Resizes the property sheet to fit the largest page.
  */
-static BOOL PROPSHEET_AdjustSizeWizard(HWND hwndDlg, PropSheetInfo* psInfo)
+static BOOL PROPSHEET_AdjustSizeWizard(HWND hwndDlg, const PropSheetInfo* psInfo)
 {
   HWND hwndLine = GetDlgItem(hwndDlg, IDC_SUNKEN_LINE);
   RECT rc, lineRect, dialogRect;
@@ -856,7 +856,7 @@ static BOOL PROPSHEET_AdjustSizeWizard(HWND hwndDlg, PropSheetInfo* psInfo)
  *
  * Adjusts the buttons' positions.
  */
-static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, PropSheetInfo* psInfo)
+static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, const PropSheetInfo* psInfo)
 {
   HWND hwndButton = GetDlgItem(hwndParent, IDOK);
   RECT rcSheet;
@@ -955,7 +955,7 @@ static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, PropSheetInfo* psInfo)
  * Adjusts the buttons' positions.
  */
 static BOOL PROPSHEET_AdjustButtonsWizard(HWND hwndParent,
-                                          PropSheetInfo* psInfo)
+                                          const PropSheetInfo* psInfo)
 {
   HWND hwndButton = GetDlgItem(hwndParent, IDCANCEL);
   HWND hwndLine = GetDlgItem(hwndParent, IDC_SUNKEN_LINE);
@@ -1173,7 +1173,7 @@ static PADDING_INFO PROPSHEET_GetPaddingInfoWizard(HWND hwndDlg, const PropSheet
  * Insert the tabs in the tab control.
  */
 static BOOL PROPSHEET_CreateTabControl(HWND hwndParent,
-                                       PropSheetInfo * psInfo)
+                                       const PropSheetInfo * psInfo)
 {
   HWND hwndTabCtrl = GetDlgItem(hwndParent, IDC_TABCONTROL);
   TCITEMW item;
@@ -2023,6 +2023,11 @@ static BOOL PROPSHEET_SetCurSel(HWND hwndDlg,
     return FALSE;
   }
 
+  /* unset active page while doing this transition. */
+  if (psInfo->active_page != -1)
+     ShowWindow(psInfo->proppage[psInfo->active_page].hwndPage, SW_HIDE);
+  psInfo->active_page = -1;
+
   while (1) {
     int result;
     PSHNOTIFY psn;
@@ -2704,7 +2709,7 @@ static BOOL PROPSHEET_RecalcPageSizes(HWND hwndDlg)
  * Given a HPROPSHEETPAGE, returns the index of the corresponding page from
  * the array of PropPageInfo.
  */
-static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, PropSheetInfo* psInfo)
+static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, const PropSheetInfo* psInfo)
 {
   BOOL found = FALSE;
   int index = 0;
@@ -2780,7 +2785,7 @@ static void PROPSHEET_CleanUp(HWND hwndDlg)
   GlobalFree((HGLOBAL)psInfo);
 }
 
-static INT do_loop(PropSheetInfo *psInfo)
+static INT do_loop(const PropSheetInfo *psInfo)
 {
     MSG msg;
     INT ret = -1;
@@ -3261,6 +3266,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam)
     WCHAR szBuffer[256];
     int nLength;
 
+    if (psInfo->active_page < 0) return 1;
     hdc = hdcParam ? hdcParam : BeginPaint(hwnd, &ps);
     if (!hdc) return 1;
 
index e7a1e1b..6d4e869 100644 (file)
@@ -326,7 +326,7 @@ REBAR_FmtMask( UINT mask)
 
 
 static VOID
-REBAR_DumpBandInfo(LPREBARBANDINFOW pB)
+REBAR_DumpBandInfo(const REBARBANDINFOW *pB)
 {
     if( !TRACE_ON(rebar) ) return;
     TRACE("band info: ");
@@ -359,7 +359,7 @@ REBAR_DumpBandInfo(LPREBARBANDINFOW pB)
 }
 
 static VOID
-REBAR_DumpBand (REBAR_INFO *iP)
+REBAR_DumpBand (const REBAR_INFO *iP)
 {
     REBAR_BAND *pB;
     UINT i;
@@ -423,7 +423,7 @@ REBAR_DumpBand (REBAR_INFO *iP)
 }
 
 /* dest can be equal to src */
-static void translate_rect(REBAR_INFO *infoPtr, RECT *dest, const RECT *src)
+static void translate_rect(const REBAR_INFO *infoPtr, RECT *dest, const RECT *src)
 {
     if (infoPtr->dwStyle & CCS_VERT) {
         int tmp;
@@ -439,14 +439,14 @@ static void translate_rect(REBAR_INFO *infoPtr, RECT *dest, const RECT *src)
     }
 }
 
-static int get_rect_cx(REBAR_INFO *infoPtr, RECT *lpRect)
+static int get_rect_cx(const REBAR_INFO *infoPtr, const RECT *lpRect)
 {
     if (infoPtr->dwStyle & CCS_VERT)
         return lpRect->bottom - lpRect->top;
     return lpRect->right - lpRect->left;
 }
 
-static int get_rect_cy(REBAR_INFO *infoPtr, RECT *lpRect)
+static int get_rect_cy(const REBAR_INFO *infoPtr, const RECT *lpRect)
 {
     if (infoPtr->dwStyle & CCS_VERT)
         return lpRect->right - lpRect->left;
@@ -485,7 +485,7 @@ REBAR_DrawChevron (HDC hdc, INT left, INT top, INT colorRef)
 }
 
 static HWND
-REBAR_GetNotifyParent (REBAR_INFO *infoPtr)
+REBAR_GetNotifyParent (const REBAR_INFO *infoPtr)
 {
     HWND parent, owner;
 
@@ -500,7 +500,7 @@ REBAR_GetNotifyParent (REBAR_INFO *infoPtr)
 
 
 static INT
-REBAR_Notify (NMHDR *nmhdr, REBAR_INFO *infoPtr, UINT code)
+REBAR_Notify (NMHDR *nmhdr, const REBAR_INFO *infoPtr, UINT code)
 {
     HWND parent;
 
@@ -515,7 +515,7 @@ REBAR_Notify (NMHDR *nmhdr, REBAR_INFO *infoPtr, UINT code)
 }
 
 static INT
-REBAR_Notify_NMREBAR (REBAR_INFO *infoPtr, UINT uBand, UINT code)
+REBAR_Notify_NMREBAR (const REBAR_INFO *infoPtr, UINT uBand, UINT code)
 {
     NMREBAR notify_rebar;
     REBAR_BAND *lpBand;
@@ -541,7 +541,7 @@ REBAR_Notify_NMREBAR (REBAR_INFO *infoPtr, UINT uBand, UINT code)
 }
 
 static VOID
-REBAR_DrawBand (HDC hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
+REBAR_DrawBand (HDC hdc, const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
 {
     HFONT hOldFont = 0;
     INT oldBkMode = 0;
@@ -667,7 +667,7 @@ REBAR_DrawBand (HDC hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
 
 
 static VOID
-REBAR_Refresh (REBAR_INFO *infoPtr, HDC hdc)
+REBAR_Refresh (const REBAR_INFO *infoPtr, HDC hdc)
 {
     REBAR_BAND *lpBand;
     UINT i;
@@ -689,7 +689,7 @@ REBAR_Refresh (REBAR_INFO *infoPtr, HDC hdc)
 
 
 static void
-REBAR_CalcHorzBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend)
+REBAR_CalcHorzBand (const REBAR_INFO *infoPtr, UINT rstart, UINT rend)
      /* Function: this routine initializes all the rectangles in */
      /*  each band in a row to fit in the adjusted rcBand rect.  */
      /* *** Supports only Horizontal bars. ***                   */
@@ -798,7 +798,7 @@ REBAR_CalcHorzBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend)
 
 
 static VOID
-REBAR_CalcVertBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend)
+REBAR_CalcVertBand (const REBAR_INFO *infoPtr, UINT rstart, UINT rend)
      /* Function: this routine initializes all the rectangles in */
      /*  each band in a row to fit in the adjusted rcBand rect.  */
      /* *** Supports only Vertical bars. ***                     */
@@ -986,7 +986,7 @@ REBAR_ForceResize (REBAR_INFO *infoPtr)
 
 
 static VOID
-REBAR_MoveChildWindows (REBAR_INFO *infoPtr, UINT start, UINT endplus)
+REBAR_MoveChildWindows (const REBAR_INFO *infoPtr, UINT start, UINT endplus)
 {
     static const WCHAR strComboBox[] = { 'C','o','m','b','o','B','o','x',0 };
     REBAR_BAND *lpBand;
@@ -1096,7 +1096,7 @@ REBAR_MoveChildWindows (REBAR_INFO *infoPtr, UINT start, UINT endplus)
 
 }
 
-static int next_band(REBAR_INFO *infoPtr, int i)
+static int next_band(const REBAR_INFO *infoPtr, int i)
 {
     int n;
     for (n = i + 1; n < infoPtr->uNumBands; n++)
@@ -1105,7 +1105,7 @@ static int next_band(REBAR_INFO *infoPtr, int i)
     return n;
 }
 
-static int prev_band(REBAR_INFO *infoPtr, int i)
+static int prev_band(const REBAR_INFO *infoPtr, int i)
 {
     int n;
     for (n = i - 1; n >= 0; n--)
@@ -1114,7 +1114,7 @@ static int prev_band(REBAR_INFO *infoPtr, int i)
     return n;
 }
 
-static int get_row_begin_for_band(REBAR_INFO *infoPtr, INT iBand)
+static int get_row_begin_for_band(const REBAR_INFO *infoPtr, INT iBand)
 {
     int iLastBand = iBand;
     int iRow = infoPtr->bands[iBand].iRow;
@@ -1127,7 +1127,7 @@ static int get_row_begin_for_band(REBAR_INFO *infoPtr, INT iBand)
     return iLastBand;
 }
 
-static int get_row_end_for_band(REBAR_INFO *infoPtr, INT iBand)
+static int get_row_end_for_band(const REBAR_INFO *infoPtr, INT iBand)
 {
     int iRow = infoPtr->bands[iBand].iRow;
     while ((iBand = next_band(infoPtr, iBand)) < infoPtr->uNumBands)
@@ -1136,7 +1136,7 @@ static int get_row_end_for_band(REBAR_INFO *infoPtr, INT iBand)
     return iBand;
 }
 
-static void REBAR_SetRowRectsX(REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand)
+static void REBAR_SetRowRectsX(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand)
 {
     int xPos = 0, i;
     for (i = iBeginBand; i < iEndBand; i = next_band(infoPtr, i))
@@ -1160,7 +1160,7 @@ static void REBAR_SetRowRectsX(REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand
  * For some reason "big enough" is defined as bigger than the minimum size of the
  * first band in the row
  */
-static REBAR_BAND *REBAR_FindBandToGrow(REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand)
+static REBAR_BAND *REBAR_FindBandToGrow(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand)
 {
     INT iLcx = 0, i;
 
@@ -1179,7 +1179,7 @@ static REBAR_BAND *REBAR_FindBandToGrow(REBAR_INFO *infoPtr, INT iBeginBand, INT
     return &infoPtr->bands[i];
 }
 
-static int REBAR_ShrinkBandsRTL(REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT cxShrink, BOOL bEnforce)
+static int REBAR_ShrinkBandsRTL(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT cxShrink, BOOL bEnforce)
 {
     REBAR_BAND *lpBand;
     INT width, i;
@@ -1201,7 +1201,7 @@ static int REBAR_ShrinkBandsRTL(REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBan
 }
 
 
-static int REBAR_ShrinkBandsLTR(REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT cxShrink, BOOL bEnforce)
+static int REBAR_ShrinkBandsLTR(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT cxShrink, BOOL bEnforce)
 {
     REBAR_BAND *lpBand;
     INT width, i;
@@ -1222,7 +1222,7 @@ static int REBAR_ShrinkBandsLTR(REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBan
     return cxShrink;
 }
 
-static int REBAR_SetBandsHeight(REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT yStart)
+static int REBAR_SetBandsHeight(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT yStart)
 {
     REBAR_BAND *lpBand;
     int yMaxHeight = 0;
@@ -1255,7 +1255,7 @@ static int REBAR_SetBandsHeight(REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBan
     return yPos + yMaxHeight;
 }
 
-static void REBAR_LayoutRow(REBAR_INFO *infoPtr, int iBeginBand, int iEndBand, int cx, int *piRow, int *pyPos)
+static void REBAR_LayoutRow(const REBAR_INFO *infoPtr, int iBeginBand, int iEndBand, int cx, int *piRow, int *pyPos)
 {
     REBAR_BAND *lpBand;
     int i, extra;
@@ -1298,7 +1298,7 @@ static void REBAR_LayoutRow(REBAR_INFO *infoPtr, int iBeginBand, int iEndBand, i
 }
 
 static VOID
-REBAR_Layout(REBAR_INFO *infoPtr, LPRECT lpRect)
+REBAR_Layout(REBAR_INFO *infoPtr, const RECT *lpRect)
 {
     REBAR_BAND *lpBand;
     RECT rcAdj;
@@ -1387,7 +1387,7 @@ REBAR_Layout(REBAR_INFO *infoPtr, LPRECT lpRect)
 
 
 static VOID
-REBAR_ValidateBand (REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
+REBAR_ValidateBand (const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
      /* Function:  This routine evaluates the band specs supplied */
      /*  by the user and updates the following 5 fields in        */
      /*  the internal band structure: cxHeader, lcx, lcy, hcx, hcy*/
@@ -1508,7 +1508,7 @@ REBAR_ValidateBand (REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
 }
 
 static BOOL
-REBAR_CommonSetupBand(HWND hwnd, LPREBARBANDINFOW lprbbi, REBAR_BAND *lpBand)
+REBAR_CommonSetupBand(HWND hwnd, const REBARBANDINFOW *lprbbi, REBAR_BAND *lpBand)
      /* Function:  This routine copies the supplied values from   */
      /*  user input (lprbbi) to the internal band structure.      */
      /*  It returns true if something changed and false if not.   */
@@ -1640,7 +1640,7 @@ REBAR_CommonSetupBand(HWND hwnd, LPREBARBANDINFOW lprbbi, REBAR_BAND *lpBand)
 }
 
 static LRESULT
-REBAR_InternalEraseBkGnd (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, RECT *clip)
+REBAR_InternalEraseBkGnd (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, const RECT *clip)
      /* Function:  This erases the background rectangle by drawing  */
      /*  each band with its background color (or the default) and   */
      /*  draws each bands right separator if necessary. The row     */
@@ -1762,7 +1762,7 @@ REBAR_InternalEraseBkGnd (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, REC
 }
 
 static void
-REBAR_InternalHitTest (REBAR_INFO *infoPtr, const POINT *lpPt, UINT *pFlags, INT *pBand)
+REBAR_InternalHitTest (const REBAR_INFO *infoPtr, const POINT *lpPt, UINT *pFlags, INT *pBand)
 {
     REBAR_BAND *lpBand;
     RECT rect;
@@ -1940,7 +1940,7 @@ REBAR_DeleteBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-REBAR_GetBandBorders (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_GetBandBorders (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     LPRECT lpRect = (LPRECT)lParam;
     REBAR_BAND *lpBand;
@@ -1978,8 +1978,8 @@ REBAR_GetBandBorders (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
-REBAR_GetBandCount (REBAR_INFO *infoPtr)
+static inline LRESULT
+REBAR_GetBandCount (const REBAR_INFO *infoPtr)
 {
     TRACE("band count %u!\n", infoPtr->uNumBands);
 
@@ -1988,7 +1988,7 @@ REBAR_GetBandCount (REBAR_INFO *infoPtr)
 
 
 static LRESULT
-REBAR_GetBandInfoT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode)
+REBAR_GetBandInfoT(const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode)
 {
     LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam;
     REBAR_BAND *lpBand;
@@ -2068,7 +2068,7 @@ REBAR_GetBandInfoT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnic
 
 
 static LRESULT
-REBAR_GetBarHeight (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_GetBarHeight (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     INT nHeight;
 
@@ -2081,7 +2081,7 @@ REBAR_GetBarHeight (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-REBAR_GetBarInfo (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_GetBarInfo (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     LPREBARINFO lpInfo = (LPREBARINFO)lParam;
 
@@ -2102,8 +2102,8 @@ REBAR_GetBarInfo (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
-REBAR_GetBkColor (REBAR_INFO *infoPtr)
+static inline LRESULT
+REBAR_GetBkColor (const REBAR_INFO *infoPtr)
 {
     COLORREF clr = infoPtr->clrBk;
 
@@ -2121,7 +2121,7 @@ REBAR_GetBkColor (REBAR_INFO *infoPtr)
 
 
 static LRESULT
-REBAR_GetPalette (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_GetPalette (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     FIXME("empty stub!\n");
 
@@ -2130,7 +2130,7 @@ REBAR_GetPalette (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-REBAR_GetRect (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_GetRect (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     INT iBand = (INT)wParam;
     LPRECT lprc = (LPRECT)lParam;
@@ -2152,8 +2152,8 @@ REBAR_GetRect (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
-REBAR_GetRowCount (REBAR_INFO *infoPtr)
+static inline LRESULT
+REBAR_GetRowCount (const REBAR_INFO *infoPtr)
 {
     TRACE("%u\n", infoPtr->uNumRows);
 
@@ -2162,7 +2162,7 @@ REBAR_GetRowCount (REBAR_INFO *infoPtr)
 
 
 static LRESULT
-REBAR_GetRowHeight (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_GetRowHeight (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     INT iRow = (INT)wParam;
     int j = 0, ret = 0;
@@ -2183,8 +2183,8 @@ REBAR_GetRowHeight (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
-REBAR_GetTextColor (REBAR_INFO *infoPtr)
+static inline LRESULT
+REBAR_GetTextColor (const REBAR_INFO *infoPtr)
 {
     TRACE("text color 0x%06x!\n", infoPtr->clrText);
 
@@ -2192,15 +2192,15 @@ REBAR_GetTextColor (REBAR_INFO *infoPtr)
 }
 
 
-inline static LRESULT
-REBAR_GetToolTips (REBAR_INFO *infoPtr)
+static inline LRESULT
+REBAR_GetToolTips (const REBAR_INFO *infoPtr)
 {
     return (LRESULT)infoPtr->hwndToolTip;
 }
 
 
-inline static LRESULT
-REBAR_GetUnicodeFormat (REBAR_INFO *infoPtr)
+static inline LRESULT
+REBAR_GetUnicodeFormat (const REBAR_INFO *infoPtr)
 {
     TRACE("%s hwnd=%p\n",
          infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf);
@@ -2209,8 +2209,8 @@ REBAR_GetUnicodeFormat (REBAR_INFO *infoPtr)
 }
 
 
-inline static LRESULT
-REBAR_GetVersion (REBAR_INFO *infoPtr)
+static inline LRESULT
+REBAR_GetVersion (const REBAR_INFO *infoPtr)
 {
     TRACE("version %d\n", infoPtr->iVersion);
     return infoPtr->iVersion;
@@ -2218,7 +2218,7 @@ REBAR_GetVersion (REBAR_INFO *infoPtr)
 
 
 static LRESULT
-REBAR_HitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_HitTest (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam;
 
@@ -2232,7 +2232,7 @@ REBAR_HitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-REBAR_IdToIndex (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_IdToIndex (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     UINT i;
 
@@ -2311,7 +2311,7 @@ REBAR_InsertBandT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnico
 
 
 static LRESULT
-REBAR_MaximizeBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_MaximizeBand (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     REBAR_BAND *lpBand;
     UINT uBand = (UINT) wParam;
@@ -2359,7 +2359,7 @@ REBAR_MaximizeBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-REBAR_MinimizeBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_MinimizeBand (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     REBAR_BAND *lpBand;
     UINT uBand = (UINT) wParam;
@@ -2619,7 +2619,7 @@ REBAR_SetTextColor (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 /* << REBAR_SetTooltips >> */
 
 
-inline static LRESULT
+static inline LRESULT
 REBAR_SetUnicodeFormat (REBAR_INFO *infoPtr, WPARAM wParam)
 {
     BOOL bTemp = infoPtr->bUnicode;
@@ -2778,7 +2778,7 @@ REBAR_Destroy (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-REBAR_EraseBkGnd (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_EraseBkGnd (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     RECT cliprect;
 
@@ -2789,13 +2789,13 @@ REBAR_EraseBkGnd (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-REBAR_GetFont (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_GetFont (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     return (LRESULT)infoPtr->hFont;
 }
 
 static LRESULT
-REBAR_PushChevron(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_PushChevron(const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     if (wParam >= 0 && (UINT)wParam < infoPtr->uNumBands)
     {
@@ -2999,8 +2999,8 @@ REBAR_MouseMove (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
-REBAR_NCCalcSize (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+static inline LRESULT
+REBAR_NCCalcSize (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     HTHEME theme;
     RECT *rect = (RECT *)lParam;
@@ -3116,7 +3116,7 @@ REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-REBAR_NCHitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_NCHitTest (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     NMMOUSE nmmouse;
     POINT clpt;
@@ -3151,7 +3151,7 @@ REBAR_NCHitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-REBAR_NCPaint (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_NCPaint (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     RECT rcWindow;
     HDC hdc;
@@ -3211,7 +3211,7 @@ REBAR_NotifyFormat (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-REBAR_Paint (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_Paint (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     HDC hdc;
     PAINTSTRUCT ps;
@@ -3238,7 +3238,7 @@ REBAR_Paint (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-REBAR_SetCursor (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_SetCursor (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     POINT pt;
     UINT  flags;
@@ -3283,7 +3283,7 @@ REBAR_SetFont (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 REBAR_SetRedraw (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
      /*****************************************************
       *
@@ -3376,7 +3376,7 @@ static LRESULT theme_changed (REBAR_INFO* infoPtr)
 }
 
 static LRESULT
-REBAR_WindowPosChanged (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+REBAR_WindowPosChanged (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     LRESULT ret;
     RECT rc;
index 4c57ea9..e71fac3 100644 (file)
@@ -68,7 +68,7 @@ typedef struct tagSMOOTHSCROLLSTRUCT {
  *     Currently only scrolls ONCE. The comctl32 implementation uses GetTickCount
  *     and what else to do smooth scrolling.
  */
-BOOL WINAPI SmoothScrollWindow( SMOOTHSCROLLSTRUCT *smooth ) {
+BOOL WINAPI SmoothScrollWindow( const SMOOTHSCROLLSTRUCT *smooth ) {
    LPRECT      lpupdaterect = smooth->lpupdaterect;
    HRGN                hrgnupdate = smooth->hrgnupdate;
    RECT                tmprect;
index 82c784d..522123c 100644 (file)
@@ -168,7 +168,7 @@ STATUSBAR_DrawSizeGrip (HTHEME theme, HDC hdc, LPRECT lpRect)
 
 
 static void
-STATUSBAR_DrawPart (STATUS_INFO *infoPtr, HDC hdc, STATUSWINDOWPART *part, int itemID)
+STATUSBAR_DrawPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART *part, int itemID)
 {
     RECT r = part->bound;
     UINT border = BDR_SUNKENOUTER;
@@ -215,7 +215,7 @@ STATUSBAR_DrawPart (STATUS_INFO *infoPtr, HDC hdc, STATUSWINDOWPART *part, int i
 
 
 static void
-STATUSBAR_RefreshPart (STATUS_INFO *infoPtr, HDC hdc, STATUSWINDOWPART *part, int itemID)
+STATUSBAR_RefreshPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART *part, int itemID)
 {
     HBRUSH hbrBk;
     HFONT  hOldFont;
@@ -357,7 +357,7 @@ STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr)
 
 
 static LRESULT
-STATUSBAR_Relay2Tip (STATUS_INFO *infoPtr, UINT uMsg,
+STATUSBAR_Relay2Tip (const STATUS_INFO *infoPtr, UINT uMsg,
                     WPARAM wParam, LPARAM lParam)
 {
     MSG msg;
@@ -375,7 +375,7 @@ STATUSBAR_Relay2Tip (STATUS_INFO *infoPtr, UINT uMsg,
 
 
 static BOOL
-STATUSBAR_GetBorders (STATUS_INFO *infoPtr, INT out[])
+STATUSBAR_GetBorders (const STATUS_INFO *infoPtr, INT out[])
 {
     TRACE("\n");
     out[0] = infoPtr->horizontalBorder;
@@ -387,7 +387,7 @@ STATUSBAR_GetBorders (STATUS_INFO *infoPtr, INT out[])
 
 
 static BOOL
-STATUSBAR_SetBorders (STATUS_INFO *infoPtr, INT in[])
+STATUSBAR_SetBorders (STATUS_INFO *infoPtr, const INT in[])
 {
     TRACE("\n");
     infoPtr->horizontalBorder = in[0];
@@ -400,7 +400,7 @@ STATUSBAR_SetBorders (STATUS_INFO *infoPtr, INT in[])
 
 
 static HICON
-STATUSBAR_GetIcon (STATUS_INFO *infoPtr, INT nPart)
+STATUSBAR_GetIcon (const STATUS_INFO *infoPtr, INT nPart)
 {
     TRACE("%d\n", nPart);
     /* MSDN says: "simple parts are indexed with -1" */
@@ -415,7 +415,7 @@ STATUSBAR_GetIcon (STATUS_INFO *infoPtr, INT nPart)
 
 
 static INT
-STATUSBAR_GetParts (STATUS_INFO *infoPtr, INT num_parts, INT parts[])
+STATUSBAR_GetParts (const STATUS_INFO *infoPtr, INT num_parts, INT parts[])
 {
     INT   i;
 
@@ -430,7 +430,7 @@ STATUSBAR_GetParts (STATUS_INFO *infoPtr, INT num_parts, INT parts[])
 
 
 static BOOL
-STATUSBAR_GetRect (STATUS_INFO *infoPtr, INT nPart, LPRECT rect)
+STATUSBAR_GetRect (const STATUS_INFO *infoPtr, INT nPart, LPRECT rect)
 {
     TRACE("part %d\n", nPart);
     if(nPart >= infoPtr->numParts || nPart < 0)
@@ -524,7 +524,7 @@ STATUSBAR_GetTextLength (STATUS_INFO *infoPtr, INT nPart)
 }
 
 static LRESULT
-STATUSBAR_GetTipTextA (STATUS_INFO *infoPtr, INT id, LPSTR tip, INT size)
+STATUSBAR_GetTipTextA (const STATUS_INFO *infoPtr, INT id, LPSTR tip, INT size)
 {
     TRACE("\n");
     if (tip) {
@@ -546,7 +546,7 @@ STATUSBAR_GetTipTextA (STATUS_INFO *infoPtr, INT id, LPSTR tip, INT size)
 
 
 static LRESULT
-STATUSBAR_GetTipTextW (STATUS_INFO *infoPtr, INT id, LPWSTR tip, INT size)
+STATUSBAR_GetTipTextW (const STATUS_INFO *infoPtr, INT id, LPWSTR tip, INT size)
 {
     TRACE("\n");
     if (tip) {
@@ -793,7 +793,7 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
 
 
 static LRESULT
-STATUSBAR_SetTipTextA (STATUS_INFO *infoPtr, INT id, LPSTR text)
+STATUSBAR_SetTipTextA (const STATUS_INFO *infoPtr, INT id, LPSTR text)
 {
     TRACE("part %d: \"%s\"\n", id, text);
     if (infoPtr->hwndToolTip) {
@@ -811,7 +811,7 @@ STATUSBAR_SetTipTextA (STATUS_INFO *infoPtr, INT id, LPSTR text)
 
 
 static LRESULT
-STATUSBAR_SetTipTextW (STATUS_INFO *infoPtr, INT id, LPWSTR text)
+STATUSBAR_SetTipTextW (const STATUS_INFO *infoPtr, INT id, LPWSTR text)
 {
     TRACE("part %d: \"%s\"\n", id, debugstr_w(text));
     if (infoPtr->hwndToolTip) {
@@ -828,7 +828,7 @@ STATUSBAR_SetTipTextW (STATUS_INFO *infoPtr, INT id, LPWSTR text)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 STATUSBAR_SetUnicodeFormat (STATUS_INFO *infoPtr, BOOL bUnicode)
 {
     BOOL bOld = infoPtr->bUnicode;
@@ -892,7 +892,7 @@ STATUSBAR_WMDestroy (STATUS_INFO *infoPtr)
 
 
 static LRESULT
-STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
+STATUSBAR_WMCreate (HWND hwnd, const CREATESTRUCTA *lpCreate)
 {
     STATUS_INFO *infoPtr;
     NONCLIENTMETRICSW nclm;
@@ -1048,7 +1048,7 @@ create_fail:
 /* in contrast to SB_GETTEXT*, WM_GETTEXT handles the text
  * of the first part only (usual behaviour) */
 static INT
-STATUSBAR_WMGetText (STATUS_INFO *infoPtr, INT size, LPWSTR buf)
+STATUSBAR_WMGetText (const STATUS_INFO *infoPtr, INT size, LPWSTR buf)
 {
     INT len;
 
@@ -1074,7 +1074,7 @@ STATUSBAR_WMGetText (STATUS_INFO *infoPtr, INT size, LPWSTR buf)
 
 
 static BOOL
-STATUSBAR_WMNCHitTest (STATUS_INFO *infoPtr, INT x, INT y)
+STATUSBAR_WMNCHitTest (const STATUS_INFO *infoPtr, INT x, INT y)
 {
     if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) {
        RECT  rect;
@@ -1125,7 +1125,7 @@ STATUSBAR_WMSetFont (STATUS_INFO *infoPtr, HFONT font, BOOL redraw)
 
 
 static BOOL
-STATUSBAR_WMSetText (STATUS_INFO *infoPtr, LPCSTR text)
+STATUSBAR_WMSetText (const STATUS_INFO *infoPtr, LPCSTR text)
 {
     STATUSWINDOWPART *part;
     int len;
@@ -1190,7 +1190,7 @@ STATUSBAR_WMSize (STATUS_INFO *infoPtr, WORD flags)
 
 
 /* update theme after a WM_THEMECHANGED message */
-static LRESULT theme_changed (STATUS_INFO* infoPtr)
+static LRESULT theme_changed (const STATUS_INFO* infoPtr)
 {
     HTHEME theme = GetWindowTheme (infoPtr->Self);
     CloseThemeData (theme);
@@ -1211,7 +1211,7 @@ STATUSBAR_NotifyFormat (STATUS_INFO *infoPtr, HWND from, INT cmd)
 
 
 static LRESULT
-STATUSBAR_SendNotify (STATUS_INFO *infoPtr, UINT code)
+STATUSBAR_SendNotify (const STATUS_INFO *infoPtr, UINT code)
 {
     NMHDR  nmhdr;
 
index 33effbd..00f72ad 100644 (file)
@@ -427,7 +427,7 @@ LPSTR WINAPI StrStrIA(LPCSTR lpszStr, LPCSTR lpszSearch)
  *   The signed integer value represented by the string, or 0 if no integer is
  *   present.
  */
-INT WINAPI StrToIntA (LPSTR lpszStr)
+INT WINAPI StrToIntA (LPCSTR lpszStr)
 {
     return atoi(lpszStr);
 }
@@ -449,7 +449,7 @@ LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
  *
  * See StrToIntA.
  */
-INT WINAPI StrToIntW (LPWSTR lpString)
+INT WINAPI StrToIntW (LPCWSTR lpString)
 {
     return atoiW(lpString);
 }
index fcf253d..1d90b5c 100644 (file)
@@ -472,7 +472,7 @@ CheckParameter:
  * SYSLINK_RepaintLink
  * Repaints a link.
  */
-static VOID SYSLINK_RepaintLink (SYSLINK_INFO *infoPtr, PDOC_ITEM DocItem)
+static VOID SYSLINK_RepaintLink (const SYSLINK_INFO *infoPtr, const DOC_ITEM *DocItem)
 {
     PDOC_TEXTBLOCK bl;
     int n;
@@ -501,7 +501,7 @@ static VOID SYSLINK_RepaintLink (SYSLINK_INFO *infoPtr, PDOC_ITEM DocItem)
  * SYSLINK_GetLinkItemByIndex
  * Retrieves a document link by its index
  */
-static PDOC_ITEM SYSLINK_GetLinkItemByIndex (SYSLINK_INFO *infoPtr, int iLink)
+static PDOC_ITEM SYSLINK_GetLinkItemByIndex (const SYSLINK_INFO *infoPtr, int iLink)
 {
     PDOC_ITEM Current = infoPtr->Items;
 
@@ -520,7 +520,7 @@ static PDOC_ITEM SYSLINK_GetLinkItemByIndex (SYSLINK_INFO *infoPtr, int iLink)
  * SYSLINK_GetFocusLink
  * Retrieves the link that has the LIS_FOCUSED bit
  */
-static PDOC_ITEM SYSLINK_GetFocusLink (SYSLINK_INFO *infoPtr, int *LinkId)
+static PDOC_ITEM SYSLINK_GetFocusLink (const SYSLINK_INFO *infoPtr, int *LinkId)
 {
     PDOC_ITEM Current = infoPtr->Items;
     int id = 0;
@@ -546,7 +546,7 @@ static PDOC_ITEM SYSLINK_GetFocusLink (SYSLINK_INFO *infoPtr, int *LinkId)
  * SYSLINK_GetNextLink
  * Gets the next link
  */
-static PDOC_ITEM SYSLINK_GetNextLink (SYSLINK_INFO *infoPtr, PDOC_ITEM Current)
+static PDOC_ITEM SYSLINK_GetNextLink (const SYSLINK_INFO *infoPtr, PDOC_ITEM Current)
 {
     for(Current = (Current != NULL ? Current->Next : infoPtr->Items);
         Current != NULL;
@@ -564,7 +564,7 @@ static PDOC_ITEM SYSLINK_GetNextLink (SYSLINK_INFO *infoPtr, PDOC_ITEM Current)
  * SYSLINK_GetPrevLink
  * Gets the previous link
  */
-static PDOC_ITEM SYSLINK_GetPrevLink (SYSLINK_INFO *infoPtr, PDOC_ITEM Current)
+static PDOC_ITEM SYSLINK_GetPrevLink (const SYSLINK_INFO *infoPtr, PDOC_ITEM Current)
 {
     if(Current == NULL)
     {
@@ -643,7 +643,7 @@ static BOOL SYSLINK_WrapLine (HDC hdc, LPWSTR Text, WCHAR BreakChar, int *LineLe
  * SYSLINK_Render
  * Renders the document in memory
  */
-static VOID SYSLINK_Render (SYSLINK_INFO *infoPtr, HDC hdc, PRECT pRect)
+static VOID SYSLINK_Render (const SYSLINK_INFO *infoPtr, HDC hdc, PRECT pRect)
 {
     RECT rc;
     PDOC_ITEM Current;
@@ -824,7 +824,7 @@ static VOID SYSLINK_Render (SYSLINK_INFO *infoPtr, HDC hdc, PRECT pRect)
  * SYSLINK_Draw
  * Draws the SysLink control.
  */
-static LRESULT SYSLINK_Draw (SYSLINK_INFO *infoPtr, HDC hdc)
+static LRESULT SYSLINK_Draw (const SYSLINK_INFO *infoPtr, HDC hdc)
 {
     RECT rc;
     PDOC_ITEM Current;
@@ -894,7 +894,7 @@ static LRESULT SYSLINK_Draw (SYSLINK_INFO *infoPtr, HDC hdc)
  * SYSLINK_Paint
  * Handles the WM_PAINT message.
  */
-static LRESULT SYSLINK_Paint (SYSLINK_INFO *infoPtr, HDC hdcParam)
+static LRESULT SYSLINK_Paint (const SYSLINK_INFO *infoPtr, HDC hdcParam)
 {
     HDC hdc;
     PAINTSTRUCT ps;
@@ -1005,7 +1005,7 @@ static LRESULT SYSLINK_SetText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
  * If no document item is specified, the focus bit will be removed from all links.
  * Returns the previous focused item.
  */
-static PDOC_ITEM SYSLINK_SetFocusLink (SYSLINK_INFO *infoPtr, PDOC_ITEM DocItem)
+static PDOC_ITEM SYSLINK_SetFocusLink (const SYSLINK_INFO *infoPtr, const DOC_ITEM *DocItem)
 {
     PDOC_ITEM Current, PrevFocus = NULL;
     
@@ -1036,7 +1036,7 @@ static PDOC_ITEM SYSLINK_SetFocusLink (SYSLINK_INFO *infoPtr, PDOC_ITEM DocItem)
  *           SYSLINK_SetItem
  * Sets the states and attributes of a link item.
  */
-static LRESULT SYSLINK_SetItem (SYSLINK_INFO *infoPtr, PLITEM Item)
+static LRESULT SYSLINK_SetItem (const SYSLINK_INFO *infoPtr, const LITEM *Item)
 {
     PDOC_ITEM di;
     int nc;
@@ -1126,7 +1126,7 @@ static LRESULT SYSLINK_SetItem (SYSLINK_INFO *infoPtr, PLITEM Item)
  *           SYSLINK_GetItem
  * Retrieves the states and attributes of a link item.
  */
-static LRESULT SYSLINK_GetItem (SYSLINK_INFO *infoPtr, PLITEM Item)
+static LRESULT SYSLINK_GetItem (const SYSLINK_INFO *infoPtr, PLITEM Item)
 {
     PDOC_ITEM di;
     
@@ -1184,7 +1184,7 @@ static LRESULT SYSLINK_GetItem (SYSLINK_INFO *infoPtr, PLITEM Item)
  *           SYSLINK_PtInDocItem
  * Determines if a point is in the region of a document item
  */
-static BOOL SYSLINK_PtInDocItem (PDOC_ITEM DocItem, POINT pt)
+static BOOL SYSLINK_PtInDocItem (const DOC_ITEM *DocItem, POINT pt)
 {
     PDOC_TEXTBLOCK bl;
     int n;
@@ -1212,7 +1212,7 @@ static BOOL SYSLINK_PtInDocItem (PDOC_ITEM DocItem, POINT pt)
  *           SYSLINK_HitTest
  * Determines the link the user clicked on.
  */
-static LRESULT SYSLINK_HitTest (SYSLINK_INFO *infoPtr, PLHITTESTINFO HitTest)
+static LRESULT SYSLINK_HitTest (const SYSLINK_INFO *infoPtr, PLHITTESTINFO HitTest)
 {
     PDOC_ITEM Current;
     int id = 0;
@@ -1256,7 +1256,7 @@ static LRESULT SYSLINK_HitTest (SYSLINK_INFO *infoPtr, PLHITTESTINFO HitTest)
  *           SYSLINK_GetIdealHeight
  * Returns the preferred height of a link at the current control's width.
  */
-static LRESULT SYSLINK_GetIdealHeight (SYSLINK_INFO *infoPtr)
+static LRESULT SYSLINK_GetIdealHeight (const SYSLINK_INFO *infoPtr)
 {
     HDC hdc = GetDC(infoPtr->Self);
     if(hdc != NULL)
@@ -1285,7 +1285,7 @@ static LRESULT SYSLINK_GetIdealHeight (SYSLINK_INFO *infoPtr)
  *           SYSLINK_SendParentNotify
  * Sends a WM_NOTIFY message to the parent window.
  */
-static LRESULT SYSLINK_SendParentNotify (SYSLINK_INFO *infoPtr, UINT code, PDOC_ITEM Link, int iLink)
+static LRESULT SYSLINK_SendParentNotify (const SYSLINK_INFO *infoPtr, UINT code, const DOC_ITEM *Link, int iLink)
 {
     NMLINK nml;
 
@@ -1363,7 +1363,7 @@ static LRESULT SYSLINK_KillFocus (SYSLINK_INFO *infoPtr, HWND NewFocusWindow)
  *           SYSLINK_LinkAtPt
  * Returns a link at the specified position
  */
-static PDOC_ITEM SYSLINK_LinkAtPt (SYSLINK_INFO *infoPtr, POINT *pt, int *LinkId, BOOL MustBeEnabled)
+static PDOC_ITEM SYSLINK_LinkAtPt (const SYSLINK_INFO *infoPtr, const POINT *pt, int *LinkId, BOOL MustBeEnabled)
 {
     PDOC_ITEM Current;
     int id = 0;
@@ -1389,7 +1389,7 @@ static PDOC_ITEM SYSLINK_LinkAtPt (SYSLINK_INFO *infoPtr, POINT *pt, int *LinkId
  *           SYSLINK_LButtonDown
  * Handles mouse clicks
  */
-static LRESULT SYSLINK_LButtonDown (SYSLINK_INFO *infoPtr, DWORD Buttons, POINT *pt)
+static LRESULT SYSLINK_LButtonDown (SYSLINK_INFO *infoPtr, DWORD Buttons, const POINT *pt)
 {
     PDOC_ITEM Current, Old;
     int id;
@@ -1415,7 +1415,7 @@ static LRESULT SYSLINK_LButtonDown (SYSLINK_INFO *infoPtr, DWORD Buttons, POINT
  *           SYSLINK_LButtonUp
  * Handles mouse clicks
  */
-static LRESULT SYSLINK_LButtonUp (SYSLINK_INFO *infoPtr, DWORD Buttons, POINT *pt)
+static LRESULT SYSLINK_LButtonUp (SYSLINK_INFO *infoPtr, DWORD Buttons, const POINT *pt)
 {
     if(infoPtr->MouseDownID > -1)
     {
@@ -1438,7 +1438,7 @@ static LRESULT SYSLINK_LButtonUp (SYSLINK_INFO *infoPtr, DWORD Buttons, POINT *p
  *           SYSLINK_OnEnter
  * Handles ENTER key events
  */
-static BOOL SYSLINK_OnEnter (SYSLINK_INFO *infoPtr)
+static BOOL SYSLINK_OnEnter (const SYSLINK_INFO *infoPtr)
 {
     if(infoPtr->HasFocus)
     {
@@ -1459,7 +1459,7 @@ static BOOL SYSLINK_OnEnter (SYSLINK_INFO *infoPtr)
  *           SYSKEY_SelectNextPrevLink
  * Changes the currently focused link
  */
-static BOOL SYSKEY_SelectNextPrevLink (SYSLINK_INFO *infoPtr, BOOL Prev)
+static BOOL SYSKEY_SelectNextPrevLink (const SYSLINK_INFO *infoPtr, BOOL Prev)
 {
     if(infoPtr->HasFocus)
     {
@@ -1497,7 +1497,7 @@ static BOOL SYSKEY_SelectNextPrevLink (SYSLINK_INFO *infoPtr, BOOL Prev)
  * Determines if there's a next or previous link to decide whether the control
  * should capture the tab key message
  */
-static BOOL SYSLINK_NoNextLink (SYSLINK_INFO *infoPtr, BOOL Prev)
+static BOOL SYSLINK_NoNextLink (const SYSLINK_INFO *infoPtr, BOOL Prev)
 {
     PDOC_ITEM Focus, NewFocus;
 
@@ -1514,7 +1514,7 @@ static BOOL SYSLINK_NoNextLink (SYSLINK_INFO *infoPtr, BOOL Prev)
  *           SYSLINK_GetIdealSize
  * Calculates the ideal size of a link control at a given maximum width.
  */
-static VOID SYSLINK_GetIdealSize (SYSLINK_INFO *infoPtr, int cxMaxWidth, LPSIZE lpSize)
+static VOID SYSLINK_GetIdealSize (const SYSLINK_INFO *infoPtr, int cxMaxWidth, LPSIZE lpSize)
 {
     RECT rc;
     HDC hdc;
index c63b0f7..d3237c7 100644 (file)
@@ -164,9 +164,9 @@ static const WCHAR themeClass[] = { 'T','a','b',0 };
 /******************************************************************************
  * Prototypes
  */
-static void TAB_InvalidateTabArea(TAB_INFO *);
+static void TAB_InvalidateTabArea(const TAB_INFO *);
 static void TAB_EnsureSelectionVisible(TAB_INFO *);
-static void TAB_DrawItemInterior(TAB_INFO *, HDC, INT, RECT*);
+static void TAB_DrawItemInterior(const TAB_INFO *, HDC, INT, RECT*);
 
 static BOOL
 TAB_SendSimpleNotify (const TAB_INFO *infoPtr, UINT code)
@@ -199,7 +199,7 @@ TAB_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg,
 }
 
 static void
-TAB_DumpItemExternalT(TCITEMW *pti, UINT iItem, BOOL isW)
+TAB_DumpItemExternalT(const TCITEMW *pti, UINT iItem, BOOL isW)
 {
     if (TRACE_ON(tab)) {
        TRACE("external tab %d, mask=0x%08x, dwState=0x%08x, dwStateMask=0x%08x, cchTextMax=0x%08x\n",
@@ -210,7 +210,7 @@ TAB_DumpItemExternalT(TCITEMW *pti, UINT iItem, BOOL isW)
 }
 
 static void
-TAB_DumpItemInternal(TAB_INFO *infoPtr, UINT iItem)
+TAB_DumpItemInternal(const TAB_INFO *infoPtr, UINT iItem)
 {
     if (TRACE_ON(tab)) {
        TAB_ITEM *ti;
@@ -231,19 +231,10 @@ static inline LRESULT TAB_GetCurSel (const TAB_INFO *infoPtr)
 }
 
 /* RETURNS
- *   the index of the tab item that has the focus
- * NOTE
- *   we have not to return negative value
- * TODO
- *   test for windows */
+ *   the index of the tab item that has the focus. */
 static inline LRESULT
 TAB_GetCurFocus (const TAB_INFO *infoPtr)
 {
-    if (infoPtr->uFocus<0)
-    {
-        FIXME("we have not to return negative value\n");
-        return 0;
-    }
     return infoPtr->uFocus;
 }
 
@@ -255,10 +246,13 @@ static inline LRESULT TAB_GetToolTips (const TAB_INFO *infoPtr)
 
 static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem)
 {
-  INT prevItem = -1;
+  INT prevItem = infoPtr->iSelected;
 
-  if (iItem >= 0 && iItem < infoPtr->uNumItem) {
-      prevItem=infoPtr->iSelected;
+  if (iItem < 0)
+      infoPtr->iSelected=-1;
+  else if (iItem >= infoPtr->uNumItem)
+      return -1;
+  else {
       if (infoPtr->iSelected != iItem) {
           infoPtr->iSelected=iItem;
           TAB_EnsureSelectionVisible(infoPtr);
@@ -270,23 +264,25 @@ static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem)
 
 static LRESULT TAB_SetCurFocus (TAB_INFO *infoPtr, INT iItem)
 {
-  if (iItem < 0 || iItem >= infoPtr->uNumItem) return 0;
-
-  if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) {
-    FIXME("Should set input focus\n");
-  } else {
-    int oldFocus = infoPtr->uFocus;
-    if (infoPtr->iSelected != iItem || oldFocus == -1 ) {
-      infoPtr->uFocus = iItem;
-      if (oldFocus != -1) {
-        if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING))  {
-          infoPtr->iSelected = iItem;
-          TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE);
+  if (iItem < 0)
+      infoPtr->uFocus = -1;
+  else if (iItem < infoPtr->uNumItem) {
+    if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) {
+      FIXME("Should set input focus\n");
+    } else {
+      int oldFocus = infoPtr->uFocus;
+      if (infoPtr->iSelected != iItem || oldFocus == -1 ) {
+        infoPtr->uFocus = iItem;
+        if (oldFocus != -1) {
+          if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING))  {
+            infoPtr->iSelected = iItem;
+            TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE);
+          }
+          else
+            infoPtr->iSelected = iItem;
+          TAB_EnsureSelectionVisible(infoPtr);
+          TAB_InvalidateTabArea(infoPtr);
         }
-        else
-          infoPtr->iSelected = iItem;
-        TAB_EnsureSelectionVisible(infoPtr);
-        TAB_InvalidateTabArea(infoPtr);
       }
     }
   }
@@ -462,7 +458,7 @@ static BOOL TAB_InternalGetItemRect(
 }
 
 static inline BOOL
-TAB_GetItemRect(TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+TAB_GetItemRect(const TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
   return TAB_InternalGetItemRect(infoPtr, (INT)wParam, (LPRECT)lParam, (LPRECT)NULL);
 }
@@ -539,11 +535,7 @@ static void TAB_FocusChanging(const TAB_INFO *infoPtr)
   }
 }
 
-static INT TAB_InternalHitTest (
-  TAB_INFO* infoPtr,
-  POINT     pt,
-  UINT*     flags)
-
+static INT TAB_InternalHitTest (const TAB_INFO *infoPtr, POINT pt, UINT *flags)
 {
   RECT rect;
   INT iCount;
@@ -564,7 +556,7 @@ static INT TAB_InternalHitTest (
 }
 
 static inline LRESULT
-TAB_HitTest (TAB_INFO *infoPtr, LPTCHITTESTINFO lptest)
+TAB_HitTest (const TAB_INFO *infoPtr, LPTCHITTESTINFO lptest)
 {
   return TAB_InternalHitTest (infoPtr, lptest->pt, &lptest->flags);
 }
@@ -582,7 +574,7 @@ TAB_HitTest (TAB_INFO *infoPtr, LPTCHITTESTINFO lptest)
  * doesn't do it that way. Maybe depends on tab control styles ?
  */
 static inline LRESULT
-TAB_NCHitTest (TAB_INFO *infoPtr, LPARAM lParam)
+TAB_NCHitTest (const TAB_INFO *infoPtr, LPARAM lParam)
 {
   POINT pt;
   UINT dummyflag;
@@ -663,7 +655,7 @@ TAB_RButtonDown (const TAB_INFO *infoPtr)
  * only calls TAB_DrawItemInterior for the single specified item.
  */
 static void
-TAB_DrawLoneItemInterior(TAB_INFO* infoPtr, int iItem)
+TAB_DrawLoneItemInterior(const TAB_INFO* infoPtr, int iItem)
 {
   HDC hdc = GetDC(infoPtr->hwnd);
   RECT r, rC;
@@ -681,7 +673,7 @@ TAB_DrawLoneItemInterior(TAB_INFO* infoPtr, int iItem)
 
 /* update a tab after hottracking - invalidate it or just redraw the interior,
  * based on whether theming is used or not */
-static inline void hottrack_refresh (TAB_INFO* infoPtr, int tabIndex)
+static inline void hottrack_refresh(const TAB_INFO *infoPtr, int tabIndex)
 {
     if (tabIndex == -1) return;
 
@@ -866,10 +858,7 @@ TAB_MouseMove (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
  * Calculates the tab control's display area given the window rectangle or
  * the window rectangle given the requested display rectangle.
  */
-static LRESULT TAB_AdjustRect(
-  TAB_INFO *infoPtr,
-  WPARAM fLarger,
-  LPRECT prc)
+static LRESULT TAB_AdjustRect(const TAB_INFO *infoPtr, WPARAM fLarger, LPRECT prc)
 {
     DWORD lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
     LONG *iRightBottom, *iLeftTop;
@@ -927,11 +916,7 @@ static LRESULT TAB_AdjustRect(
  * This method will handle the notification from the scroll control and
  * perform the scrolling operation on the tab control.
  */
-static LRESULT TAB_OnHScroll(
-  TAB_INFO *infoPtr,
-  int     nScrollCode,
-  int     nPos,
-  HWND    hwndScroll)
+static LRESULT TAB_OnHScroll(TAB_INFO *infoPtr, int nScrollCode, int nPos, HWND hwndScroll)
 {
   if(nScrollCode == SB_THUMBPOSITION && nPos != infoPtr->leftmostVisible)
   {
@@ -1443,13 +1428,7 @@ static void TAB_SetItemBounds (TAB_INFO *infoPtr)
 
 
 static void
-TAB_EraseTabInterior
-    (
-    TAB_INFO*   infoPtr,
-    HDC         hdc,
-    INT         iItem,
-    RECT*       drawRect
-    )
+TAB_EraseTabInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect)
 {
     LONG     lStyle  = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
     HBRUSH   hbr = CreateSolidBrush (comctl32_color.clrBtnFace);
@@ -1511,13 +1490,7 @@ TAB_EraseTabInterior
  * into the tab control.
  */
 static void
-TAB_DrawItemInterior
-  (
-  TAB_INFO*   infoPtr,
-  HDC         hdc,
-  INT         iItem,
-  RECT*       drawRect
-  )
+TAB_DrawItemInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect)
 {
   LONG      lStyle  = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
 
@@ -1933,10 +1906,7 @@ TAB_DrawItemInterior
  *
  * This method is used to draw a single tab into the tab control.
  */
-static void TAB_DrawItem(
-  TAB_INFO *infoPtr,
-  HDC  hdc,
-  INT  iItem)
+static void TAB_DrawItem(const TAB_INFO *infoPtr, HDC  hdc, INT  iItem)
 {
   LONG      lStyle  = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
   RECT      itemRect;
@@ -2286,7 +2256,7 @@ static void TAB_DrawItem(
  * This method is used to draw the raised border around the tab control
  * "content" area.
  */
-static void TAB_DrawBorder (TAB_INFO *infoPtr, HDC hdc)
+static void TAB_DrawBorder(const TAB_INFO *infoPtr, HDC hdc)
 {
   RECT rect;
   DWORD lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
@@ -2501,7 +2471,7 @@ static void TAB_EnsureSelectionVisible(
  * tabs. It is called when the state of the control changes and needs
  * to be redisplayed
  */
-static void TAB_InvalidateTabArea(TAB_INFO* infoPtr)
+static void TAB_InvalidateTabArea(const TAB_INFO *infoPtr)
 {
   RECT clientRect, rInvalidate, rAdjClient;
   DWORD lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
@@ -3118,7 +3088,7 @@ TAB_Destroy (TAB_INFO *infoPtr)
 }
 
 /* update theme after a WM_THEMECHANGED message */
-static LRESULT theme_changed (TAB_INFO* infoPtr)
+static LRESULT theme_changed(const TAB_INFO *infoPtr)
 {
     HTHEME theme = GetWindowTheme (infoPtr->hwnd);
     CloseThemeData (theme);
index b4007db..af6eee8 100644 (file)
@@ -45,7 +45,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(themingcombo);
 #define EDIT_CONTROL_PADDING   1
 
 /* paint text of combobox, needed for read-only drop downs. */
-static void paint_text (HWND hwnd, HDC hdc, DWORD dwStyle, COMBOBOXINFO* cbi)
+static void paint_text (HWND hwnd, HDC hdc, DWORD dwStyle, const COMBOBOXINFO *cbi)
 {
     INT  id, size = 0;
     LPWSTR pText = NULL;
index 86d3ffc..89037c4 100644 (file)
@@ -125,7 +125,6 @@ typedef struct
     INT      nButtonHeight;
     INT      nButtonWidth;
     INT      nBitmapHeight;
-    INT      nVBitmapHeight;  /* see TOOLBAR_Create for an explanation */
     INT      nBitmapWidth;
     INT      nIndent;
     INT      nRows;           /* number of button rows */
@@ -240,10 +239,10 @@ typedef enum
 
 static const WCHAR themeClass[] = { 'T','o','o','l','b','a','r',0 };
 
-static BOOL TOOLBAR_GetButtonInfo(TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb);
-static BOOL TOOLBAR_IsButtonRemovable(TOOLBAR_INFO *infoPtr, int iItem, PCUSTOMBUTTON btnInfo);
-static HIMAGELIST TOOLBAR_GetImageList(PIMLENTRY *pies, INT cies, INT id);
-static PIMLENTRY TOOLBAR_GetImageListEntry(PIMLENTRY *pies, INT cies, INT id);
+static BOOL TOOLBAR_GetButtonInfo(const TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb);
+static BOOL TOOLBAR_IsButtonRemovable(const TOOLBAR_INFO *infoPtr, int iItem, PCUSTOMBUTTON btnInfo);
+static HIMAGELIST TOOLBAR_GetImageList(const PIMLENTRY *pies, INT cies, INT id);
+static PIMLENTRY TOOLBAR_GetImageListEntry(const 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);
@@ -251,18 +250,18 @@ static void TOOLBAR_SetHotItemEx (TOOLBAR_INFO *infoPtr, INT nHit, DWORD dwReaso
 static void TOOLBAR_LayoutToolbar(HWND hwnd);
 static LRESULT TOOLBAR_AutoSize(HWND hwnd);
 static void TOOLBAR_CheckImageListIconSize(TOOLBAR_INFO *infoPtr);
-static void TOOLBAR_TooltipSetRect(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *button);
+static void TOOLBAR_TooltipSetRect(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button);
 
 static LRESULT
-TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam);
+TOOLBAR_NotifyFormat(const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam);
 
-inline static int default_top_margin(TOOLBAR_INFO *infoPtr)
+static inline int default_top_margin(const TOOLBAR_INFO *infoPtr)
 {
     return (infoPtr->dwStyle & TBSTYLE_FLAT ? 0 : TOP_BORDER);
 }
 
 static LPWSTR
-TOOLBAR_GetText(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)
+TOOLBAR_GetText(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr)
 {
     LPWSTR lpText = NULL;
 
@@ -276,7 +275,7 @@ TOOLBAR_GetText(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)
 }
 
 static void
-TOOLBAR_DumpButton(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *bP, INT btn_num, BOOL internal)
+TOOLBAR_DumpButton(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *bP, INT btn_num, BOOL internal)
 {
     if (TRACE_ON(toolbar)){
         TRACE("button %d id %d, bitmap=%d, state=%02x, style=%02x, data=%08lx, stringid=0x%08x\n",
@@ -294,7 +293,7 @@ TOOLBAR_DumpButton(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *bP, INT btn_num, BOOL in
 
 
 static void
-TOOLBAR_DumpToolbar(TOOLBAR_INFO *iP, INT line)
+TOOLBAR_DumpToolbar(const TOOLBAR_INFO *iP, INT line)
 {
     if (TRACE_ON(toolbar)) {
        INT i;
@@ -330,7 +329,7 @@ TOOLBAR_CheckStyle (HWND hwnd, DWORD dwStyle)
 
 
 static INT
-TOOLBAR_SendNotify (NMHDR *nmhdr, TOOLBAR_INFO *infoPtr, UINT code)
+TOOLBAR_SendNotify (NMHDR *nmhdr, const TOOLBAR_INFO *infoPtr, UINT code)
 {
        if(!IsWindow(infoPtr->hwndSelf))
            return 0;   /* we have just been destroyed */
@@ -354,7 +353,7 @@ TOOLBAR_SendNotify (NMHDR *nmhdr, TOOLBAR_INFO *infoPtr, UINT code)
 * is issued to retrieve the index.
 */
 static INT
-TOOLBAR_GetBitmapIndex(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)
+TOOLBAR_GetBitmapIndex(const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)
 {
     INT ret = btnPtr->iBitmap;
 
@@ -384,7 +383,7 @@ TOOLBAR_GetBitmapIndex(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)
 
 
 static BOOL
-TOOLBAR_IsValidBitmapIndex(TOOLBAR_INFO *infoPtr, INT index)
+TOOLBAR_IsValidBitmapIndex(const TOOLBAR_INFO *infoPtr, INT index)
 {
     HIMAGELIST himl;
     INT id = GETHIMLID(infoPtr, index);
@@ -400,7 +399,7 @@ TOOLBAR_IsValidBitmapIndex(TOOLBAR_INFO *infoPtr, INT index)
 
 
 static inline BOOL
-TOOLBAR_IsValidImageList(TOOLBAR_INFO *infoPtr, INT index)
+TOOLBAR_IsValidImageList(const TOOLBAR_INFO *infoPtr, INT index)
 {
     HIMAGELIST himl = GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr, index));
     return (himl != NULL) && (ImageList_GetImageCount(himl) > 0);
@@ -414,7 +413,8 @@ TOOLBAR_IsValidImageList(TOOLBAR_INFO *infoPtr, INT index)
 * functionality) and returns the corresponding image list.
 */
 static HIMAGELIST
-TOOLBAR_GetImageListForDrawing (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, IMAGE_LIST_TYPE imagelist, INT * index)
+TOOLBAR_GetImageListForDrawing (const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
+                                IMAGE_LIST_TYPE imagelist, INT * index)
 {
     HIMAGELIST himl;
 
@@ -457,7 +457,7 @@ TOOLBAR_GetImageListForDrawing (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, IMA
 
 
 static void
-TOOLBAR_DrawFlatSeparator (LPRECT lpRect, HDC hdc, TOOLBAR_INFO *infoPtr)
+TOOLBAR_DrawFlatSeparator (const RECT *lpRect, HDC hdc, const TOOLBAR_INFO *infoPtr)
 {
     RECT myrect;
     COLORREF oldcolor, newcolor;
@@ -496,7 +496,8 @@ TOOLBAR_DrawFlatSeparator (LPRECT lpRect, HDC hdc, TOOLBAR_INFO *infoPtr)
 * FIXME: It is possible that the height of each line is really SM_CYBORDER.
 */
 static void
-TOOLBAR_DrawDDFlatSeparator (LPRECT lpRect, HDC hdc, TBUTTON_INFO *btnPtr, TOOLBAR_INFO *infoPtr)
+TOOLBAR_DrawDDFlatSeparator (const RECT *lpRect, HDC hdc, const TBUTTON_INFO *btnPtr,
+                             const TOOLBAR_INFO *infoPtr)
 {
     RECT myrect;
     COLORREF oldcolor, newcolor;
@@ -555,8 +556,8 @@ TOOLBAR_DrawArrow (HDC hdc, INT left, INT top, COLORREF clr)
  *      an image list
  */
 static void
-TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, RECT *rcText, LPWSTR lpText,
-                    NMTBCUSTOMDRAW *tbcd, DWORD dwItemCDFlag)
+TOOLBAR_DrawString (const TOOLBAR_INFO *infoPtr, RECT *rcText, LPCWSTR lpText,
+                    const NMTBCUSTOMDRAW *tbcd, DWORD dwItemCDFlag)
 {
     HDC hdc = tbcd->nmcd.hdc;
     HFONT  hOldFont = 0;
@@ -606,7 +607,7 @@ TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, RECT *rcText, LPWSTR lpText,
 
 
 static void
-TOOLBAR_DrawPattern (LPRECT lpRect, NMTBCUSTOMDRAW *tbcd)
+TOOLBAR_DrawPattern (const RECT *lpRect, const NMTBCUSTOMDRAW *tbcd)
 {
     HDC hdc = tbcd->nmcd.hdc;
     HBRUSH hbr = SelectObject (hdc, tbcd->hbrMonoDither);
@@ -669,7 +670,7 @@ static void TOOLBAR_DrawMasked(HIMAGELIST himl, int index, HDC hdc, INT x, INT y
 
 
 static UINT
-TOOLBAR_TranslateState(TBUTTON_INFO *btnPtr)
+TOOLBAR_TranslateState(const TBUTTON_INFO *btnPtr)
 {
     UINT retstate = 0;
 
@@ -685,8 +686,8 @@ TOOLBAR_TranslateState(TBUTTON_INFO *btnPtr)
 
 /* draws the image on a toolbar button */
 static void
-TOOLBAR_DrawImage(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top,
-    const NMTBCUSTOMDRAW *tbcd, DWORD dwItemCDFlag)
+TOOLBAR_DrawImage(const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top,
+                  const NMTBCUSTOMDRAW *tbcd, DWORD dwItemCDFlag)
 {
     HIMAGELIST himl = NULL;
     BOOL draw_masked = FALSE;
@@ -1075,7 +1076,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc, DWORD dwBaseCustDr
 
 
 static void
-TOOLBAR_Refresh (HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
+TOOLBAR_Refresh (HWND hwnd, HDC hdc, const PAINTSTRUCT *ps)
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
@@ -1170,7 +1171,7 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
 * only DrawText does. Note that the BTNS_NOPREFIX is handled here.
 */
 static void
-TOOLBAR_MeasureString(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
+TOOLBAR_MeasureString(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr,
                      HDC hdc, LPSIZE lpSize)
 {
     RECT myrect;
@@ -1554,13 +1555,14 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
 * Without text:
 *   As for with bitmaps, but with szText.cx zero.
 */
-static inline SIZE TOOLBAR_MeasureButton(TOOLBAR_INFO *infoPtr, SIZE sizeString, BOOL bHasBitmap, BOOL bValidImageList)
+static inline SIZE TOOLBAR_MeasureButton(const TOOLBAR_INFO *infoPtr, SIZE sizeString,
+                                         BOOL bHasBitmap, BOOL bValidImageList)
 {
     SIZE sizeButton;
     if (infoPtr->dwStyle & TBSTYLE_LIST)
     {
         /* set button height from bitmap / text height... */
-        sizeButton.cy = max((bHasBitmap ? infoPtr->nVBitmapHeight : 0),
+        sizeButton.cy = max((bHasBitmap ? infoPtr->nBitmapHeight : 0),
             sizeString.cy);
 
         /* ... add on the necessary padding */
@@ -1589,7 +1591,7 @@ static inline SIZE TOOLBAR_MeasureButton(TOOLBAR_INFO *infoPtr, SIZE sizeString,
     {
         if (bHasBitmap)
         {
-            sizeButton.cy = infoPtr->nVBitmapHeight + DEFPAD_CY;
+            sizeButton.cy = infoPtr->nBitmapHeight + DEFPAD_CY;
             if (sizeString.cy > 0)
                 sizeButton.cy += 1 + sizeString.cy;
             sizeButton.cx = infoPtr->szPadding.cx +
@@ -1790,7 +1792,7 @@ TOOLBAR_LayoutToolbar(HWND hwnd)
 
 
 static INT
-TOOLBAR_InternalHitTest (HWND hwnd, LPPOINT lpPt)
+TOOLBAR_InternalHitTest (HWND hwnd, const POINT *lpPt)
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
@@ -1821,7 +1823,7 @@ TOOLBAR_InternalHitTest (HWND hwnd, LPPOINT lpPt)
 
 
 static INT
-TOOLBAR_GetButtonIndex (TOOLBAR_INFO *infoPtr, INT idCommand, BOOL CommandIsIndex)
+TOOLBAR_GetButtonIndex (const TOOLBAR_INFO *infoPtr, INT idCommand, BOOL CommandIsIndex)
 {
     TBUTTON_INFO *btnPtr;
     INT i;
@@ -1844,7 +1846,7 @@ TOOLBAR_GetButtonIndex (TOOLBAR_INFO *infoPtr, INT idCommand, BOOL CommandIsInde
 
 
 static INT
-TOOLBAR_GetCheckedGroupButtonIndex (TOOLBAR_INFO *infoPtr, INT nIndex)
+TOOLBAR_GetCheckedGroupButtonIndex (const TOOLBAR_INFO *infoPtr, INT nIndex)
 {
     TBUTTON_INFO *btnPtr;
     INT nRunIndex;
@@ -1907,7 +1909,7 @@ TOOLBAR_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg,
 }
 
 static void
-TOOLBAR_TooltipAddTool(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *button)
+TOOLBAR_TooltipAddTool(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
 {
     if (infoPtr->hwndToolTip && !(button->fsStyle & BTNS_SEP)) {
         TTTOOLINFOW ti;
@@ -1926,7 +1928,7 @@ TOOLBAR_TooltipAddTool(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *button)
 }
 
 static void
-TOOLBAR_TooltipDelTool(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *button)
+TOOLBAR_TooltipDelTool(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
 {
     if ((infoPtr->hwndToolTip) && !(button->fsStyle & BTNS_SEP)) {
         TTTOOLINFOW ti;
@@ -1940,7 +1942,7 @@ TOOLBAR_TooltipDelTool(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *button)
     }
 }
 
-static void TOOLBAR_TooltipSetRect(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *button)
+static void TOOLBAR_TooltipSetRect(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
 {
     /* Set the toolTip only for non-hidden, non-separator button */
     if (infoPtr->hwndToolTip && !(button->fsStyle & BTNS_SEP))
@@ -2009,7 +2011,7 @@ static void TOOLBAR_Cust_InsertAvailButton(HWND hwnd, PCUSTOMBUTTON btnInfoNew)
     SendMessageW(hwndAvail, LB_SETITEMDATA, i, (LPARAM)btnInfoNew);
 }
 
-static void TOOLBAR_Cust_MoveButton(PCUSTDLG_INFO custInfo, HWND hwnd, INT nIndexFrom, INT nIndexTo)
+static void TOOLBAR_Cust_MoveButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT nIndexFrom, INT nIndexTo)
 {
     NMTOOLBARW nmtb;
 
@@ -2053,7 +2055,7 @@ static void TOOLBAR_Cust_MoveButton(PCUSTDLG_INFO custInfo, HWND hwnd, INT nInde
     }
 }
 
-static void TOOLBAR_Cust_AddButton(PCUSTDLG_INFO custInfo, HWND hwnd, INT nIndexAvail, INT nIndexTo)
+static void TOOLBAR_Cust_AddButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT nIndexAvail, INT nIndexTo)
 {
     NMTOOLBARW nmtb;
 
@@ -2101,7 +2103,7 @@ static void TOOLBAR_Cust_AddButton(PCUSTDLG_INFO custInfo, HWND hwnd, INT nIndex
     }
 }
 
-static void TOOLBAR_Cust_RemoveButton(PCUSTDLG_INFO custInfo, HWND hwnd, INT index)
+static void TOOLBAR_Cust_RemoveButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT index)
 {
     PCUSTOMBUTTON btnInfo;
     HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
@@ -2131,7 +2133,8 @@ static void TOOLBAR_Cust_RemoveButton(PCUSTDLG_INFO custInfo, HWND hwnd, INT ind
 }
 
 /* drag list notification function for toolbar buttons list box */
-static LRESULT TOOLBAR_Cust_ToolbarDragListNotification(PCUSTDLG_INFO custInfo, HWND hwnd, DRAGLISTINFO *pDLI)
+static LRESULT TOOLBAR_Cust_ToolbarDragListNotification(const CUSTDLG_INFO *custInfo, HWND hwnd,
+                                                        const DRAGLISTINFO *pDLI)
 {
     HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
     switch (pDLI->uNotification)
@@ -2205,7 +2208,8 @@ static LRESULT TOOLBAR_Cust_ToolbarDragListNotification(PCUSTDLG_INFO custInfo,
 }
 
 /* drag list notification function for available buttons list box */
-static LRESULT TOOLBAR_Cust_AvailDragListNotification(PCUSTDLG_INFO custInfo, HWND hwnd, DRAGLISTINFO *pDLI)
+static LRESULT TOOLBAR_Cust_AvailDragListNotification(const CUSTDLG_INFO *custInfo, HWND hwnd,
+                                                      const DRAGLISTINFO *pDLI)
 {
     HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
     switch (pDLI->uNotification)
@@ -2670,7 +2674,8 @@ TOOLBAR_AddBitmapToImageList(TOOLBAR_INFO *infoPtr, HIMAGELIST himlDef, const TB
 
     /* enlarge the bitmap if needed */
     ImageList_GetIconSize(himlDef, &cxIcon, &cyIcon);
-    COMCTL32_EnsureBitmapSize(&hbmLoad, cxIcon*(INT)bitmap->nButtons, cyIcon, comctl32_color.clrBtnFace);
+    if (bitmap->hInst != COMCTL32_hModule)
+        COMCTL32_EnsureBitmapSize(&hbmLoad, cxIcon*(INT)bitmap->nButtons, cyIcon, comctl32_color.clrBtnFace);
     
     nIndex = ImageList_AddMasked(himlDef, hbmLoad, comctl32_color.clrBtnFace);
     DeleteObject(hbmLoad);
@@ -2776,22 +2781,13 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
        /* Windows resize all the buttons to the size of a newly added standard image */
        if (lpAddBmp->nID & 1)
        {
-           /* large icons */
-           /* FIXME: on windows the size of the images is 25x24 but the size of the bitmap
-             * in rsrc is only 24x24. Fix the bitmap (how?) and then fix this
-             */
-           SendMessageW (hwnd, TB_SETBITMAPSIZE, 0,
-                         MAKELPARAM((WORD)24, (WORD)24));
-           SendMessageW (hwnd, TB_SETBUTTONSIZE, 0,
-                         MAKELPARAM((WORD)31, (WORD)30));
+           /* large icons: 24x24. Will make the button 31x30 */
+           SendMessageW (hwnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(24, 24));
        }
        else
        {
-           /* small icons */
-           SendMessageW (hwnd, TB_SETBITMAPSIZE, 0,
-                         MAKELPARAM((WORD)16, (WORD)16));
-           SendMessageW (hwnd, TB_SETBUTTONSIZE, 0,
-                         MAKELPARAM((WORD)22, (WORD)22));
+           /* small icons: 16x16. Will make the buttons 23x22 */
+           SendMessageW (hwnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16));
        }
 
        TOOLBAR_CalcToolbar (hwnd);
@@ -3358,73 +3354,33 @@ TOOLBAR_GetButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-TOOLBAR_GetButtonInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_GetButtonInfoT(HWND hwnd, WPARAM wParam, LPARAM lParam, BOOL bUnicode)
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-    LPTBBUTTONINFOA lpTbInfo = (LPTBBUTTONINFOA)lParam;
+    /* TBBUTTONINFOW and TBBUTTONINFOA have the same layout*/
+    LPTBBUTTONINFOW lpTbInfo = (LPTBBUTTONINFOW)lParam;
     TBUTTON_INFO *btnPtr;
     INT nIndex;
 
     if (lpTbInfo == NULL)
        return -1;
-    if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOA))
-       return -1;
 
-    nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam,
-                                    lpTbInfo->dwMask & 0x80000000);
-    if (nIndex == -1)
+    /* MSDN documents a iImageLabel field added in Vista but it is not present in
+     * the headers and tests shows that even with comctl 6 Vista accepts only the
+     * original TBBUTTONINFO size
+     */
+    if (lpTbInfo->cbSize != sizeof(TBBUTTONINFOW))
+    {
+        WARN("Invalid button size\n");
        return -1;
-
-    if (!(btnPtr = &infoPtr->buttons[nIndex])) return -1;
-
-    if (lpTbInfo->dwMask & TBIF_COMMAND)
-       lpTbInfo->idCommand = btnPtr->idCommand;
-    if (lpTbInfo->dwMask & TBIF_IMAGE)
-       lpTbInfo->iImage = btnPtr->iBitmap;
-    if (lpTbInfo->dwMask & TBIF_LPARAM)
-       lpTbInfo->lParam = btnPtr->dwData;
-    if (lpTbInfo->dwMask & TBIF_SIZE)
-       lpTbInfo->cx = (WORD)(btnPtr->rect.right - btnPtr->rect.left);
-    if (lpTbInfo->dwMask & TBIF_STATE)
-       lpTbInfo->fsState = btnPtr->fsState;
-    if (lpTbInfo->dwMask & TBIF_STYLE)
-       lpTbInfo->fsStyle = btnPtr->fsStyle;
-    if (lpTbInfo->dwMask & TBIF_TEXT) {
-        /* TB_GETBUTTONINFO doesn't retrieve text from the string list, so we
-           can't use TOOLBAR_GetText here */
-        LPWSTR lpText;
-        if (HIWORD(btnPtr->iString) && (btnPtr->iString != -1)) {
-            lpText = (LPWSTR)btnPtr->iString;
-            Str_GetPtrWtoA (lpText, lpTbInfo->pszText,lpTbInfo->cchText);
-        } else
-            lpTbInfo->pszText[0] = '\0';
     }
-    return nIndex;
-}
-
-
-static LRESULT
-TOOLBAR_GetButtonInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-    LPTBBUTTONINFOW lpTbInfo = (LPTBBUTTONINFOW)lParam;
-    TBUTTON_INFO *btnPtr;
-    INT nIndex;
-
-    if (lpTbInfo == NULL)
-       return -1;
-    if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOW))
-       return -1;
 
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam,
                                     lpTbInfo->dwMask & 0x80000000);
     if (nIndex == -1)
        return -1;
 
-    btnPtr = &infoPtr->buttons[nIndex];
-
-    if(!btnPtr)
-        return -1;
+    if (!(btnPtr = &infoPtr->buttons[nIndex])) return -1;
 
     if (lpTbInfo->dwMask & TBIF_COMMAND)
        lpTbInfo->idCommand = btnPtr->idCommand;
@@ -3441,14 +3397,15 @@ TOOLBAR_GetButtonInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
     if (lpTbInfo->dwMask & TBIF_TEXT) {
         /* TB_GETBUTTONINFO doesn't retrieve text from the string list, so we
            can't use TOOLBAR_GetText here */
-        LPWSTR lpText;
         if (HIWORD(btnPtr->iString) && (btnPtr->iString != -1)) {
-            lpText = (LPWSTR)btnPtr->iString;
-            Str_GetPtrW (lpText,lpTbInfo->pszText,lpTbInfo->cchText);
+            LPWSTR lpText = (LPWSTR)btnPtr->iString;
+            if (bUnicode)
+                Str_GetPtrW(lpText, lpTbInfo->pszText, lpTbInfo->cchText);
+            else
+                Str_GetPtrWtoA(lpText, (LPSTR)lpTbInfo->pszText, lpTbInfo->cchText);
         } else
             lpTbInfo->pszText[0] = '\0';
     }
-
     return nIndex;
 }
 
@@ -3519,7 +3476,7 @@ TOOLBAR_GetDisabledImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLBAR_GetExtendedStyle (HWND hwnd)
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
@@ -3739,7 +3696,7 @@ TOOLBAR_GetUnicodeFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLBAR_GetVersion (HWND hwnd)
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
@@ -3766,7 +3723,7 @@ TOOLBAR_HideButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
     else
        btnPtr->fsState |= TBSTATE_HIDDEN;
 
-    TOOLBAR_CalcToolbar (hwnd);
+    TOOLBAR_LayoutToolbar (hwnd);
 
     InvalidateRect (hwnd, NULL, TRUE);
 
@@ -3774,7 +3731,7 @@ TOOLBAR_HideButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLBAR_HitTest (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     return TOOLBAR_InternalHitTest (hwnd, (LPPOINT)lParam);
@@ -4045,7 +4002,7 @@ TOOLBAR_MarkButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
 
 /* fixes up an index of a button affected by a move */
-inline static void TOOLBAR_MoveFixupIndex(INT* pIndex, INT nIndex, INT nMoveIndex, BOOL bMoveUp)
+static inline void TOOLBAR_MoveFixupIndex(INT* pIndex, INT nIndex, INT nMoveIndex, BOOL bMoveUp)
 {
     if (bMoveUp)
     {
@@ -4108,7 +4065,7 @@ TOOLBAR_MoveButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
         TOOLBAR_MoveFixupIndex(&infoPtr->nHotItem, nIndex, nMoveIndex, FALSE);
     }
 
-    TOOLBAR_CalcToolbar(hwnd);
+    TOOLBAR_LayoutToolbar(hwnd);
     TOOLBAR_AutoSize(hwnd);
     InvalidateRect(hwnd, NULL, TRUE);
 
@@ -4223,7 +4180,7 @@ TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
 /* helper for TOOLBAR_SaveRestoreW */
 static BOOL
-TOOLBAR_Save(TOOLBAR_INFO *infoPtr, LPTBSAVEPARAMSW lpSave)
+TOOLBAR_Save(const TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *lpSave)
 {
     FIXME("save to %s %s\n", debugstr_w(lpSave->pszSubKey),
         debugstr_w(lpSave->pszValueName));
@@ -4251,7 +4208,7 @@ TOOLBAR_DeleteAllButtons(TOOLBAR_INFO *infoPtr)
 
 /* helper for TOOLBAR_SaveRestoreW */
 static BOOL
-TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, LPTBSAVEPARAMSW lpSave)
+TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *lpSave)
 {
     LONG res;
     HKEY hkey = NULL;
@@ -4356,7 +4313,7 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, LPTBSAVEPARAMSW lpSave)
 
 
 static LRESULT
-TOOLBAR_SaveRestoreW (HWND hwnd, WPARAM wParam, LPTBSAVEPARAMSW lpSave)
+TOOLBAR_SaveRestoreW (HWND hwnd, WPARAM wParam, const TBSAVEPARAMSW *lpSave)
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
 
@@ -4370,7 +4327,7 @@ TOOLBAR_SaveRestoreW (HWND hwnd, WPARAM wParam, LPTBSAVEPARAMSW lpSave)
 
 
 static LRESULT
-TOOLBAR_SaveRestoreA (HWND hwnd, WPARAM wParam, LPTBSAVEPARAMSA lpSave)
+TOOLBAR_SaveRestoreA (HWND hwnd, WPARAM wParam, const TBSAVEPARAMSA *lpSave)
 {
     LPWSTR pszValueName = 0, pszSubKey = 0;
     TBSAVEPARAMSW SaveW;
@@ -4442,7 +4399,7 @@ TOOLBAR_SetBitmapSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
              LOWORD(lParam), HIWORD(lParam));
 
     infoPtr->nBitmapWidth = (INT)LOWORD(lParam);
-    infoPtr->nVBitmapHeight = infoPtr->nBitmapHeight = (INT)HIWORD(lParam);
+    infoPtr->nBitmapHeight = (INT)HIWORD(lParam);
 
     if ((himlDef == infoPtr->himlInt) &&
         (ImageList_GetImageCount(infoPtr->himlInt) == 0))
@@ -4593,7 +4550,7 @@ TOOLBAR_SetButtonSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
     if (cy == 0) cx = 22;
     
     cx = max(cx, infoPtr->szPadding.cx + infoPtr->nBitmapWidth);
-    cy = max(cy, infoPtr->szPadding.cy + infoPtr->nVBitmapHeight);
+    cy = max(cy, infoPtr->szPadding.cy + infoPtr->nBitmapHeight);
 
     infoPtr->nButtonWidth = cx;
     infoPtr->nButtonHeight = cy;
@@ -4852,7 +4809,6 @@ TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
         infoPtr->nBitmapWidth = 1;
         infoPtr->nBitmapHeight = 1;
     }
-    infoPtr->nVBitmapHeight = infoPtr->nBitmapHeight;
     TOOLBAR_CalcToolbar(hwnd);
 
     TRACE("hwnd %p, new himl=%p, id = %d, count=%d, bitmap w=%d, h=%d\n",
@@ -5058,7 +5014,7 @@ TOOLBAR_SetStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLBAR_SetToolTips (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
@@ -5101,7 +5057,7 @@ TOOLBAR_GetColorScheme (HWND hwnd, LPCOLORSCHEME lParam)
 
 
 static LRESULT
-TOOLBAR_SetColorScheme (HWND hwnd, LPCOLORSCHEME lParam)
+TOOLBAR_SetColorScheme (HWND hwnd, const COLORSCHEME *lParam)
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
 
@@ -5321,13 +5277,8 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
     /* initialize info structure */
     infoPtr->nButtonWidth = 23;
     infoPtr->nButtonHeight = 22;
-    infoPtr->nBitmapHeight = 15;
+    infoPtr->nBitmapHeight = 16;
     infoPtr->nBitmapWidth = 16;
-    /* By default Windows creates an image list with 16x15 icons but computes the button size as
-     * if the icons were 16x16. That's why we keep infoPtr->nVBitmapHeight. After a call to
-     * TB_SETBITMAPSIZE or TB_SETIMAGELIST the nVBitmapHeight = nBitmapHeight.
-     */
-    infoPtr->nVBitmapHeight = 16;
 
     infoPtr->nMaxTextRows = 1;
     infoPtr->cxMin = -1;
@@ -5870,6 +5821,10 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
        {
            SendMessageW (infoPtr->hwndNotify, WM_COMMAND,
              MAKEWPARAM(infoPtr->buttons[nHit].idCommand, BN_CLICKED), (LPARAM)hwnd);
+
+            /* In case we have just been destroyed... */
+            if(!IsWindow(hwnd))
+                return 0;
         }
     }
 
@@ -6078,7 +6033,7 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLBAR_NCActivate (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
 /*    if (wndPtr->dwStyle & CCS_NODIVIDER) */
@@ -6088,7 +6043,7 @@ TOOLBAR_NCActivate (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLBAR_NCCalcSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     if (!(GetWindowLongW(hwnd, GWL_STYLE) & CCS_NODIVIDER))
@@ -6336,7 +6291,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLBAR_Notify (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
@@ -6386,7 +6341,7 @@ TOOLBAR_Notify (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+TOOLBAR_NotifyFormat(const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     LRESULT format;
 
@@ -6547,7 +6502,7 @@ TOOLBAR_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
 
 static LRESULT
-TOOLBAR_StyleChanged (HWND hwnd, INT nType, LPSTYLESTRUCT lpStyle)
+TOOLBAR_StyleChanged (HWND hwnd, INT nType, const STYLESTRUCT *lpStyle)
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
 
@@ -6669,10 +6624,10 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
            return TOOLBAR_GetButton (hwnd, wParam, lParam);
 
        case TB_GETBUTTONINFOA:
-           return TOOLBAR_GetButtonInfoA (hwnd, wParam, lParam);
+           return TOOLBAR_GetButtonInfoT(hwnd, wParam, lParam, FALSE);
 
        case TB_GETBUTTONINFOW:
-           return TOOLBAR_GetButtonInfoW (hwnd, wParam, lParam);
+           return TOOLBAR_GetButtonInfoT(hwnd, wParam, lParam, TRUE);
 
        case TB_GETBUTTONSIZE:
            return TOOLBAR_GetButtonSize (hwnd);
@@ -7087,7 +7042,7 @@ static VOID TOOLBAR_DeleteImageList(PIMLENTRY **pies, INT *cies)
 }
 
 
-static PIMLENTRY TOOLBAR_GetImageListEntry(PIMLENTRY *pies, INT cies, INT id)
+static PIMLENTRY TOOLBAR_GetImageListEntry(const PIMLENTRY *pies, INT cies, INT id)
 {
     PIMLENTRY c = NULL;
 
@@ -7109,7 +7064,7 @@ static PIMLENTRY TOOLBAR_GetImageListEntry(PIMLENTRY *pies, INT cies, INT id)
 }
 
 
-static HIMAGELIST TOOLBAR_GetImageList(PIMLENTRY *pies, INT cies, INT id)
+static HIMAGELIST TOOLBAR_GetImageList(const PIMLENTRY *pies, INT cies, INT id)
 {
     HIMAGELIST himlDef = 0;
     PIMLENTRY pie = TOOLBAR_GetImageListEntry(pies, cies, id);
@@ -7121,7 +7076,7 @@ static HIMAGELIST TOOLBAR_GetImageList(PIMLENTRY *pies, INT cies, INT id)
 }
 
 
-static BOOL TOOLBAR_GetButtonInfo(TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb)
+static BOOL TOOLBAR_GetButtonInfo(const TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb)
 {
     if (infoPtr->bUnicode)
         return TOOLBAR_SendNotify(&nmtb->hdr, infoPtr, TBN_GETBUTTONINFOW);
@@ -7152,8 +7107,7 @@ static BOOL TOOLBAR_GetButtonInfo(TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb)
 }
 
 
-static BOOL TOOLBAR_IsButtonRemovable(TOOLBAR_INFO *infoPtr,
-       int iItem, PCUSTOMBUTTON btnInfo)
+static BOOL TOOLBAR_IsButtonRemovable(const TOOLBAR_INFO *infoPtr, int iItem, PCUSTOMBUTTON btnInfo)
 {
     NMTOOLBARW nmtb;
 
index a4191d4..da5f7d8 100644 (file)
@@ -174,7 +174,7 @@ static LRESULT CALLBACK
 TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR dwRef);
 
 
-inline static UINT_PTR
+static inline UINT_PTR
 TOOLTIPS_GetTitleIconIndex(HICON hIcon)
 {
     UINT i;
@@ -435,7 +435,7 @@ TOOLTIPS_GetTipText (HWND hwnd, TOOLTIPS_INFO *infoPtr, INT nTool)
 
 
 static void
-TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize)
+TOOLTIPS_CalcTipSize (HWND hwnd, const TOOLTIPS_INFO *infoPtr, LPSIZE lpSize)
 {
     HDC hdc;
     HFONT hOldFont;
@@ -816,7 +816,7 @@ TOOLTIPS_TrackShow (HWND hwnd, TOOLTIPS_INFO *infoPtr)
 
 
 static void
-TOOLTIPS_TrackHide (HWND hwnd, TOOLTIPS_INFO *infoPtr)
+TOOLTIPS_TrackHide (HWND hwnd, const TOOLTIPS_INFO *infoPtr)
 {
     TTTOOL_INFO *toolPtr;
     NMHDR hdr;
@@ -840,7 +840,7 @@ TOOLTIPS_TrackHide (HWND hwnd, TOOLTIPS_INFO *infoPtr)
 
 
 static INT
-TOOLTIPS_GetToolFromInfoA (TOOLTIPS_INFO *infoPtr, LPTTTOOLINFOA lpToolInfo)
+TOOLTIPS_GetToolFromInfoA (const TOOLTIPS_INFO *infoPtr, const TTTOOLINFOA *lpToolInfo)
 {
     TTTOOL_INFO *toolPtr;
     INT nTool;
@@ -867,7 +867,7 @@ TOOLTIPS_GetToolFromInfoA (TOOLTIPS_INFO *infoPtr, LPTTTOOLINFOA lpToolInfo)
 
 
 static INT
-TOOLTIPS_GetToolFromInfoW (TOOLTIPS_INFO *infoPtr, LPTTTOOLINFOW lpToolInfo)
+TOOLTIPS_GetToolFromInfoW (const TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *lpToolInfo)
 {
     TTTOOL_INFO *toolPtr;
     INT nTool;
@@ -894,7 +894,7 @@ TOOLTIPS_GetToolFromInfoW (TOOLTIPS_INFO *infoPtr, LPTTTOOLINFOW lpToolInfo)
 
 
 static INT
-TOOLTIPS_GetToolFromPoint (TOOLTIPS_INFO *infoPtr, HWND hwnd, LPPOINT lpPt)
+TOOLTIPS_GetToolFromPoint (const TOOLTIPS_INFO *infoPtr, HWND hwnd, const POINT *lpPt)
 {
     TTTOOL_INFO *toolPtr;
     INT  nTool;
@@ -1484,7 +1484,7 @@ TOOLTIPS_GetMargin (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLTIPS_GetMaxTipWidth (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
@@ -1540,7 +1540,7 @@ TOOLTIPS_GetTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLTIPS_GetTipBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
@@ -1548,7 +1548,7 @@ TOOLTIPS_GetTipBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLTIPS_GetTipTextColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
@@ -1556,7 +1556,7 @@ TOOLTIPS_GetTipTextColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLTIPS_GetToolCount (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
@@ -1756,7 +1756,7 @@ TOOLTIPS_NewToolRectW (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLTIPS_Pop (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
@@ -1889,7 +1889,7 @@ TOOLTIPS_SetMargin (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLTIPS_SetMaxTipWidth (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
@@ -1901,7 +1901,7 @@ TOOLTIPS_SetMaxTipWidth (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLTIPS_SetTipBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
@@ -1912,7 +1912,7 @@ TOOLTIPS_SetTipBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TOOLTIPS_SetTipTextColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
index b61e64d..8282e7c 100644 (file)
@@ -103,14 +103,14 @@ typedef struct
 static const WCHAR themeClass[] = { 'T','r','a','c','k','b','a','r',0 };
 
 static inline int 
-notify_customdraw(TRACKBAR_INFO *infoPtr, NMCUSTOMDRAW *pnmcd, int stage)
+notify_customdraw (const TRACKBAR_INFO *infoPtr, NMCUSTOMDRAW *pnmcd, int stage)
 {
     pnmcd->dwDrawStage = stage;
     return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 
                         pnmcd->hdr.idFrom, (LPARAM)pnmcd);
 }
 
-static LRESULT notify_hdr(TRACKBAR_INFO *infoPtr, INT code, LPNMHDR pnmh)
+static LRESULT notify_hdr (const TRACKBAR_INFO *infoPtr, INT code, LPNMHDR pnmh)
 {
     LRESULT result;
     
@@ -127,14 +127,14 @@ static LRESULT notify_hdr(TRACKBAR_INFO *infoPtr, INT code, LPNMHDR pnmh)
     return result;
 }
 
-static inline int notify(TRACKBAR_INFO *infoPtr, INT code)
+static inline int notify (const TRACKBAR_INFO *infoPtr, INT code)
 {
     NMHDR nmh;
     return notify_hdr(infoPtr, code, &nmh);
 }
 
 static BOOL
-notify_with_scroll (TRACKBAR_INFO *infoPtr, UINT code)
+notify_with_scroll (const TRACKBAR_INFO *infoPtr, UINT code)
 {
     BOOL bVert = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_VERT;
 
@@ -179,8 +179,7 @@ static void TRACKBAR_RecalculateTics (TRACKBAR_INFO *infoPtr)
    (in range of trackbar) */
 
 static inline LONG
-TRACKBAR_ConvertPlaceToPosition (TRACKBAR_INFO *infoPtr, int place,
-                                 int vertical)
+TRACKBAR_ConvertPlaceToPosition (const TRACKBAR_INFO *infoPtr, int place, int vertical)
 {
     double range, width, pos, offsetthumb;
 
@@ -207,7 +206,7 @@ TRACKBAR_ConvertPlaceToPosition (TRACKBAR_INFO *infoPtr, int place,
 
 /* return: 0> prev, 0 none, >0 next */
 static LONG
-TRACKBAR_GetAutoPageDirection (TRACKBAR_INFO *infoPtr, POINT clickPoint)
+TRACKBAR_GetAutoPageDirection (const TRACKBAR_INFO *infoPtr, POINT clickPoint)
 {
     DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
     RECT pageRect;
@@ -237,7 +236,7 @@ TRACKBAR_GetAutoPageDirection (TRACKBAR_INFO *infoPtr, POINT clickPoint)
     return 0;
 }
 
-inline static void
+static inline void
 TRACKBAR_PageDown (TRACKBAR_INFO *infoPtr)
 {
     if (infoPtr->lPos == infoPtr->lRangeMax) return;
@@ -249,7 +248,7 @@ TRACKBAR_PageDown (TRACKBAR_INFO *infoPtr)
 }
 
 
-inline static void
+static inline void
 TRACKBAR_PageUp (TRACKBAR_INFO *infoPtr)
 {
     if (infoPtr->lPos == infoPtr->lRangeMin) return;
@@ -260,7 +259,7 @@ TRACKBAR_PageUp (TRACKBAR_INFO *infoPtr)
     notify_with_scroll (infoPtr, TB_PAGEUP);
 }
 
-inline static void TRACKBAR_LineUp(TRACKBAR_INFO *infoPtr)
+static inline void TRACKBAR_LineUp(TRACKBAR_INFO *infoPtr)
 {
     if (infoPtr->lPos == infoPtr->lRangeMin) return;
     infoPtr->lPos -= infoPtr->lLineSize;
@@ -269,7 +268,7 @@ inline static void TRACKBAR_LineUp(TRACKBAR_INFO *infoPtr)
     notify_with_scroll (infoPtr, TB_LINEUP);
 }
 
-inline static void TRACKBAR_LineDown(TRACKBAR_INFO *infoPtr)
+static inline void TRACKBAR_LineDown(TRACKBAR_INFO *infoPtr)
 {
     if (infoPtr->lPos == infoPtr->lRangeMax) return;
     infoPtr->lPos += infoPtr->lLineSize;
@@ -334,7 +333,7 @@ TRACKBAR_CalcChannel (TRACKBAR_INFO *infoPtr)
 }
 
 static void
-TRACKBAR_CalcThumb (TRACKBAR_INFO *infoPtr, LONG lPos, RECT *thumb)
+TRACKBAR_CalcThumb (const TRACKBAR_INFO *infoPtr, LONG lPos, RECT *thumb)
 {
     int range, width, height, thumbwidth;
     DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
@@ -374,20 +373,20 @@ TRACKBAR_CalcThumb (TRACKBAR_INFO *infoPtr, LONG lPos, RECT *thumb)
     }
 }
 
-inline static void
+static inline void
 TRACKBAR_UpdateThumb (TRACKBAR_INFO *infoPtr)
 {
     TRACKBAR_CalcThumb(infoPtr, infoPtr->lPos, &infoPtr->rcThumb);
 }
 
 static inline void
-TRACKBAR_InvalidateAll(TRACKBAR_INFO * infoPtr)
+TRACKBAR_InvalidateAll (const TRACKBAR_INFO *infoPtr)
 {
     InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
 }
 
 static void
-TRACKBAR_InvalidateThumb (TRACKBAR_INFO *infoPtr, LONG thumbPos)
+TRACKBAR_InvalidateThumb (const TRACKBAR_INFO *infoPtr, LONG thumbPos)
 {
     RECT rcThumb;
 
@@ -397,15 +396,15 @@ TRACKBAR_InvalidateThumb (TRACKBAR_INFO *infoPtr, LONG thumbPos)
 }
 
 static inline void
-TRACKBAR_InvalidateThumbMove (TRACKBAR_INFO *infoPtr, LONG oldPos, LONG newPos)
+TRACKBAR_InvalidateThumbMove (const TRACKBAR_INFO *infoPtr, LONG oldPos, LONG newPos)
 {
     TRACKBAR_InvalidateThumb (infoPtr, oldPos);
     if (newPos != oldPos)
         TRACKBAR_InvalidateThumb (infoPtr, newPos);
 }
 
-inline static BOOL
-TRACKBAR_HasSelection (TRACKBAR_INFO *infoPtr)
+static inline BOOL
+TRACKBAR_HasSelection (const TRACKBAR_INFO *infoPtr)
 {
     return infoPtr->lSelMin != infoPtr->lSelMax;
 }
@@ -468,7 +467,7 @@ TRACKBAR_AutoPage (TRACKBAR_INFO *infoPtr, POINT clickPoint)
 /* Trackbar drawing code. I like my spaghetti done milanese.  */
 
 static void
-TRACKBAR_DrawChannel (TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
+TRACKBAR_DrawChannel (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
 {
     RECT rcChannel = infoPtr->rcChannel;
     HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
@@ -491,7 +490,7 @@ TRACKBAR_DrawChannel (TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
 }
 
 static void
-TRACKBAR_DrawOneTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, int flags)
+TRACKBAR_DrawOneTic (const TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, int flags)
 {
     int x, y, ox, oy, range, side, indent = 0, len = 3;
     int offsetthumb;
@@ -566,7 +565,7 @@ TRACKBAR_DrawOneTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, int flags)
 
 
 static inline void
-TRACKBAR_DrawTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, int flags)
+TRACKBAR_DrawTic (const TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, int flags)
 {
     if ((flags & (TBS_LEFT | TBS_TOP)) || (flags & TBS_BOTH))
         TRACKBAR_DrawOneTic (infoPtr, hdc, ticPos, flags | TBS_LEFT);
@@ -576,7 +575,7 @@ TRACKBAR_DrawTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, int flags)
 }
 
 static void
-TRACKBAR_DrawTics (TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
+TRACKBAR_DrawTics (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
 {
     unsigned int i;
     int ticFlags = dwStyle & 0x0f;
@@ -615,7 +614,7 @@ TRACKBAR_DrawTics (TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
 }
 
 static void
-TRACKBAR_DrawThumb(TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
+TRACKBAR_DrawThumb (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
 {
     HBRUSH oldbr;
     HPEN  oldpen;
@@ -757,8 +756,8 @@ TRACKBAR_DrawThumb(TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
 }
 
 
-inline static void
-TRACKBAR_ActivateToolTip (TRACKBAR_INFO *infoPtr, BOOL fShow)
+static inline void
+TRACKBAR_ActivateToolTip (const TRACKBAR_INFO *infoPtr, BOOL fShow)
 {
     TTTOOLINFOW ti;
 
@@ -773,7 +772,7 @@ TRACKBAR_ActivateToolTip (TRACKBAR_INFO *infoPtr, BOOL fShow)
 
 
 static void
-TRACKBAR_UpdateToolTip (TRACKBAR_INFO *infoPtr)
+TRACKBAR_UpdateToolTip (const TRACKBAR_INFO *infoPtr)
 {
     DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
     WCHAR buf[80];
@@ -942,7 +941,7 @@ cleanup:
 
 
 static void
-TRACKBAR_AlignBuddies (TRACKBAR_INFO *infoPtr)
+TRACKBAR_AlignBuddies (const TRACKBAR_INFO *infoPtr)
 {
     DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
     HWND hwndParent = GetParent (infoPtr->hwndSelf);
@@ -1022,8 +1021,8 @@ TRACKBAR_ClearTics (TRACKBAR_INFO *infoPtr, BOOL fRedraw)
 }
 
 
-inline static LRESULT
-TRACKBAR_GetChannelRect (TRACKBAR_INFO *infoPtr, LPRECT lprc)
+static inline LRESULT
+TRACKBAR_GetChannelRect (const TRACKBAR_INFO *infoPtr, LPRECT lprc)
 {
     if (lprc == NULL) return 0;
 
@@ -1036,17 +1035,20 @@ TRACKBAR_GetChannelRect (TRACKBAR_INFO *infoPtr, LPRECT lprc)
 }
 
 
-inline static LONG
-TRACKBAR_GetNumTics (TRACKBAR_INFO *infoPtr)
+static inline LONG
+TRACKBAR_GetNumTics (const TRACKBAR_INFO *infoPtr)
 {
     if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_NOTICKS)
         return 0;
 
-    return infoPtr->uNumTics + 2;
+    if(infoPtr->uNumTics == 0)
+        return 2;
+    else
+        return infoPtr->uNumTics + 1;
 }
 
 
-static int comp_tics(const void *ap, const void *bp)
+static int comp_tics (const void *ap, const void *bp)
 {
     const DWORD a = *(const DWORD *)ap;
     const DWORD b = *(const DWORD *)bp;
@@ -1058,8 +1060,8 @@ static int comp_tics(const void *ap, const void *bp)
 }
 
 
-inline static LONG
-TRACKBAR_GetTic (TRACKBAR_INFO *infoPtr, INT iTic)
+static inline LONG
+TRACKBAR_GetTic (const TRACKBAR_INFO *infoPtr, INT iTic)
 {
     if ((iTic < 0) || (iTic >= infoPtr->uNumTics) || !infoPtr->tics)
        return -1;
@@ -1069,8 +1071,8 @@ TRACKBAR_GetTic (TRACKBAR_INFO *infoPtr, INT iTic)
 }
 
 
-inline static LONG
-TRACKBAR_GetTicPos (TRACKBAR_INFO *infoPtr, INT iTic)
+static inline LONG
+TRACKBAR_GetTicPos (const TRACKBAR_INFO *infoPtr, INT iTic)
 {
     LONG range, width, pos, tic;
     int offsetthumb;
@@ -1111,7 +1113,7 @@ TRACKBAR_SetBuddy (TRACKBAR_INFO *infoPtr, BOOL fLocation, HWND hwndBuddy)
 }
 
 
-inline static LONG
+static inline LONG
 TRACKBAR_SetLineSize (TRACKBAR_INFO *infoPtr, LONG lLineSize)
 {
     LONG lTemp = infoPtr->lLineSize;
@@ -1122,7 +1124,7 @@ TRACKBAR_SetLineSize (TRACKBAR_INFO *infoPtr, LONG lLineSize)
 }
 
 
-inline static LONG
+static inline LONG
 TRACKBAR_SetPageSize (TRACKBAR_INFO *infoPtr, LONG lPageSize)
 {
     LONG lTemp = infoPtr->lPageSize;
@@ -1133,7 +1135,7 @@ TRACKBAR_SetPageSize (TRACKBAR_INFO *infoPtr, LONG lPageSize)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TRACKBAR_SetPos (TRACKBAR_INFO *infoPtr, BOOL fPosition, LONG lPosition)
 {
     LONG oldPos = infoPtr->lPos;
@@ -1152,7 +1154,7 @@ TRACKBAR_SetPos (TRACKBAR_INFO *infoPtr, BOOL fPosition, LONG lPosition)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TRACKBAR_SetRange (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lRange)
 {
     infoPtr->lRangeMin = (SHORT)LOWORD(lRange);
@@ -1177,7 +1179,7 @@ TRACKBAR_SetRange (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lRange)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TRACKBAR_SetRangeMax (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lMax)
 {
     infoPtr->lRangeMax = lMax;
@@ -1195,7 +1197,7 @@ TRACKBAR_SetRangeMax (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lMax)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TRACKBAR_SetRangeMin (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lMin)
 {
     infoPtr->lRangeMin = lMin;
@@ -1213,11 +1215,14 @@ TRACKBAR_SetRangeMin (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lMin)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TRACKBAR_SetSel (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lSel)
 {
-    if (!GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)
+    if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
+        infoPtr->lSelMin = 0;
+        infoPtr->lSelMax = 0;
         return 0;
+    }
 
     infoPtr->lSelMin = (SHORT)LOWORD(lSel);
     infoPtr->lSelMax = (SHORT)HIWORD(lSel);
@@ -1234,11 +1239,13 @@ TRACKBAR_SetSel (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lSel)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TRACKBAR_SetSelEnd (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lEnd)
 {
-    if (!GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)
+    if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
+        infoPtr->lSelMax = 0;
        return 0;
+    }
 
     infoPtr->lSelMax = lEnd;
     infoPtr->flags |= TB_SELECTIONCHANGED;
@@ -1252,11 +1259,13 @@ TRACKBAR_SetSelEnd (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lEnd)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TRACKBAR_SetSelStart (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lStart)
 {
-    if (!GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)
+    if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
+        infoPtr->lSelMin = 0;
        return 0;
+    }
 
     infoPtr->lSelMin = lStart;
     infoPtr->flags  |=TB_SELECTIONCHANGED;
@@ -1270,7 +1279,7 @@ TRACKBAR_SetSelStart (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lStart)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TRACKBAR_SetThumbLength (TRACKBAR_INFO *infoPtr, UINT iLength)
 {
     if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_FIXEDLENGTH) {
@@ -1283,7 +1292,7 @@ TRACKBAR_SetThumbLength (TRACKBAR_INFO *infoPtr, UINT iLength)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TRACKBAR_SetTic (TRACKBAR_INFO *infoPtr, LONG lPos)
 {
     if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_AUTOTICKS)
@@ -1310,7 +1319,7 @@ TRACKBAR_SetTic (TRACKBAR_INFO *infoPtr, LONG lPos)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TRACKBAR_SetTicFreq (TRACKBAR_INFO *infoPtr, WORD wFreq)
 {
     if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_AUTOTICKS) {
@@ -1323,7 +1332,7 @@ TRACKBAR_SetTicFreq (TRACKBAR_INFO *infoPtr, WORD wFreq)
 }
 
 
-inline static INT
+static inline INT
 TRACKBAR_SetTipSide (TRACKBAR_INFO *infoPtr, INT fLocation)
 {
     INT fTemp = infoPtr->fLocation;
@@ -1334,7 +1343,7 @@ TRACKBAR_SetTipSide (TRACKBAR_INFO *infoPtr, INT fLocation)
 }
 
 
-inline static LRESULT
+static inline LRESULT
 TRACKBAR_SetToolTips (TRACKBAR_INFO *infoPtr, HWND hwndTT)
 {
     infoPtr->hwndToolTip = hwndTT;
@@ -1343,7 +1352,7 @@ TRACKBAR_SetToolTips (TRACKBAR_INFO *infoPtr, HWND hwndTT)
 }
 
 
-inline static BOOL
+static inline BOOL
 TRACKBAR_SetUnicodeFormat (TRACKBAR_INFO *infoPtr, BOOL fUnicode)
 {
     BOOL bTemp = infoPtr->bUnicode;
@@ -1383,7 +1392,7 @@ TRACKBAR_InitializeThumb (TRACKBAR_INFO *infoPtr)
 
 
 static LRESULT
-TRACKBAR_Create (HWND hwnd, LPCREATESTRUCTW lpcs)
+TRACKBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
 {
     TRACKBAR_INFO *infoPtr;
     DWORD dwStyle;
@@ -1515,7 +1524,7 @@ TRACKBAR_LButtonUp (TRACKBAR_INFO *infoPtr, DWORD fwKeys, INT x, INT y)
 
 
 static LRESULT
-TRACKBAR_CaptureChanged (TRACKBAR_INFO *infoPtr)
+TRACKBAR_CaptureChanged (const TRACKBAR_INFO *infoPtr)
 {
     notify_with_scroll (infoPtr, TB_ENDTRACK);
     return 0;
@@ -1560,7 +1569,7 @@ TRACKBAR_Size (TRACKBAR_INFO *infoPtr, DWORD fwSizeType, INT nWidth, INT nHeight
 
 
 static LRESULT
-TRACKBAR_Timer (TRACKBAR_INFO *infoPtr, INT wTimerID, TIMERPROC *tmrpc)
+TRACKBAR_Timer (TRACKBAR_INFO *infoPtr, INT wTimerID, const TIMERPROC *tmrpc)
 {
     if (infoPtr->flags & TB_AUTO_PAGE) {
        POINT pt;
@@ -1573,7 +1582,7 @@ TRACKBAR_Timer (TRACKBAR_INFO *infoPtr, INT wTimerID, TIMERPROC *tmrpc)
 
 
 /* update theme after a WM_THEMECHANGED message */
-static LRESULT theme_changed (TRACKBAR_INFO* infoPtr)
+static LRESULT theme_changed (const TRACKBAR_INFO* infoPtr)
 {
     HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
     CloseThemeData (theme);
@@ -1702,8 +1711,8 @@ TRACKBAR_KeyDown (TRACKBAR_INFO *infoPtr, INT nVirtKey, DWORD lKeyData)
 }
 
 
-inline static BOOL
-TRACKBAR_KeyUp (TRACKBAR_INFO *infoPtr, INT nVirtKey, DWORD lKeyData)
+static inline BOOL
+TRACKBAR_KeyUp (const TRACKBAR_INFO *infoPtr, INT nVirtKey, DWORD lKeyData)
 {
     switch (nVirtKey) {
     case VK_LEFT:
index 8ababc9..8adf28b 100644 (file)
@@ -204,12 +204,12 @@ static const WCHAR themeClass[] = { 'T','r','e','e','v','i','e','w',0 };
 typedef VOID (*TREEVIEW_ItemEnumFunc)(TREEVIEW_INFO *, TREEVIEW_ITEM *,LPVOID);
 
 
-static VOID TREEVIEW_Invalidate(TREEVIEW_INFO *, TREEVIEW_ITEM *);
+static VOID TREEVIEW_Invalidate(const TREEVIEW_INFO *, const TREEVIEW_ITEM *);
 
 static LRESULT TREEVIEW_DoSelectItem(TREEVIEW_INFO *, INT, HTREEITEM, INT);
 static VOID TREEVIEW_SetFirstVisible(TREEVIEW_INFO *, TREEVIEW_ITEM *, BOOL);
 static LRESULT TREEVIEW_EnsureVisible(TREEVIEW_INFO *, HTREEITEM, BOOL);
-static LRESULT TREEVIEW_RButtonUp(TREEVIEW_INFO *, LPPOINT);
+static LRESULT TREEVIEW_RButtonUp(const TREEVIEW_INFO *, const POINT *);
 static LRESULT TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel);
 static VOID TREEVIEW_UpdateScrollBars(TREEVIEW_INFO *infoPtr);
 static LRESULT TREEVIEW_HScroll(TREEVIEW_INFO *, WPARAM);
@@ -239,7 +239,7 @@ TREEVIEW_GetInfoPtr(HWND hwnd)
 
 /* Don't call this. Nothing wants an item index. */
 static inline int
-TREEVIEW_GetItemIndex(TREEVIEW_INFO *infoPtr, HTREEITEM handle)
+TREEVIEW_GetItemIndex(const TREEVIEW_INFO *infoPtr, HTREEITEM handle)
 {
     assert(infoPtr != NULL);
 
@@ -247,7 +247,8 @@ TREEVIEW_GetItemIndex(TREEVIEW_INFO *infoPtr, HTREEITEM handle)
 }
 
 /* Checks if item has changed and needs to be redrawn */
-static inline BOOL item_changed (TREEVIEW_ITEM *tiOld, TREEVIEW_ITEM *tiNew, LPTVITEMEXW tvChange)
+static inline BOOL item_changed (const TREEVIEW_ITEM *tiOld, const TREEVIEW_ITEM *tiNew,
+                                 const TVITEMEXW *tvChange)
 {
     /* Number of children has changed */
     if ((tvChange->mask & TVIF_CHILDREN) && (tiOld->cChildren != tiNew->cChildren))
@@ -283,7 +284,7 @@ static inline BOOL item_changed (TREEVIEW_ITEM *tiOld, TREEVIEW_ITEM *tiNew, LPT
  * This method checks that handle is an item for this tree.
  */
 static BOOL
-TREEVIEW_ValidItem(TREEVIEW_INFO *infoPtr, HTREEITEM handle)
+TREEVIEW_ValidItem(const TREEVIEW_INFO *infoPtr, HTREEITEM handle)
 {
     if (TREEVIEW_GetItemIndex(infoPtr, handle) == -1)
     {
@@ -315,7 +316,7 @@ TREEVIEW_CreateUnderlineFont(HFONT hOrigFont)
 }
 
 static inline HFONT
-TREEVIEW_FontForItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
+TREEVIEW_FontForItem(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
 {
     if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (item == infoPtr->hotItem))
         return infoPtr->hUnderlineFont;
@@ -326,7 +327,7 @@ TREEVIEW_FontForItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 
 /* for trace/debugging purposes only */
 static const char *
-TREEVIEW_ItemName(TREEVIEW_ITEM *item)
+TREEVIEW_ItemName(const TREEVIEW_ITEM *item)
 {
     if (item == NULL) return "<null item>";
     if (item->pszText == LPSTR_TEXTCALLBACKW) return "<callback>";
@@ -336,7 +337,7 @@ TREEVIEW_ItemName(TREEVIEW_ITEM *item)
 
 /* An item is not a child of itself. */
 static BOOL
-TREEVIEW_IsChildOf(TREEVIEW_ITEM *parent, TREEVIEW_ITEM *child)
+TREEVIEW_IsChildOf(const TREEVIEW_ITEM *parent, const TREEVIEW_ITEM *child)
 {
     do
     {
@@ -355,7 +356,7 @@ TREEVIEW_IsChildOf(TREEVIEW_ITEM *parent, TREEVIEW_ITEM *child)
  * of a tree node
  */
 static TREEVIEW_ITEM *
-TREEVIEW_GetLastListItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem)
+TREEVIEW_GetLastListItem(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem)
 {
     if (!wineItem)
        return NULL;
@@ -379,7 +380,7 @@ TREEVIEW_GetLastListItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem)
  * considering the tree hierarchy.
  */
 static TREEVIEW_ITEM *
-TREEVIEW_GetPrevListItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *tvItem)
+TREEVIEW_GetPrevListItem(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *tvItem)
 {
     if (tvItem->prevSibling)
     {
@@ -404,7 +405,7 @@ TREEVIEW_GetPrevListItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *tvItem)
  * considering the tree hierarchy.
  */
 static TREEVIEW_ITEM *
-TREEVIEW_GetNextListItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *tvItem)
+TREEVIEW_GetNextListItem(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *tvItem)
 {
     assert(tvItem != NULL);
 
@@ -445,10 +446,10 @@ TREEVIEW_GetNextListItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *tvItem)
  *             forward if count is >0.
  */
 static TREEVIEW_ITEM *
-TREEVIEW_GetListItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
+TREEVIEW_GetListItem(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
                     LONG count)
 {
-    TREEVIEW_ITEM *(*next_item)(TREEVIEW_INFO *, TREEVIEW_ITEM *);
+    TREEVIEW_ITEM *(*next_item)(const TREEVIEW_INFO *, const TREEVIEW_ITEM *);
     TREEVIEW_ITEM *previousItem;
 
     assert(wineItem != NULL);
@@ -478,7 +479,7 @@ TREEVIEW_GetListItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
 
 /* Notifications ************************************************************/
 
-static INT get_notifycode(TREEVIEW_INFO *infoPtr, INT code)
+static INT get_notifycode(const TREEVIEW_INFO *infoPtr, INT code)
 {
     if (!infoPtr->bNtfUnicode) {
        switch (code) {
@@ -500,14 +501,14 @@ static INT get_notifycode(TREEVIEW_INFO *infoPtr, INT code)
 }
 
 static LRESULT
-TREEVIEW_SendRealNotify(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+TREEVIEW_SendRealNotify(const TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     TRACE("wParam=%d, lParam=%ld\n", wParam, lParam);
     return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, wParam, lParam);
 }
 
 static BOOL
-TREEVIEW_SendSimpleNotify(TREEVIEW_INFO *infoPtr, UINT code)
+TREEVIEW_SendSimpleNotify(const TREEVIEW_INFO *infoPtr, UINT code)
 {
     NMHDR nmhdr;
     HWND hwnd = infoPtr->hwnd;
@@ -522,7 +523,7 @@ TREEVIEW_SendSimpleNotify(TREEVIEW_INFO *infoPtr, UINT code)
 }
 
 static VOID
-TREEVIEW_TVItemFromItem(TREEVIEW_INFO *infoPtr, UINT mask, TVITEMW *tvItem, TREEVIEW_ITEM *item)
+TREEVIEW_TVItemFromItem(const TREEVIEW_INFO *infoPtr, UINT mask, TVITEMW *tvItem, TREEVIEW_ITEM *item)
 {
     tvItem->mask = mask;
     tvItem->hItem = item;
@@ -555,7 +556,7 @@ TREEVIEW_TVItemFromItem(TREEVIEW_INFO *infoPtr, UINT mask, TVITEMW *tvItem, TREE
 }
 
 static BOOL
-TREEVIEW_SendTreeviewNotify(TREEVIEW_INFO *infoPtr, UINT code, UINT action,
+TREEVIEW_SendTreeviewNotify(const TREEVIEW_INFO *infoPtr, UINT code, UINT action,
                            UINT mask, HTREEITEM oldItem, HTREEITEM newItem)
 {
     HWND hwnd = infoPtr->hwnd;
@@ -593,7 +594,7 @@ TREEVIEW_SendTreeviewNotify(TREEVIEW_INFO *infoPtr, UINT code, UINT action,
 }
 
 static BOOL
-TREEVIEW_SendTreeviewDnDNotify(TREEVIEW_INFO *infoPtr, UINT code,
+TREEVIEW_SendTreeviewDnDNotify(const TREEVIEW_INFO *infoPtr, UINT code,
                               HTREEITEM dragItem, POINT pt)
 {
     HWND hwnd = infoPtr->hwnd;
@@ -620,7 +621,7 @@ TREEVIEW_SendTreeviewDnDNotify(TREEVIEW_INFO *infoPtr, UINT code,
 
 
 static BOOL
-TREEVIEW_SendCustomDrawNotify(TREEVIEW_INFO *infoPtr, DWORD dwDrawStage,
+TREEVIEW_SendCustomDrawNotify(const TREEVIEW_INFO *infoPtr, DWORD dwDrawStage,
                              HDC hdc, RECT rc)
 {
     HWND hwnd = infoPtr->hwnd;
@@ -653,7 +654,7 @@ TREEVIEW_SendCustomDrawNotify(TREEVIEW_INFO *infoPtr, DWORD dwDrawStage,
 /* FIXME: need to find out when the flags in uItemState need to be set */
 
 static BOOL
-TREEVIEW_SendCustomDrawItemNotify(TREEVIEW_INFO *infoPtr, HDC hdc,
+TREEVIEW_SendCustomDrawItemNotify(const TREEVIEW_INFO *infoPtr, HDC hdc,
                                  TREEVIEW_ITEM *wineItem, UINT uItemDrawState,
                                  NMTVCUSTOMDRAW *nmcdhdr)
 {
@@ -698,7 +699,7 @@ TREEVIEW_SendCustomDrawItemNotify(TREEVIEW_INFO *infoPtr, HDC hdc,
 }
 
 static BOOL
-TREEVIEW_BeginLabelEditNotify(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *editItem)
+TREEVIEW_BeginLabelEditNotify(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *editItem)
 {
     HWND hwnd = infoPtr->hwnd;
     NMTVDISPINFOW tvdi;
@@ -720,7 +721,7 @@ TREEVIEW_BeginLabelEditNotify(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *editItem)
 }
 
 static void
-TREEVIEW_UpdateDispInfo(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
+TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
                        UINT mask)
 {
     NMTVDISPINFOW callback;
@@ -848,7 +849,7 @@ TREEVIEW_UpdateDispInfo(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
  * Just use wineItem->firstChild to check for physical children.
  */
 static BOOL
-TREEVIEW_HasChildren(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem)
+TREEVIEW_HasChildren(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem)
 {
     TREEVIEW_UpdateDispInfo(infoPtr, wineItem, TVIF_CHILDREN);
 
@@ -860,8 +861,7 @@ TREEVIEW_HasChildren(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem)
 
 /* Compute linesOffset, stateOffset, imageOffset, textOffset of an item. */
 static VOID
-TREEVIEW_ComputeItemInternalMetrics(TREEVIEW_INFO *infoPtr,
-                                   TREEVIEW_ITEM *item)
+TREEVIEW_ComputeItemInternalMetrics(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 {
     /* Same effect, different optimisation. */
 #if 0
@@ -882,7 +882,7 @@ TREEVIEW_ComputeItemInternalMetrics(TREEVIEW_INFO *infoPtr,
 }
 
 static VOID
-TREEVIEW_ComputeTextWidth(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, HDC hDC)
+TREEVIEW_ComputeTextWidth(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, HDC hDC)
 {
     HDC hdc;
     HFONT hOldFont=0;
@@ -916,7 +916,7 @@ TREEVIEW_ComputeTextWidth(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, HDC hDC)
 }
 
 static VOID
-TREEVIEW_ComputeItemRect(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
+TREEVIEW_ComputeItemRect(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 {
     item->rect.top = infoPtr->uItemHeight *
        (item->visibleOrder - infoPtr->firstVisible->visibleOrder);
@@ -964,7 +964,7 @@ TREEVIEW_RecalculateVisibleOrder(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *start)
  * root must be expanded
  */
 static VOID
-TREEVIEW_UpdateSubTree(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *root)
+TREEVIEW_UpdateSubTree(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *root)
 {
    TREEVIEW_ITEM *sibling;
    HDC hdc;
@@ -1002,7 +1002,7 @@ TREEVIEW_UpdateSubTree(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *root)
 /* Item Allocation **********************************************************/
 
 static TREEVIEW_ITEM *
-TREEVIEW_AllocateItem(TREEVIEW_INFO *infoPtr)
+TREEVIEW_AllocateItem(const TREEVIEW_INFO *infoPtr)
 {
     TREEVIEW_ITEM *newItem = Alloc(sizeof(TREEVIEW_ITEM));
 
@@ -1116,7 +1116,7 @@ TREEVIEW_InsertAfter(TREEVIEW_ITEM *newItem, TREEVIEW_ITEM *sibling,
 }
 
 static BOOL
-TREEVIEW_DoSetItemT(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
+TREEVIEW_DoSetItemT(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
                   const TVITEMEXW *tvItem, BOOL isW)
 {
     UINT callbackClear = 0;
@@ -1425,7 +1425,7 @@ static void
 TREEVIEW_RemoveItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem);
 
 static void
-TREEVIEW_RemoveAllChildren(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *parentItem)
+TREEVIEW_RemoveAllChildren(TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *parentItem)
 {
     TREEVIEW_ITEM *kill = parentItem->firstChild;
 
@@ -1444,7 +1444,7 @@ TREEVIEW_RemoveAllChildren(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *parentItem)
 }
 
 static void
-TREEVIEW_UnlinkItem(TREEVIEW_ITEM *item)
+TREEVIEW_UnlinkItem(const TREEVIEW_ITEM *item)
 {
     TREEVIEW_ITEM *parentItem = item->parent;
 
@@ -1610,7 +1610,7 @@ TREEVIEW_SetRedraw(TREEVIEW_INFO* infoPtr, WPARAM wParam, LPARAM lParam)
 }
 
 static LRESULT
-TREEVIEW_GetIndent(TREEVIEW_INFO *infoPtr)
+TREEVIEW_GetIndent(const TREEVIEW_INFO *infoPtr)
 {
     TRACE("\n");
     return infoPtr->uIndent;
@@ -1637,7 +1637,7 @@ TREEVIEW_SetIndent(TREEVIEW_INFO *infoPtr, UINT newIndent)
 
 
 static LRESULT
-TREEVIEW_GetToolTips(TREEVIEW_INFO *infoPtr)
+TREEVIEW_GetToolTips(const TREEVIEW_INFO *infoPtr)
 {
     TRACE("\n");
     return (LRESULT)infoPtr->hwndToolTip;
@@ -1664,13 +1664,13 @@ TREEVIEW_SetUnicodeFormat(TREEVIEW_INFO *infoPtr, BOOL fUnicode)
 }
 
 static LRESULT
-TREEVIEW_GetUnicodeFormat(TREEVIEW_INFO *infoPtr)
+TREEVIEW_GetUnicodeFormat(const TREEVIEW_INFO *infoPtr)
 {
      return infoPtr->bNtfUnicode;
 }
 
 static LRESULT
-TREEVIEW_GetScrollTime(TREEVIEW_INFO *infoPtr)
+TREEVIEW_GetScrollTime(const TREEVIEW_INFO *infoPtr)
 {
     return infoPtr->uScrollTime;
 }
@@ -1687,7 +1687,7 @@ TREEVIEW_SetScrollTime(TREEVIEW_INFO *infoPtr, UINT uScrollTime)
 
 
 static LRESULT
-TREEVIEW_GetImageList(TREEVIEW_INFO *infoPtr, WPARAM wParam)
+TREEVIEW_GetImageList(const TREEVIEW_INFO *infoPtr, WPARAM wParam)
 {
     TRACE("\n");
 
@@ -1709,7 +1709,7 @@ TREEVIEW_GetImageList(TREEVIEW_INFO *infoPtr, WPARAM wParam)
 
 /* Compute the natural height for items. */
 static UINT
-TREEVIEW_NaturalHeight(TREEVIEW_INFO *infoPtr)
+TREEVIEW_NaturalHeight(const TREEVIEW_INFO *infoPtr)
 {
     TEXTMETRICW tm;
     HDC hdc = GetDC(0);
@@ -1844,7 +1844,7 @@ TREEVIEW_SetItemHeight(TREEVIEW_INFO *infoPtr, INT newHeight)
 }
 
 static LRESULT
-TREEVIEW_GetItemHeight(TREEVIEW_INFO *infoPtr)
+TREEVIEW_GetItemHeight(const TREEVIEW_INFO *infoPtr)
 {
     TRACE("\n");
     return infoPtr->uItemHeight;
@@ -1852,7 +1852,7 @@ TREEVIEW_GetItemHeight(TREEVIEW_INFO *infoPtr)
 
 
 static LRESULT
-TREEVIEW_GetFont(TREEVIEW_INFO *infoPtr)
+TREEVIEW_GetFont(const TREEVIEW_INFO *infoPtr)
 {
     TRACE("%p\n", infoPtr->hFont);
     return (LRESULT)infoPtr->hFont;
@@ -1901,7 +1901,7 @@ TREEVIEW_SetFont(TREEVIEW_INFO *infoPtr, HFONT hFont, BOOL bRedraw)
 
 
 static LRESULT
-TREEVIEW_GetLineColor(TREEVIEW_INFO *infoPtr)
+TREEVIEW_GetLineColor(const TREEVIEW_INFO *infoPtr)
 {
     TRACE("\n");
     return (LRESULT)infoPtr->clrLine;
@@ -1919,7 +1919,7 @@ TREEVIEW_SetLineColor(TREEVIEW_INFO *infoPtr, COLORREF color)
 
 
 static LRESULT
-TREEVIEW_GetTextColor(TREEVIEW_INFO *infoPtr)
+TREEVIEW_GetTextColor(const TREEVIEW_INFO *infoPtr)
 {
     TRACE("\n");
     return (LRESULT)infoPtr->clrText;
@@ -1941,7 +1941,7 @@ TREEVIEW_SetTextColor(TREEVIEW_INFO *infoPtr, COLORREF color)
 
 
 static LRESULT
-TREEVIEW_GetBkColor(TREEVIEW_INFO *infoPtr)
+TREEVIEW_GetBkColor(const TREEVIEW_INFO *infoPtr)
 {
     TRACE("\n");
     return (LRESULT)infoPtr->clrBk;
@@ -1963,7 +1963,7 @@ TREEVIEW_SetBkColor(TREEVIEW_INFO *infoPtr, COLORREF newColor)
 
 
 static LRESULT
-TREEVIEW_GetInsertMarkColor(TREEVIEW_INFO *infoPtr)
+TREEVIEW_GetInsertMarkColor(const TREEVIEW_INFO *infoPtr)
 {
     TRACE("\n");
     return (LRESULT)infoPtr->clrInsertMark;
@@ -2003,7 +2003,7 @@ TREEVIEW_SetInsertMark(TREEVIEW_INFO *infoPtr, BOOL wParam, HTREEITEM item)
  * input HTREEITEM and the output RECT.
  */
 static LRESULT
-TREEVIEW_GetItemRect(TREEVIEW_INFO *infoPtr, BOOL fTextRect, LPRECT lpRect)
+TREEVIEW_GetItemRect(const TREEVIEW_INFO *infoPtr, BOOL fTextRect, LPRECT lpRect)
 {
     TREEVIEW_ITEM *wineItem;
     const HTREEITEM *pItem = (HTREEITEM *)lpRect;
@@ -2045,7 +2045,7 @@ TREEVIEW_GetItemRect(TREEVIEW_INFO *infoPtr, BOOL fTextRect, LPRECT lpRect)
 }
 
 static inline LRESULT
-TREEVIEW_GetVisibleCount(TREEVIEW_INFO *infoPtr)
+TREEVIEW_GetVisibleCount(const TREEVIEW_INFO *infoPtr)
 {
     /* Suprise! This does not take integral height into account. */
     return infoPtr->clientHeight / infoPtr->uItemHeight;
@@ -2053,7 +2053,7 @@ TREEVIEW_GetVisibleCount(TREEVIEW_INFO *infoPtr)
 
 
 static LRESULT
-TREEVIEW_GetItemT(TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem, BOOL isW)
+TREEVIEW_GetItemT(const TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem, BOOL isW)
 {
     TREEVIEW_ITEM *wineItem;
 
@@ -2130,7 +2130,7 @@ TREEVIEW_GetItemT(TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem, BOOL isW)
 /* Beware MSDN Library Visual Studio 6.0. It says -1 on failure, 0 on success,
  * which is wrong. */
 static LRESULT
-TREEVIEW_SetItemT(TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem, BOOL isW)
+TREEVIEW_SetItemT(TREEVIEW_INFO *infoPtr, const TVITEMEXW *tvItem, BOOL isW)
 {
     TREEVIEW_ITEM *wineItem;
     TREEVIEW_ITEM originalItem;
@@ -2185,7 +2185,7 @@ TREEVIEW_SetItemT(TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem, BOOL isW)
 }
 
 static LRESULT
-TREEVIEW_GetItemState(TREEVIEW_INFO *infoPtr, HTREEITEM wineItem, UINT mask)
+TREEVIEW_GetItemState(const TREEVIEW_INFO *infoPtr, HTREEITEM wineItem, UINT mask)
 {
     TRACE("\n");
 
@@ -2196,7 +2196,7 @@ TREEVIEW_GetItemState(TREEVIEW_INFO *infoPtr, HTREEITEM wineItem, UINT mask)
 }
 
 static LRESULT
-TREEVIEW_GetNextItem(TREEVIEW_INFO *infoPtr, UINT which, HTREEITEM wineItem)
+TREEVIEW_GetNextItem(const TREEVIEW_INFO *infoPtr, UINT which, HTREEITEM wineItem)
 {
     TREEVIEW_ITEM *retval;
 
@@ -2272,14 +2272,14 @@ TREEVIEW_GetNextItem(TREEVIEW_INFO *infoPtr, UINT which, HTREEITEM wineItem)
 
 
 static LRESULT
-TREEVIEW_GetCount(TREEVIEW_INFO *infoPtr)
+TREEVIEW_GetCount(const TREEVIEW_INFO *infoPtr)
 {
     TRACE(" %d\n", infoPtr->uNumItems);
     return (LRESULT)infoPtr->uNumItems;
 }
 
 static VOID
-TREEVIEW_ToggleItemState(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
+TREEVIEW_ToggleItemState(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 {
     if (infoPtr->dwStyle & TVS_CHECKBOXES)
     {
@@ -2307,7 +2307,7 @@ TREEVIEW_ToggleItemState(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 /* Draw the lines and expand button for an item. Also draws one section
  * of the line from item's parent to item's parent's next sibling. */
 static void
-TREEVIEW_DrawItemLines(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item)
+TREEVIEW_DrawItemLines(const TREEVIEW_INFO *infoPtr, HDC hdc, const TREEVIEW_ITEM *item)
 {
     LONG centerx, centery;
     BOOL lar = ((infoPtr->dwStyle
@@ -2443,7 +2443,7 @@ TREEVIEW_DrawItemLines(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item)
 }
 
 static void
-TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem)
+TREEVIEW_DrawItem(const TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem)
 {
     INT cditem;
     HFONT hOldFont;
@@ -2789,7 +2789,7 @@ TREEVIEW_UpdateScrollBars(TREEVIEW_INFO *infoPtr)
 
 /* CtrlSpy doesn't mention this, but CorelDRAW's object manager needs it. */
 static LRESULT
-TREEVIEW_EraseBackground(TREEVIEW_INFO *infoPtr, HDC hDC)
+TREEVIEW_EraseBackground(const TREEVIEW_INFO *infoPtr, HDC hDC)
 {
     HBRUSH hBrush = CreateSolidBrush(infoPtr->clrBk);
     RECT rect;
@@ -2802,7 +2802,7 @@ TREEVIEW_EraseBackground(TREEVIEW_INFO *infoPtr, HDC hDC)
 }
 
 static void
-TREEVIEW_Refresh(TREEVIEW_INFO *infoPtr, HDC hdc, RECT *rc)
+TREEVIEW_Refresh(TREEVIEW_INFO *infoPtr, HDC hdc, const RECT *rc)
 {
     HWND hwnd = infoPtr->hwnd;
     RECT rect = *rc;
@@ -2847,7 +2847,7 @@ TREEVIEW_Refresh(TREEVIEW_INFO *infoPtr, HDC hdc, RECT *rc)
 }
 
 static void
-TREEVIEW_Invalidate(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
+TREEVIEW_Invalidate(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
 {
     if (item != NULL)
        InvalidateRect(infoPtr->hwnd, &item->rect, TRUE);
@@ -2892,7 +2892,8 @@ TREEVIEW_Paint(TREEVIEW_INFO *infoPtr, WPARAM wParam)
  * Forward the DPA local callback to the treeview owner callback
  */
 static INT WINAPI
-TREEVIEW_CallBackCompare(TREEVIEW_ITEM *first, TREEVIEW_ITEM *second, LPTVSORTCB pCallBackSort)
+TREEVIEW_CallBackCompare(const TREEVIEW_ITEM *first, const TREEVIEW_ITEM *second,
+                         const TVSORTCB *pCallBackSort)
 {
     /* Forward the call to the client-defined callback */
     return pCallBackSort->lpfnCompare(first->lParam,
@@ -2905,7 +2906,7 @@ TREEVIEW_CallBackCompare(TREEVIEW_ITEM *first, TREEVIEW_ITEM *second, LPTVSORTCB
  */
 static INT WINAPI
 TREEVIEW_SortOnName(TREEVIEW_ITEM *first, TREEVIEW_ITEM *second,
-                     TREEVIEW_INFO *infoPtr)
+                    const TREEVIEW_INFO *infoPtr)
 {
     TREEVIEW_UpdateDispInfo(infoPtr, first, TVIF_TEXT);
     TREEVIEW_UpdateDispInfo(infoPtr, second, TVIF_TEXT);
@@ -2922,7 +2923,7 @@ TREEVIEW_SortOnName(TREEVIEW_ITEM *first, TREEVIEW_ITEM *second,
 
 /* Returns the number of physical children belonging to item. */
 static INT
-TREEVIEW_CountChildren(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
+TREEVIEW_CountChildren(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
 {
     INT cChildren = 0;
     HTREEITEM hti;
@@ -2936,7 +2937,7 @@ TREEVIEW_CountChildren(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 /* Returns a DPA containing a pointer to each physical child of item in
  * sibling order. If item has no children, an empty DPA is returned. */
 static HDPA
-TREEVIEW_BuildChildDPA(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
+TREEVIEW_BuildChildDPA(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
 {
     HTREEITEM child = item->firstChild;
 
@@ -3107,7 +3108,7 @@ TREEVIEW_SortChildren(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 /* Expansion/Collapse ***************************************************/
 
 static BOOL
-TREEVIEW_SendExpanding(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
+TREEVIEW_SendExpanding(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
                       UINT action)
 {
     return !TREEVIEW_SendTreeviewNotify(infoPtr, TVN_ITEMEXPANDINGW, action,
@@ -3117,7 +3118,7 @@ TREEVIEW_SendExpanding(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
 }
 
 static VOID
-TREEVIEW_SendExpanded(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
+TREEVIEW_SendExpanded(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
                      UINT action)
 {
     TREEVIEW_SendTreeviewNotify(infoPtr, TVN_ITEMEXPANDEDW, action,
@@ -3413,7 +3414,7 @@ TREEVIEW_ExpandMsg(TREEVIEW_INFO *infoPtr, UINT flag, HTREEITEM wineItem)
 /* Hit-Testing **********************************************************/
 
 static TREEVIEW_ITEM *
-TREEVIEW_HitTestPoint(TREEVIEW_INFO *infoPtr, POINT pt)
+TREEVIEW_HitTestPoint(const TREEVIEW_INFO *infoPtr, POINT pt)
 {
     TREEVIEW_ITEM *wineItem;
     LONG row;
@@ -3435,7 +3436,7 @@ TREEVIEW_HitTestPoint(TREEVIEW_INFO *infoPtr, POINT pt)
 }
 
 static LRESULT
-TREEVIEW_HitTest(TREEVIEW_INFO *infoPtr, LPTVHITTESTINFO lpht)
+TREEVIEW_HitTest(const TREEVIEW_INFO *infoPtr, LPTVHITTESTINFO lpht)
 {
     TREEVIEW_ITEM *wineItem;
     RECT rect;
@@ -3513,7 +3514,7 @@ TREEVIEW_HitTest(TREEVIEW_INFO *infoPtr, LPTVHITTESTINFO lpht)
 /* Item Label Editing ***************************************************/
 
 static LRESULT
-TREEVIEW_GetEditControl(TREEVIEW_INFO *infoPtr)
+TREEVIEW_GetEditControl(const TREEVIEW_INFO *infoPtr)
 {
     return (LRESULT)infoPtr->hwndEdit;
 }
@@ -3793,7 +3794,8 @@ TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel)
 
         if (strcmpW(newText, editedItem->pszText) != 0)
         {
-            if (NULL == ReAlloc(editedItem->pszText, iLength + 1))
+            WCHAR *ptr = ReAlloc(editedItem->pszText, sizeof(WCHAR)*(iLength + 1));
+            if (ptr == NULL)
             {
                 ERR("OutOfMemory, cannot allocate space for label\n");
                 DestroyWindow(infoPtr->hwndEdit);
@@ -3802,8 +3804,10 @@ TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel)
             }
             else
             {
+                editedItem->pszText = ptr;
                 editedItem->cchTextMax = iLength + 1;
                 strcpyW(editedItem->pszText, newText);
+                TREEVIEW_ComputeTextWidth(infoPtr, editedItem, 0);
             }
         }
         if(newText != tmpText) Free(newText);
@@ -3840,7 +3844,7 @@ TREEVIEW_HandleTimer(TREEVIEW_INFO *infoPtr, WPARAM wParam)
  * Windows.
  */
 static LRESULT
-TREEVIEW_TrackMouse(TREEVIEW_INFO *infoPtr, POINT pt)
+TREEVIEW_TrackMouse(const TREEVIEW_INFO *infoPtr, POINT pt)
 {
     INT cxDrag = GetSystemMetrics(SM_CXDRAG);
     INT cyDrag = GetSystemMetrics(SM_CYDRAG);
@@ -4148,7 +4152,7 @@ TREEVIEW_RButtonDown(TREEVIEW_INFO *infoPtr, LPARAM lParam)
 }
 
 static LRESULT
-TREEVIEW_RButtonUp(TREEVIEW_INFO *infoPtr, LPPOINT pPt)
+TREEVIEW_RButtonUp(const TREEVIEW_INFO *infoPtr, const POINT *pPt)
 {
     return 0;
 }
@@ -4825,6 +4829,46 @@ TREEVIEW_MouseWheel(TREEVIEW_INFO *infoPtr, WPARAM wParam)
 
 /* Create/Destroy *******************************************************/
 
+static void
+initialize_checkboxes(TREEVIEW_INFO *infoPtr)
+{
+    RECT rc;
+    HBITMAP hbm, hbmOld;
+    HDC hdc, hdcScreen;
+    int nIndex;
+
+    infoPtr->himlState = ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 3, 0);
+
+    hdcScreen = GetDC(0);
+
+    hdc = CreateCompatibleDC(hdcScreen);
+    hbm = CreateCompatibleBitmap(hdcScreen, 48, 16);
+    hbmOld = SelectObject(hdc, hbm);
+
+    SetRect(&rc, 0, 0, 48, 16);
+    FillRect(hdc, &rc, (HBRUSH)(COLOR_WINDOW+1));
+
+    SetRect(&rc, 18, 2, 30, 14);
+    DrawFrameControl(hdc, &rc, DFC_BUTTON,
+                     DFCS_BUTTONCHECK|DFCS_FLAT);
+
+    SetRect(&rc, 34, 2, 46, 14);
+    DrawFrameControl(hdc, &rc, DFC_BUTTON,
+                     DFCS_BUTTONCHECK|DFCS_FLAT|DFCS_CHECKED);
+
+    SelectObject(hdc, hbmOld);
+    nIndex = ImageList_AddMasked(infoPtr->himlState, hbm,
+                                 GetSysColor(COLOR_WINDOW));
+    TRACE("checkbox index %d\n", nIndex);
+
+    DeleteObject(hbm);
+    DeleteDC(hdc);
+    ReleaseDC(0, hdcScreen);
+
+    infoPtr->stateImageWidth = 16;
+    infoPtr->stateImageHeight = 16;
+}
+
 static LRESULT
 TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
 {
@@ -4926,48 +4970,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
        infoPtr->hwndToolTip = COMCTL32_CreateToolTip(hwnd);
 
     if (infoPtr->dwStyle & TVS_CHECKBOXES)
-    {
-       RECT rc;
-       HBITMAP hbm, hbmOld;
-       HDC hdc,hdcScreen;
-       int nIndex;
-
-       infoPtr->himlState =
-           ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 3, 0);
-
-       hdcScreen = GetDC(0);
-
-       /* Create a coloured bitmap compatible with the screen depth
-          because checkboxes are not black&white */
-       hdc = CreateCompatibleDC(hdcScreen);
-       hbm = CreateCompatibleBitmap(hdcScreen, 48, 16);
-       hbmOld = SelectObject(hdc, hbm);
-
-       rc.left  = 0;   rc.top    = 0;
-       rc.right = 48;  rc.bottom = 16;
-       FillRect(hdc, &rc, (HBRUSH)(COLOR_WINDOW+1));
-
-       rc.left  = 18;   rc.top    = 2;
-       rc.right = 30;   rc.bottom = 14;
-       DrawFrameControl(hdc, &rc, DFC_BUTTON,
-                         DFCS_BUTTONCHECK|DFCS_FLAT);
-
-       rc.left  = 34;   rc.right  = 46;
-       DrawFrameControl(hdc, &rc, DFC_BUTTON,
-                         DFCS_BUTTONCHECK|DFCS_FLAT|DFCS_CHECKED);
-
-       SelectObject(hdc, hbmOld);
-       nIndex = ImageList_AddMasked(infoPtr->himlState, hbm,
-                                     GetSysColor(COLOR_WINDOW));
-       TRACE("checkbox index %d\n", nIndex);
-
-       DeleteObject(hbm);
-       DeleteDC(hdc);
-       ReleaseDC(0, hdcScreen);
-
-       infoPtr->stateImageWidth = 16;
-       infoPtr->stateImageHeight = 16;
-    }
+        initialize_checkboxes(infoPtr);
 
     /* Make sure actual scrollbar state is consistent with uInternalStatus */
     ShowScrollBar(hwnd, SB_VERT, FALSE);
@@ -5227,7 +5230,7 @@ TREEVIEW_MouseMove (TREEVIEW_INFO * infoPtr, WPARAM wParam, LPARAM lParam)
 }
 
 /* Draw themed border */
-static BOOL nc_paint (TREEVIEW_INFO *infoPtr, HRGN region)
+static BOOL nc_paint (const TREEVIEW_INFO *infoPtr, HRGN region)
 {
     HTHEME theme = GetWindowTheme (infoPtr->hwnd);
     HDC dc;
@@ -5261,7 +5264,7 @@ static BOOL nc_paint (TREEVIEW_INFO *infoPtr, HRGN region)
 }
 
 static LRESULT
-TREEVIEW_Notify(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+TREEVIEW_Notify(const TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     LPNMHDR lpnmh = (LPNMHDR)lParam;
 
@@ -5329,24 +5332,37 @@ TREEVIEW_StyleChanged(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
     if (wParam == GWL_STYLE)
     {
-       DWORD dwNewStyle = ((LPSTYLESTRUCT)lParam)->styleNew;
+        DWORD dwNewStyle = ((LPSTYLESTRUCT)lParam)->styleNew;
 
-       /* we have to take special care about tooltips */
-       if ((infoPtr->dwStyle ^ dwNewStyle) & TVS_NOTOOLTIPS)
-       {
-          if (infoPtr->dwStyle & TVS_NOTOOLTIPS)
-          {
-              infoPtr->hwndToolTip = COMCTL32_CreateToolTip(infoPtr->hwnd);
-              TRACE("\n");
-          }
-          else
-          {
-             DestroyWindow(infoPtr->hwndToolTip);
-             infoPtr->hwndToolTip = 0;
-          }
-       }
+        if ((infoPtr->dwStyle ^ dwNewStyle) & TVS_CHECKBOXES)
+        {
+            if (dwNewStyle & TVS_CHECKBOXES)
+            {
+                initialize_checkboxes(infoPtr);
+                TRACE("checkboxes enabled\n");
+            }
+            else
+            {
+                FIXME("tried to disable checkboxes\n");
+            }
+        }
+
+        if ((infoPtr->dwStyle ^ dwNewStyle) & TVS_NOTOOLTIPS)
+        {
+            if (infoPtr->dwStyle & TVS_NOTOOLTIPS)
+            {
+                infoPtr->hwndToolTip = COMCTL32_CreateToolTip(infoPtr->hwnd);
+                TRACE("tooltips enabled\n");
+            }
+            else
+            {
+                DestroyWindow(infoPtr->hwndToolTip);
+                infoPtr->hwndToolTip = 0;
+                TRACE("tooltips disabled\n");
+            }
+        }
 
-       infoPtr->dwStyle = dwNewStyle;
+        infoPtr->dwStyle = dwNewStyle;
     }
 
     TREEVIEW_UpdateSubTree(infoPtr, infoPtr->root);
@@ -5357,7 +5373,7 @@ TREEVIEW_StyleChanged(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 }
 
 static LRESULT
-TREEVIEW_SetCursor(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+TREEVIEW_SetCursor(const TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     POINT pt;
     TREEVIEW_ITEM * item;
@@ -5395,7 +5411,7 @@ TREEVIEW_SetFocus(TREEVIEW_INFO *infoPtr)
 }
 
 static LRESULT
-TREEVIEW_KillFocus(TREEVIEW_INFO *infoPtr)
+TREEVIEW_KillFocus(const TREEVIEW_INFO *infoPtr)
 {
     TRACE("\n");
 
@@ -5406,7 +5422,7 @@ TREEVIEW_KillFocus(TREEVIEW_INFO *infoPtr)
 }
 
 /* update theme after a WM_THEMECHANGED message */
-static LRESULT theme_changed (TREEVIEW_INFO* infoPtr)
+static LRESULT theme_changed(const TREEVIEW_INFO *infoPtr)
 {
     HTHEME theme = GetWindowTheme (infoPtr->hwnd);
     CloseThemeData (theme);
index c5801a1..63df9dc 100644 (file)
@@ -108,7 +108,7 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action);
  *           UPDOWN_IsBuddyEdit
  * Tests if our buddy is an edit control.
  */
-static inline BOOL UPDOWN_IsBuddyEdit(UPDOWN_INFO *infoPtr)
+static inline BOOL UPDOWN_IsBuddyEdit(const UPDOWN_INFO *infoPtr)
 {
     return infoPtr->BuddyType == BUDDY_TYPE_EDIT;
 }
@@ -117,7 +117,7 @@ static inline BOOL UPDOWN_IsBuddyEdit(UPDOWN_INFO *infoPtr)
  *           UPDOWN_IsBuddyListbox
  * Tests if our buddy is a listbox control.
  */
-static inline BOOL UPDOWN_IsBuddyListbox(UPDOWN_INFO *infoPtr)
+static inline BOOL UPDOWN_IsBuddyListbox(const UPDOWN_INFO *infoPtr)
 {
     return infoPtr->BuddyType == BUDDY_TYPE_LISTBOX;
 }
@@ -126,7 +126,7 @@ static inline BOOL UPDOWN_IsBuddyListbox(UPDOWN_INFO *infoPtr)
  *           UPDOWN_InBounds
  * Tests if a given value 'val' is between the Min&Max limits
  */
-static BOOL UPDOWN_InBounds(UPDOWN_INFO *infoPtr, int val)
+static BOOL UPDOWN_InBounds(const UPDOWN_INFO *infoPtr, int val)
 {
     if(infoPtr->MaxVal > infoPtr->MinVal)
         return (infoPtr->MinVal <= val) && (val <= infoPtr->MaxVal);
@@ -162,7 +162,7 @@ static BOOL UPDOWN_OffsetVal(UPDOWN_INFO *infoPtr, int delta)
  * When we have a buddy set and that we are aligned on our buddy, we
  * want to draw a sunken edge to make like we are part of that control.
  */
-static BOOL UPDOWN_HasBuddyBorder(UPDOWN_INFO* infoPtr)
+static BOOL UPDOWN_HasBuddyBorder(const UPDOWN_INFO *infoPtr)
 {
     return  ( ((infoPtr->dwStyle & (UDS_ALIGNLEFT | UDS_ALIGNRIGHT)) != 0) &&
              UPDOWN_IsBuddyEdit(infoPtr) );
@@ -176,7 +176,7 @@ static BOOL UPDOWN_HasBuddyBorder(UPDOWN_INFO* infoPtr)
  *            FLAG_DECR to get the "decrement" rect (down or left)
  *            If both flags are pressent, the envelope is returned.
  */
-static void UPDOWN_GetArrowRect (UPDOWN_INFO* infoPtr, RECT *rect, int arrow)
+static void UPDOWN_GetArrowRect (const UPDOWN_INFO* infoPtr, RECT *rect, int arrow)
 {
     HTHEME theme = GetWindowTheme (infoPtr->Self);
     const int border = theme ? DEFAULT_BUDDYBORDER_THEMED : DEFAULT_BUDDYBORDER;
@@ -228,7 +228,7 @@ static void UPDOWN_GetArrowRect (UPDOWN_INFO* infoPtr, RECT *rect, int arrow)
  * If it returns the up rect, it returns FLAG_INCR.
  * If it returns the down rect, it returns FLAG_DECR.
  */
-static INT UPDOWN_GetArrowFromPoint (UPDOWN_INFO* infoPtr, RECT *rect, POINT pt)
+static INT UPDOWN_GetArrowFromPoint (const UPDOWN_INFO *infoPtr, RECT *rect, POINT pt)
 {
     UPDOWN_GetArrowRect (infoPtr, rect, FLAG_INCR);
     if(PtInRect(rect, pt)) return FLAG_INCR;
@@ -306,7 +306,7 @@ static BOOL UPDOWN_GetBuddyInt (UPDOWN_INFO *infoPtr)
  *   TRUE  - if it set the caption of the  buddy successfully
  *   FALSE - if an error occurred
  */
-static BOOL UPDOWN_SetBuddyInt (UPDOWN_INFO *infoPtr)
+static BOOL UPDOWN_SetBuddyInt (const UPDOWN_INFO *infoPtr)
 {
     WCHAR fmt[3] = { '%', 'd', '\0' };
     WCHAR txt[20];
@@ -352,7 +352,7 @@ static BOOL UPDOWN_SetBuddyInt (UPDOWN_INFO *infoPtr)
  *
  * Draw buddy background for visual integration.
  */
-static BOOL UPDOWN_DrawBuddyBackground (UPDOWN_INFO *infoPtr, HDC hdc)
+static BOOL UPDOWN_DrawBuddyBackground (const UPDOWN_INFO *infoPtr, HDC hdc)
 {
     RECT br;
     HTHEME buddyTheme = GetWindowTheme (infoPtr->Buddy);
@@ -370,7 +370,7 @@ static BOOL UPDOWN_DrawBuddyBackground (UPDOWN_INFO *infoPtr, HDC hdc)
  *
  * Draw the arrows. The background need not be erased.
  */
-static LRESULT UPDOWN_Draw (UPDOWN_INFO *infoPtr, HDC hdc)
+static LRESULT UPDOWN_Draw (const UPDOWN_INFO *infoPtr, HDC hdc)
 {
     BOOL uPressed, uHot, dPressed, dHot;
     RECT rect;
@@ -437,7 +437,7 @@ static LRESULT UPDOWN_Draw (UPDOWN_INFO *infoPtr, HDC hdc)
  * Asynchronous drawing (must ONLY be used in WM_PAINT).
  * Calls UPDOWN_Draw.
  */
-static LRESULT UPDOWN_Paint (UPDOWN_INFO *infoPtr, HDC hdc)
+static LRESULT UPDOWN_Paint (const UPDOWN_INFO *infoPtr, HDC hdc)
 {
     PAINTSTRUCT ps;
     if (hdc) return UPDOWN_Draw (infoPtr, hdc);
@@ -650,7 +650,7 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
  * Returns TRUE if it is enabled as well as its buddy (if any)
  *         FALSE otherwise
  */
-static BOOL UPDOWN_IsEnabled (UPDOWN_INFO *infoPtr)
+static BOOL UPDOWN_IsEnabled (const UPDOWN_INFO *infoPtr)
 {
     if (!IsWindowEnabled(infoPtr->Self))
         return FALSE;