Skip to content

Commit 5a0de14

Browse files
committed
remove table header top border
1 parent 1e889c8 commit 5a0de14

7 files changed

Lines changed: 86 additions & 11 deletions

File tree

mac/Base.lproj/Main.storyboard

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@
914914
<rect key="frame" x="224" y="17" width="15" height="102"/>
915915
<autoresizingMask key="autoresizingMask"/>
916916
</scroller>
917-
<tableHeaderView key="headerView" id="G9a-lN-ghx">
917+
<tableHeaderView key="headerView" id="G9a-lN-ghx" customClass="TableHeaderView" customModule="node_box" customModuleProvider="target">
918918
<rect key="frame" x="0.0" y="0.0" width="450" height="23"/>
919919
<autoresizingMask key="autoresizingMask"/>
920920
</tableHeaderView>
@@ -1077,7 +1077,7 @@
10771077
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
10781078
<subviews>
10791079
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" headerView="qpG-JT-klm" viewBased="YES" id="sAr-UI-HW7">
1080-
<rect key="frame" x="0.0" y="0.0" width="289" height="277"/>
1080+
<rect key="frame" x="0.0" y="0.0" width="356" height="277"/>
10811081
<autoresizingMask key="autoresizingMask"/>
10821082
<size key="intercellSpacing" width="3" height="2"/>
10831083
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -1149,6 +1149,39 @@
11491149
</tableCellView>
11501150
</prototypeCellViews>
11511151
</tableColumn>
1152+
<tableColumn width="64" minWidth="10" maxWidth="3.4028234663852886e+38" id="TyE-rh-QOM" userLabel="Download">
1153+
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
1154+
<font key="font" metaFont="smallSystem"/>
1155+
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
1156+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
1157+
</tableHeaderCell>
1158+
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="GPj-Yy-2kB">
1159+
<font key="font" metaFont="system"/>
1160+
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
1161+
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
1162+
</textFieldCell>
1163+
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
1164+
<prototypeCellViews>
1165+
<tableCellView id="edq-6e-xy3">
1166+
<rect key="frame" x="290" y="1" width="64" height="17"/>
1167+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1168+
<subviews>
1169+
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="u1b-PD-Dz4">
1170+
<rect key="frame" x="0.0" y="0.0" width="64" height="17"/>
1171+
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
1172+
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="38m-JA-bZz">
1173+
<font key="font" metaFont="system"/>
1174+
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
1175+
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
1176+
</textFieldCell>
1177+
</textField>
1178+
</subviews>
1179+
<connections>
1180+
<outlet property="textField" destination="u1b-PD-Dz4" id="Nc7-sv-6iz"/>
1181+
</connections>
1182+
</tableCellView>
1183+
</prototypeCellViews>
1184+
</tableColumn>
11521185
</tableColumns>
11531186
<connections>
11541187
<outlet property="dataSource" destination="zfF-Kx-ABF" id="a0C-O5-oA7"/>
@@ -1157,16 +1190,16 @@
11571190
</tableView>
11581191
</subviews>
11591192
</clipView>
1160-
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="Dfq-nP-3hp">
1161-
<rect key="frame" x="1" y="119" width="223" height="15"/>
1193+
<scroller key="horizontalScroller" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="0.97014925373134331" horizontal="YES" id="Dfq-nP-3hp">
1194+
<rect key="frame" x="0.0" y="284" width="289" height="16"/>
11621195
<autoresizingMask key="autoresizingMask"/>
11631196
</scroller>
11641197
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="FWR-1h-9yy">
11651198
<rect key="frame" x="224" y="17" width="15" height="102"/>
11661199
<autoresizingMask key="autoresizingMask"/>
11671200
</scroller>
1168-
<tableHeaderView key="headerView" id="qpG-JT-klm">
1169-
<rect key="frame" x="0.0" y="0.0" width="289" height="23"/>
1201+
<tableHeaderView key="headerView" id="qpG-JT-klm" customClass="TableHeaderView" customModule="node_box" customModuleProvider="target">
1202+
<rect key="frame" x="0.0" y="0.0" width="356" height="23"/>
11701203
<autoresizingMask key="autoresizingMask"/>
11711204
</tableHeaderView>
11721205
</scrollView>

mac/DownloadViewController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ class DownloadViewController: NSSplitViewController,
132132
} else if tableColumn == tableView.tableColumns[1] {
133133
text = item.date
134134
identifier = CellIdentifiers.DateCell
135+
} else if tableColumn == tableView.tableColumns[2] {
136+
135137
}
136138

137139
if let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: identifier), owner: nil) as? NSTableCellView {

mac/Store.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ class Store {
4848
}
4949
}
5050
}
51+
52+
public func refresh(onSuccess success: @escaping () -> Void) {
53+
// TODO: refresh version list
54+
}
5155

5256
/**
5357
* Get a local file from file system

mac/TableHeaderView.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// TableHeaderView.swift
3+
// node-box
4+
//
5+
// Created by Learning on 2019/1/24.
6+
// Copyright © 2019 Learning. All rights reserved.
7+
//
8+
9+
import Cocoa
10+
11+
class TableHeaderView: NSTableHeaderView {
12+
13+
override func draw(_ dirtyRect: NSRect) {
14+
super.draw(dirtyRect)
15+
16+
// Remove 1px border on the top
17+
let topBorderBox = NSRect(x: 0, y: 0, width: bounds.size.width, height: 1)
18+
if dirtyRect.intersects(topBorderBox) {
19+
NSColor.white.setFill()
20+
topBorderBox.fill()
21+
}
22+
}
23+
24+
}

mac/Version.swift

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@
99
import Foundation
1010

1111
class Version {
12-
var version:String;
13-
var npmVersion:String;
14-
var v8Version:String;
15-
var nodeModuleVersion:String;
12+
var version:String
13+
var npmVersion:String
14+
var v8Version:String
15+
var nodeModuleVersion:String
1616
var url:String
17-
var date:String;
17+
var date:String
18+
var isDownloaded:Bool
19+
var isDownloading:Bool
20+
var percentage:Float
21+
var isActive:Bool
1822

1923
init(data: Dictionary<String, Any>) {
2024
self.version = data["version"] as? String ?? ""
@@ -23,5 +27,9 @@ class Version {
2327
self.nodeModuleVersion = data["node-module-version"] as? String ?? ""
2428
self.url = (data["url"] as! Dictionary<String, String>)["darwin"] ?? ""
2529
self.date = data["date"] as? String ?? ""
30+
self.isDownloaded = false
31+
self.isDownloading = false
32+
self.percentage = 0
33+
self.isActive = false
2634
}
2735
}

node-box.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
B06D8EEA212FB87A00B65EEE /* Store.swift in Sources */ = {isa = PBXBuildFile; fileRef = B06D8EE9212FB87A00B65EEE /* Store.swift */; };
2121
B0EAC05921F995E600E48C15 /* Branch.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0EAC05821F995E600E48C15 /* Branch.swift */; };
2222
B0EAC05B21F9A11C00E48C15 /* Version.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0EAC05A21F9A11C00E48C15 /* Version.swift */; };
23+
B0EAC05F21F9C29900E48C15 /* TableHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0EAC05E21F9C29900E48C15 /* TableHeaderView.swift */; };
2324
/* End PBXBuildFile section */
2425

2526
/* Begin PBXCopyFilesBuildPhase section */
@@ -51,6 +52,7 @@
5152
B06D8EE9212FB87A00B65EEE /* Store.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Store.swift; sourceTree = "<group>"; };
5253
B0EAC05821F995E600E48C15 /* Branch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Branch.swift; sourceTree = "<group>"; };
5354
B0EAC05A21F9A11C00E48C15 /* Version.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Version.swift; sourceTree = "<group>"; };
55+
B0EAC05E21F9C29900E48C15 /* TableHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableHeaderView.swift; sourceTree = "<group>"; };
5456
B0F19CEF2133ABC0005C7BD2 /* node-box.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "node-box.entitlements"; sourceTree = "<group>"; };
5557
/* End PBXFileReference section */
5658

@@ -100,6 +102,7 @@
100102
B066C06C2133D1FC005F126B /* DownloadViewController.swift */,
101103
B052CED7213688CA004B5E87 /* VersionListViewController.swift */,
102104
B052CED92136987E004B5E87 /* VersionListView.swift */,
105+
B0EAC05E21F9C29900E48C15 /* TableHeaderView.swift */,
103106
B06D8EE9212FB87A00B65EEE /* Store.swift */,
104107
B0EAC05821F995E600E48C15 /* Branch.swift */,
105108
B0EAC05A21F9A11C00E48C15 /* Version.swift */,
@@ -188,6 +191,7 @@
188191
isa = PBXSourcesBuildPhase;
189192
buildActionMask = 2147483647;
190193
files = (
194+
B0EAC05F21F9C29900E48C15 /* TableHeaderView.swift in Sources */,
191195
B06D8EEA212FB87A00B65EEE /* Store.swift in Sources */,
192196
B0EAC05B21F9A11C00E48C15 /* Version.swift in Sources */,
193197
B06D8EDA212E88F400B65EEE /* TabViewController.swift in Sources */,
Binary file not shown.

0 commit comments

Comments
 (0)