ComboEx: CBES_EX_PATHWORDBREAKPROC

Dimitrie O. Paun dpaun at rogers.com
Mon Aug 26 23:03:41 CDT 2002


ChangeLog
  Implement CBES_EX_PATHWORDBREAKPROC for the ComboEx control.

Index: dlls/comctl32/comboex.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/comboex.c,v
retrieving revision 1.49
diff -u -r1.49 comboex.c
--- dlls/comctl32/comboex.c	26 Aug 2002 21:46:25 -0000	1.49
+++ dlls/comctl32/comboex.c	27 Aug 2002 03:46:35 -0000
@@ -21,7 +21,6 @@
  *
  * FIXME:
  *  1. Implement following extended styles:
- *	     CBES_EX_PATHWORDBREAKPROC
  *	     CBES_EX_NOSIZELIMIT
  *  2. Notify CBEN_DRAGBEGIN is not implemented.
  *
@@ -119,6 +118,8 @@
 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);
 
@@ -622,15 +623,21 @@
 
     dwTemp = infoPtr->dwExtStyle;
 
-    if (style &  (CBES_EX_PATHWORDBREAKPROC |
-		  CBES_EX_NOSIZELIMIT))
-	FIXME("Extended style not implemented %08lx\n", style);
+    if (style & CBES_EX_NOSIZELIMIT)
+	FIXME("Extended style CBES_EX_NOSIZELIMIT implemented\n");
 
     if (mask)
 	infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~mask) | style;
     else
 	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);
+    }
+    
     /* test if the control's appearance has changed */
     mask = CBES_EX_NOEDITIMAGE | CBES_EX_NOEDITIMAGEINDENT;
     if ((infoPtr->dwExtStyle & mask) != (dwTemp & mask)) {
@@ -912,9 +919,9 @@
     infoPtr->hwndCombo = CreateWindowW (COMBOBOX, NIL,
 			 /* following line added to match native */
                          WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL |
-                         CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST |
+                         CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | 
 			 /* was base and is necessary */
-			 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED |
+			 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | 
 			 GetWindowLongW (hwnd, GWL_STYLE),
 			 cs->y, cs->x, cs->cx, cs->cy, hwnd,
 			 (HMENU) GetWindowLongW (hwnd, GWL_ID),
@@ -1598,6 +1605,29 @@
     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
 COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)




More information about the wine-patches mailing list