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

Fixed compile errors
author Jacob Carlborg <doob@me.com>
date Thu, 15 Jan 2009 23:08:54 +0100
parents 844f65808a36
children
comparison
equal deleted inserted replaced
122:2e671fa40eec 123:63a09873578e
78 ToolBar parent; 78 ToolBar parent;
79 Image hotImage, disabledImage; 79 Image hotImage, disabledImage;
80 String toolTipText; 80 String toolTipText;
81 Control control; 81 Control control;
82 bool selection; 82 bool selection;
83 83
84 static const int DEFAULT_WIDTH = 24; 84 static const int DEFAULT_WIDTH = 24;
85 static const int DEFAULT_HEIGHT = 22; 85 static const int DEFAULT_HEIGHT = 22;
86 static const int DEFAULT_SEPARATOR_WIDTH = 6; 86 static const int DEFAULT_SEPARATOR_WIDTH = 6;
87 static const int INSET = 3; 87 static const int INSET = 3;
88 static const int ARROW_WIDTH = 5; 88 static const int ARROW_WIDTH = 5;
89 89
90 /** 90 /**
91 * Constructs a new instance of this class given its parent 91 * Constructs a new instance of this class given its parent
92 * (which must be a <code>ToolBar</code>) and a style value 92 * (which must be a <code>ToolBar</code>) and a style value
93 * describing its behavior and appearance. The item is added 93 * describing its behavior and appearance. The item is added
94 * to the end of the items maintained by its parent. 94 * to the end of the items maintained by its parent.
169 parent.createItem (this, index); 169 parent.createItem (this, index);
170 } 170 }
171 171
172 objc.id accessibilityAttributeValue(objc.id id, objc.SEL sel, objc.id arg0) { 172 objc.id accessibilityAttributeValue(objc.id id, objc.SEL sel, objc.id arg0) {
173 NSString nsAttributeName = new NSString(arg0); 173 NSString nsAttributeName = new NSString(arg0);
174 174
175 if (nsAttributeName.isEqualToString (OS.NSAccessibilityRoleAttribute) || nsAttributeName.isEqualToString (OS.NSAccessibilityRoleDescriptionAttribute)) { 175 if (nsAttributeName.isEqualToString (OS.NSAccessibilityRoleAttribute) || nsAttributeName.isEqualToString (OS.NSAccessibilityRoleDescriptionAttribute)) {
176 NSString roleText = ((style & DWT.PUSH) !is 0) ? OS.NSAccessibilityButtonRole 176 NSString roleText = ((style & DWT.PUSH) !is 0) ? OS.NSAccessibilityButtonRole
177 : ((style & DWT.RADIO) !is 0) ? OS.NSAccessibilityRadioButtonRole 177 : ((style & DWT.RADIO) !is 0) ? OS.NSAccessibilityRadioButtonRole
178 : ((style & DWT.CHECK) !is 0) ? OS.NSAccessibilityCheckBoxRole 178 : ((style & DWT.CHECK) !is 0) ? OS.NSAccessibilityCheckBoxRole
179 : ((style & DWT.DROP_DOWN) !is 0) ? OS.NSAccessibilityMenuButtonRole 179 : ((style & DWT.DROP_DOWN) !is 0) ? OS.NSAccessibilityMenuButtonRole
180 : null; // SEPARATOR 180 : null; // SEPARATOR
181 if (roleText !is null) { 181 if (roleText !is null) {
182 if (nsAttributeName.isEqualToString (OS.NSAccessibilityRoleAttribute)) { 182 if (nsAttributeName.isEqualToString (OS.NSAccessibilityRoleAttribute)) {
183 return roleText.id; 183 return roleText.id;
184 } else { // NSAccessibilityRoleDescriptionAttribute 184 } else { // NSAccessibilityRoleDescriptionAttribute
185 objc.id description = OS.NSAccessibilityRoleDescription (roleText.id, null); 185 objc.id description = OS.NSAccessibilityRoleDescription (roleText.id, null);
201 return value.id; 201 return value.id;
202 } else if (nsAttributeName.isEqualToString(OS.NSAccessibilityEnabledAttribute)) { 202 } else if (nsAttributeName.isEqualToString(OS.NSAccessibilityEnabledAttribute)) {
203 NSNumber value = NSNumber.numberWithInt(getEnabled() ? 1 : 0); 203 NSNumber value = NSNumber.numberWithInt(getEnabled() ? 1 : 0);
204 return value.id; 204 return value.id;
205 } 205 }
206 206
207 return super.accessibilityAttributeValue(id, sel, arg0); 207 return super.accessibilityAttributeValue(id, sel, arg0);
208 } 208 }
209 209
210 /** 210 /**
211 * Adds the listener to the collection of listeners who will 211 * Adds the listener to the collection of listeners who will
322 dict.setObject(font.handle, OS.NSFontAttributeName); 322 dict.setObject(font.handle, OS.NSFontAttributeName);
323 } 323 }
324 char [] chars = new char [text.length ()]; 324 char [] chars = new char [text.length ()];
325 text.getChars (0, chars.length, chars, 0); 325 text.getChars (0, chars.length, chars, 0);
326 int length = fixMnemonic (chars); 326 int length = fixMnemonic (chars);
327 327
328 NSMutableParagraphStyle pStyle = cast(NSMutableParagraphStyle)(new NSMutableParagraphStyle()).alloc().init(); 328 NSMutableParagraphStyle pStyle = cast(NSMutableParagraphStyle)(new NSMutableParagraphStyle()).alloc().init();
329 pStyle.autorelease(); 329 pStyle.autorelease();
330 pStyle.setAlignment(OS.NSCenterTextAlignment); 330 pStyle.setAlignment(OS.NSCenterTextAlignment);
331 dict.setObject(pStyle, OS.NSParagraphStyleAttributeName); 331 dict.setObject(pStyle, OS.NSParagraphStyleAttributeName);
332 332