Re: NSApplicationMain question
Re: NSApplicationMain question
- Subject: Re: NSApplicationMain question
- From: Bill Appleton <email@hidden>
- Date: Sun, 25 Apr 2010 06:44:58 -0700
hi all,
i wanted to do a reality check on some of my code & ask some specific
questions.
1) how do i get that nifty application/preferences/services menu? i create
my menus dynamically (not nibs)
2) i need to create a raw NSScroller and control it like a NSSlider (min,
max, value, proportion) is that possible?
3) are there window styles for palettes / document windows? there seems to
be only one style...
4) how do you guys check for memory leaks in the cocoa objects? when i
delete a menu... do i have to delete the individual items?
5) is my screen flipping code below going to work on multiple monitors?
thanks,
bill
void deletewindow(NSWindow *thewind)
{
[thewind setReleasedWhenClosed:YES];
[thewind close];
}
NSWindow *createwindow(rect *therect, long thestyle)
{
NSWindow *thewind;
NSRect myrect, newrect;
myrect = [[NSScreen mainScreen] frame];
newrect.origin.x = (*therect).left;
newrect.origin.y = myrect.size.height - (*therect).bottom;
newrect.size.width = (*therect).right - (*therect).left;
newrect.size.height = (*therect).bottom - (*therect).top;
thewind = [[NSWindow alloc] initWithContentRect:newrect
styleMask:thestyle backing:NSBackingStoreBuffered defer:YES];
return(thewind);
}
NSMenu *newmenu(unsigned char *menuname)
{
NSMenu *themenu;
NSString *mystring;
char tempstring[256];
pstr2cstr(menuname, tempstring);
mystring = [NSString stringWithUTF8String:tempstring];
themenu = [[NSMenu alloc] initWithTitle:mystring];
[themenu setAutoenablesItems:NO];
[mystring release];
return(themenu);
}
void deletemenu(NSMenu *themenu)
{
[themenu release];
}
void setmenuitemtext(NSMenu *themenu, long itemindex, unsigned char
*itemname)
{
NSString *mystring;
NSMenuItem *theitem;
char tempstring[256];
itemindex --;
pstr2cstr(itemname, tempstring);
mystring = [NSString stringWithUTF8String:tempstring];
theitem = [themenu itemAtIndex:itemindex];
[theitem setTitle:mystring];
[mystring release];
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden