// // 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? = nil { willSet(newDelegate) {} didSet { libraryToolbarView.delegate = delegate } } let libraryToolbarView:LibraryToolbarView let sourceListView:NSView let backgroundColor = NSColor(SRGBRed: 0.95, green: 0.94, blue: 0.95, alpha: 1.0) let toolbarHeight = 39 init(frame:NSRect, sourceList:NSView) { let sourceListRect = NSRect(x: 0, y: toolbarHeight, width: Int(frame.size.width), height: (Int(frame.size.height) - toolbarHeight)) sourceListView = sourceList sourceListView.frame = sourceListRect 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(sourceListView) addSubview(libraryToolbarView) } override func resizeSubviewsWithOldSize(oldBoundsSize: NSSize) { let scrollSize = NSSize(width:frame.width, height:frame.height - CGFloat(toolbarHeight)) sourceListView.setFrameSize(scrollSize) libraryToolbarView.setFrameSize(NSSize(width: frame.width, height: CGFloat(toolbarHeight))) } }