comparison dwtx/ui/internal/forms/widgets/FormHeading.d @ 104:04b47443bb01

Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections. These new wrappers now use the tango.util.containers instead of the tango.util.collections.
author Frank Benoit <benoit@tionex.de>
date Thu, 07 Aug 2008 15:01:33 +0200
parents e193036d82c9
children
comparison
equal deleted inserted replaced
103:2d6540440fe6 104:04b47443bb01
56 import dwtx.ui.forms.widgets.SizeCache; 56 import dwtx.ui.forms.widgets.SizeCache;
57 import dwtx.ui.internal.forms.IMessageToolTipManager; 57 import dwtx.ui.internal.forms.IMessageToolTipManager;
58 import dwtx.ui.internal.forms.MessageManager; 58 import dwtx.ui.internal.forms.MessageManager;
59 59
60 import dwt.dwthelper.utils; 60 import dwt.dwthelper.utils;
61 import tango.util.collection.HashMap; 61 import dwtx.dwtxhelper.Collection;
62 62
63 /** 63 /**
64 * Form header moved out of the form class. 64 * Form header moved out of the form class.
65 */ 65 */
66 public class FormHeading : Canvas { 66 public class FormHeading : Canvas {
82 82
83 private Image backgroundImage; 83 private Image backgroundImage;
84 84
85 private Image gradientImage; 85 private Image gradientImage;
86 86
87 HashMap!(String,Object) colors; 87 Hashtable colors;
88 88
89 private int flags; 89 private int flags;
90 90
91 private GradientInfo gradientInfo; 91 private GradientInfo gradientInfo;
92 92
430 return; 430 return;
431 } 431 }
432 ensureControlExists(); 432 ensureControlExists();
433 if (needHyperlink()) { 433 if (needHyperlink()) {
434 messageHyperlink.setText(newMessage); 434 messageHyperlink.setText(newMessage);
435 messageHyperlink.setHref(new ArrayWrapperT!(IMessage)(messages)); 435 messageHyperlink.setHref(new ArrayWrapperObject(arraycast!(Object)(messages)));
436 } else { 436 } else {
437 messageLabel.setText(newMessage); 437 messageLabel.setText(newMessage);
438 } 438 }
439 if (oldType !is newType) 439 if (oldType !is newType)
440 updateForeground(); 440 updateForeground();
514 messageLabel.setVisible(false); 514 messageLabel.setVisible(false);
515 if (messageHyperlink is null) { 515 if (messageHyperlink is null) {
516 messageHyperlink = new Hyperlink(this.outer, DWT.NULL); 516 messageHyperlink = new Hyperlink(this.outer, DWT.NULL);
517 messageHyperlink.setUnderlined(true); 517 messageHyperlink.setUnderlined(true);
518 messageHyperlink.setText(message); 518 messageHyperlink.setText(message);
519 messageHyperlink.setHref(new ArrayWrapperT!(IMessage)(messages)); 519 messageHyperlink.setHref(new ArrayWrapperObject(arraycast!(Object)(messages)));
520 Object[] llist = listeners.getListeners(); 520 Object[] llist = listeners.getListeners();
521 for (int i = 0; i < llist.length; i++) 521 for (int i = 0; i < llist.length; i++)
522 messageHyperlink 522 messageHyperlink
523 .addHyperlinkListener(cast(IHyperlinkListener) llist[i]); 523 .addHyperlinkListener(cast(IHyperlinkListener) llist[i]);
524 if (messageToolTipManager !is null) 524 if (messageToolTipManager !is null)
525 messageToolTipManager.createToolTip(messageHyperlink, false); 525 messageToolTipManager.createToolTip(messageHyperlink, false);
526 } else if (!messageHyperlink.getVisible()) { 526 } else if (!messageHyperlink.getVisible()) {
527 messageHyperlink.setText(message); 527 messageHyperlink.setText(message);
528 messageHyperlink.setHref(new ArrayWrapperT!(IMessage)(messages)); 528 messageHyperlink.setHref(new ArrayWrapperObject(arraycast!(Object)(messages)));
529 messageHyperlink.setVisible(true); 529 messageHyperlink.setVisible(true);
530 } 530 }
531 } else { 531 } else {
532 // need a label 532 // need a label
533 if (messageHyperlink !is null) 533 if (messageHyperlink !is null)
582 * 582 *
583 * @param parent 583 * @param parent
584 * the parent widget 584 * the parent widget
585 */ 585 */
586 public this(Composite parent, int style) { 586 public this(Composite parent, int style) {
587 colors = new HashMap!(String,Object); 587 colors = new Hashtable();
588 toolbarCache = new SizeCache(); 588 toolbarCache = new SizeCache();
589 clientCache = new SizeCache(); 589 clientCache = new SizeCache();
590 messageCache = new SizeCache(); 590 messageCache = new SizeCache();
591 messageToolTipManager = new DefaultMessageToolTipManager(); 591 messageToolTipManager = new DefaultMessageToolTipManager();
592 592
995 layout(); 995 layout();
996 } 996 }
997 997
998 public void putColor(String key, Color color) { 998 public void putColor(String key, Color color) {
999 if (color is null) 999 if (color is null)
1000 colors.removeKey(key); 1000 colors.remove(key);
1001 else 1001 else
1002 colors.add(key, color); 1002 colors.put(key, color);
1003 } 1003 }
1004 1004
1005 public Color getColor(String key) { 1005 public Color getColor(String key) {
1006 return cast(Color) colors.get(key); 1006 return cast(Color) colors.get(key);
1007 } 1007 }