Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 180977 Details for
Bug 222859
Support native Mac toolbar
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
getTrimBar patch
222859-getTrimBar.txt (text/plain), 5.65 KB, created by
Scott Kovatch
on 2010-10-15 11:51:49 EDT
(
hide
)
Description:
getTrimBar patch
Filename:
MIME Type:
Creator:
Scott Kovatch
Created:
2010-10-15 11:51:49 EDT
Size:
5.65 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java,v >retrieving revision 1.179 >diff -u -r1.179 Shell.java >--- Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java 13 Oct 2010 22:27:18 -0000 1.179 >+++ Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java 15 Oct 2010 15:51:21 -0000 >@@ -126,6 +126,13 @@ > NSRect fullScreenFrame; > ToolBar toolBar; > >+ /* Trim bar */ >+ NSToolbarItem trimBarItem; >+ NSToolbar trimBarToolbar; >+ NSView trimBarView; >+ NSString trimBarID; >+ Composite trimArea; >+ > static int DEFAULT_CLIENT_WIDTH = -1; > static int DEFAULT_CLIENT_HEIGHT = -1; > >@@ -715,6 +722,8 @@ > } else { > display.removeWidget (view.window()); > } >+ if (trimBarView != null) display.removeWidget(trimBarView); >+ if (trimBarToolbar != null) display.removeWidget (trimBarToolbar); > if (windowDelegate != null) display.removeWidget (windowDelegate); > } > >@@ -1137,10 +1146,66 @@ > */ > public ToolBar getToolBar() { > checkWidget(); >+ // FIXME: Is this the right thing to do? >+ if (trimArea != null) return null; > if (toolBar == null) toolBar = new ToolBar(this, SWT.HORIZONTAL | SWT.SMOOTH, true); > return toolBar; > } > >+public Composite getTrimBar() { >+ checkWidget(); >+ if (toolBar != null) return toolBar; >+ if (trimArea != null) return trimArea; >+ >+ // Composite must have clear background or the window content color will show through. >+ trimArea = new Composite(this, SWT.NO_BACKGROUND); >+ >+ // Create an NSToolbar and NSToolbarItem that will hold the Composite's view. >+ trimBarToolbar = ((NSToolbar)new SWTToolbar().alloc()).initWithIdentifier(NSString.stringWith(String.valueOf(ToolBar.NEXT_ID++))); >+ trimBarToolbar.setDelegate(trimBarToolbar); >+ >+ // Track the widget right away, as many of these calls use the delegate methods. >+ display.addWidget (trimBarToolbar, this); >+ trimBarToolbar.setDisplayMode(OS.NSToolbarDisplayModeIconOnly); >+ trimBarToolbar.setVisible(true); >+ trimBarID = NSString.stringWith(String.valueOf(ToolBar.NEXT_ID++)); >+ trimBarID.retain(); >+ trimBarItem = ((NSToolbarItem)new NSToolbarItem().alloc()).initWithItemIdentifier(trimBarID); >+ trimBarToolbar.insertItemWithItemIdentifier(trimBarID, 0); >+ >+ // setView moves the Composite's view to the toolbar. >+ trimBarItem.setView(trimArea.topView()); >+ window.setToolbar(trimBarToolbar); >+ >+ // Need to change the toolbar view to an SWTToolbarView so mouseDownCanMoveWindow can be overridden. >+ NSArray views = window.contentView().superview().subviews(); >+ for (int i = 0; i < views.count(); i++) { >+ NSView view = new NSView(views.objectAtIndex(i).id); >+ if (view.className().getString().equals("NSToolbarView")) { >+ trimBarView = view; >+ trimBarView.retain(); >+ OS.object_setClass(trimBarView.id, OS.objc_getClass("SWTToolbarView")); >+ display.addWidget(trimBarView, this); >+ break; >+ } >+ } >+ >+ // Keep the min/max size of the item in sync with the size of the Composite. >+ trimArea.addControlListener(new ControlAdapter() { >+ public void controlResized(ControlEvent e) { >+ NSSize newSize = new NSSize(); >+ newSize.width = trimArea.getSize().x; >+ newSize.height = trimArea.getSize().y; >+ trimBarItem.setView(null); >+ trimBarItem.setMaxSize(newSize); >+ trimBarItem.setMinSize(newSize); >+ trimBarItem.setView(trimArea.topView()); >+ } >+ }); >+ >+ return trimArea; >+} >+ > boolean hasBorder () { > return false; > } >@@ -1231,6 +1296,13 @@ > return new Point (width, height); > } > >+boolean mouseDownCanMoveWindow(int /*long*/ id, int /*long*/ sel) { >+ if (id == trimArea.topView().id) { >+ return false; >+ } >+ return super.mouseDownCanMoveWindow(id, sel); >+} >+ > void mouseMoved(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { > super.mouseMoved(id, sel, theEvent); > >@@ -1340,6 +1412,20 @@ > NSNotificationCenter.defaultCenter().removeObserver(windowDelegate); > if (windowDelegate != null) windowDelegate.release(); > windowDelegate = null; >+ >+ if (trimBarToolbar != null) { >+ trimBarToolbar.removeItemAtIndex(0); >+ trimBarItem.release(); >+ trimBarItem = null; >+ window.setToolbar(null); >+ trimBarView.release(); >+ trimBarView = null; >+ trimBarToolbar.release(); >+ trimBarToolbar = null; >+ trimBarID.release(); >+ trimBarID = null; >+ } >+ > super.releaseHandle (); > window = null; > } >@@ -1942,6 +2028,35 @@ > } > } > >+int /*long*/ toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar, int /*long*/ itemIdentifier, boolean flag) { >+ return trimBarItem.id; >+} >+ >+/* >+ * Returns an array of all toolbar item IDs allowed to be in the toolbar. Since the ToolBar created all of the ToolItems >+ * return all of the item IDs. >+ */ >+int /*long*/ toolbarAllowedItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) { >+ NSMutableArray array = NSMutableArray.arrayWithCapacity(1); >+ array.addObject(trimBarItem.itemIdentifier()); >+ return array.id; >+} >+ >+/* >+ * This delegate method isn't really needed because ToolBars aren't customizable, but it's required according to the documentation. >+ */ >+int /*long*/ toolbarDefaultItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) { >+ return toolbarAllowedItemIdentifiers(id, sel, toolbar); >+} >+ >+/* >+ * toolbarSelectableItemIdentifiers returns an array of all items that can be the selected item, as determined >+ * by setSelectedItemIdentifier. >+ */ >+int /*long*/ toolbarSelectableItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) { >+ return 0; >+} >+ > boolean traverseEscape () { > if (parent == null) return false; > if (!isVisible () || !isEnabled ()) return false;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 222859
:
97896
|
99000
|
99485
|
99492
|
99494
|
100753
|
129651
|
129697
|
129893
|
129894
|
129909
|
129973
|
130031
|
130057
|
147838
|
170610
|
170611
|
180221
|
180379
|
180532
| 180977 |
189297
|
189299