Mac OS: allow internationalization of file dialogs (continued).

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8784 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2011-06-06 12:11:04 +00:00
parent c53313ac6e
commit 9223527992

View File

@ -465,9 +465,9 @@ static NSPopUpButton *createPopupAccessory(NSSavePanel *panel, const char *filte
NSPopUpButton *popup;
NSRect rectview = NSMakeRect(5, 5, 350, 30 );
NSView *view = [[[NSView alloc] initWithFrame:rectview] autorelease];
NSRect rectbox = NSMakeRect(0, 3, 50, 1 );
NSRect rectbox = NSMakeRect(0, 3, 140, 20 );
NSBox *box = [[[NSBox alloc] initWithFrame:rectbox] autorelease];
NSRect rectpop = NSMakeRect(60, 0, 250, 30 );
NSRect rectpop = NSMakeRect(105, 0, 246, 30 );
popup = [[[NSPopUpButton alloc ] initWithFrame:rectpop pullsDown:NO] autorelease];
[view addSubview:box];
[view addSubview:popup];
@ -478,9 +478,14 @@ static NSPopUpButton *createPopupAccessory(NSSavePanel *panel, const char *filte
NSFont *font = [NSFont controlContentFontOfSize:NSRegularControlSize];
[box setTitleFont:font];
[box sizeToFit];
// horizontally move box to fit the locale-dependent width of its title
NSRect r=[box frame];
NSPoint o = r.origin;
o.x = rectpop.origin.x - r.size.width + 15;
[box setFrameOrigin:o];
CFStringRef tab = CFSTR("\n");
CFStringRef tmp_cfs;
tmp_cfs = CFStringCreateWithCString(NULL, filter, kCFStringEncodingASCII);
tmp_cfs = CFStringCreateWithCString(NULL, filter, kCFStringEncodingUTF8);
CFArrayRef array = CFStringCreateArrayBySeparatingStrings(NULL, tmp_cfs, tab);
CFRelease(tmp_cfs);
CFRelease(tab);