comparison dwt/widgets/CoolBar.d @ 240:ce446666f5a2

Update to SWT 3.4M7
author Frank Benoit <benoit@tionex.de>
date Mon, 12 May 2008 19:13:01 +0200
parents 08789b28bdf3
children 5a30aa9820f3
comparison
equal deleted inserted replaced
239:06a1f6829310 240:ce446666f5a2
133 ]; 133 ];
134 for (int i = 0; i < events.length; i++) { 134 for (int i = 0; i < events.length; i++) {
135 addListener(events[i], listener); 135 addListener(events[i], listener);
136 } 136 }
137 } 137 }
138 private static int checkStyle (int style) { 138 static int checkStyle (int style) {
139 style |= DWT.NO_FOCUS; 139 style |= DWT.NO_FOCUS;
140 return (style | DWT.NO_REDRAW_RESIZE) & ~(DWT.V_SCROLL | DWT.H_SCROLL); 140 return (style | DWT.NO_REDRAW_RESIZE) & ~(DWT.V_SCROLL | DWT.H_SCROLL);
141 } 141 }
142 void _setCursor (Cursor cursor) { 142 void _setCursor (Cursor cursor) {
143 if (this.cursor !is null) return; 143 if (this.cursor !is null) return;
321 * appropriately. 321 * appropriately.
322 */ 322 */
323 void insertItemIntoRow(CoolItem item, int rowIndex, int x_root) { 323 void insertItemIntoRow(CoolItem item, int rowIndex, int x_root) {
324 int barWidth = getWidth(); 324 int barWidth = getWidth();
325 int rowY = items[rowIndex][0].internalGetBounds().y; 325 int rowY = items[rowIndex][0].internalGetBounds().y;
326 int x = Math.max(0, x_root - toDisplay(new Point(0, 0)).x); 326 int x = Math.max(0, Math.abs(x_root - toDisplay(new Point(0, 0)).x));
327 327
328 /* Find the insertion index and add the item. */ 328 /* Find the insertion index and add the item. */
329 int index; 329 int index;
330 for (index = 0; index < items[rowIndex].length; index++) { 330 for (index = 0; index < items[rowIndex].length; index++) {
331 if (x < items[rowIndex][index].internalGetBounds().x) break; 331 if (x < items[rowIndex][index].internalGetBounds().x) break;
621 void onMouseMove(Event event) { 621 void onMouseMove(Event event) {
622 if (isLocked) return; 622 if (isLocked) return;
623 fixEvent(event); 623 fixEvent(event);
624 CoolItem grabbed = getGrabbedItem(event.x, event.y); 624 CoolItem grabbed = getGrabbedItem(event.x, event.y);
625 if (dragging !is null) { 625 if (dragging !is null) {
626 int left_root = toDisplay(new Point(event.x, event.y)).x - itemXOffset; 626 int left_root = toDisplay(new Point(event.x - itemXOffset, event.y)).x;
627 Rectangle bounds = dragging.internalGetBounds(); 627 Rectangle bounds = dragging.internalGetBounds();
628 if (event.y < bounds.y) { 628 if (event.y < bounds.y) {
629 moveUp(dragging, left_root); 629 moveUp(dragging, left_root);
630 } else if (event.y > bounds.y + bounds.height){ 630 } else if (event.y > bounds.y + bounds.height){
631 moveDown(dragging, left_root); 631 moveDown(dragging, left_root);