--- hatari/src/gui-osx/Shared.h 2019/04/09 08:51:02 1.1.1.5 +++ hatari/src/gui-osx/Shared.h 2019/04/09 08:55:21 1.1.1.8 @@ -1,14 +1,29 @@ /* Hatari - Shared.h - This file is distributed under the GNU Public License, version 2 or at - your option any later version. Read the file gpl.txt for details. + This file is distributed under the GNU General Public License, version 2 + or at your option any later version. Read the file gpl.txt for details. + M. SARO 2013 */ #import +// add some macro for easy writing + +#define localize(laklef) [[NSBundle mainBundle] localizedStringForKey:laklef value:(laklef != nil ? laklef : @"???") table:@"Localizable"] + +// disk extensions alowed in open box +#define allF @"st",@"msa",@"dim",@"gz",@"zip",@"stx",@"ipf",@"raw",@"ctr" +// cartdridge extensions +#define allC @"img",@"rom",@"bin",@"cart" +// TOS extensions +#define allT @"img",@"rom",@"bin" + + + // Wrapper to run an NSWindow modally @protocol NSWindowDelegate; + @interface ModalWrapper : NSWindowController { IBOutlet NSWindow *modalWindow; @@ -25,3 +40,28 @@ void GuiOsx_Pause(void); // Switches back to emulation mode and resume emulation void GuiOsx_Resume(void); + + +// Add method for general Usage +// +@interface NSApplication (service) + +// Some usefull tools +// choose file to open +- (NSString *)hopenfile:(BOOL)chooseDir defoDir:(NSString *)defoDir defoFile:(NSString *)defoFile types:(NSArray *)types ; +- (NSString *)hopenfile:(BOOL)chooseDir defoDir:(NSString *)defoDir defoFile:(NSString *)defoFile types:(NSArray *)types titre:(NSString *)titre ; + +// choose file to save +- (NSString *)hsavefile:(BOOL)creatDir defoDir:(NSString *)defoDir defoFile:(NSString *)defoFile types:(NSArray *)types ; +- (NSString *)hsavefile:(BOOL)creatDir defoDir:(NSString *)defoDir defoFile:(NSString *)defoFile types:(NSArray *)types titre:(NSString *)titre ; + +// Return localized path, Full path or partial path. +- (NSString *)localpath:(NSString *)thepath ; // Full +- (NSString *)pathUser:(NSString *)thepath ; // Partial if possible. + +// Alert available 10.4 to 10.9 (styles: NSWarningAlertStyle, NSInformationalAlertStyle, NSCriticalAlertStyle) +// return: NSAlertDefaultReturn, NSAlertAlternateReturn, and NSAlertOtherReturn. +- (NSInteger)myAlerte:(NSUInteger)style Txt:(NSString *)Txt firstB:(NSString *)firstB alternateB:(NSString *)alternateB + otherB:(NSString *)otherB informativeTxt:(NSString *)informativeT ; + +@end