Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » Mac OS » Mac OS X port architecture
Re: best way to draw text/fonts on MacOS from C/C++ [message #33682 is a reply to message #33354] Mon, 05 September 2011 14:35 Go to previous message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
mirek wrote on Wed, 27 July 2011 09:15

daveremba wrote on Wed, 27 July 2011 02:12

Here is the minimal app from the Xcode template
for a Cocoa MacOS application:
// this code creates a top level window, and draws whatever is in the nib file
// if there is no nib file, the app will draw nothing and no top window appears
// Xcode template puts this code into three files, but they can be merged into one .m file:

#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
    return NSApplicationMain(argc,  (const char **) argv);
}

@interface cocoa_test2AppDelegate : NSObject <NSApplicationDelegate> {
    NSWindow *window;
}
@property (assign) IBOutlet NSWindow *window;
@end

@implementation cocoa_test2AppDelegate
@synthesize window;
// The @synthesize directive automatically generates the setters and getters 
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
	// Insert code here to initialize your application 
}
@end

and this file must exist:
  cocoa_test2_bundle.app/Contents/Resources/English.lproj/MainMenu.nib




Could we do without nib eventually?


Yes. As I said in this post http://www.ultimatepp.org/forum/index.php?t=msg&goto=304 21&&srch=nib#msg_30421
Quote:

upp mac apps without nib files will be better than Qt's


Have you had a look inside http://code.google.com/p/upp-mac/
?
Quote:

Yes, but maybe 2000 lines of code is needed:
(comparing to FLTK)

1 line actually made the difference:

	
	[application setDelegate:appDelegate]; //create menus in appDelegate
//[application setDelegate:nil]; //to test or if can find another way to apple mac style menus
//!!!	return NSApplicationMain(argc,  (const char **) argv); //don't use this if you want nibless


P.S I am back from my kind of holiday again.

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: TheIDE/max x11 binary by daveremba
Next Topic: fix TheIde [DOWNLOAD] build flag options in GccBuilder for OSX11 and Cocoa
Goto Forum:
  


Current Time: Thu May 09 11:48:25 CEST 2024

Total time taken to generate the page: 0.04411 seconds