Changeset 213:36f5cb12e1a2 for dwt/internal/BidiUtil.d
- Timestamp:
- 05/17/08 11:34:28 (8 months ago)
- Files:
-
- dwt/internal/BidiUtil.d (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/internal/BidiUtil.d
r212 r213 18 18 import dwt.internal.win32.OS; 19 19 20 import dwt.widgets.Control; 20 21 import tango.util.Convert; 21 22 import dwt.dwthelper.utils; … … 113 114 subclass(hwnd); 114 115 } 116 public static void addLanguageListener (Control control, Runnable runnable) { 117 addLanguageListener(control.handle, runnable); 118 } 115 119 /** 116 120 * Proc used for OS.EnumSystemLanguageGroups call during isBidiPlatform test. … … 408 412 public static int getKeyboardLanguage() { 409 413 int layout = cast(int) OS.GetKeyboardLayout(0); 410 // only interested in low 2 bytes, which is the primary 411 // language identifier 412 layout = layout & 0x000000FF; 413 if (layout is LANG_HEBREW) return KEYBOARD_BIDI; 414 if (layout is LANG_ARABIC) return KEYBOARD_BIDI; 414 int langID = OS.PRIMARYLANGID(OS.LOWORD(layout)); 415 if (langID is LANG_HEBREW) return KEYBOARD_BIDI; 416 if (langID is LANG_ARABIC) return KEYBOARD_BIDI; 415 417 // return non-bidi for all other languages 416 418 return KEYBOARD_NON_BIDI; … … 483 485 void*[] list = getKeyboardLanguageList(); 484 486 for (int i=0; i<list.length; i++) { 485 int id = cast(int)list[i] & 0x000000FF;487 int id = OS.PRIMARYLANGID(OS.LOWORD( cast(int) list[i])); 486 488 if ((id is LANG_ARABIC) || (id is LANG_HEBREW)) { 487 489 return true; … … 499 501 languageMap.remove(hwnd); 500 502 unsubclass(hwnd); 503 } 504 public static void removeLanguageListener (Control control) { 505 removeLanguageListener(control.handle); 501 506 } 502 507 /** … … 518 523 // set to first bidi language 519 524 for (int i=0; i<list.length; i++) { 520 int id = cast(int)list[i] & 0x000000FF;525 int id = OS.PRIMARYLANGID(OS.LOWORD( cast(int) list[i])); 521 526 if ((id is LANG_ARABIC) || (id is LANG_HEBREW)) { 522 527 OS.ActivateKeyboardLayout(list[i], 0); … … 530 535 // Hebrew or Arabic) 531 536 for (int i=0; i<list.length; i++) { 532 int id = cast(int)list[i] & 0x000000FF;537 int id = OS.PRIMARYLANGID(OS.LOWORD( cast(int) list[i])); 533 538 if ((id !is LANG_HEBREW) && (id !is LANG_ARABIC)) { 534 539 OS.ActivateKeyboardLayout(list[i], 0); … … 560 565 return true; 561 566 } 567 public static bool setOrientation (Control control, int orientation) { 568 return setOrientation(control.handle, orientation); 569 } 562 570 /** 563 571 * Override the window proc. … … 568 576 HWND key = hwnd; 569 577 if ( ( key in oldProcMap ) is null) { 570 int oldProc = OS.GetWindowLong(hwnd, OS.GWL_WNDPROC);578 int /*long*/ oldProc = OS.GetWindowLongPtr(hwnd, OS.GWLP_WNDPROC); 571 579 oldProcMap[key] = cast(WNDPROC)oldProc; 572 580 WNDPROC t = &windowProc; // test signature 573 OS.SetWindowLong (hwnd, OS.GWL_WNDPROC, cast(int)&windowProc);581 OS.SetWindowLongPtr(hwnd, OS.GWLP_WNDPROC, cast(LONG_PTR)&windowProc); 574 582 } 575 583 } … … 635 643 } 636 644 if (proc is null) return; 637 OS.SetWindowLong (hwnd, OS.GWL_WNDPROC, cast(int)proc );645 OS.SetWindowLongPtr(hwnd, OS.GWLP_WNDPROC, cast(LONG_PTR) proc ); 638 646 } 639 647 } … … 657 665 } 658 666 auto oldProc = oldProcMap[key]; 659 return OS.CallWindowProc ( oldProc,hwnd, msg, wParam, lParam);660 } 661 662 } 667 return oldProc( hwnd, msg, wParam, lParam); 668 } 669 670 }
