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

Fixed compile errors
author Jacob Carlborg <doob@me.com>
date Thu, 15 Jan 2009 23:08:54 +0100
parents c7f7f4d7091a
children 0ba75290f8ce
comparison
equal deleted inserted replaced
122:2e671fa40eec 123:63a09873578e
124 // The accessibility documentation says that these next two are optional, but the 124 // The accessibility documentation says that these next two are optional, but the
125 // Accessibility Verifier says they are required. 125 // Accessibility Verifier says they are required.
126 ourAttributes.addObject(OS.NSAccessibilityNextContentsAttribute); 126 ourAttributes.addObject(OS.NSAccessibilityNextContentsAttribute);
127 ourAttributes.addObject(OS.NSAccessibilityPreviousContentsAttribute); 127 ourAttributes.addObject(OS.NSAccessibilityPreviousContentsAttribute);
128 ourAttributes.addObject(OS.NSAccessibilityOrientationAttribute); 128 ourAttributes.addObject(OS.NSAccessibilityOrientationAttribute);
129 129
130 if (accessible !is null) { 130 if (accessible !is null) {
131 // See if the accessible will override or augment the standard list. 131 // See if the accessible will override or augment the standard list.
132 // Help, title, and description can be overridden. 132 // Help, title, and description can be overridden.
133 NSMutableArray extraAttributes = NSMutableArray.arrayWithCapacity(3); 133 NSMutableArray extraAttributes = NSMutableArray.arrayWithCapacity(3);
134 extraAttributes.addObject(OS.NSAccessibilityHelpAttribute); 134 extraAttributes.addObject(OS.NSAccessibilityHelpAttribute);
135 extraAttributes.addObject(OS.NSAccessibilityDescriptionAttribute); 135 extraAttributes.addObject(OS.NSAccessibilityDescriptionAttribute);
136 extraAttributes.addObject(OS.NSAccessibilityTitleAttribute); 136 extraAttributes.addObject(OS.NSAccessibilityTitleAttribute);
137 137
138 for (int i = extraAttributes.count() - 1; i >= 0; i--) { 138 for (int i = extraAttributes.count() - 1; i >= 0; i--) {
139 NSString attribute = new NSString(extraAttributes.objectAtIndex(i).id); 139 NSString attribute = new NSString(extraAttributes.objectAtIndex(i).id);
140 if (accessible.internal_accessibilityAttributeValue(attribute, ACC.CHILDID_SELF) !is null) { 140 if (accessible.internal_accessibilityAttributeValue(attribute, ACC.CHILDID_SELF) !is null) {
141 ourAttributes.addObject(extraAttributes.objectAtIndex(i)); 141 ourAttributes.addObject(extraAttributes.objectAtIndex(i));
142 } 142 }
143 } 143 }
144 } 144 }
145 145
146 accessibilityAttributes = ourAttributes; 146 accessibilityAttributes = ourAttributes;
147 accessibilityAttributes.retain(); 147 accessibilityAttributes.retain();
148 } 148 }
149 149
150 return accessibilityAttributes.id; 150 return accessibilityAttributes.id;
157 if (accessible !is null) { 157 if (accessible !is null) {
158 cocoa.id returnObject = accessible.internal_accessibilityAttributeValue(attributeName, ACC.CHILDID_SELF); 158 cocoa.id returnObject = accessible.internal_accessibilityAttributeValue(attributeName, ACC.CHILDID_SELF);
159 159
160 if (returnObject !is null) returnValue = returnObject.id; 160 if (returnObject !is null) returnValue = returnObject.id;
161 } 161 }
162 162
163 if (returnValue !is null) return returnValue; 163 if (returnValue !is null) return returnValue;
164 164
165 if (attributeName.isEqualToString (OS.NSAccessibilityRoleAttribute) || attributeName.isEqualToString (OS.NSAccessibilityRoleDescriptionAttribute)) { 165 if (attributeName.isEqualToString (OS.NSAccessibilityRoleAttribute) || attributeName.isEqualToString (OS.NSAccessibilityRoleDescriptionAttribute)) {
166 NSString roleText = OS.NSAccessibilitySplitterRole; 166 NSString roleText = OS.NSAccessibilitySplitterRole;
167 167
168 if (attributeName.isEqualToString (OS.NSAccessibilityRoleAttribute)) { 168 if (attributeName.isEqualToString (OS.NSAccessibilityRoleAttribute)) {
169 return roleText.id; 169 return roleText.id;
170 } else { // NSAccessibilityRoleDescriptionAttribute 170 } else { // NSAccessibilityRoleDescriptionAttribute
171 return OS.NSAccessibilityRoleDescription (roleText.id, null); 171 return OS.NSAccessibilityRoleDescription (roleText.id, null);
172 } 172 }
180 int value = (style & DWT.VERTICAL) !is 0 ? location.x : location.y; 180 int value = (style & DWT.VERTICAL) !is 0 ? location.x : location.y;
181 return NSNumber.numberWithInt(value).id; 181 return NSNumber.numberWithInt(value).id;
182 } else if (attributeName.isEqualToString (OS.NSAccessibilityMaxValueAttribute)) { 182 } else if (attributeName.isEqualToString (OS.NSAccessibilityMaxValueAttribute)) {
183 NSRect parentBounds = view.bounds(); 183 NSRect parentBounds = view.bounds();
184 float maxValue = (style & DWT.VERTICAL) !is 0 ? 184 float maxValue = (style & DWT.VERTICAL) !is 0 ?
185 parentBounds.width : 185 parentBounds.width :
186 parentBounds.height; 186 parentBounds.height;
187 return NSNumber.numberWithInt(cast(int)maxValue).id; 187 return NSNumber.numberWithInt(cast(int)maxValue).id;
188 } else if (attributeName.isEqualToString (OS.NSAccessibilityMinValueAttribute)) { 188 } else if (attributeName.isEqualToString (OS.NSAccessibilityMinValueAttribute)) {
189 return NSNumber.numberWithInt(0).id; 189 return NSNumber.numberWithInt(0).id;
190 } else if (attributeName.isEqualToString (OS.NSAccessibilityNextContentsAttribute)) { 190 } else if (attributeName.isEqualToString (OS.NSAccessibilityNextContentsAttribute)) {
191 Control[] children = parent._getChildren(); 191 Control[] children = parent._getChildren();
218 if (nextView !is null) 218 if (nextView !is null)
219 return NSArray.arrayWithObject(nextView.view).id; 219 return NSArray.arrayWithObject(nextView.view).id;
220 else 220 else
221 return NSArray.array().id; 221 return NSArray.array().id;
222 } 222 }
223 223
224 return super.accessibilityAttributeValue(id, sel, arg0); 224 return super.accessibilityAttributeValue(id, sel, arg0);
225 } 225 }
226 226
227 bool accessibilityIsIgnored(objc.id id, objc.SEL sel) { 227 bool accessibilityIsIgnored(objc.id id, objc.SEL sel) {
228 return false; 228 return false;
261 addListener(DWT.DefaultSelection,typedListener); 261 addListener(DWT.DefaultSelection,typedListener);
262 } 262 }
263 263
264 static int checkStyle (int style) { 264 static int checkStyle (int style) {
265 /* 265 /*
266 * Macintosh only supports smooth dragging. 266 * Macintosh only supports smooth dragging.
267 */ 267 */
268 style |= DWT.SMOOTH; 268 style |= DWT.SMOOTH;
269 return checkBits (style, DWT.HORIZONTAL, DWT.VERTICAL, 0, 0, 0, 0); 269 return checkBits (style, DWT.HORIZONTAL, DWT.VERTICAL, 0, 0, 0, 0);
270 } 270 }
271 271
272 bool becomeFirstResponder (objc.id id, objc.SEL sel) { 272 bool becomeFirstResponder (objc.id id, objc.SEL sel) {
370 return true; 370 return true;
371 } 371 }
372 372
373 void mouseDown(objc.id id, objc.SEL sel, objc.id theEvent) { 373 void mouseDown(objc.id id, objc.SEL sel, objc.id theEvent) {
374 //TODO use sendMouseEvent 374 //TODO use sendMouseEvent
375 // super.mouseDown(id, sel, theEvent); 375 // super.mouseDown(id, sel, theEvent);
376 NSEvent nsEvent = new NSEvent(theEvent); 376 NSEvent nsEvent = new NSEvent(theEvent);
377 if (nsEvent.clickCount() !is 1) return; 377 if (nsEvent.clickCount() !is 1) return;
378 NSPoint location = nsEvent.locationInWindow(); 378 NSPoint location = nsEvent.locationInWindow();
379 NSPoint point = view.convertPoint_fromView_(location, null); 379 NSPoint point = view.convertPoint_fromView_(location, null);
380 startX = cast(int)point.x; 380 startX = cast(int)point.x;
395 } 395 }
396 } 396 }
397 397
398 void mouseDragged(objc.id id, objc.SEL sel, objc.id theEvent) { 398 void mouseDragged(objc.id id, objc.SEL sel, objc.id theEvent) {
399 //TODO use sendMouseEvent 399 //TODO use sendMouseEvent
400 // super.mouseDragged(id, sel, theEvent); 400 // super.mouseDragged(id, sel, theEvent);
401 if (!dragging) return; 401 if (!dragging) return;
402 NSEvent nsEvent = new NSEvent(theEvent); 402 NSEvent nsEvent = new NSEvent(theEvent);
403 NSPoint location = nsEvent.locationInWindow(); 403 NSPoint location = nsEvent.locationInWindow();
404 NSPoint point = view.convertPoint_fromView_(location, null); 404 NSPoint point = view.convertPoint_fromView_(location, null);
405 NSRect frame = view.frame(); 405 NSRect frame = view.frame();
425 } 425 }
426 } 426 }
427 427
428 void mouseUp(objc.id id, objc.SEL sel, objc.id theEvent) { 428 void mouseUp(objc.id id, objc.SEL sel, objc.id theEvent) {
429 //TODO use sendMouseEvent 429 //TODO use sendMouseEvent
430 // super.mouseUp(id, sel, theEvent); 430 // super.mouseUp(id, sel, theEvent);
431 if (!dragging) return; 431 if (!dragging) return;
432 dragging = false; 432 dragging = false;
433 NSRect frame = view.frame(); 433 NSRect frame = view.frame();
434 Event event = new Event (); 434 Event event = new Event ();
435 event.x = lastX; 435 event.x = lastX;