Mercurial > projects > dwt2
comparison org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Combo.d @ 39:0ecb2b338560
further work on phobosification
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 25 Mar 2009 13:20:43 +0100 |
parents | 2e09b0e6857a |
children | 9f4c18c268b2 |
comparison
equal
deleted
inserted
replaced
38:2e09b0e6857a | 39:0ecb2b338560 |
---|---|
1026 | 1026 |
1027 /* Use CB_FINDSTRINGEXACT to search for the item */ | 1027 /* Use CB_FINDSTRINGEXACT to search for the item */ |
1028 int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0); | 1028 int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0); |
1029 if (!(0 <= start && start < count)) return -1; | 1029 if (!(0 <= start && start < count)) return -1; |
1030 int index = start - 1, last = 0; | 1030 int index = start - 1, last = 0; |
1031 TCHAR* buffer = StrToTCHARz( string ); | 1031 LPCTSTR buffer = StrToTCHARz( string ); |
1032 do { | 1032 do { |
1033 index = OS.SendMessage (handle, OS.CB_FINDSTRINGEXACT, last = index, buffer); | 1033 index = OS.SendMessage (handle, OS.CB_FINDSTRINGEXACT, last = index, cast(void*)buffer); |
1034 if (index is OS.CB_ERR || index <= last) return -1; | 1034 if (index is OS.CB_ERR || index <= last) return -1; |
1035 } while (string!=/*eq*/getItem (index)); | 1035 } while (string!=/*eq*/getItem (index)); |
1036 return index; | 1036 return index; |
1037 } | 1037 } |
1038 | 1038 |
1407 break; | 1407 break; |
1408 } | 1408 } |
1409 String newText = verifyText (oldText, start, end, event); | 1409 String newText = verifyText (oldText, start, end, event); |
1410 if (newText is null) return false; | 1410 if (newText is null) return false; |
1411 if (newText is oldText) return true; | 1411 if (newText is oldText) return true; |
1412 TCHAR* buffer = StrToTCHARz( newText ); | 1412 LPCTSTR buffer = StrToTCHARz( newText ); |
1413 OS.SendMessage (hwndText, OS.EM_SETSEL, start, end); | 1413 OS.SendMessage (hwndText, OS.EM_SETSEL, start, end); |
1414 OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, buffer); | 1414 OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, cast(void*)buffer); |
1415 return false; | 1415 return false; |
1416 } | 1416 } |
1417 | 1417 |
1418 /** | 1418 /** |
1419 * Selects the item at the given zero-relative index in the receiver's | 1419 * Selects the item at the given zero-relative index in the receiver's |
1576 } | 1576 } |
1577 OS.SendMessage (handle, OS.CB_RESETCONTENT, 0, 0); | 1577 OS.SendMessage (handle, OS.CB_RESETCONTENT, 0, 0); |
1578 int codePage = getCodePage (); | 1578 int codePage = getCodePage (); |
1579 for (int i=0; i<items.length; i++) { | 1579 for (int i=0; i<items.length; i++) { |
1580 String string = items [i]; | 1580 String string = items [i]; |
1581 TCHAR* buffer = StrToTCHARz( string ); | 1581 LPCTSTR buffer = StrToTCHARz( string ); |
1582 int code = OS.SendMessage (handle, OS.CB_ADDSTRING, 0, buffer); | 1582 int code = OS.SendMessage (handle, OS.CB_ADDSTRING, 0, cast(void*)buffer); |
1583 if (code is OS.CB_ERR) error (SWT.ERROR_ITEM_NOT_ADDED); | 1583 if (code is OS.CB_ERR) error (SWT.ERROR_ITEM_NOT_ADDED); |
1584 if (code is OS.CB_ERRSPACE) error (SWT.ERROR_ITEM_NOT_ADDED); | 1584 if (code is OS.CB_ERRSPACE) error (SWT.ERROR_ITEM_NOT_ADDED); |
1585 if ((style & SWT.H_SCROLL) !is 0) { | 1585 if ((style & SWT.H_SCROLL) !is 0) { |
1586 int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX; | 1586 int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX; |
1587 OS.DrawText (hDC, buffer, -1, &rect, flags); | 1587 OS.DrawText (hDC, buffer, -1, &rect, flags); |
1818 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); | 1818 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); |
1819 if (hwndText !is null) { | 1819 if (hwndText !is null) { |
1820 limit = OS.SendMessage (hwndText, OS.EM_GETLIMITTEXT, 0, 0) & 0x7FFFFFFF; | 1820 limit = OS.SendMessage (hwndText, OS.EM_GETLIMITTEXT, 0, 0) & 0x7FFFFFFF; |
1821 } | 1821 } |
1822 if (string.length > limit) string = string.substring (0, limit); | 1822 if (string.length > limit) string = string.substring (0, limit); |
1823 TCHAR* buffer = StrToTCHARz( string ); | 1823 LPCTSTR buffer = StrToTCHARz( string ); |
1824 if (OS.SetWindowText (handle, buffer)) { | 1824 if (OS.SetWindowText (handle, buffer)) { |
1825 sendEvent (SWT.Modify); | 1825 sendEvent (SWT.Modify); |
1826 // widget could be disposed at this point | 1826 // widget could be disposed at this point |
1827 } | 1827 } |
1828 } | 1828 } |
2396 OS.MoveMemory (pszText, buffer.ptr, byteCount); | 2396 OS.MoveMemory (pszText, buffer.ptr, byteCount); |
2397 int code = OS.CallWindowProc (EditProc, hwndText, msg, wParam, cast(int) pszText); | 2397 int code = OS.CallWindowProc (EditProc, hwndText, msg, wParam, cast(int) pszText); |
2398 OS.HeapFree (hHeap, 0, pszText); | 2398 OS.HeapFree (hHeap, 0, pszText); |
2399 return new LRESULT (code); | 2399 return new LRESULT (code); |
2400 } else { | 2400 } else { |
2401 TCHAR* buffer = StrToTCHARz( newText ); | 2401 LPCTSTR buffer = StrToTCHARz( newText ); |
2402 OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, buffer); | 2402 OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, cast(void*)buffer); |
2403 return LRESULT.ZERO; | 2403 return LRESULT.ZERO; |
2404 } | 2404 } |
2405 } | 2405 } |
2406 } | 2406 } |
2407 return null; | 2407 return null; |