From aafae7d843cb4cb70caf3847b532e2962c19b5dd Mon Sep 17 00:00:00 2001 From: Zhigang Fang Date: Tue, 24 Oct 2017 12:20:31 +0800 Subject: [PATCH] Make it float --- FloatingToggl.xcodeproj/project.pbxproj | 4 ++++ .../xcdebugger/Breakpoints_v2.xcbkptlist | 5 ++++ FloatingToggl/Base.lproj/Main.storyboard | 21 +++++++++-------- FloatingToggl/FloatingPannel.swift | 23 +++++++++++++++++++ 4 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 FloatingToggl.xcodeproj/xcuserdata/kylefang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist create mode 100644 FloatingToggl/FloatingPannel.swift diff --git a/FloatingToggl.xcodeproj/project.pbxproj b/FloatingToggl.xcodeproj/project.pbxproj index 0bc6a30..85e92c8 100644 --- a/FloatingToggl.xcodeproj/project.pbxproj +++ b/FloatingToggl.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 041E2BAE1F9EF0370036687C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041E2BAD1F9EF0370036687C /* ViewController.swift */; }; 041E2BB01F9EF0370036687C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 041E2BAF1F9EF0370036687C /* Assets.xcassets */; }; 041E2BB31F9EF0370036687C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 041E2BB11F9EF0370036687C /* Main.storyboard */; }; + 041E2BBC1F9EF3450036687C /* FloatingPannel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041E2BBB1F9EF3450036687C /* FloatingPannel.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -21,6 +22,7 @@ 041E2BB21F9EF0370036687C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 041E2BB41F9EF0370036687C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 041E2BB51F9EF0370036687C /* FloatingToggl.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = FloatingToggl.entitlements; sourceTree = ""; }; + 041E2BBB1F9EF3450036687C /* FloatingPannel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FloatingPannel.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -55,6 +57,7 @@ children = ( 041E2BAB1F9EF0370036687C /* AppDelegate.swift */, 041E2BAD1F9EF0370036687C /* ViewController.swift */, + 041E2BBB1F9EF3450036687C /* FloatingPannel.swift */, 041E2BAF1F9EF0370036687C /* Assets.xcassets */, 041E2BB11F9EF0370036687C /* Main.storyboard */, 041E2BB41F9EF0370036687C /* Info.plist */, @@ -135,6 +138,7 @@ buildActionMask = 2147483647; files = ( 041E2BAE1F9EF0370036687C /* ViewController.swift in Sources */, + 041E2BBC1F9EF3450036687C /* FloatingPannel.swift in Sources */, 041E2BAC1F9EF0370036687C /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/FloatingToggl.xcodeproj/xcuserdata/kylefang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/FloatingToggl.xcodeproj/xcuserdata/kylefang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/FloatingToggl.xcodeproj/xcuserdata/kylefang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/FloatingToggl/Base.lproj/Main.storyboard b/FloatingToggl/Base.lproj/Main.storyboard index 46f7afd..c15a262 100644 --- a/FloatingToggl/Base.lproj/Main.storyboard +++ b/FloatingToggl/Base.lproj/Main.storyboard @@ -1,7 +1,9 @@ - - + + - + + + @@ -673,7 +675,7 @@ - + @@ -682,13 +684,14 @@ - - - + + + + - + @@ -703,7 +706,7 @@ - + diff --git a/FloatingToggl/FloatingPannel.swift b/FloatingToggl/FloatingPannel.swift new file mode 100644 index 0000000..54976f9 --- /dev/null +++ b/FloatingToggl/FloatingPannel.swift @@ -0,0 +1,23 @@ +// +// FloatingPannel.swift +// FloatingToggl +// +// Created by Zhigang Fang on 10/24/17. +// Copyright © 2017 matrix. All rights reserved. +// + +import Cocoa + +class FloatingPannel: NSWindowController { + + override func windowDidLoad() { + super.windowDidLoad() + + if let panel = self.window as? NSPanel { + panel.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary] + panel.isFloatingPanel = true + } + + } + +}