Add support for form file picker
This commit is contained in:
parent
ccee813f4a
commit
75efd96645
|
@ -45,6 +45,7 @@ id preferencesWindowController;
|
|||
-(void)showBookmarksWindow: (id)sender;
|
||||
-(void)showPreferencesWindow: (id)sender;
|
||||
-(NSURL*)requestDownloadDestination;
|
||||
-(NSURL*)requestFileLocation;
|
||||
-(void)openWebsite: (Website*)aWebsite;
|
||||
-(void)openDeveloperFileAtPath: (NSString*)path;
|
||||
-(NSString*)currentUrl;
|
||||
|
|
|
@ -193,6 +193,16 @@ static NSMenuItem *menuItemForItem(id item) {
|
|||
}
|
||||
}
|
||||
|
||||
-(NSURL*)requestFileLocation {
|
||||
NSSavePanel *openPanel = [NSOpenPanel openPanel];
|
||||
[openPanel setDirectory: NSHomeDirectory()];
|
||||
if ([openPanel runModal] == NSOKButton) {
|
||||
return [openPanel URL];
|
||||
} else {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)openWebsite: (Website*)aWebsite {
|
||||
struct nsurl *url;
|
||||
nserror error;
|
||||
|
|
|
@ -50,6 +50,7 @@ struct form_control;
|
|||
-(id)initialTabId;
|
||||
|
||||
// Browser control
|
||||
-(struct browser_window *)browser;
|
||||
-(NSSize)getBrowserSizeForTab: (id)tab;
|
||||
-(NSPoint)getBrowserScrollForTab: (id)tab;
|
||||
-(void)setBrowserScroll: (NSPoint)scroll forTab: (id)tab;
|
||||
|
|
|
@ -183,6 +183,10 @@ static id newTabTarget;
|
|||
return [tabs objectAtIndex: 0];
|
||||
}
|
||||
|
||||
-(struct browser_window *)browser {
|
||||
return browser;
|
||||
}
|
||||
|
||||
-(void)back: (id)sender {
|
||||
NSLog(@"Browser backward");
|
||||
[plotView back: sender];
|
||||
|
|
|
@ -152,7 +152,7 @@ static void gnustep_window_create_form_select_menu(struct gui_window *gw, struct
|
|||
struct rect rect;
|
||||
struct window_tab *wtab = (struct window_tab*)gw;
|
||||
if (form_control_bounding_rect(control, &rect) != NSERROR_OK) {
|
||||
NSLog("Failed to get control bounding rect, skipping");
|
||||
NSLog(@"Failed to get control bounding rect, skipping");
|
||||
return;
|
||||
}
|
||||
NSMutableArray *options = [NSMutableArray array];
|
||||
|
@ -163,6 +163,15 @@ static void gnustep_window_create_form_select_menu(struct gui_window *gw, struct
|
|||
NSMakePoint(rect.x0, rect.y1) inTab: wtab->tab control: control];
|
||||
}
|
||||
|
||||
static void gnustep_window_file_gadget_open(struct gui_window *gw, struct hlcache_handle *hl, struct form_control *gadget) {
|
||||
AppDelegate *appDelegate = (AppDelegate*)[NSApp delegate];
|
||||
NSURL *location = [appDelegate requestFileLocation];
|
||||
if (location != nil) {
|
||||
struct window_tab *wtab = (struct window_tab*)gw;
|
||||
browser_window_set_gadget_filename([wtab->window browser], gadget, [[location absoluteString] cString]);
|
||||
}
|
||||
}
|
||||
|
||||
struct gui_window_table gnustep_window_table = {
|
||||
.create = gnustep_window_create,
|
||||
.destroy = gnustep_window_destroy,
|
||||
|
@ -176,4 +185,5 @@ struct gui_window_table gnustep_window_table = {
|
|||
.place_caret = gnustep_window_place_caret,
|
||||
.set_pointer = gnustep_window_set_pointer,
|
||||
.create_form_select_menu = gnustep_window_create_form_select_menu,
|
||||
.file_gadget_open = gnustep_window_file_gadget_open,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue