Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 222859 | Differences between
and this patch

Collapse All | Expand All

(-)org/eclipse/swt/SWT.java (+14 lines)
Lines 905-910 Link Here
905
	 */
905
	 */
906
	public static final int SEPARATOR = 1 << 1;
906
	public static final int SEPARATOR = 1 << 1;
907
907
908
    /**
909
     * A Style constant representing a flexible space separator in a Cocoa
910
     * Unified toolbar. Although the (1 << 7) bit is already taken (they all are
911
     * several times over) it's in a different context so it shouldn't represent
912
     * a conflict. Carries no meaning on WS-s other than Cocoa.
913
     */
914
    public static final int FLEX_SPACER = 1 << 7;
915
916
    /**
917
     * A Style constant representing a space separator in a Cocoa Unified
918
     * toolbar. Carries no meaning on WS-s other than Cocoa.
919
     */
920
    public static final int SPACER = 1 << 10;
921
908
	/**
922
	/**
909
	 * Style constant for toggle button behavior (value is 1&lt;&lt;1).
923
	 * Style constant for toggle button behavior (value is 1&lt;&lt;1).
910
	 * <p><b>Used By:</b><ul>
924
	 * <p><b>Used By:</b><ul>
(-)org/eclipse/swt/widgets/Control.java (-1 / +5 lines)
Lines 1862-1868 Link Here
1862
}
1862
}
1863
1863
1864
boolean isDrawing () {
1864
boolean isDrawing () {
1865
	return getDrawing() && parent.isDrawing();
1865
    if (parent != null) {
1866
        return getDrawing() && parent.isDrawing();
1867
    } else {
1868
        return getDrawing();
1869
    }
1866
}
1870
}
1867
1871
1868
/**
1872
/**
(-)org/eclipse/swt/widgets/Combo.java (-11 / +98 lines)
Lines 60-65 Link Here
60
	boolean receivingFocus;
60
	boolean receivingFocus;
61
	boolean ignoreVerify, ignoreSelection;
61
	boolean ignoreVerify, ignoreSelection;
62
	NSRange selectionRange;
62
	NSRange selectionRange;
63
    private boolean arrowHit;
64
	private Image image;
65
	private ToolItem toolItem;
66
    
67
	/*
68
     * When a combo with a dropdown is a small (i.e. 24x24) item in
69
     * a unified toolbar, its arrow lives in a rectangle that is
70
     * 10px wide and 24px high.
71
     */
72
    private static final Rectangle arrow24Bounds = new Rectangle(38, 0, 10, 24);	
73
74
    private static final Rectangle arrow32Bounds = new Rectangle(44, 0, 10, 32); 
63
75
64
	/**
76
	/**
65
	 * the operating system limit for the number of characters
77
	 * the operating system limit for the number of characters
Lines 136-141 Link Here
136
		NSMenu nsMenu = widget.menu();
148
		NSMenu nsMenu = widget.menu();
137
		NSMenuItem nsItem = (NSMenuItem)new NSMenuItem().alloc();
149
		NSMenuItem nsItem = (NSMenuItem)new NSMenuItem().alloc();
138
		nsItem.initWithTitle(str, 0, NSString.stringWith(""));
150
		nsItem.initWithTitle(str, 0, NSString.stringWith(""));
151
		if (((style & SWT.SMOOTH) != 0) && (string.length() == 0)){
152
			nsItem.setImage(image.handle);
153
		}
139
		nsMenu.addItem(nsItem);
154
		nsMenu.addItem(nsItem);
140
		nsItem.release();
155
		nsItem.release();
141
		if (selection == -1) widget.selectItemAtIndex(-1);
156
		if (selection == -1) widget.selectItemAtIndex(-1);
Lines 144-149 Link Here
144
	}
159
	}
145
}
160
}
146
161
162
void setImage(Image image){
163
	this.image = image;
164
}
147
/**
165
/**
148
 * Adds the argument to the receiver's list at the given
166
 * Adds the argument to the receiver's list at the given
149
 * zero-relative index.
167
 * zero-relative index.
Lines 406-411 Link Here
406
		widget.menu().setAutoenablesItems(false);
424
		widget.menu().setAutoenablesItems(false);
407
		widget.setTarget(widget);
425
		widget.setTarget(widget);
408
		widget.setAction(OS.sel_sendSelection);
426
		widget.setAction(OS.sel_sendSelection);
427
		if ((style & SWT.SMOOTH) != 0) {
428
		    /* When the button is not bordered, the bezel style is ignored. */
429
			widget.setBordered(false);
430
			/* Choose the pull-down (down-pointing arrow) menu, not the pop-up one (up-down arrow) */
431
			widget.setPullsDown(true);
432
		}
409
		view = widget;
433
		view = widget;
410
	} else {
434
	} else {
411
		NSComboBox widget = (NSComboBox)new SWTComboBox().alloc();
435
		NSComboBox widget = (NSComboBox)new SWTComboBox().alloc();
Lines 849-855 Link Here
849
		return (int)/*64*/((NSComboBox)view).numberOfVisibleItems();
873
		return (int)/*64*/((NSComboBox)view).numberOfVisibleItems();
850
	}
874
	}
851
}
875
}
852
	
876
877
/**
878
 * Use hitTest() to determine whether, in the case when the combo is an item
879
 * in a Unified toolbar, the user clicked on the dropdown arrow; store the
880
 * result in arrowHit for later use in mouseDown()
881
 */
882
int /*long*/ hitTest (int /*long*/ id, int /*long*/ sel, NSPoint point) {
883
	if ((state & DISABLED) != 0) return 0;
884
	if (!isActive ()) return 0;
885
	if (((style & SWT.SMOOTH) != 0) && (image != null)) {
886
		arrowHit = false;
887
		NSView superview = new NSView(id).superview();
888
		if (superview != null) {
889
			NSPoint pt = superview.convertPoint_toView_(point, view);
890
			if (!view.isFlipped ()) {
891
				pt.y = view.bounds().height - pt.y;
892
			}
893
            Rectangle arrowBounds = (toolItem.parent.toolbar.sizeMode() == NSToolbar.NSToolbarSizeModeSmall) ? arrow24Bounds
894
                    : arrow32Bounds;
895
			if (arrowBounds.contains((int) pt.x, (int) pt.y)) {
896
				arrowHit = true;
897
			}
898
		}
899
	}
900
	return super.hitTest(id, sel, point);
901
}	
902
853
/**
903
/**
854
 * Searches the receiver's list starting at the first item
904
 * Searches the receiver's list starting at the first item
855
 * (index 0) until an item is found that is equal to the 
905
 * (index 0) until an item is found that is equal to the 
Lines 942-957 Link Here
942
}
992
}
943
993
944
void mouseDown(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
994
void mouseDown(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
945
	// If this is a combo box with an editor field and the control is disposed
995
	if (((style & SWT.SMOOTH) != 0) && ((style & SWT.DROP_DOWN) != 0) && (id == view.id)) {
946
	// while the view's cell editor is open we crash while tearing down the
996
		super.mouseDown(id, sel, theEvent);
947
	// popup window. Fix is to retain the view before letting Cocoa track
997
		NSRect rect = view.frame();
948
	// the mouse events.
998
		/* Convert the combo rect from combo-relative coordinates to its parent-, the 
949
	
999
		 * toolbar, relative coordinates. */
950
	// 'view' will be cleared if disposed during the mouseDown so cache it.
1000
		Point position = getDisplay().map(this, parent, (int)rect.x, (int)rect.y);
951
	NSView viewCopy = view;
1001
		Event event = new Event ();
952
	viewCopy.retain();
1002
		event.detail = arrowHit ? SWT.ARROW : 0;
953
	super.mouseDown(id, sel, theEvent);
1003
		event.x = position.x;
954
	viewCopy.release();
1004
		event.y = (int)(rect.y + rect.height);
1005
		if ((toolItem != null) && (toolItem.isDisposed() == false)) {
1006
			toolItem.postEvent (SWT.Selection, event);
1007
		}
1008
	} else {		
1009
		// If this is a combo box with an editor field and the control is disposed
1010
		// while the view's cell editor is open we crash while tearing down the
1011
		// popup window. Fix is to retain the view before letting Cocoa track
1012
		// the mouse events.
1013
		
1014
		// 'view' will be cleared if disposed during the mouseDown so cache it.
1015
		NSView viewCopy = view;
1016
		viewCopy.retain();
1017
		super.mouseDown(id, sel, theEvent);
1018
		viewCopy.release();
1019
	}
955
}
1020
}
956
1021
957
/**
1022
/**
Lines 999-1010 Link Here
999
	display.addWidget(((NSControl)view).cell(), this);
1064
	display.addWidget(((NSControl)view).cell(), this);
1000
}
1065
}
1001
1066
1067
void releaseParent () {
1068
    if ((style & SWT.SMOOTH) == 0) {
1069
        super.releaseParent();
1070
    }
1071
}
1072
1002
void releaseWidget () {
1073
void releaseWidget () {
1003
	super.releaseWidget ();
1074
	super.releaseWidget ();
1004
	if ((style & SWT.READ_ONLY) == 0) {
1075
	if ((style & SWT.READ_ONLY) == 0) {
1005
		((NSControl)view).abortEditing();
1076
		((NSControl)view).abortEditing();
1006
	}
1077
	}
1007
	selectionRange = null;
1078
	selectionRange = null;
1079
	toolItem = null;
1080
    if (image != null) {
1081
        image.dispose();
1082
        image = null;
1083
    }
1008
}
1084
}
1009
1085
1010
/**
1086
/**
Lines 1526-1531 Link Here
1526
}
1602
}
1527
1603
1528
/**
1604
/**
1605
 * Sets the ToolItem to be used to post events to when the combo is used as a
1606
 * menu-button in a toolbar.
1607
 * 
1608
 * @param toolItem
1609
 */
1610
void setToolItem(ToolItem toolItem) {
1611
	this.toolItem = toolItem;
1612
}
1613
1614
1615
/**
1529
 * Sets the number of items that are visible in the drop
1616
 * Sets the number of items that are visible in the drop
1530
 * down portion of the receiver's list.
1617
 * down portion of the receiver's list.
1531
 * <p>
1618
 * <p>
(-)org/eclipse/swt/widgets/ToolBar.java (-10 / +179 lines)
Lines 48-55 Link Here
48
public class ToolBar extends Composite {
48
public class ToolBar extends Composite {
49
	int itemCount;
49
	int itemCount;
50
	ToolItem [] items;
50
	ToolItem [] items;
51
	NSToolbar toolbar;
51
	NSArray accessibilityAttributes = null;
52
	NSArray accessibilityAttributes = null;
52
	
53
	
54
	static int NEXT_ID;
55
	
53
/**
56
/**
54
 * Constructs a new instance of this class given its parent
57
 * Constructs a new instance of this class given its parent
55
 * and a style value describing its behavior and appearance.
58
 * and a style value describing its behavior and appearance.
Lines 101-106 Link Here
101
	}
104
	}
102
}
105
}
103
106
107
Control[] _getChildren() {
108
	Control[] children = super._getChildren();
109
	int count = 0;
110
	for (int i = 0; i < itemCount; i++) {
111
		ToolItem item = items[i];
112
		if (item.control != null) count++;
113
	}
114
	Control[] result = new Control[children.length + count];
115
	System.arraycopy(children, 0, result, 0, children.length);
116
	for (int i = 0, j= children.length; i < itemCount; i++) {
117
		ToolItem item = items[i];
118
		if (item.control != null) result[j++] = item.control;
119
	}
120
	return result;
121
}
122
104
int /*long*/ accessibilityAttributeNames(int /*long*/ id, int /*long*/ sel) {
123
int /*long*/ accessibilityAttributeNames(int /*long*/ id, int /*long*/ sel) {
105
	
124
	
106
	if (accessibilityAttributes == null) {
125
	if (accessibilityAttributes == null) {
Lines 200-210 Link Here
200
}
219
}
201
220
202
void createHandle () {
221
void createHandle () {
203
	state |= THEME_BACKGROUND;
222
	if (isUnified()) {
204
	NSView widget = (NSView)new SWTView().alloc();
223
        toolbar = ((NSToolbar)new SWTToolbar().alloc()).initWithIdentifier(NSString.stringWith(String.valueOf(NEXT_ID++)));
205
	widget.init();
224
        toolbar.setDelegate(toolbar);
206
//	widget.setDrawsBackground(false);
225
        toolbar.setSizeMode(NSToolbar.NSToolbarSizeModeRegular);
207
	view = widget;
226
        toolbar.setDisplayMode(NSToolbar.NSToolbarDisplayModeIconAndLabel);
227
        NSWindow window = parent.view.window();
228
        window.setToolbar(toolbar);
229
        toolbar.setVisible(true);
230
        NSArray views = window.contentView().superview().subviews();
231
        for (int i = 0; i < views.count(); i++) {
232
            id id = views.objectAtIndex(i);
233
            if (new NSObject(id).className().getString().equals("NSToolbarView")) {
234
                view = new NSView(id);
235
            }
236
        }
237
	} else {
238
	    state |= THEME_BACKGROUND;
239
        NSView widget = (NSView)new SWTView().alloc();
240
        widget.init();
241
        view = widget;
242
	}
208
}
243
}
209
244
210
void createItem (ToolItem item, int index) {
245
void createItem (ToolItem item, int index) {
Lines 214-223 Link Here
214
		System.arraycopy (items, 0, newItems, 0, items.length);
249
		System.arraycopy (items, 0, newItems, 0, items.length);
215
		items = newItems;
250
		items = newItems;
216
	}
251
	}
217
	item.createWidget();
252
    item.createWidget();
218
	view.addSubview(item.view);
219
	System.arraycopy (items, index, items, index + 1, itemCount++ - index);
253
	System.arraycopy (items, index, items, index + 1, itemCount++ - index);
220
	items [index] = item;
254
	items [index] = item;
255
	if (isUnified()) {
256
        NSString itemId = null;
257
        if ((item.style & SWT.SEPARATOR) != 0) {
258
            itemId = OS.NSToolbarSeparatorItemIdentifier;
259
        } else if ((item.style & SWT.SPACER) != 0) {
260
            itemId = OS.NSToolbarSpaceItemIdentifier;
261
        } else if ((item.style & SWT.FLEX_SPACER) != 0) {
262
            itemId = OS.NSToolbarFlexibleSpaceItemIdentifier;
263
        } else {
264
            itemId = item.id;
265
        }
266
        toolbar.insertItemWithItemIdentifier(itemId, index);	    
267
        item.createDropdown();
268
	} else {
269
        view.addSubview(item.view);
270
	}
221
	relayout ();
271
	relayout ();
222
}
272
}
223
273
Lines 227-232 Link Here
227
	itemCount = 0;
277
	itemCount = 0;
228
}
278
}
229
279
280
void deregister () {
281
	super.deregister ();
282
	if (toolbar != null) display.removeWidget (toolbar);
283
}
284
230
void destroyItem (ToolItem item) {
285
void destroyItem (ToolItem item) {
231
	int index = 0;
286
	int index = 0;
232
	while (index < itemCount) {
287
	while (index < itemCount) {
Lines 235-242 Link Here
235
	}
290
	}
236
	if (index == itemCount) return;
291
	if (index == itemCount) return;
237
	System.arraycopy (items, index + 1, items, index, --itemCount - index);
292
	System.arraycopy (items, index + 1, items, index, --itemCount - index);
238
	items [itemCount] = null;
293
	if (isUnified()) {
239
	item.view.removeFromSuperview();
294
        toolbar.removeItemAtIndex(index);
295
	} else {
296
        items [itemCount] = null;
297
        item.view.removeFromSuperview();
298
	}
240
	relayout ();
299
	relayout ();
241
}
300
}
242
301
Lines 399-404 Link Here
399
	return -1;
458
	return -1;
400
}
459
}
401
460
461
boolean isUnified() {
462
    return ((style & SWT.SMOOTH) == SWT.SMOOTH);
463
}
464
402
int [] layoutHorizontal (int width, int height, boolean resize) {
465
int [] layoutHorizontal (int width, int height, boolean resize) {
403
	int xSpacing = 0, ySpacing = 2;
466
	int xSpacing = 0, ySpacing = 2;
404
	int marginWidth = 0, marginHeight = 0;
467
	int marginWidth = 0, marginHeight = 0;
Lines 474-479 Link Here
474
}
537
}
475
538
476
int [] layout (int nWidth, int nHeight, boolean resize) {
539
int [] layout (int nWidth, int nHeight, boolean resize) {
540
    if (isUnified()) {
541
        Rectangle rect = getClientArea();
542
        return new int[] { 1, rect.width, rect.height };
543
    }
477
	if ((style & SWT.VERTICAL) != 0) {
544
	if ((style & SWT.VERTICAL) != 0) {
478
		return layoutVertical (nWidth, nHeight, resize);
545
		return layoutVertical (nWidth, nHeight, resize);
479
	} else {
546
	} else {
Lines 481-492 Link Here
481
	}
548
	}
482
}
549
}
483
550
551
void register() {
552
	super.register();
553
	if (isUnified()) {
554
	    display.addWidget (toolbar, this);
555
	}
556
}
557
484
void relayout () {
558
void relayout () {
485
	if (!getDrawing()) return;
559
	if (!getDrawing()) return;
486
	Rectangle rect = getClientArea ();
560
	Rectangle rect = getClientArea ();
487
	layout (rect.width, rect.height, true);
561
	layout (rect.width, rect.height, true);
488
}
562
}
489
563
564
void release (boolean destroy) {
565
    if (isUnified()) {
566
        parent = null;
567
    }
568
    
569
    super.release(destroy);
570
}
490
void releaseChildren (boolean destroy) {
571
void releaseChildren (boolean destroy) {
491
	if (items != null) {
572
	if (items != null) {
492
		for (int i=0; i<itemCount; i++) {
573
		for (int i=0; i<itemCount; i++) {
Lines 502-512 Link Here
502
}
583
}
503
584
504
void releaseHandle () {
585
void releaseHandle () {
505
	super.releaseHandle ();
586
	if (isUnified()) {
587
        /*
588
         * The super#releaseHandle() will call view#release() and will cause
589
         * a crash, because it'll try to release the view, which was not 
590
         * created in a way that would bump up its reference count e.g. using
591
         * alloc(), retain() etc., but was kind of 'attached' to the 
592
         * NSToolbarView hosting the toolbar (see createHandle() above).
593
         * Don't call super.releaseHandle() for the the NSToolbar case.
594
         */
595
        toolbar.release();
596
        toolbar = null;
597
	} else {
598
        super.releaseHandle ();
599
	}
506
	if (accessibilityAttributes != null) accessibilityAttributes.release();
600
	if (accessibilityAttributes != null) accessibilityAttributes.release();
507
	accessibilityAttributes = null;
601
	accessibilityAttributes = null;
508
}
602
}
509
603
604
void releaseParent () {
605
    if (parent != null) {
606
        super.releaseParent();
607
    }
608
}
609
510
void removeControl (Control control) {
610
void removeControl (Control control) {
511
	super.removeControl (control);
611
	super.removeControl (control);
512
	for (int i=0; i<itemCount; i++) {
612
	for (int i=0; i<itemCount; i++) {
Lines 520-525 Link Here
520
	relayout ();
620
	relayout ();
521
}
621
}
522
622
623
void sendSelection (int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) {
624
	for (int i = 0; i < itemCount; i++) {
625
		ToolItem item = items[i];
626
		if (item.nsItem.id == arg0) {
627
			item.postEvent(SWT.Selection);
628
			break;
629
		}
630
	}
631
}
632
523
void setFont(NSFont font) {
633
void setFont(NSFont font) {
524
	for (int i = 0; i < itemCount; i++) {
634
	for (int i = 0; i < itemCount; i++) {
525
		ToolItem item = items[i];
635
		ToolItem item = items[i];
Lines 533-536 Link Here
533
	if (redraw && drawCount == 0) relayout();
643
	if (redraw && drawCount == 0) relayout();
534
}
644
}
535
645
646
public void setVisible(boolean visible) {
647
    if (isUnified()) {
648
        toolbar.setVisible(visible);
649
    } else {
650
        super.setVisible(visible);
651
    }
652
}
653
654
void setZOrder() {
655
	if (toolbar != null) return;
656
	super.setZOrder();
657
}
658
659
int /*long*/ toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar, int /*long*/ itemIdentifier, boolean flag) {
660
	NSString itemID = new NSString(itemIdentifier);
661
	for (int j = 0; j < itemCount; j++) {
662
		ToolItem item = items[j];
663
		if (itemID.isEqual(item.id)) {
664
			return item.nsItem.id;
665
		}
666
	}
667
	return 0;
668
}
669
670
int /*long*/ toolbarAllowedItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) {
671
	NSMutableArray array = NSMutableArray.arrayWithCapacity(itemCount);
672
	for (int i = 0; i < itemCount; i++) {
673
		ToolItem item = items[i];
674
		NSString itemId = null;
675
		if (((item.style & SWT.SEPARATOR) != 0) && (item.control == null)) {
676
			itemId = OS.NSToolbarSeparatorItemIdentifier;
677
        } else if ((item.style & SWT.SPACER) != 0) {
678
            itemId = OS.NSToolbarSpaceItemIdentifier;
679
        } else if ((item.style & SWT.FLEX_SPACER) != 0) {
680
            itemId = OS.NSToolbarFlexibleSpaceItemIdentifier;
681
		} else {
682
			itemId = item.id;
683
		}
684
		array.addObject(itemId);
685
	}
686
	return array.id;
687
}
688
689
int /*long*/ toolbarDefaultItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) {
690
	return toolbarAllowedItemIdentifiers(id, sel, toolbar);
691
}
692
693
boolean validateToolbarItem(int id, int sel, int toolbarItem) {
694
    NSToolbarItem nsItem = new NSToolbarItem(toolbarItem);
695
    for (int itemIx = 0; itemIx < itemCount; itemIx++) {
696
        ToolItem item = items[itemIx];
697
        if (item.nsItem.id == nsItem.id) {
698
            return item.getEnabled();
699
        }
700
    }
701
702
    return true;
703
}
704
536
}
705
}
(-)org/eclipse/swt/widgets/Display.java (-1 / +22 lines)
Lines 2437-2442 Link Here
2437
	OS.class_addMethod(cls, OS.sel_timerProc_, proc3, "@:@");
2437
	OS.class_addMethod(cls, OS.sel_timerProc_, proc3, "@:@");
2438
	OS.class_addMethod(cls, OS.sel_systemSettingsChanged_, proc3, "@:@");
2438
	OS.class_addMethod(cls, OS.sel_systemSettingsChanged_, proc3, "@:@");
2439
	OS.objc_registerClassPair(cls);	
2439
	OS.objc_registerClassPair(cls);	
2440
2441
	className = "SWTToolbar";
2442
	cls = OS.objc_allocateClassPair(OS.class_NSToolbar, className, 0);
2443
	OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types);
2444
	OS.class_addMethod(cls, OS.sel_toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar_, proc5, "@:@@Z");
2445
	OS.class_addMethod(cls, OS.sel_toolbarAllowedItemIdentifiers_, proc3, "@:@");
2446
	OS.class_addMethod(cls, OS.sel_toolbarDefaultItemIdentifiers_, proc3, "@:@");
2447
	OS.class_addMethod(cls, OS.sel_sendSelection_, proc3, "@:@");
2448
    OS.class_addMethod(cls, OS.sel_validateToolbarItem_, proc3, "@:@");
2449
	OS.objc_registerClassPair(cls);
2440
}
2450
}
2441
2451
2442
NSFont getFont (int /*long*/ cls, int /*long*/ sel) {
2452
NSFont getFont (int /*long*/ cls, int /*long*/ sel) {
Lines 4788-4794 Link Here
4788
		widget.setObjectValue(id, sel, arg0);
4798
		widget.setObjectValue(id, sel, arg0);
4789
	} else if (sel == OS.sel_updateOpenGLContext_) {
4799
	} else if (sel == OS.sel_updateOpenGLContext_) {
4790
		widget.updateOpenGLContext(id, sel, arg0);
4800
		widget.updateOpenGLContext(id, sel, arg0);
4791
	}
4801
	} else if (sel == OS.sel_toolbarAllowedItemIdentifiers_) {
4802
		return widget.toolbarAllowedItemIdentifiers(id, sel, arg0);
4803
	} else if (sel == OS.sel_toolbarDefaultItemIdentifiers_) {
4804
		return widget.toolbarDefaultItemIdentifiers(id, sel, arg0);
4805
	} else if (sel == OS.sel_sendSelection_) {
4806
		widget.sendSelection(id, sel, arg0);
4807
	} else if (sel == OS.sel_validateToolbarItem_) {
4808
        return widget.validateToolbarItem(id, sel, arg0) ? 1 : 0;
4809
    }
4810
4792
	return 0;
4811
	return 0;
4793
}
4812
}
4794
4813
Lines 4876-4881 Link Here
4876
		return (widget.tableView_writeRowsWithIndexes_toPasteboard(id, sel, arg0, arg1, arg2) ? 1 : 0);
4895
		return (widget.tableView_writeRowsWithIndexes_toPasteboard(id, sel, arg0, arg1, arg2) ? 1 : 0);
4877
	} else if (sel == OS.sel_outlineView_writeItems_toPasteboard_) {
4896
	} else if (sel == OS.sel_outlineView_writeItems_toPasteboard_) {
4878
		return (widget.outlineView_writeItems_toPasteboard(id, sel, arg0, arg1, arg2) ? 1 : 0);
4897
		return (widget.outlineView_writeItems_toPasteboard(id, sel, arg0, arg1, arg2) ? 1 : 0);
4898
	} else if (sel == OS.sel_toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar_) {
4899
		return widget.toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar(id, sel, arg0, arg1, arg2 != 0);
4879
	}
4900
	}
4880
	return 0;
4901
	return 0;
4881
}
4902
}
(-)org/eclipse/swt/widgets/Widget.java (+19 lines)
Lines 1306-1311 Link Here
1306
void sendSelection () {
1306
void sendSelection () {
1307
}
1307
}
1308
1308
1309
void sendSelection (int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) {
1310
}
1311
1309
void sendVerticalSelection () {
1312
void sendVerticalSelection () {
1310
}
1313
}
1311
1314
Lines 1686-1691 Link Here
1686
	return result;
1689
	return result;
1687
}
1690
}
1688
1691
1692
int /*long*/ toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar, int /*long*/ itemID, boolean flag) {
1693
	return 0;
1694
}
1695
1696
int /*long*/ toolbarAllowedItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) {
1697
	return 0;
1698
}
1699
1700
int /*long*/ toolbarDefaultItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) {
1701
	return 0;
1702
}
1703
1689
String tooltipText () {
1704
String tooltipText () {
1690
	return null;
1705
	return null;
1691
}
1706
}
Lines 1764-1767 Link Here
1764
void updateOpenGLContext(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
1779
void updateOpenGLContext(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
1765
}
1780
}
1766
1781
1782
boolean validateToolbarItem(int id, int sel, int arg0) {
1783
    return true;
1784
}
1785
1767
}
1786
}
(-)org/eclipse/swt/widgets/ToolItem.java (-79 / +234 lines)
Lines 39-44 Link Here
39
public class ToolItem extends Item {
39
public class ToolItem extends Item {
40
	NSView view;
40
	NSView view;
41
	NSButton button;
41
	NSButton button;
42
	NSToolbarItem nsItem;
43
	NSString id;
42
	int width = DEFAULT_SEPARATOR_WIDTH;
44
	int width = DEFAULT_SEPARATOR_WIDTH;
43
	ToolBar parent;
45
	ToolBar parent;
44
	Image hotImage, disabledImage;
46
	Image hotImage, disabledImage;
Lines 49-54 Link Here
49
	static final int DEFAULT_WIDTH = 24;
51
	static final int DEFAULT_WIDTH = 24;
50
	static final int DEFAULT_HEIGHT = 22;
52
	static final int DEFAULT_HEIGHT = 22;
51
	static final int DEFAULT_SEPARATOR_WIDTH = 6;
53
	static final int DEFAULT_SEPARATOR_WIDTH = 6;
54
    
55
	static final int UNIFIED_SMALL_SIZE = 36;
56
    static final int UNIFIED_SMALL_IMAGE_SIZE = 24;
57
    static final int UNIFIED_SMALL_DROPDOWN_WIDTH = 48;
58
    
59
    static final int UNIFIED_REGULAR_SIZE = 44;
60
    static final int UNIFIED_REGULAR_IMAGE_SIZE = 32;
61
    static final int UNIFIED_REGULAR_DROPDOWN_WIDTH = 54;
52
    /*
62
    /*
53
     * An inset of 5, instead of 3, makes for less cramped toolbars and balances
63
     * An inset of 5, instead of 3, makes for less cramped toolbars and balances
54
     * well with the height imposed by the search control, if such is hosted in
64
     * well with the height imposed by the search control, if such is hosted in
Lines 232-239 Link Here
232
		}
242
		}
233
	} else {
243
	} else {
234
		if (text.length () != 0 || image != null) {
244
		if (text.length () != 0 || image != null) {
235
			NSButton widget = (NSButton)button;
245
			NSSize size = new NSSize();
236
			NSSize size = widget.cell().cellSize();
246
			if (nsItem == null) {
247
				NSButton widget = (NSButton)button;
248
				size = widget.cell().cellSize();
249
			} else {
250
				size.width = DEFAULT_WIDTH;
251
				size.height = DEFAULT_HEIGHT;
252
			}
237
			width = (int)Math.ceil(size.width);
253
			width = (int)Math.ceil(size.width);
238
			height = (int)Math.ceil(size.height);
254
			height = (int)Math.ceil(size.height);
239
		} else {
255
		} else {
Lines 249-285 Link Here
249
	return new Point (width, height);
265
	return new Point (width, height);
250
}
266
}
251
267
268
void createDropdown () {
269
	if ((parent.toolbar != null) && (style & SWT.DROP_DOWN) != 0) {
270
		final Combo combo = new Combo(parent, SWT.READ_ONLY | SWT.SMOOTH);
271
        if (parent.toolbar.sizeMode() == NSToolbar.NSToolbarSizeModeSmall) {
272
            setWidth(UNIFIED_SMALL_DROPDOWN_WIDTH);
273
        } else {
274
            setWidth(UNIFIED_REGULAR_DROPDOWN_WIDTH);
275
        }
276
		setControl(combo);
277
		combo.setToolItem(this);
278
	}
279
}
252
void createHandle () {
280
void createHandle () {
253
	if ((style & SWT.SEPARATOR) != 0) {
281
	if (parent.isUnified()) {
254
		NSBox widget = (NSBox)new SWTBox().alloc();
282
        id = NSString.stringWith(String.valueOf(++ToolBar.NEXT_ID));
255
		widget.init();
283
        id.retain();
256
		widget.setBoxType(OS.NSBoxSeparator);
284
        nsItem = ((NSToolbarItem)new NSToolbarItem().alloc()).initWithItemIdentifier(id);
257
		widget.setBorderWidth(0);
285
        nsItem.setTarget(parent.toolbar);
258
		view = widget;
286
        nsItem.setAction(OS.sel_sendSelection_);
259
	} else {
287
	} else {
260
		NSView widget = (NSView)new SWTView().alloc();
288
        if ((style & SWT.SEPARATOR) != 0) {
261
		widget.init();
289
            NSBox widget = (NSBox)new SWTBox().alloc();
262
		button = (NSButton)new SWTButton().alloc();
290
            widget.init();
263
		button.init();
291
            widget.setBoxType(OS.NSBoxSeparator);
264
		/*
292
            widget.setBorderWidth(0);
265
		* Feature in Cocoa.  NSButtons without borders do not leave any margin
293
            view = widget;
266
		* between their edge and their image.  The workaround is to provide a
294
        } else {
267
		* custom cell that displays the image in a better position. 
295
            NSView widget = (NSView)new SWTView().alloc();
268
		*/
296
            widget.init();
269
		NSButtonCell cell = (NSButtonCell)new SWTButtonCell ().alloc ().init ();
297
            button = (NSButton)new SWTButton().alloc();
270
		button.setCell (cell);
298
            button.init();
271
		cell.release();
299
            /*
272
		button.setBordered(false);
300
            * Feature in Cocoa.  NSButtons without borders do not leave any margin
273
		button.setAction(OS.sel_sendSelection);
301
            * between their edge and their image.  The workaround is to provide a
274
		button.setTarget(button);
302
            * custom cell that displays the image in a better position. 
275
		Font font = parent.font != null ? parent.font : parent.defaultFont ();
303
            */
276
		button.setFont(font.handle);
304
            NSButtonCell cell = (NSButtonCell)new SWTButtonCell ().alloc ().init ();
277
		button.setImagePosition(OS.NSImageOverlaps);
305
            button.setCell (cell);
278
		NSString emptyStr = NSString.stringWith("");
306
            button.setBordered(false);
279
		button.setTitle(emptyStr);
307
            button.setAction(OS.sel_sendSelection);
280
		button.setEnabled(parent.getEnabled());
308
            button.setTarget(button);
281
		widget.addSubview(button);
309
            Font font = parent.font != null ? parent.font : parent.defaultFont ();
282
		view = widget;
310
            button.setFont(font.handle);
311
            button.setImagePosition(OS.NSImageOverlaps);
312
            button.setTitle(NSString.stringWith(""));
313
            button.setEnabled(parent.getEnabled());
314
            widget.addSubview(button);
315
            view = widget;
316
        }
283
	}
317
	}
284
}
318
}
285
319
Lines 354-361 Link Here
354
}
388
}
355
389
356
void enableWidget(boolean enabled) {
390
void enableWidget(boolean enabled) {
357
	if ((style & SWT.SEPARATOR) == 0) {
391
	if (parent.isUnified()) {
358
		((NSButton)button).setEnabled(enabled);
392
        nsItem.setEnabled(enabled);
393
	} else {
394
        if ((style & SWT.SEPARATOR) == 0) {
395
            ((NSButton)button).setEnabled(enabled);
396
        }
359
	}
397
	}
360
}
398
}
361
399
Lines 372-379 Link Here
372
 */
410
 */
373
public Rectangle getBounds () {
411
public Rectangle getBounds () {
374
	checkWidget();
412
	checkWidget();
375
	NSRect rect = view.frame();
413
	if (parent.isUnified()) {
376
	return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
414
        if ((style & SWT.DROP_DOWN) != 0) {
415
            NSRect rect = control.topView().frame();
416
            /*
417
             * Convert the toolitem rect from toolitem-relative coordinates to its
418
             * parent, the toolbar, relative coordinates.
419
             */
420
            Point position = getDisplay().map(control, parent, (int)rect.x, (int)rect.y);
421
            return new Rectangle((int)position.x, (int)rect.y, (int)rect.width, (int)rect.height);
422
        } else {
423
            if (parent.toolbar.sizeMode() == NSToolbar.NSToolbarSizeModeSmall) {
424
                return new Rectangle(0, 0, UNIFIED_SMALL_SIZE, UNIFIED_SMALL_SIZE);
425
            } else {
426
                return new Rectangle(0, 0, UNIFIED_REGULAR_SIZE, UNIFIED_REGULAR_SIZE);
427
            }
428
        }
429
	} else {
430
        NSRect rect = view.frame();
431
        return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
432
	}
377
}
433
}
378
434
379
void setClipRegion (float /*double*/ x, float /*double*/ y) {
435
void setClipRegion (float /*double*/ x, float /*double*/ y) {
Lines 656-667 Link Here
656
	if (view != null) view.release ();
712
	if (view != null) view.release ();
657
	if (button != null) button.release ();
713
	if (button != null) button.release ();
658
	view = button = null;
714
	view = button = null;
715
	if (nsItem != null) {
716
	    nsItem.release();
717
	    nsItem = null;
718
	}
719
	if (id != null) {
720
	    id.release();
721
	    id = null;
722
	}
659
	parent = null;
723
	parent = null;
660
}
724
}
661
725
662
void releaseWidget () {
726
void releaseWidget () {
663
	super.releaseWidget ();
727
	super.releaseWidget ();
664
	control = null;
728
    if (control != null) {
729
        control.dispose();
730
        control = null;
731
    }
665
	toolTipText = null;
732
	toolTipText = null;
666
	image = disabledImage = hotImage = null; 
733
	image = disabledImage = hotImage = null; 
667
}
734
}
Lines 688-693 Link Here
688
}
755
}
689
756
690
void setBounds (int x, int y, int width, int height) {
757
void setBounds (int x, int y, int width, int height) {
758
	if (view == null) return;
691
	NSRect rect = new NSRect();
759
	NSRect rect = new NSRect();
692
	rect.x = x;
760
	rect.x = x;
693
	rect.y = y;
761
	rect.y = y;
Lines 725-742 Link Here
725
		if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
793
		if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
726
		if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
794
		if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
727
	}
795
	}
728
	if ((style & SWT.SEPARATOR) == 0) return;
796
    if (this.control == control) return;
729
	if (this.control == control) return;
797
	Control oldControl = this.control;
730
	NSBox widget = (NSBox)view;
731
	if (control == null) {
732
		widget.setBoxType(OS.NSBoxSeparator);
733
	} else {
734
		widget.setBoxType(OS.NSBoxCustom);
735
	}
736
	this.control = control;
798
	this.control = control;
737
	view.setHidden(control != null);
799
	if (parent.isUnified()) {
738
	if (control != null && !control.isDisposed ()) {
800
        /* Unified toolbar case */
739
		control.moveAbove (null);
801
        NSToolbar toolbar = parent.toolbar;
802
        int index = parent.indexOf(this);
803
        toolbar.removeItemAtIndex(index);
804
        NSString itemId = null;
805
        if (control != null) {
806
            itemId = id;
807
        } else if ((style & SWT.SEPARATOR) != 0){ 
808
            itemId = OS.NSToolbarSeparatorItemIdentifier;
809
        } else if ((style & SWT.SPACER) != 0) {
810
            itemId = OS.NSToolbarSpaceItemIdentifier;
811
        } else if ((style & SWT.FLEX_SPACER) != 0) {
812
            itemId = OS.NSToolbarFlexibleSpaceItemIdentifier;
813
        }
814
        
815
        toolbar.insertItemWithItemIdentifier(itemId, index);
816
        nsItem.setView(control != null ? control.topView() : null);
817
        if (control != null) {
818
            NSSize size = new NSSize();
819
            if ((style & SWT.DROP_DOWN) == 0){
820
                //TODO should not computeSize
821
                size.height = control.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
822
            } else {
823
                if (parent.toolbar.sizeMode() == NSToolbar.NSToolbarSizeModeSmall) {
824
                    size.height = UNIFIED_SMALL_IMAGE_SIZE;
825
                } else {
826
                    size.height = UNIFIED_REGULAR_IMAGE_SIZE;
827
                }
828
            }
829
            size.width = width;
830
            nsItem.setMinSize(size);
831
            nsItem.setMaxSize(size);
832
        }
833
        if (oldControl != null && !oldControl.isDisposed()) {
834
            oldControl.dispose();
835
        }
836
	} else {
837
	    if ((style & SWT.SEPARATOR) == 0) return;
838
        NSBox widget = (NSBox)view;
839
        if (control == null) {
840
            widget.setBoxType(OS.NSBoxSeparator);
841
        } else {
842
            widget.setBoxType(OS.NSBoxCustom);
843
        }
844
        view.setHidden(control != null);
845
        if (control != null && !control.isDisposed ()) {
846
            control.moveAbove (null);
847
        }
740
	}
848
	}
741
	parent.relayout ();
849
	parent.relayout ();
742
}
850
}
Lines 789-796 Link Here
789
	checkWidget();
897
	checkWidget();
790
	if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
898
	if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
791
	if ((style & SWT.SEPARATOR) != 0) return;
899
	if ((style & SWT.SEPARATOR) != 0) return;
792
	disabledImage = image;
900
	if ((disabledImage != null) || (image != null)) {
793
	updateImage (true);
901
	    disabledImage = image;
902
	    updateImage (true);
903
	}
794
}
904
}
795
905
796
/**
906
/**
Lines 823-828 Link Here
823
	if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
933
	if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
824
	if ((style & SWT.SEPARATOR) != 0) return;
934
	if ((style & SWT.SEPARATOR) != 0) return;
825
	super.setImage (image);
935
	super.setImage (image);
936
    if ((control instanceof Combo) && (control.isDisposed() == false)
937
            && ((control.getStyle() & SWT.SMOOTH) != 0)) {
938
	    Combo combo = (Combo)control;
939
		/*
940
		 * In a Unified toolbar, an NSComboBox will behave like a tool item with an icon
941
		 * and a dropdown arrow if it has an image and its first string needs to be an empty 
942
         * string.
943
		 */
944
	    combo.setImage(image);
945
	    combo.removeAll();
946
	    if (image != null) {
947
	        combo.add("");
948
	    }
949
	}
826
	updateImage (true);
950
	updateImage (true);
827
}
951
}
828
952
Lines 887-902 Link Here
887
	if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
1011
	if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
888
	if ((style & SWT.SEPARATOR) != 0) return;
1012
	if ((style & SWT.SEPARATOR) != 0) return;
889
	super.setText (string);
1013
	super.setText (string);
890
	NSButton widget = (NSButton)button;
1014
	if (parent.isUnified()) {
891
	widget.setAttributedTitle(createString());
1015
        char [] chars = new char [text.length ()];
892
	if (text.length() != 0 && image != null) {
1016
        text.getChars (0, chars.length, chars, 0);
893
		if ((parent.style & SWT.RIGHT) != 0) {
1017
        int length = fixMnemonic (chars);
894
			widget.setImagePosition(OS.NSImageLeft);
1018
        nsItem.setLabel(NSString.stringWithCharacters(chars, length));
895
		} else {
896
			widget.setImagePosition(OS.NSImageAbove);		
897
		}
898
	} else {
1019
	} else {
899
		widget.setImagePosition(text.length() != 0 ? OS.NSNoImage : OS.NSImageOnly);
1020
        NSButton widget = (NSButton)button;
1021
        widget.setAttributedTitle(createString());
1022
        if (text.length() != 0 && image != null) {
1023
            if ((parent.style & SWT.RIGHT) != 0) {
1024
                widget.setImagePosition(OS.NSImageLeft);
1025
            } else {
1026
                widget.setImagePosition(OS.NSImageAbove);
1027
            }
1028
        } else {
1029
            widget.setImagePosition(text.length() != 0 ? OS.NSNoImage : OS.NSImageOnly);
1030
        }
900
	}
1031
	}
901
	parent.relayout ();
1032
	parent.relayout ();
902
}
1033
}
Lines 923-930 Link Here
923
 */
1054
 */
924
public void setToolTipText (String string) {
1055
public void setToolTipText (String string) {
925
	checkWidget();
1056
	checkWidget();
926
	toolTipText = string;
1057
	if (string == null) {
927
	parent.checkToolTip (this);
1058
		return;
1059
	}
1060
1061
	if (parent.isUnified()) {
1062
        char[] chars = new char [string.length ()];
1063
        string.getChars (0, chars.length, chars, 0);
1064
        int length = fixMnemonic (chars);
1065
        nsItem.setToolTip(NSString.stringWithCharacters (chars, length));
1066
	} else {
1067
        toolTipText = string;
1068
        parent.checkToolTip (this);
1069
	}
928
}
1070
}
929
1071
930
void setVisible (boolean visible) {
1072
void setVisible (boolean visible) {
Lines 950-958 Link Here
950
 */
1092
 */
951
public void setWidth (int width) {
1093
public void setWidth (int width) {
952
	checkWidget();
1094
	checkWidget();
953
	if ((style & SWT.SEPARATOR) == 0) return;
954
	if (width < 0 || this.width == width) return;
1095
	if (width < 0 || this.width == width) return;
955
	this.width = width;
1096
	if (parent.isUnified()) {
1097
		NSSize size = new NSSize();
1098
		//TODO should not computeSize
1099
		size.height = control != null ? control.computeSize(SWT.DEFAULT, SWT.DEFAULT).y : 0;
1100
		size.width = width;
1101
		nsItem.setMinSize(size);
1102
		nsItem.setMaxSize(size);
1103
	} else {
1104
	    if ((style & SWT.SEPARATOR) == 0) return;
1105
	}
1106
    this.width = width;
956
	parent.relayout();
1107
	parent.relayout();
957
}
1108
}
958
1109
Lines 972-995 Link Here
972
			image = disabledImage;
1123
			image = disabledImage;
973
		}
1124
		}
974
	}
1125
	}
975
	NSButton widget = (NSButton)button;
1126
	if (parent.isUnified()) {
976
	/*
1127
        nsItem.setImage(image != null ? image.handle : null);
977
	 * Feature in Cocoa.  If the NSImage object being set into the button is
978
	 * the same NSImage object that is already there then the button does not
979
	 * redraw itself.  This results in the button's image not visually updating
980
	 * if the NSImage object's content has changed since it was last set
981
	 * into the button.  The workaround is to explicitly redraw the button.
982
	 */
983
	widget.setImage(image != null ? image.handle : null);
984
	widget.setNeedsDisplay(true);
985
	if (text.length() != 0 && image != null) {
986
		if ((parent.style & SWT.RIGHT) != 0) {
987
			widget.setImagePosition(OS.NSImageLeft);
988
		} else {
989
			((NSButton)button).setImagePosition(OS.NSImageAbove);		
990
		}
991
	} else {	
1128
	} else {	
992
		widget.setImagePosition(text.length() != 0 ? OS.NSNoImage : OS.NSImageOnly);		
1129
        NSButton widget = (NSButton)button;
1130
        /*
1131
         * Feature in Cocoa.  If the NSImage object being set into the button is
1132
         * the same NSImage object that is already there then the button does not
1133
         * redraw itself.  This results in the button's image not visually updating
1134
         * if the NSImage object's content has changed since it was last set
1135
         * into the button.  The workaround is to explicitly redraw the button.
1136
         */
1137
        widget.setImage(image != null ? image.handle : null);
1138
        widget.setNeedsDisplay(true);
1139
        if (text.length() != 0 && image != null) {
1140
            if ((parent.style & SWT.RIGHT) != 0) {
1141
                widget.setImagePosition(OS.NSImageLeft);
1142
            } else {
1143
                ((NSButton)button).setImagePosition(OS.NSImageAbove);
1144
            }
1145
        } else {    
1146
            widget.setImagePosition(text.length() != 0 ? OS.NSNoImage : OS.NSImageOnly);        
1147
        }
993
	}
1148
	}
994
	parent.relayout();
1149
	parent.relayout();
995
}
1150
}
(-)org/eclipse/swt/internal/cocoa/NSToolbar.java (+24 lines)
Lines 12-17 Link Here
12
12
13
public class NSToolbar extends NSObject {
13
public class NSToolbar extends NSObject {
14
14
15
/* NSToolbarSizeMode */
16
public static final int NSToolbarSizeModeDefault = 0;
17
18
public static final int NSToolbarSizeModeRegular = 1;
19
	
20
public static final int NSToolbarSizeModeSmall = 2;
21
22
/* NSToolbarDisplayMode */
23
public static final int NSToolbarDisplayModeDefault = 0;
24
25
public static final int NSToolbarDisplayModeIconAndLabel = 1;
26
27
public static final int NSToolbarDisplayModeIconOnly = 2;
28
29
public static final int NSToolbarDisplayModeLabelOnly = 3;
30
15
public NSToolbar() {
31
public NSToolbar() {
16
	super();
32
	super();
17
}
33
}
Lines 49-56 Link Here
49
	OS.objc_msgSend(this.id, OS.sel_setDisplayMode_, displayMode);
65
	OS.objc_msgSend(this.id, OS.sel_setDisplayMode_, displayMode);
50
}
66
}
51
67
68
public void setSizeMode(int /*long*/ sizeMode) {
69
	OS.objc_msgSend(this.id, OS.sel_setSizeMode_, sizeMode);
70
}
71
52
public void setVisible(boolean shown) {
72
public void setVisible(boolean shown) {
53
	OS.objc_msgSend(this.id, OS.sel_setVisible_, shown);
73
	OS.objc_msgSend(this.id, OS.sel_setVisible_, shown);
54
}
74
}
55
75
76
public int /*long*/ sizeMode() {
77
    return OS.objc_msgSend(this.id, OS.sel_sizeMode);
78
}
79
56
}
80
}
(-)org/eclipse/swt/internal/cocoa/OS.java (+3 lines)
Lines 1624-1629 Link Here
1624
public static final int /*long*/ sel_shouldChangeTextInRange_replacementString_ = sel_registerName("shouldChangeTextInRange:replacementString:");
1624
public static final int /*long*/ sel_shouldChangeTextInRange_replacementString_ = sel_registerName("shouldChangeTextInRange:replacementString:");
1625
public static final int /*long*/ sel_shouldDelayWindowOrderingForEvent_ = sel_registerName("shouldDelayWindowOrderingForEvent:");
1625
public static final int /*long*/ sel_shouldDelayWindowOrderingForEvent_ = sel_registerName("shouldDelayWindowOrderingForEvent:");
1626
public static final int /*long*/ sel_size = sel_registerName("size");
1626
public static final int /*long*/ sel_size = sel_registerName("size");
1627
public static final int /*long*/ sel_setSizeMode_ = sel_registerName("setSizeMode:");
1628
public static final int /*long*/ sel_sizeMode = sel_registerName("sizeMode");
1627
public static final int /*long*/ sel_sizeToFit = sel_registerName("sizeToFit");
1629
public static final int /*long*/ sel_sizeToFit = sel_registerName("sizeToFit");
1628
public static final int /*long*/ sel_sizeValue = sel_registerName("sizeValue");
1630
public static final int /*long*/ sel_sizeValue = sel_registerName("sizeValue");
1629
public static final int /*long*/ sel_skipDescendents = sel_registerName("skipDescendents");
1631
public static final int /*long*/ sel_skipDescendents = sel_registerName("skipDescendents");
Lines 1735-1740 Link Here
1735
public static final int /*long*/ sel_userInfo = sel_registerName("userInfo");
1737
public static final int /*long*/ sel_userInfo = sel_registerName("userInfo");
1736
public static final int /*long*/ sel_usesAlternatingRowBackgroundColors = sel_registerName("usesAlternatingRowBackgroundColors");
1738
public static final int /*long*/ sel_usesAlternatingRowBackgroundColors = sel_registerName("usesAlternatingRowBackgroundColors");
1737
public static final int /*long*/ sel_validAttributesForMarkedText = sel_registerName("validAttributesForMarkedText");
1739
public static final int /*long*/ sel_validAttributesForMarkedText = sel_registerName("validAttributesForMarkedText");
1740
public static final int /*long*/ sel_validateToolbarItem_ = sel_registerName("validateToolbarItem:");
1738
public static final int /*long*/ sel_validateVisibleColumns = sel_registerName("validateVisibleColumns");
1741
public static final int /*long*/ sel_validateVisibleColumns = sel_registerName("validateVisibleColumns");
1739
public static final int /*long*/ sel_value = sel_registerName("value");
1742
public static final int /*long*/ sel_value = sel_registerName("value");
1740
public static final int /*long*/ sel_valueForKey_ = sel_registerName("valueForKey:");
1743
public static final int /*long*/ sel_valueForKey_ = sel_registerName("valueForKey:");

Return to bug 222859