Removed Control.Relayout(). It's not going to be needed, as only a change in control-specific state would trigger a relayout, and we don't need to lay /the entire window/ out recursively due to an internal change.

This commit is contained in:
Pietro Gagliardi 2015-08-07 22:10:11 -04:00
parent 34684cf2aa
commit 39d36f30b5
7 changed files with 3 additions and 34 deletions

View File

@ -37,10 +37,4 @@ class Box : NSView, Control {
func SetParent(p: Control) {
self.parent = p
}
func Relayout() {
if self.parent != nil {
self.parent?.Relayout()
}
}
}

View File

@ -27,10 +27,4 @@ class Button : NSButton, Control {
func SetParent(p: Control) {
self.parent = p
}
func Relayout() {
if self.parent != nil {
self.parent?.Relayout()
}
}
}

View File

@ -4,7 +4,6 @@ import Cocoa
protocol Control : class {
func View() -> NSView
func SetParent(p: Control)
func Relayout()
}
func mkconstraints(constraint: String, views: [String: NSView]) -> [AnyObject] {

View File

@ -32,12 +32,6 @@ class Entry : NSTextField, Control {
func SetParent(p: Control) {
self.parent = p
}
func Relayout() {
if self.parent != nil {
self.parent?.Relayout()
}
}
}
//TODO p.nonStretchyWidthPredicate = "(==96)" // TODO verify against Interface Builder

View File

@ -35,10 +35,4 @@ class Label : NSTextField, Control {
func SetParent(p: Control) {
self.parent = p
}
func Relayout() {
if self.parent != nil {
self.parent?.Relayout()
}
}
}

View File

@ -67,12 +67,6 @@ nspinbox++
func SetParent(p: Control) {
self.parent = p
}
func Relayout() {
if self.parent != nil {
self.parent?.Relayout()
}
}
}
//TODO p.nonStretchyWidthPredicate = "(==96)" // TODO on the text field only

View File

@ -37,12 +37,12 @@ class Window : NSWindow, Control {
self.c = c
var contentView = self.contentView as! NSView
contentView.addSubview(self.c!.View())
self.Relayout()
self.relayout()
}
func SetMargined(m: Bool) {
self.margined = m
self.Relayout()
self.relayout()
}
func Show() {
@ -59,7 +59,7 @@ class Window : NSWindow, Control {
fatalError("cannot call Window.SetParent()")
}
func Relayout() {
private func relayout() {
if self.c == nil {
return
}