From 9c27649627da21c0fd656bcbd584f21b934a6a1a Mon Sep 17 00:00:00 2001 From: Richard Wilkes Date: Fri, 31 Dec 2021 20:27:54 -0800 Subject: [PATCH] Remove old, unused code --- internal/ns/application_darwin.go | 19 ------------------- internal/ns/menu_item_darwin.go | 3 --- internal/ns/url_darwin.go | 7 ------- internal/ns/window_darwin.go | 7 ------- open_dialog_darwin.go | 2 +- save_dialog_darwin.go | 2 +- 6 files changed, 2 insertions(+), 38 deletions(-) diff --git a/internal/ns/application_darwin.go b/internal/ns/application_darwin.go index e4f7f7c..78e0e5d 100644 --- a/internal/ns/application_darwin.go +++ b/internal/ns/application_darwin.go @@ -23,15 +23,6 @@ const ( ActivationPolicyProhibited ) -// https://developer.apple.com/documentation/appkit/nsmodalresponse -const ( - ModalResponseCancel = 0 - ModalResponseOK = 1 - ModalResponseStop = -1000 - ModalResponseAbort = -1001 - ModalResponseContinue = -1002 -) - var applicationClass = objc.Get("NSApplication") // Application https://developer.apple.com/documentation/appkit/nsapplication?language=objc @@ -88,13 +79,3 @@ func (a Application) SetWindowsMenu(menu Menu) { func (a Application) SetHelpMenu(menu Menu) { a.Send("setHelpMenu:", menu) } - -// KeyWindow https://developer.apple.com/documentation/appkit/nsapplication/1428406-keywindow?language=objc -func (a Application) KeyWindow() Window { - return Window{Object: a.Send("keyWindow")} -} - -// MainWindow https://developer.apple.com/documentation/appkit/nsapplication/1428723-mainwindow?language=objc -func (a Application) MainWindow() Window { - return Window{Object: a.Send("mainWindow")} -} diff --git a/internal/ns/menu_item_darwin.go b/internal/ns/menu_item_darwin.go index 59896d2..167eb76 100644 --- a/internal/ns/menu_item_darwin.go +++ b/internal/ns/menu_item_darwin.go @@ -23,9 +23,6 @@ const ( EventModifierFlagControl EventModifierFlagOption EventModifierFlagCommand - EventModifierFlagNumericPad - EventModifierFlagHelp - EventModifierFlagFunction ) // ControlStateValue https://developer.apple.com/documentation/appkit/nscontrolstatevalue?language=objc diff --git a/internal/ns/url_darwin.go b/internal/ns/url_darwin.go index 0a92841..4ef4cf8 100644 --- a/internal/ns/url_darwin.go +++ b/internal/ns/url_darwin.go @@ -18,13 +18,6 @@ type URL struct { objc.Object } -// NewURL https://developer.apple.com/documentation/foundation/nsurl/1572047-urlwithstring?language=objc -func NewURL(str string) URL { - s := StringFromString(str) - defer s.Release() - return URL{Object: urlClass.Send("URLWithString:", s)} -} - // NewFileURL https://developer.apple.com/documentation/foundation/nsurl/1414650-fileurlwithpath?language=objc func NewFileURL(str string) URL { s := StringFromString(str) diff --git a/internal/ns/window_darwin.go b/internal/ns/window_darwin.go index 2b8d532..4f1a9b1 100644 --- a/internal/ns/window_darwin.go +++ b/internal/ns/window_darwin.go @@ -20,10 +20,3 @@ type Window struct { func (w Window) ContentView() View { return View{Object: w.Send("contentView")} } - -// Frame https://developer.apple.com/documentation/appkit/nswindow/1419697-frame?language=objc -func (w Window) Frame() Rect { - var frame Rect - w.Send("frame", &frame) - return frame -} diff --git a/open_dialog_darwin.go b/open_dialog_darwin.go index a7afb4e..b9fdb99 100644 --- a/open_dialog_darwin.go +++ b/open_dialog_darwin.go @@ -105,5 +105,5 @@ func (d *macOpenDialog) RunModal() bool { if active != nil && active.IsVisible() { active.ToFront() } - return result == ns.ModalResponseOK + return result == 1 } diff --git a/save_dialog_darwin.go b/save_dialog_darwin.go index 6db6718..bda7d78 100644 --- a/save_dialog_darwin.go +++ b/save_dialog_darwin.go @@ -70,5 +70,5 @@ func (d *macSaveDialog) RunModal() bool { if active != nil && active.IsVisible() { active.ToFront() } - return result == ns.ModalResponseOK + return result == 1 }