public void init( Shell shell ) throws Throwable{ Callback callback = TGCocoa.newCallback( this , "callbackProc64", "callbackProc32", 3 ); long callbackProc = TGCocoa.getCallbackAddress( callback ); if( callbackProc != 0 ){ String classname = ("MacToolbarDelegate"); if( TGCocoa.objc_lookUpClass ( classname ) == 0 ) { long cls = TGCocoa.objc_allocateClassPair( classname , 0 ) ; TGCocoa.class_addIvar(cls, SWT_OBJECT, C.PTR_SIZEOF , (byte)(C.PTR_SIZEOF == 4 ? 2 : 3), new byte[]{'*','\0'} ); TGCocoa.class_addMethod(cls, sel_toolbarButtonClicked_, callbackProc , "@:@"); TGCocoa.objc_registerClassPair(cls); } this.delegate = TGCocoa.newMacToolbarDelegate(); this.delegate.alloc().init(); this.delegateRef = TGCocoa.NewGlobalRef( MacToolbar.this ); TGCocoa.object_setInstanceVariable( MacToolbarDelegate.class.getField("id").get( delegate ) , SWT_OBJECT , this.delegateRef ); NSToolbar dummyBar = new NSToolbar(); dummyBar.alloc(); dummyBar.initWithIdentifier(NSString.stringWith("SWTToolbar")); //$NON-NLS-1$ dummyBar.setVisible(false); NSWindow nsWindow = shell.view.window(); nsWindow.setToolbar(dummyBar); dummyBar.release(); nsWindow.setShowsToolbarButton(true); NSButton toolbarButton = TGCocoa.getStandardWindowButton(nsWindow, NSWindowToolbarButton); if (toolbarButton != null) { toolbarButton.setTarget( delegate ); TGCocoa.setControlAction( toolbarButton , sel_toolbarButtonClicked_ ); } } }
public static final NSButton getStandardWindowButton(NSWindow nsWindow, long index) throws Throwable{ return (NSButton)invokeMethod(NSWindow.class, nsWindow, "standardWindowButton", new Object[] { osType(index) }); }
private void setFrameState(boolean modified) { Shell shell = TuxGuitar.getInstance().getShell(); NSWindow nsWindow = shell.view.window(); nsWindow.setDocumentEdited(modified); }
private void setFrameState(boolean modified) { Shell shell = TuxGuitar.instance().getShell(); NSWindow nsWindow = shell.view.window(); nsWindow.setDocumentEdited(modified); }