--- hatari/src/gui-osx/Shared.h 2019/04/01 07:13:04 1.1 +++ hatari/src/gui-osx/Shared.h 2019/04/09 08:56:37 1.1.1.9 @@ -1,14 +1,30 @@ /* - Hatari - CreateFloppyController.m + 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 allowed in open box +#define allF @"st",@"msa",@"dim",@"gz",@"zip",@"stx",@"ipf",@"raw",@"ctr" +// cartridge extensions +#define allC @"img",@"rom",@"bin",@"cart" +// TOS extensions +#define allT @"img",@"rom",@"bin" + + + // Wrapper to run an NSWindow modally -@interface ModalWrapper : NSObject +@protocol NSWindowDelegate; + +@interface ModalWrapper : NSWindowController { IBOutlet NSWindow *modalWindow; } @@ -20,7 +36,32 @@ void GuiOsx_ExportPathString(NSString* path, char* szTarget, size_t cchTarget); // Pauses emulation and gets ready to use Cocoa UI -void GuiOsx_PauseAndSwitchToCocoaUI(); +void GuiOsx_Pause(bool); // Switches back to emulation mode and resume emulation -void GuiOsx_ResumeFromCocoaUI(); \ No newline at end of file +void GuiOsx_Resume(void); + + +// Add method for general Usage +// +@interface NSApplication (service) + +// Some useful 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