// // 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 toolbarHeight = 24 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) 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) libraryToolbarView.setFrameSize(NSSize(width: CGFloat(frame.width), height: CGFloat(toolbarHeight))) } }