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:
parent
34684cf2aa
commit
39d36f30b5
|
@ -37,10 +37,4 @@ class Box : NSView, Control {
|
||||||
func SetParent(p: Control) {
|
func SetParent(p: Control) {
|
||||||
self.parent = p
|
self.parent = p
|
||||||
}
|
}
|
||||||
|
|
||||||
func Relayout() {
|
|
||||||
if self.parent != nil {
|
|
||||||
self.parent?.Relayout()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,4 @@ class Button : NSButton, Control {
|
||||||
func SetParent(p: Control) {
|
func SetParent(p: Control) {
|
||||||
self.parent = p
|
self.parent = p
|
||||||
}
|
}
|
||||||
|
|
||||||
func Relayout() {
|
|
||||||
if self.parent != nil {
|
|
||||||
self.parent?.Relayout()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import Cocoa
|
||||||
protocol Control : class {
|
protocol Control : class {
|
||||||
func View() -> NSView
|
func View() -> NSView
|
||||||
func SetParent(p: Control)
|
func SetParent(p: Control)
|
||||||
func Relayout()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func mkconstraints(constraint: String, views: [String: NSView]) -> [AnyObject] {
|
func mkconstraints(constraint: String, views: [String: NSView]) -> [AnyObject] {
|
||||||
|
|
|
@ -32,12 +32,6 @@ class Entry : NSTextField, Control {
|
||||||
func SetParent(p: Control) {
|
func SetParent(p: Control) {
|
||||||
self.parent = p
|
self.parent = p
|
||||||
}
|
}
|
||||||
|
|
||||||
func Relayout() {
|
|
||||||
if self.parent != nil {
|
|
||||||
self.parent?.Relayout()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO p.nonStretchyWidthPredicate = "(==96)" // TODO verify against Interface Builder
|
//TODO p.nonStretchyWidthPredicate = "(==96)" // TODO verify against Interface Builder
|
||||||
|
|
|
@ -35,10 +35,4 @@ class Label : NSTextField, Control {
|
||||||
func SetParent(p: Control) {
|
func SetParent(p: Control) {
|
||||||
self.parent = p
|
self.parent = p
|
||||||
}
|
}
|
||||||
|
|
||||||
func Relayout() {
|
|
||||||
if self.parent != nil {
|
|
||||||
self.parent?.Relayout()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,12 +67,6 @@ nspinbox++
|
||||||
func SetParent(p: Control) {
|
func SetParent(p: Control) {
|
||||||
self.parent = p
|
self.parent = p
|
||||||
}
|
}
|
||||||
|
|
||||||
func Relayout() {
|
|
||||||
if self.parent != nil {
|
|
||||||
self.parent?.Relayout()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO p.nonStretchyWidthPredicate = "(==96)" // TODO on the text field only
|
//TODO p.nonStretchyWidthPredicate = "(==96)" // TODO on the text field only
|
||||||
|
|
|
@ -37,12 +37,12 @@ class Window : NSWindow, Control {
|
||||||
self.c = c
|
self.c = c
|
||||||
var contentView = self.contentView as! NSView
|
var contentView = self.contentView as! NSView
|
||||||
contentView.addSubview(self.c!.View())
|
contentView.addSubview(self.c!.View())
|
||||||
self.Relayout()
|
self.relayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetMargined(m: Bool) {
|
func SetMargined(m: Bool) {
|
||||||
self.margined = m
|
self.margined = m
|
||||||
self.Relayout()
|
self.relayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
func Show() {
|
func Show() {
|
||||||
|
@ -59,7 +59,7 @@ class Window : NSWindow, Control {
|
||||||
fatalError("cannot call Window.SetParent()")
|
fatalError("cannot call Window.SetParent()")
|
||||||
}
|
}
|
||||||
|
|
||||||
func Relayout() {
|
private func relayout() {
|
||||||
if self.c == nil {
|
if self.c == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue