mirror of
https://github.com/zhigang1992/InTime.git
synced 2026-03-27 00:54:16 +08:00
Add style
This commit is contained in:
6
FloatingToggl/Assets.xcassets/Contents.json
Normal file
6
FloatingToggl/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
12
FloatingToggl/Assets.xcassets/Start.imageset/Contents.json
vendored
Normal file
12
FloatingToggl/Assets.xcassets/Start.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "Start.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
FloatingToggl/Assets.xcassets/Start.imageset/Start.pdf
vendored
Normal file
BIN
FloatingToggl/Assets.xcassets/Start.imageset/Start.pdf
vendored
Normal file
Binary file not shown.
12
FloatingToggl/Assets.xcassets/Stop.imageset/Contents.json
vendored
Normal file
12
FloatingToggl/Assets.xcassets/Stop.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "Stop.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
FloatingToggl/Assets.xcassets/Stop.imageset/Stop.pdf
vendored
Normal file
BIN
FloatingToggl/Assets.xcassets/Stop.imageset/Stop.pdf
vendored
Normal file
Binary file not shown.
@@ -3,7 +3,9 @@
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13196"/>
|
||||
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
<capability name="stacking Non-gravity area distributions on NSStackView" minToolsVersion="7.0" minSystemVersion="10.11"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Application-->
|
||||
@@ -686,10 +688,10 @@
|
||||
<objects>
|
||||
<windowController showSeguePresentationStyle="single" id="B8D-0N-5wS" customClass="FloatingPannel" customModule="FloatingToggl" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA" customClass="NSPanel">
|
||||
<windowStyleMask key="styleMask" resizable="YES" utility="YES" nonactivatingPanel="YES" HUD="YES"/>
|
||||
<windowStyleMask key="styleMask" titled="YES" resizable="YES" utility="YES" nonactivatingPanel="YES" HUD="YES" fullSizeContentView="YES"/>
|
||||
<windowCollectionBehavior key="collectionBehavior" moveToActiveSpace="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
|
||||
<rect key="contentRect" x="585" y="830" width="480" height="100"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
|
||||
@@ -708,13 +710,81 @@
|
||||
<objects>
|
||||
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="FloatingToggl" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="558" height="60"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<stackView distribution="fill" orientation="horizontal" alignment="centerY" spacing="0.0" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="wu7-dI-dhr">
|
||||
<rect key="frame" x="20" y="0.0" width="538" height="60"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="247" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="BPy-6c-wmT">
|
||||
<rect key="frame" x="-2" y="20.5" width="438" height="19"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="200" id="Tug-Tb-Szc"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" placeholderString="What are you working on?" usesSingleLineMode="YES" id="Yb4-dr-ehw">
|
||||
<font key="font" metaFont="system" size="15"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="XfG-lQ-9wD" id="kfr-UL-Oef"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TdA-qV-FLw">
|
||||
<rect key="frame" x="432" y="20.5" width="53" height="19"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="1:17:28" id="7aI-t8-bK1">
|
||||
<font key="font" metaFont="system" size="15"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="kag-yT-y1V">
|
||||
<rect key="frame" x="483" y="2.5" width="55" height="55"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="55" id="Gyb-XX-9Vm"/>
|
||||
<constraint firstAttribute="width" secondItem="kag-yT-y1V" secondAttribute="height" id="Xf4-F1-gUv"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="Start" imagePosition="overlaps" alignment="center" alternateImage="Stop" inset="2" id="LaA-Fa-c8O">
|
||||
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="60" id="EYP-Pw-r0d"/>
|
||||
</constraints>
|
||||
<visibilityPriorities>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
</visibilityPriorities>
|
||||
<customSpacing>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
</customSpacing>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="wu7-dI-dhr" firstAttribute="leading" secondItem="m2S-Jp-Qdl" secondAttribute="leading" constant="20" id="0Bk-A0-XKV"/>
|
||||
<constraint firstAttribute="trailing" secondItem="wu7-dI-dhr" secondAttribute="trailing" id="LPI-zO-QJY"/>
|
||||
<constraint firstAttribute="bottom" secondItem="wu7-dI-dhr" secondAttribute="bottom" id="PMU-dI-y8Q"/>
|
||||
<constraint firstItem="wu7-dI-dhr" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" id="fcA-No-1Cl"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="actionButton" destination="kag-yT-y1V" id="U2W-2O-Tg6"/>
|
||||
<outlet property="inputLabel" destination="Yb4-dr-ehw" id="xsw-IJ-Oqo"/>
|
||||
<outlet property="timerLabel" destination="TdA-qV-FLw" id="GbL-H7-Wyb"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="75" y="655"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="Start" width="30" height="40"/>
|
||||
<image name="Stop" width="40" height="40"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -12,12 +12,13 @@ class FloatingPannel: NSWindowController {
|
||||
|
||||
override func windowDidLoad() {
|
||||
super.windowDidLoad()
|
||||
|
||||
if let panel = self.window as? NSPanel {
|
||||
panel.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
|
||||
panel.isFloatingPanel = true
|
||||
guard let panel = self.window as? NSPanel else {
|
||||
fatalError("Not loading")
|
||||
}
|
||||
|
||||
panel.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
|
||||
panel.isFloatingPanel = true
|
||||
panel.titleVisibility = .hidden
|
||||
panel.titlebarAppearsTransparent = true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,14 +6,22 @@
|
||||
// Copyright © 2017 matrix. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Cocoa
|
||||
|
||||
class ViewController: NSViewController {
|
||||
|
||||
@IBOutlet weak var inputLabel: NSTextFieldCell!
|
||||
|
||||
@IBOutlet weak var timerLabel: NSTextField!
|
||||
|
||||
@IBOutlet weak var actionButton: NSButton!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// Do any additional setup after loading the view.
|
||||
self.timerLabel.isHidden = true
|
||||
self.actionButton.isHidden = true
|
||||
setupUI()
|
||||
}
|
||||
|
||||
override var representedObject: Any? {
|
||||
@@ -25,3 +33,30 @@ class ViewController: NSViewController {
|
||||
|
||||
}
|
||||
|
||||
extension ViewController: NSTextFieldDelegate {
|
||||
|
||||
func control(_ control: NSControl, textView: NSTextView, completions words: [String], forPartialWordRange charRange: NSRange, indexOfSelectedItem index: UnsafeMutablePointer<Int>) -> [String] {
|
||||
return words
|
||||
}
|
||||
|
||||
// override func controlTextDidChange(_ obj: Notification) {
|
||||
// guard let fieldEditor = obj.userInfo?["NSFieldEditor"] as? NSTextView else { return }
|
||||
//// fieldEditor.complete(nil)
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
private extension ViewController {
|
||||
|
||||
func setupUI() {
|
||||
inputLabel.focusRingType = .none
|
||||
inputLabel.placeholderAttributedString = NSAttributedString(
|
||||
string: inputLabel.placeholderString ?? "",
|
||||
attributes: [
|
||||
.foregroundColor: NSColor(white: 1, alpha: 0.4),
|
||||
.font: NSFont.systemFont(ofSize: 15)
|
||||
])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user