Changeset 240:ce446666f5a2
- Timestamp:
- 05/12/08 13:13:01 (4 months ago)
- Files:
-
- dwt/DWT.d (modified) (9 diffs)
- dwt/accessibility/AccessibleObject.d (modified) (1 diff)
- dwt/custom/CCombo.d (modified) (22 diffs)
- dwt/custom/CLabel.d (modified) (2 diffs)
- dwt/custom/CTabFolder.d (modified) (7 diffs)
- dwt/custom/CTabItem.d (modified) (6 diffs)
- dwt/custom/LineBackgroundEvent.d (modified) (1 diff)
- dwt/custom/LineStyleEvent.d (modified) (1 diff)
- dwt/custom/SashForm.d (modified) (2 diffs)
- dwt/custom/ScrolledComposite.d (modified) (7 diffs)
- dwt/custom/StyleRange.d (modified) (4 diffs)
- dwt/custom/StyledText.d (modified) (43 diffs)
- dwt/custom/StyledTextDropTargetEffect.d (modified) (4 diffs)
- dwt/custom/StyledTextPrintOptions.d (modified) (1 diff)
- dwt/custom/StyledTextRenderer.d (modified) (4 diffs)
- dwt/custom/TableCursor.d (modified) (10 diffs)
- dwt/custom/TableTreeItem.d (modified) (1 diff)
- dwt/dnd/ClipboardProxy.d (modified) (1 diff)
- dwt/dnd/DND.d (modified) (2 diffs)
- dwt/dnd/DragSource.d (modified) (5 diffs)
- dwt/dnd/DropTarget.d (modified) (7 diffs)
- dwt/dnd/DropTargetEffect.d (modified) (3 diffs)
- dwt/dnd/FileTransfer.d (modified) (2 diffs)
- dwt/dnd/ImageTransfer.d (added)
- dwt/dnd/TableDragSourceEffect.d (modified) (1 diff)
- dwt/dnd/TableDropTargetEffect.d (modified) (2 diffs)
- dwt/dnd/TransferData.d (modified) (1 diff)
- dwt/dnd/TreeDragSourceEffect.d (modified) (1 diff)
- dwt/dnd/TreeDropTargetEffect.d (modified) (2 diffs)
- dwt/dnd/URLTransfer.d (added)
- dwt/graphics/Color.d (modified) (6 diffs)
- dwt/graphics/Cursor.d (modified) (9 diffs)
- dwt/graphics/Device.d (modified) (9 diffs)
- dwt/graphics/Font.d (modified) (9 diffs)
- dwt/graphics/GC.d (modified) (30 diffs)
- dwt/graphics/GCData.d (modified) (3 diffs)
- dwt/graphics/Image.d (modified) (20 diffs)
- dwt/graphics/ImageData.d (modified) (2 diffs)
- dwt/graphics/Path.d (modified) (4 diffs)
- dwt/graphics/Pattern.d (modified) (4 diffs)
- dwt/graphics/Region.d (modified) (4 diffs)
- dwt/graphics/Resource.d (modified) (3 diffs)
- dwt/graphics/TextLayout.d (modified) (38 diffs)
- dwt/graphics/TextStyle.d (modified) (8 diffs)
- dwt/graphics/Transform.d (modified) (4 diffs)
- dwt/internal/BidiUtil.d (modified) (4 diffs)
- dwt/internal/Compatibility.d (modified) (5 diffs)
- dwt/internal/DWTMessages.properties (modified) (1 diff)
- dwt/internal/LONG.d (modified) (1 diff)
- dwt/internal/Library.d (modified) (2 diffs)
- dwt/internal/gtk/OS.d (modified) (34 diffs)
- dwt/internal/image/FileFormat.d (modified) (1 diff)
- dwt/internal/image/GIFFileFormat.d (modified) (5 diffs)
- dwt/internal/image/JPEGDecoder.d (modified) (6 diffs)
- dwt/internal/image/JPEGFileFormat.d (modified) (5 diffs)
- dwt/internal/image/LEDataInputStream.d (modified) (1 diff)
- dwt/internal/image/PNGFileFormat.d (modified) (2 diffs)
- dwt/internal/image/PngDeflater.d (modified) (1 diff)
- dwt/internal/image/PngEncoder.d (modified) (6 diffs)
- dwt/internal/image/PngHuffmanTable.d (modified) (1 diff)
- dwt/internal/image/PngPlteChunk.d (modified) (1 diff)
- dwt/internal/image/WinICOFileFormat.d (modified) (1 diff)
- dwt/layout/RowLayout.d (modified) (13 diffs)
- dwt/printing/PrintDialog.d (modified) (6 diffs)
- dwt/printing/Printer.d (modified) (10 diffs)
- dwt/printing/PrinterData.d (modified) (1 diff)
- dwt/program/Program.d (modified) (2 diffs)
- dwt/widgets/Button.d (modified) (8 diffs)
- dwt/widgets/Canvas.d (modified) (8 diffs)
- dwt/widgets/Caret.d (modified) (4 diffs)
- dwt/widgets/ColorDialog.d (modified) (5 diffs)
- dwt/widgets/Combo.d (modified) (21 diffs)
- dwt/widgets/Composite.d (modified) (10 diffs)
- dwt/widgets/Control.d (modified) (60 diffs)
- dwt/widgets/CoolBar.d (modified) (3 diffs)
- dwt/widgets/CoolItem.d (modified) (1 diff)
- dwt/widgets/DateTime.d (modified) (9 diffs)
- dwt/widgets/Dialog.d (modified) (2 diffs)
- dwt/widgets/DirectoryDialog.d (modified) (6 diffs)
- dwt/widgets/Display.d (modified) (51 diffs)
- dwt/widgets/Event.d (modified) (1 diff)
- dwt/widgets/EventTable.d (modified) (2 diffs)
- dwt/widgets/ExpandItem.d (modified) (2 diffs)
- dwt/widgets/FileDialog.d (modified) (15 diffs)
- dwt/widgets/FontDialog.d (modified) (6 diffs)
- dwt/widgets/IME.d (added)
- dwt/widgets/Label.d (modified) (1 diff)
- dwt/widgets/Link.d (modified) (5 diffs)
- dwt/widgets/Menu.d (modified) (2 diffs)
- dwt/widgets/MenuItem.d (modified) (3 diffs)
- dwt/widgets/MessageBox.d (modified) (4 diffs)
- dwt/widgets/Monitor.d (modified) (2 diffs)
- dwt/widgets/ProgressBar.d (modified) (2 diffs)
- dwt/widgets/Sash.d (modified) (7 diffs)
- dwt/widgets/ScrollBar.d (modified) (5 diffs)
- dwt/widgets/Scrollable.d (modified) (3 diffs)
- dwt/widgets/Shell.d (modified) (25 diffs)
- dwt/widgets/Slider.d (modified) (1 diff)
- dwt/widgets/Spinner.d (modified) (13 diffs)
- dwt/widgets/Synchronizer.d (modified) (5 diffs)
- dwt/widgets/TabFolder.d (modified) (2 diffs)
- dwt/widgets/TabItem.d (modified) (2 diffs)
- dwt/widgets/Table.d (modified) (6 diffs)
- dwt/widgets/TableItem.d (modified) (27 diffs)
- dwt/widgets/Text.d (modified) (4 diffs)
- dwt/widgets/ToolBar.d (modified) (2 diffs)
- dwt/widgets/ToolItem.d (modified) (4 diffs)
- dwt/widgets/ToolTip.d (modified) (4 diffs)
- dwt/widgets/Tracker.d (modified) (9 diffs)
- dwt/widgets/Tree.d (modified) (13 diffs)
- dwt/widgets/TreeColumn.d (modified) (3 diffs)
- dwt/widgets/TreeItem.d (modified) (31 diffs)
- dwt/widgets/Widget.d (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/DWT.d
r238 r240 650 650 public static const int PaintItem = 42; 651 651 652 /** 653 * The IME composition event type (value is 43). 654 * <p> 655 * The IME composition event is sent to allow 656 * custom text editors to implement in-line 657 * editing of international text. 658 * </p> 659 * 660 * The detail field indicates the action to be taken: 661 * <p><ul> 662 * <li>{@link DWT#COMPOSITION_CHANGED}</li> 663 * <li>{@link DWT#COMPOSITION_OFFSET}</li> 664 * <li>{@link DWT#COMPOSITION_SELECTION}</li> 665 * </ul></p> 666 * 667 * @see dwt.widgets.Widget#addListener 668 * @see dwt.widgets.Display#addFilter 669 * @see dwt.widgets.Event 670 * 671 * @since 3.4 672 */ 673 public static const int ImeComposition = 43; 674 652 675 /* Event Details */ 676 677 /** 678 * The IME composition event detail that indicates 679 * a change in the IME composition. The text field 680 * of the event is the new composition text. 681 * The start and end indicate the offsets where the 682 * composition text should be inserted. 683 * The styles and ranges are stored in the IME 684 * object (value is 1). 685 * 686 * @see DWT#ImeComposition 687 * 688 * @since 3.4 689 */ 690 public static const int COMPOSITION_CHANGED = 1; 691 692 /** 693 * The IME composition event detail that indicates 694 * that the IME needs the offset for a given location. 695 * The x and y fields of the event are used by the 696 * application to determine the offset. 697 * 698 * The index field of the event should be set to the 699 * text offset at that location. The count field should 700 * be set to indicate whether the location is closer to 701 * the leading edge (0) or the trailing edge (1) (value is 2). 702 * 703 * @see DWT#ImeComposition 704 * @see dwt.graphics.TextLayout#getOffset(int, int, int[]) 705 * 706 * @since 3.4 707 */ 708 public static const int COMPOSITION_OFFSET = 2; 709 710 /** 711 * The IME composition event detail that indicates 712 * that IME needs the selected text and its start 713 * and end offsets (value is 3). 714 * 715 * @see DWT#ImeComposition 716 * 717 * @since 3.4 718 */ 719 public static const int COMPOSITION_SELECTION = 3; 653 720 654 721 /** … … 1143 1210 */ 1144 1211 public static const int V_SCROLL = 1 << 9; 1212 1213 /** 1214 * Style constant for no scrollbar behavior (value is 1<<4). 1215 * <p> 1216 * When neither H_SCROLL or V_SCROLL are specified, controls 1217 * are free to create the default scroll bars for the control. 1218 * Using NO_SCROLL overrides the default and forces the control 1219 * to have no scroll bars. 1220 * 1221 * <b>Used By:</b><ul> 1222 * <li><code>Tree</code></li> 1223 * <li><code>Table</code></li> 1224 * </ul></p> 1225 * 1226 * @since 3.4 1227 */ 1228 public static const int NO_SCROLL = 1 << 4; 1145 1229 1146 1230 /** … … 1299 1383 /** 1300 1384 * Style constant for no focus from the mouse behavior (value is 1<<19). 1385 * <p> 1386 * Normally, when the user clicks on a control, focus is assigned to that 1387 * control, providing the control has no children. Some controls, such as 1388 * tool bars and sashes, don't normally take focus when the mouse is clicked 1389 * or accept focus when assigned from within the program. This style allows 1390 * Composites to implement "no focus" mouse behavior. 1391 * 1301 1392 * <br>Note that this is a <em>HINT</em>. 1393 * </p> 1302 1394 * <p><b>Used By:</b><ul> 1303 1395 * <li><code>Composite</code></li> … … 1314 1406 * sent with a GC clipped to only the new areas to be painted. Without this 1315 1407 * style, the entire client area will be repainted. 1408 * 1409 * <br>Note that this is a <em>HINT</em>. 1316 1410 * </p><p><b>Used By:</b><ul> 1317 1411 * <li><code>Composite</code></li> … … 1322 1416 /** 1323 1417 * Style constant for no paint event merging behavior (value is 1<<21). 1418 * 1419 * <br>Note that this is a <em>HINT</em>. 1324 1420 * <p><b>Used By:</b><ul> 1325 1421 * <li><code>Composite</code></li> … … 1419 1515 1420 1516 /** 1517 * Style constant for transparent behavior (value is 1<<30). 1518 * <p> 1519 * By default, before a widget paints, the client area is filled with the current background. 1520 * When this style is specified, the background is not filled and widgets that are obscured 1521 * will draw through. 1522 * </p><p><b>Used By:</b><ul> 1523 * <li><code>Composite</code></li> 1524 * </ul></p> 1525 * 1526 * @since 3.4 1527 * 1528 * WARNING: THIS API IS UNDER CONSTRUCTION AND SHOULD NOT BE USED 1529 */ 1530 public static const int TRANSPARENT = 1 << 30; 1531 1532 /** 1421 1533 * Style constant for align up behavior (value is 1<<7, 1422 1534 * since align UP and align TOP are considered the same). … … 1424 1536 * <li><code>Button</code> with <code>ARROW</code> style</li> 1425 1537 * <li><code>Tracker</code></li> 1538 * <li><code>Table</code></li> 1539 * <li><code>Tree</code></li> 1426 1540 * </ul></p> 1427 1541 */ 1428 1542 public static const int UP = 1 << 7; 1543 1544 /** 1545 * Style constant to indicate single underline (value is 0). 1546 * <p><b>Used By:</b><ul> 1547 * <li><code>TextStyle</code></li> 1548 * </ul></p> 1549 * 1550 * @since 3.4 1551 */ 1552 public static const int UNDERLINE_SINGLE = 0; 1553 1554 /** 1555 * Style constant to indicate double underline (value is 1). 1556 * <p><b>Used By:</b><ul> 1557 * <li><code>TextStyle</code></li> 1558 * </ul></p> 1559 * 1560 * @since 3.4 1561 */ 1562 public static const int UNDERLINE_DOUBLE = 1; 1563 1564 /** 1565 * Style constant to indicate error underline (value is 2). 1566 * <p><b>Used By:</b><ul> 1567 * <li><code>TextStyle</code></li> 1568 * </ul></p> 1569 * 1570 * @since 3.4 1571 */ 1572 public static const int UNDERLINE_ERROR = 2; 1573 1574 /** 1575 * Style constant to indicate squiggle underline (value is 3). 1576 * <p><b>Used By:</b><ul> 1577 * <li><code>TextStyle</code></li> 1578 * </ul></p> 1579 * 1580 * @since 3.4 1581 */ 1582 public static const int UNDERLINE_SQUIGGLE = 3; 1583 1584 /** 1585 * Style constant to indicate solid border (value is 1). 1586 * <p><b>Used By:</b><ul> 1587 * <li><code>TextStyle</code></li> 1588 * </ul></p> 1589 * 1590 * @since 3.4 1591 */ 1592 public static const int BORDER_SOLID = 1; 1593 1594 /** 1595 * Style constant to indicate dashed border (value is 2). 1596 * <p><b>Used By:</b><ul> 1597 * <li><code>TextStyle</code></li> 1598 * </ul></p> 1599 * 1600 * @since 3.4 1601 */ 1602 public static const int BORDER_DASH = 2; 1603 1604 /** 1605 * Style constant to indicate dotted border (value is 4). 1606 * <p><b>Used By:</b><ul> 1607 * <li><code>TextStyle</code></li> 1608 * </ul></p> 1609 * 1610 * @since 3.4 1611 */ 1612 public static const int BORDER_DOT = 4; 1429 1613 1430 1614 /** … … 1443 1627 * <li><code>Button</code> with <code>ARROW</code> style</li> 1444 1628 * <li><code>Tracker</code></li> 1629 * <li><code>Table</code></li> 1630 * <li><code>Tree</code></li> 1445 1631 * </ul></p> 1446 1632 */ … … 2980 3166 2981 3167 /** 3168 * Constant to indicate an error state (value is 1). 3169 * <p><b>Used By:</b><ul> 3170 * <li><code>ProgressBar</code></li> 3171 * </ul></p> 3172 * 3173 * @since 3.4 3174 */ 3175 public static const int ERROR = 1; 3176 3177 /** 3178 * Constant to a indicate a paused state (value is 4). 3179 * <p><b>Used By:</b><ul> 3180 * <li><code>ProgressBar</code></li> 3181 * </ul></p> 3182 * 3183 * @since 3.4 3184 */ 3185 public static const int PAUSED = 1 << 2; 3186 3187 /** 2982 3188 * The font style constant indicating a normal weight, non-italic font 2983 * (value is 0). 3189 * (value is 0). This constant is also used with <code>ProgressBar</code> 3190 * to indicate a normal state. 3191 * <p><b>Used By:</b><ul> 3192 * <li><code>ProgressBar</code></li> 3193 * </ul></p> 2984 3194 */ 2985 3195 public static const int NORMAL = 0; dwt/accessibility/AccessibleObject.d
r238 r240 473 473 case ACC.ROLE_SEPARATOR: return ATK.ATK_ROLE_SEPARATOR; 474 474 case ACC.ROLE_SLIDER: return ATK.ATK_ROLE_SLIDER; 475 case ACC.ROLE_TABLE: return ATK.ATK_ROLE_ TABLE;476 case ACC.ROLE_TABLECELL: return ATK.ATK_ROLE_ TABLE_CELL;475 case ACC.ROLE_TABLE: return ATK.ATK_ROLE_LIST; 476 case ACC.ROLE_TABLECELL: return ATK.ATK_ROLE_LIST_ITEM; 477 477 case ACC.ROLE_TABLECOLUMNHEADER: return ATK.ATK_ROLE_TABLE_COLUMN_HEADER; 478 478 case ACC.ROLE_TABLEROWHEADER: return ATK.ATK_ROLE_TABLE_ROW_HEADER; dwt/custom/CCombo.d
r238 r240 52 52 static import tango.text.convert.Format; 53 53 import dwt.dwthelper.utils; 54 import dwt.dwthelper.Runnable; 54 55 55 56 /** … … 153 154 } 154 155 if (getShell () is event.widget) { 155 handleFocus (DWT.FocusOut); 156 getDisplay().asyncExec(new class() Runnable { 157 public void run() { 158 if (isDisposed()) return; 159 handleFocus (DWT.FocusOut); 160 } 161 }); 156 162 } 157 163 } … … 166 172 }; 167 173 168 int [] comboEvents = [DWT.Dispose, DWT. Move, DWT.Resize];174 int [] comboEvents = [DWT.Dispose, DWT.FocusIn, DWT.Move, DWT.Resize]; 169 175 for (int i=0; i<comboEvents.length; i++) this.addListener (comboEvents [i], listener); 170 176 171 int [] textEvents = [DWT. KeyDown, DWT.KeyUp, DWT.MenuDetect, DWT.Modify, DWT.MouseDown, DWT.MouseUp, DWT.Traverse, DWT.FocusIn, DWT.Verify];177 int [] textEvents = [DWT.DefaultSelection, DWT.KeyDown, DWT.KeyUp, DWT.MenuDetect, DWT.Modify, DWT.MouseDown, DWT.MouseUp, DWT.MouseDoubleClick, DWT.MouseWheel, DWT.Traverse, DWT.FocusIn, DWT.Verify]; 172 178 for (int i=0; i<textEvents.length; i++) text.addListener (textEvents [i], listener); 173 179 174 int [] arrowEvents = [DWT. Selection, DWT.FocusIn];180 int [] arrowEvents = [DWT.MouseDown, DWT.MouseUp, DWT.Selection, DWT.FocusIn]; 175 181 for (int i=0; i<arrowEvents.length; i++) arrow.addListener (arrowEvents [i], listener); 176 182 … … 180 186 static int checkStyle (int style) { 181 187 int mask = DWT.BORDER | DWT.READ_ONLY | DWT.FLAT | DWT.LEFT_TO_RIGHT | DWT.RIGHT_TO_LEFT; 182 return style & mask;188 return DWT.NO_FOCUS | (style & mask); 183 189 } 184 190 /** … … 319 325 break; 320 326 } 327 case DWT.MouseDown: { 328 Event mouseEvent = new Event (); 329 mouseEvent.button = event.button; 330 mouseEvent.count = event.count; 331 mouseEvent.stateMask = event.stateMask; 332 mouseEvent.time = event.time; 333 mouseEvent.x = event.x; mouseEvent.y = event.y; 334 notifyListeners (DWT.MouseDown, mouseEvent); 335 event.doit = mouseEvent.doit; 336 break; 337 } 338 case DWT.MouseUp: { 339 Event mouseEvent = new Event (); 340 mouseEvent.button = event.button; 341 mouseEvent.count = event.count; 342 mouseEvent.stateMask = event.stateMask; 343 mouseEvent.time = event.time; 344 mouseEvent.x = event.x; mouseEvent.y = event.y; 345 notifyListeners (DWT.MouseUp, mouseEvent); 346 event.doit = mouseEvent.doit; 347 break; 348 } 321 349 case DWT.Selection: { 350 text.setFocus(); 322 351 dropDown (!isDropped ()); 323 352 break; … … 363 392 list = null; 364 393 arrow = null; 394 break; 395 case DWT.FocusIn: 396 Control focusControl = getDisplay ().getFocusControl (); 397 if (focusControl is arrow || focusControl is list) return; 398 if (isDropped()) { 399 list.setFocus(); 400 } else { 401 text.setFocus(); 402 } 365 403 break; 366 404 case DWT.Move: … … 466 504 public void deselect (int index) { 467 505 checkWidget (); 468 list.deselect (index); 506 if (0 <= index && index < list.getItemCount () && 507 index is list.getSelectionIndex() && 508 text.getText().equals(list.getItem(index))) { 509 text.setText(""); //$NON-NLS-1$ 510 list.deselect (index); 511 } 469 512 } 470 513 /** … … 484 527 public void deselectAll () { 485 528 checkWidget (); 529 text.setText(""); //$NON-NLS-1$ 486 530 list.deselectAll (); 487 531 } … … 490 534 if (!drop) { 491 535 popup.setVisible (false); 492 if (!isDisposed () && arrow.isFocusControl()) {536 if (!isDisposed () && isFocusControl()) { 493 537 text.setFocus(); 494 538 } … … 528 572 popup.setBounds (x, y, width, height); 529 573 popup.setVisible (true); 530 list.setFocus ();574 if (isFocusControl()) list.setFocus (); 531 575 } 532 576 /* … … 655 699 checkWidget (); 656 700 return list.getItems (); 701 } 702 /** 703 * Returns <code>true</code> if the receiver's list is visible, 704 * and <code>false</code> otherwise. 705 * <p> 706 * If one of the receiver's ancestors is not visible or some 707 * other condition makes the receiver not visible, this method 708 * may still indicate that it is considered visible even though 709 * it may not actually be showing. 710 * </p> 711 * 712 * @return the receiver's list's visibility state 713 * 714 * @exception DWTException <ul> 715 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 716 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 717 * </ul> 718 * 719 * @since 3.4 720 */ 721 public bool getListVisible () { 722 checkWidget (); 723 return isDropped(); 657 724 } 658 725 public override Menu getMenu() { … … 906 973 public void getLocation (AccessibleControlEvent e) { 907 974 Rectangle location = getBounds (); 908 Point pt = toDisplay (location.x, location.y);975 Point pt = getParent().toDisplay (location.x, location.y); 909 976 e.x = pt.x; 910 977 e.y = pt.y; … … 1003 1070 event.doit = false; 1004 1071 break; 1072 case DWT.TRAVERSE_TAB_NEXT: 1073 case DWT.TRAVERSE_TAB_PREVIOUS: 1074 event.doit = text.traverse(event.detail); 1075 event.detail = DWT.TRAVERSE_NONE; 1076 if (event.doit) dropDown(false); 1077 return; 1005 1078 default: 1006 1079 } … … 1094 1167 * it again. To prevent the popup from showing again, we will let the selection 1095 1168 * event of the arrow button hide the popup. 1169 * In Windows, hiding the popup during the deactivate causes the deactivate 1170 * to be called twice and the selection event to be disappear. 1096 1171 */ 1097 if ( "gtk".equals(DWT.getPlatform())) {1172 if (!"carbon".equals(DWT.getPlatform())) { 1098 1173 Point point = arrow.toControl(getDisplay().getCursorLocation()); 1099 1174 Point size = arrow.getSize(); … … 1318 1393 public override bool setFocus () { 1319 1394 checkWidget(); 1395 if (!isEnabled () || !isVisible ()) return false; 1320 1396 if (isFocusControl ()) return true; 1321 1397 return text.setFocus (); … … 1394 1470 checkWidget (); 1395 1471 return; 1472 } 1473 /** 1474 * Marks the receiver's list as visible if the argument is <code>true</code>, 1475 * and marks it invisible otherwise. 1476 * <p> 1477 * If one of the receiver's ancestors is not visible or some 1478 * other condition makes the receiver not visible, marking 1479 * it visible may not actually cause it to be displayed. 1480 * </p> 1481 * 1482 * @param visible the new visibility state 1483 * 1484 * @exception DWTException <ul> 1485 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 1486 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 1487 * </ul> 1488 * 1489 * @since 3.4 1490 */ 1491 public void setListVisible (bool visible) { 1492 checkWidget (); 1493 dropDown(visible); 1396 1494 } 1397 1495 public override void setMenu(Menu menu) { … … 1527 1625 break; 1528 1626 } 1627 case DWT.DefaultSelection: { 1628 dropDown (false); 1629 Event e = new Event (); 1630 e.time = event.time; 1631 e.stateMask = event.stateMask; 1632 notifyListeners (DWT.DefaultSelection, e); 1633 break; 1634 } 1529 1635 case DWT.KeyDown: { 1530 1636 Event keyEvent = new Event (); … … 1537 1643 event.doit = keyEvent.doit; 1538 1644 if (!event.doit) break; 1539 1540 if (event.character is DWT.CR) {1541 dropDown (false);1542 Event selectionEvent = new Event ();1543 selectionEvent.time = event.time;1544 selectionEvent.stateMask = event.stateMask;1545 notifyListeners (DWT.DefaultSelection, selectionEvent);1546 if (isDisposed ()) break;1547 }1548 1549 1645 if (event.keyCode is DWT.ARROW_UP || event.keyCode is DWT.ARROW_DOWN) { 1550 1646 event.doit = false; … … 1600 1696 } 1601 1697 case DWT.MouseDown: { 1698 Event mouseEvent = new Event (); 1699 mouseEvent.button = event.button; 1700 mouseEvent.count = event.count; 1701 mouseEvent.stateMask = event.stateMask; 1702 mouseEvent.time = event.time; 1703 mouseEvent.x = event.x; mouseEvent.y = event.y; 1704 notifyListeners (DWT.MouseDown, mouseEvent); 1705 if (isDisposed ()) break; 1706 event.doit = mouseEvent.doit; 1707 if (!event.doit) break; 1602 1708 if (event.button !is 1) return; 1603 1709 if (text.getEditable ()) return; … … 1609 1715 } 1610 1716 case DWT.MouseUp: { 1717 Event mouseEvent = new Event (); 1718 mouseEvent.button = event.button; 1719 mouseEvent.count = event.count; 1720 mouseEvent.stateMask = event.stateMask; 1721 mouseEvent.time = event.time; 1722 mouseEvent.x = event.x; mouseEvent.y = event.y; 1723 notifyListeners (DWT.MouseUp, mouseEvent); 1724 if (isDisposed ()) break; 1725 event.doit = mouseEvent.doit; 1726 if (!event.doit) break; 1611 1727 if (event.button !is 1) return; 1612 1728 if (text.getEditable ()) return; … … 1614 1730 break; 1615 1731 } 1732 case DWT.MouseDoubleClick: { 1733 Event mouseEvent = new Event (); 1734 mouseEvent.button = event.button; 1735 mouseEvent.count = event.count; 1736 mouseEvent.stateMask = event.stateMask; 1737 mouseEvent.time = event.time; 1738 mouseEvent.x = event.x; mouseEvent.y = event.y; 1739 notifyListeners (DWT.MouseDoubleClick, mouseEvent); 1740 break; 1741 } 1742 case DWT.MouseWheel: { 1743 Event keyEvent = new Event (); 1744 keyEvent.time = event.time; 1745 keyEvent.keyCode = event.count > 0 ? DWT.ARROW_UP : DWT.ARROW_DOWN; 1746 keyEvent.stateMask = event.stateMask; 1747 notifyListeners (DWT.KeyDown, keyEvent); 1748 if (isDisposed ()) break; 1749 event.doit = keyEvent.doit; 1750 if (!event.doit) break; 1751 if (event.count !is 0) { 1752 event.doit = false; 1753 int oldIndex = getSelectionIndex (); 1754 if (event.count > 0) { 1755 select (Math.max (oldIndex - 1, 0)); 1756 } else { 1757 select (Math.min (oldIndex + 1, getItemCount () - 1)); 1758 } 1759 if (oldIndex !is getSelectionIndex ()) { 1760 Event e = new Event(); 1761 e.time = event.time; 1762 e.stateMask = event.stateMask; 1763 notifyListeners (DWT.Selection, e); 1764 } 1765 if (isDisposed ()) break; 1766 } 1767 break; 1768 } 1616 1769 case DWT.Traverse: { 1617 1770 switch (event.detail) { 1618 case DWT.TRAVERSE_RETURN:1619 1771 case DWT.TRAVERSE_ARROW_PREVIOUS: 1620 1772 case DWT.TRAVERSE_ARROW_NEXT: … … 1624 1776 event.doit = false; 1625 1777 break; 1778 case DWT.TRAVERSE_TAB_PREVIOUS: 1779 event.doit = traverse(DWT.TRAVERSE_TAB_PREVIOUS); 1780 event.detail = DWT.TRAVERSE_NONE; 1781 return; 1626 1782 default: 1627 1783 } 1628 1629 1784 Event e = new Event (); 1630 1785 e.time = event.time; dwt/custom/CLabel.d
r238 r240 34 34 import dwt.graphics.Point; 35 35 import dwt.graphics.Rectangle; 36 import dwt.graphics.TextLayout; 36 37 import dwt.widgets.Canvas; 37 38 import dwt.widgets.Composite; … … 798 799 int mid = (max+min)/2 - 1; 799 800 if (mid <= 0) return t; 801 TextLayout layout = new TextLayout (getDisplay()); 802 layout.setText(t); 803 mid = validateOffset(layout, mid); 800 804 while (min < mid && mid < max) { 801 805 String s1 = t[0 .. mid].dup; 802 String s2 = t [l-mid .. l].dup;806 String s2 = t.substring(validateOffset(layout, l-mid), l); 803 807 int l1 = gc.textExtent(s1, DRAW_FLAGS).x; 804 808 int l2 = gc.textExtent(s2, DRAW_FLAGS).x; 805 809 if (l1+w+l2 > width) { 806 810 max = mid; 807 mid = (max+min)/2;811 mid = validateOffset(layout, (max+min)/2); 808 812 } else if (l1+w+l2 < width) { 809 813 min = mid; 810 mid = (max+min)/2;814 mid = validateOffset(layout, (max+min)/2); 811 815 } else { 812 816 min = max; 813 817 } 814 818 } 815 if (mid is 0) return t; 816 return t[ 0 .. mid ] ~ ELLIPSIS ~ t[ l-mid .. l ]; 817 } 818 819 String result = mid is 0 ? t : t.substring(0, mid) ~ ELLIPSIS ~ t.substring(validateOffset(layout, l-mid), l); 820 layout.dispose(); 821 return result; 822 } 823 int validateOffset(TextLayout layout, int offset) { 824 int nextOffset = layout.getNextOffset(offset, DWT.MOVEMENT_CLUSTER); 825 if (nextOffset !is offset) return layout.getPreviousOffset(nextOffset, DWT.MOVEMENT_CLUSTER); 826 return offset; 827 } 819 828 private String[] splitString(String text) { 820 829 String[] lines = new String[1]; dwt/custom/CTabFolder.d
r238 r240 1544 1544 style |= single ? DWT.SINGLE : DWT.MULTI; 1545 1545 if (borderLeft !is 0) style |= DWT.BORDER; 1546 style &= ~DWT.CLOSE; 1547 if (showClose) style |= DWT.CLOSE; 1546 1548 return style; 1547 1549 } … … 1718 1720 public void getLocation(AccessibleControlEvent e) { 1719 1721 Rectangle location = null; 1722 Point pt = null; 1720 1723 int childID = e.childID; 1721 1724 if (childID is ACC.CHILDID_SELF) { 1722 1725 location = getBounds(); 1723 } else if (childID >= 0 && childID < items.length) { 1724 location = items[childID].getBounds(); 1725 } else if (showChevron && childID is items.length + CHEVRON_CHILD_ID) { 1726 location = chevronRect; 1727 } else if (showMin && childID is items.length + MINIMIZE_CHILD_ID) { 1728 loc
