Mercurial > projects > dwt-mac
comparison dwt/widgets/ToolItem.d @ 46:cfa563df4fdd
Updated Widget and Display to 3.514
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Fri, 05 Dec 2008 16:00:41 +0100 |
parents | d8635bb48c7c |
children | 844f65808a36 |
comparison
equal
deleted
inserted
replaced
45:d8635bb48c7c | 46:cfa563df4fdd |
---|---|
274 } | 274 } |
275 | 275 |
276 void createHandle () { | 276 void createHandle () { |
277 if ((style & DWT.SEPARATOR) !is 0) { | 277 if ((style & DWT.SEPARATOR) !is 0) { |
278 NSBox widget = cast(NSBox)new SWTBox().alloc(); | 278 NSBox widget = cast(NSBox)new SWTBox().alloc(); |
279 widget.initWithFrame(new NSRect()); | 279 widget.initWithFrame(NSRect()); |
280 widget.setBoxType(OS.NSBoxSeparator); | 280 widget.setBoxType(OS.NSBoxSeparator); |
281 view = widget; | 281 view = widget; |
282 } else { | 282 } else { |
283 NSView widget = cast(NSView)new SWTView().alloc(); | 283 NSView widget = cast(NSView)new SWTView().alloc(); |
284 widget.initWithFrame(new NSRect()); | 284 widget.initWithFrame(NSRect()); |
285 parent.contentView().addSubview(widget); | 285 parent.contentView().addSubview(widget); |
286 button = cast(NSButton)new SWTButton().alloc(); | 286 button = cast(NSButton)new SWTButton().alloc(); |
287 button.initWithFrame(new NSRect()); | 287 button.initWithFrame(NSRect()); |
288 button.setBordered(false); | 288 button.setBordered(false); |
289 button.setAction(OS.sel_sendSelection); | 289 button.setAction(OS.sel_sendSelection); |
290 button.setTarget(button); | 290 button.setTarget(button); |
291 Font font = parent.font !is null ? parent.font : parent.defaultFont (); | 291 Font font = parent.font !is null ? parent.font : parent.defaultFont (); |
292 button.setFont(font.handle); | 292 button.setFont(font.handle); |
359 if ((style & DWT.DROP_DOWN) !is 0) { | 359 if ((style & DWT.DROP_DOWN) !is 0) { |
360 NSRect bounds = view.bounds(); | 360 NSRect bounds = view.bounds(); |
361 NSGraphicsContext context = NSGraphicsContext.currentContext(); | 361 NSGraphicsContext context = NSGraphicsContext.currentContext(); |
362 context.saveGraphicsState(); | 362 context.saveGraphicsState(); |
363 NSBezierPath path = NSBezierPath.bezierPath(); | 363 NSBezierPath path = NSBezierPath.bezierPath(); |
364 NSPoint pt = new NSPoint(); | 364 NSPoint pt = NSPoint(); |
365 path.moveToPoint(pt); | 365 path.moveToPoint(pt); |
366 pt.x += ARROW_WIDTH; | 366 pt.x += ARROW_WIDTH; |
367 path.lineToPoint(pt); | 367 path.lineToPoint(pt); |
368 pt.y += ARROW_WIDTH - 1; | 368 pt.y += ARROW_WIDTH - 1; |
369 pt.x -= ARROW_WIDTH / 2f; | 369 pt.x -= ARROW_WIDTH / 2f; |
663 if ((style & DWT.CHECK) !is 0) setSelection (!getSelection ()); | 663 if ((style & DWT.CHECK) !is 0) setSelection (!getSelection ()); |
664 postEvent (DWT.Selection); | 664 postEvent (DWT.Selection); |
665 } | 665 } |
666 | 666 |
667 void setBounds (int x, int y, int width, int height) { | 667 void setBounds (int x, int y, int width, int height) { |
668 NSRect rect = new NSRect(); | 668 NSRect rect = NSRect(); |
669 rect.x = x; | 669 rect.x = x; |
670 rect.y = y; | 670 rect.y = y; |
671 rect.width = width; | 671 rect.width = width; |
672 rect.height = height; | 672 rect.height = height; |
673 view.setFrame(rect); | 673 view.setFrame(rect); |