// // LibraryView.swift // DocHub // // Created by Tristan Juricek on 6/12/14. // Copyright (c) 2014 Perforce. All rights reserved. // import Foundation import AppKit // The left panel of the main window, this really is the "library style" menu // that is the root of all navigation in the application. class LibraryView : NSView { var delegate:LibraryViewDelegate? let scrollView:NSScrollView let libraryToolbarView:LibraryToolbarView let libraryListView:LibraryListView let backgroundColor = NSColor(SRGBRed: 0.95, green: 0.94, blue: 0.95, alpha: 1.0) let toolbarHeight = 39 init(frame:NSRect) { let scrollRect = NSRect(x: 0, y: toolbarHeight, width: Int(frame.size.width), height: (Int(frame.size.height) - toolbarHeight)) scrollView = NSScrollView(frame: scrollRect) scrollView.hasHorizontalScroller = false scrollView.hasVerticalScroller = true scrollView.borderType = NSBorderType.NoBorder scrollView.backgroundColor = backgroundColor libraryListView = LibraryListView(frame: NSRect(x:0, y:0, width: scrollRect.width, height: scrollRect.height)) scrollView.documentView = libraryListView let toolbarRect = NSRect(x: 0, y: 0, width: Int(frame.size.width), height: toolbarHeight) libraryToolbarView = LibraryToolbarView(frame:toolbarRect) super.init(frame:frame) autoresizesSubviews = true addSubview(scrollView) addSubview(libraryToolbarView) } override func resizeSubviewsWithOldSize(oldBoundsSize: NSSize) { let scrollSize = NSSize(width:frame.width, height:frame.height - CGFloat(toolbarHeight)) scrollView.setFrameSize(scrollSize) libraryListView.setFrameSize(NSSize(width: frame.width, height: libraryListView.frame.size.height)) libraryToolbarView.setFrameSize(NSSize(width: frame.width, height: CGFloat(toolbarHeight))) } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 9545 | tjuricek |
Use the left column to navigate p4 servers as "libraries" with their depots as "areas". I've had to stop using the output of login -p at the moment, since it doesn't quite work with the Objective-C API in lieu of a password. |
||
#5 | 9469 | tjuricek | Add sheet view for collecting Perforce connection information. | ||
#4 | 9439 | tjuricek | Correcting layout and color issues with the library view, and added a simple "add" pop-up menu with anticipated library types. | ||
#3 | 9438 | tjuricek |
Updated style of the library toolbar icon to match more of the Yosemite look and feel. Removed the "back/next" buttons. We should probably use a single view for them, and bring them back when they'll actually be used. |
||
#2 | 9435 | tjuricek | Split up the library view with a scroll pane and a "toolbar" that will sit on the bottom of the view | ||
#1 | 9420 | tjuricek |
Minimal UI framework. Lesson learned: if you're not using nibs, thou shalt access thy application as NSApplication.sharedApplication, or thy will encounter strange resizing exceptions. |