github.com/secoba/wails/v2@v2.6.4/internal/frontend/desktop/darwin/WailsContext.h (about) 1 // 2 // WailsContext.h 3 // test 4 // 5 // Created by Lea Anthony on 10/10/21. 6 // 7 8 #ifndef WailsContext_h 9 #define WailsContext_h 10 11 #import <Cocoa/Cocoa.h> 12 #import <WebKit/WebKit.h> 13 14 #if __has_include(<UniformTypeIdentifiers/UTType.h>) 15 #define USE_NEW_FILTERS 16 #import <UniformTypeIdentifiers/UTType.h> 17 #endif 18 19 #define ON_MAIN_THREAD(str) dispatch_async(dispatch_get_main_queue(), ^{ str; }); 20 #define unicode(input) [NSString stringWithFormat:@"%C", input] 21 22 @interface WailsWindow : NSWindow 23 24 @property NSSize userMinSize; 25 @property NSSize userMaxSize; 26 27 - (BOOL) canBecomeKeyWindow; 28 - (void) applyWindowConstraints; 29 - (void) disableWindowConstraints; 30 @end 31 32 @interface WailsContext : NSObject <WKURLSchemeHandler,WKScriptMessageHandler,WKNavigationDelegate,WKUIDelegate> 33 34 @property (retain) WailsWindow* mainWindow; 35 @property (retain) WKWebView* webview; 36 @property (nonatomic, assign) id appdelegate; 37 38 @property bool hideOnClose; 39 @property bool shuttingDown; 40 @property bool startHidden; 41 @property bool startFullscreen; 42 43 @property bool singleInstanceLockEnabled; 44 @property (retain) NSString* singleInstanceUniqueId; 45 46 @property (retain) NSEvent* mouseEvent; 47 48 @property bool alwaysOnTop; 49 50 @property bool devtoolsEnabled; 51 @property bool defaultContextMenuEnabled; 52 53 @property (retain) WKUserContentController* userContentController; 54 55 @property (retain) NSMenu* applicationMenu; 56 57 @property (retain) NSImage* aboutImage; 58 @property (retain) NSString* aboutTitle; 59 @property (retain) NSString* aboutDescription; 60 61 struct Preferences { 62 bool *tabFocusesLinks; 63 bool *textInteractionEnabled; 64 bool *fullscreenEnabled; 65 }; 66 67 - (void) CreateWindow:(int)width :(int)height :(bool)frameless :(bool)resizable :(bool)fullscreen :(bool)fullSizeContent :(bool)hideTitleBar :(bool)titlebarAppearsTransparent :(bool)hideTitle :(bool)useToolbar :(bool)hideToolbarSeparator :(bool)webviewIsTransparent :(bool)hideWindowOnClose :(NSString *)appearance :(bool)windowIsTranslucent :(int)minWidth :(int)minHeight :(int)maxWidth :(int)maxHeight :(bool)fraudulentWebsiteWarningEnabled :(struct Preferences)preferences; 68 - (void) SetSize:(int)width :(int)height; 69 - (void) SetPosition:(int)x :(int) y; 70 - (void) SetMinSize:(int)minWidth :(int)minHeight; 71 - (void) SetMaxSize:(int)maxWidth :(int)maxHeight; 72 - (void) SetTitle:(NSString*)title; 73 - (void) SetAlwaysOnTop:(int)onTop; 74 - (void) Center; 75 - (void) Fullscreen; 76 - (void) UnFullscreen; 77 - (bool) IsFullScreen; 78 - (void) Minimise; 79 - (void) UnMinimise; 80 - (bool) IsMinimised; 81 - (void) Maximise; 82 - (void) ToggleMaximise; 83 - (void) UnMaximise; 84 - (bool) IsMaximised; 85 - (void) SetBackgroundColour:(int)r :(int)g :(int)b :(int)a; 86 - (void) HideMouse; 87 - (void) ShowMouse; 88 - (void) Hide; 89 - (void) Show; 90 - (void) HideApplication; 91 - (void) ShowApplication; 92 - (void) Quit; 93 94 -(void) MessageDialog :(NSString*)dialogType :(NSString*)title :(NSString*)message :(NSString*)button1 :(NSString*)button2 :(NSString*)button3 :(NSString*)button4 :(NSString*)defaultButton :(NSString*)cancelButton :(void*)iconData :(int)iconDataLength; 95 - (void) OpenFileDialog :(NSString*)title :(NSString*)defaultFilename :(NSString*)defaultDirectory :(bool)allowDirectories :(bool)allowFiles :(bool)canCreateDirectories :(bool)treatPackagesAsDirectories :(bool)resolveAliases :(bool)showHiddenFiles :(bool)allowMultipleSelection :(NSString*)filters; 96 - (void) SaveFileDialog :(NSString*)title :(NSString*)defaultFilename :(NSString*)defaultDirectory :(bool)canCreateDirectories :(bool)treatPackagesAsDirectories :(bool)showHiddenFiles :(NSString*)filters; 97 98 - (void) loadRequest:(NSString*)url; 99 - (void) ExecJS:(NSString*)script; 100 - (NSScreen*) getCurrentScreen; 101 102 - (void) SetAbout :(NSString*)title :(NSString*)description :(void*)imagedata :(int)datalen; 103 - (void) dealloc; 104 105 @end 106 107 108 #endif /* WailsContext_h */