Common Controls: Implement SetPathWordBreakProc and MirrorIcon

Robert Shearman rob at codeweavers.com
Tue Oct 19 13:39:04 CDT 2004


Changelog:
Implement SetPathWordBreakProc and MirrorIcon.
-------------- next part --------------
Index: wine/dlls/comctl32/comctl32.h
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/comctl32.h,v
retrieving revision 1.33
diff -u -p -r1.33 comctl32.h
--- wine/dlls/comctl32/comctl32.h	7 Sep 2004 20:43:30 -0000	1.33
+++ wine/dlls/comctl32/comctl32.h	19 Oct 2004 16:17:20 -0000
@@ -188,4 +188,7 @@ BOOL WINAPI DPA_Merge (const HDPA, const
 
 #define DPA_GetPtrCount(hdpa)  (*(INT*)(hdpa))
 
+LRESULT WINAPI SetPathWordBreakProc(HWND hwnd, BOOL bSet);
+BOOL WINAPI MirrorIcon(HICON *phicon1, HICON *phicon2);
+
 #endif  /* __WINE_COMCTL32_H */
Index: wine/dlls/comctl32/commctrl.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/commctrl.c,v
retrieving revision 1.87
diff -u -p -r1.87 commctrl.c
--- wine/dlls/comctl32/commctrl.c	18 Oct 2004 23:14:38 -0000	1.87
+++ wine/dlls/comctl32/commctrl.c	19 Oct 2004 16:17:20 -0000
@@ -1485,3 +1485,67 @@ void COMCTL32_DrawInsertMark(HDC hDC, co
     SelectObject(hDC, hOldPen);
     DeleteObject(hPen);
 }
+
+/***********************************************************************
+ * MirrorIcon [COMCTL32.414]
+ *
+ * Mirrors an icon so that it will appear correctly on a mirrored DC.
+ *
+ * PARAMS
+ *     phicon1 [I/O] Icon.
+ *     phicon2 [I/O] Icon.
+ *
+ * RETURNS
+ *     Success: TRUE.
+ *     Failure: FALSE.
+ */
+BOOL WINAPI MirrorIcon(HICON *phicon1, HICON *phicon2)
+{
+    FIXME("(%p, %p): stub\n", phicon1, phicon2);
+    return FALSE;
+}
+
+static inline int IsDelimiter(WCHAR c)
+{
+    switch(c)
+    {
+	case '/':
+	case '\\':
+	case '.':
+	case ' ':
+	    return TRUE;
+    }
+    return FALSE;
+}
+
+static int CALLBACK PathWordBreakProc(LPWSTR lpch, int ichCurrent, int cch, int code)
+{
+    if (code == WB_ISDELIMITER)
+        return IsDelimiter(lpch[ichCurrent]);
+    else
+    {
+        int dir = (code == WB_LEFT) ? -1 : 1;
+        for(; 0 <= ichCurrent && ichCurrent < cch; ichCurrent += dir)
+            if (IsDelimiter(lpch[ichCurrent])) return ichCurrent;
+    }
+    return ichCurrent;
+}
+
+/***********************************************************************
+ * SetPathWordBreakProc [COMCTL32.384]
+ *
+ * Sets the word break procedure for an edit control to one that understands
+ * paths so that the user can jump over directories.
+ *
+ * PARAMS
+ *     hwnd [I] Handle to edit control.
+ *     bSet [I] If this is TRUE then the word break proc is set, otherwise it is removed.
+ *
+ * RETURNS
+ *     Result from EM_SETWORDBREAKPROC message.
+ */
+LRESULT WINAPI SetPathWordBreakProc(HWND hwnd, BOOL bSet)
+{
+    return SendMessageW(hwnd, EM_SETWORDBREAKPROC, 0,
+        (LPARAM)(bSet ? PathWordBreakProc : NULL));
+}
Index: wine/dlls/comctl32/comctl32.spec
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/comctl32.spec,v
retrieving revision 1.45
diff -u -p -r1.45 comctl32.spec
--- wine/dlls/comctl32/comctl32.spec	18 Oct 2004 19:36:13 -0000	1.45
+++ wine/dlls/comctl32/comctl32.spec	19 Oct 2004 16:17:20 -0000
@@ -89,7 +89,7 @@
 377 stdcall -noname IntlStrEqWorkerW(long wstr wstr long)
 382 stdcall -noname SmoothScrollWindow(ptr)
 383 stub -noname DoReaderMode
-384 stub -noname SetPathWordBreakProc
+384 stdcall -noname SetPathWordBreakProc(ptr long)
 385 stdcall -noname DPA_EnumCallback(long long long)
 386 stdcall -noname DPA_DestroyCallback(ptr ptr long)
 387 stdcall -noname DSA_EnumCallback(ptr ptr long)
@@ -105,7 +105,7 @@
 411 stdcall GetWindowSubclass(long ptr long ptr)
 412 stdcall RemoveWindowSubclass(long ptr long)
 413 stdcall DefSubclassProc(long long long long)
-414 stub -noname MirrorIcon
+414 stdcall -noname MirrorIcon(ptr ptr)
 415 stdcall -noname DrawTextWrap(long wstr long ptr long) user32.DrawTextW
 416 stdcall -noname DrawTextExPrivWrap(long wstr long ptr long ptr) user32.DrawTextExW
 417 stdcall -noname ExtTextOutWrap(long long long long ptr wstr long ptr) gdi32.ExtTextOutW
Index: wine/dlls/comctl32/comboex.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/comboex.c,v
retrieving revision 1.73
diff -u -p -r1.73 comboex.c
--- wine/dlls/comctl32/comboex.c	2 Sep 2004 23:00:53 -0000	1.73
+++ wine/dlls/comctl32/comboex.c	19 Oct 2004 16:17:21 -0000
@@ -130,8 +130,6 @@ static LRESULT WINAPI
 COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 static LRESULT WINAPI
 COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-static int CALLBACK
-COMBOEX_PathWordBreakProc(LPWSTR lpch, int ichCurrent, int cch, int code);
 static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr);
 typedef INT (WINAPI *cmp_func_t)(LPCWSTR, LPCWSTR);
 
@@ -674,11 +672,9 @@ COMBOEX_SetExtendedStyle (COMBOEX_INFO *
 	infoPtr->dwExtStyle = style;
 
     /* see if we need to change the word break proc on the edit */
-    if ((infoPtr->dwExtStyle ^ dwTemp) & CBES_EX_PATHWORDBREAKPROC) {
-	SendMessageW(infoPtr->hwndEdit, EM_SETWORDBREAKPROC, 0,
-		     (infoPtr->dwExtStyle & CBES_EX_PATHWORDBREAKPROC) ?
-		         (LPARAM)COMBOEX_PathWordBreakProc : 0);
-    }
+    if ((infoPtr->dwExtStyle ^ dwTemp) & CBES_EX_PATHWORDBREAKPROC)
+        SetPathWordBreakProc(infoPtr->hwndEdit, 
+            (infoPtr->dwExtStyle & CBES_EX_PATHWORDBREAKPROC) ? TRUE : FALSE);
 
     /* test if the control's appearance has changed */
     mask = CBES_EX_NOEDITIMAGE | CBES_EX_NOEDITIMAGEINDENT;
@@ -1648,30 +1644,6 @@ static LRESULT COMBOEX_WindowPosChanging
     }
 
     return 0;
-}
-
-static inline int is_delimiter(WCHAR c)
-{
-    switch(c) {
-	case '/':
-	case '\\':
-	case '.':
-	    return TRUE;
-    }
-    return FALSE;
-}
-
-static int CALLBACK
-COMBOEX_PathWordBreakProc(LPWSTR lpch, int ichCurrent, int cch, int code)
-{
-    if (code == WB_ISDELIMITER) {
-	return is_delimiter(lpch[ichCurrent]);
-    } else {
-	int dir = (code == WB_LEFT) ? -1 : 1;
-        for(; 0 <= ichCurrent && ichCurrent < cch; ichCurrent += dir)
-	    if (is_delimiter(lpch[ichCurrent])) return ichCurrent;
-    }
-    return ichCurrent;
 }
 
 static LRESULT WINAPI


More information about the wine-patches mailing list