comparison dwt/widgets/CoolItem.d @ 123:63a09873578e

Fixed compile errors
author Jacob Carlborg <doob@me.com>
date Thu, 15 Jan 2009 23:08:54 +0100
parents c7f7f4d7091a
children c41e13089a3c
comparison
equal deleted inserted replaced
122:2e671fa40eec 123:63a09873578e
35 import dwt.widgets.Item; 35 import dwt.widgets.Item;
36 import dwt.widgets.Listener; 36 import dwt.widgets.Listener;
37 import dwt.widgets.ToolBar; 37 import dwt.widgets.ToolBar;
38 import dwt.widgets.ToolItem; 38 import dwt.widgets.ToolItem;
39 import dwt.widgets.TypedListener; 39 import dwt.widgets.TypedListener;
40 40
41 /** 41 /**
42 * Instances of this class are selectable user interface 42 * Instances of this class are selectable user interface
43 * objects that represent the dynamically positionable 43 * objects that represent the dynamically positionable
44 * areas of a <code>CoolBar</code>. 44 * areas of a <code>CoolBar</code>.
45 * <dl> 45 * <dl>
279 279
280 PaletteData palette = new PaletteData ([foreground.getRGB(), background.getRGB(), black.getRGB()]); 280 PaletteData palette = new PaletteData ([foreground.getRGB(), background.getRGB(), black.getRGB()]);
281 ImageData imageData = new ImageData (width, height, 4, palette); 281 ImageData imageData = new ImageData (width, height, 4, palette);
282 imageData.transparentPixel = 1; 282 imageData.transparentPixel = 1;
283 Image image = new Image (display, imageData); 283 Image image = new Image (display, imageData);
284 284
285 GC gc = new GC (image, parent.getStyle() & DWT.RIGHT_TO_LEFT); 285 GC gc = new GC (image, parent.getStyle() & DWT.RIGHT_TO_LEFT);
286 gc.setBackground (background); 286 gc.setBackground (background);
287 gc.fillRectangle (0, 0, width, height); 287 gc.fillRectangle (0, 0, width, height);
288 gc.setForeground (black); 288 gc.setForeground (black);
289 289
639 if ((style & DWT.DROP_DOWN) !is 0 && width < preferredWidth) { 639 if ((style & DWT.DROP_DOWN) !is 0 && width < preferredWidth) {
640 if (chevron is null) { 640 if (chevron is null) {
641 chevron = new ToolBar (parent, DWT.FLAT | DWT.NO_FOCUS); 641 chevron = new ToolBar (parent, DWT.FLAT | DWT.NO_FOCUS);
642 ToolItem toolItem = new ToolItem (chevron, DWT.PUSH); 642 ToolItem toolItem = new ToolItem (chevron, DWT.PUSH);
643 toolItem.addListener (DWT.Selection, new class () Listener { 643 toolItem.addListener (DWT.Selection, new class () Listener {
644 public void handleEvent (Event event) { 644 public void handleEvent (Event event) {
645 this.outer.onSelection (event); 645 this.outer.onSelection (event);
646 } 646 }
647 }); 647 });
648 } 648 }
649 int controlHeight, currentImageHeight = 0; 649 int controlHeight, currentImageHeight = 0;
650 if ((parent.style & DWT.VERTICAL) !is 0) { 650 if ((parent.style & DWT.VERTICAL) !is 0) {
651 controlHeight = control.getSize ().x; 651 controlHeight = control.getSize ().x;
652 if (arrowImage !is null) currentImageHeight = arrowImage.getBounds().width; 652 if (arrowImage !is null) currentImageHeight = arrowImage.getBounds().width;
662 if (arrowImage !is null) arrowImage.dispose (); 662 if (arrowImage !is null) arrowImage.dispose ();
663 arrowImage = image; 663 arrowImage = image;
664 } 664 }
665 chevron.setBackground (parent.getBackground()); 665 chevron.setBackground (parent.getBackground());
666 chevron.setBounds (parent.fixRectangle ( 666 chevron.setBounds (parent.fixRectangle (
667 itemBounds.x + width - CHEVRON_LEFT_MARGIN - CHEVRON_IMAGE_WIDTH - CHEVRON_HORIZONTAL_TRIM, 667 itemBounds.x + width - CHEVRON_LEFT_MARGIN - CHEVRON_IMAGE_WIDTH - CHEVRON_HORIZONTAL_TRIM,
668 itemBounds.y, 668 itemBounds.y,
669 CHEVRON_IMAGE_WIDTH + CHEVRON_HORIZONTAL_TRIM, 669 CHEVRON_IMAGE_WIDTH + CHEVRON_HORIZONTAL_TRIM,
670 height)); 670 height));
671 chevron.setVisible(true); 671 chevron.setVisible(true);
672 } else { 672 } else {
673 if (chevron !is null) { 673 if (chevron !is null) {
674 chevron.setVisible(false); 674 chevron.setVisible(false);
675 } 675 }