public UIBuddyLayoutNode(UIView parent, IUIBuddyControl control, int flex, int height, int width) { Parent = parent; Control = control; Flex = flex; Height = height; Width = width; }
protected UIView Add(IUIBuddyControl subControl, int flex, int height, int width) { if (subControl is UIBuddyLayoutBase) { subControl.StackControl = subControl as UIBuddyLayoutBase; subControl.StackControl.IsNested = true; } int containerHeight = 0; int containerWidth = 0; if (flex > 0) { _flexTotal += flex; // These get resized later containerWidth = 0; containerHeight = 0; } else { containerWidth = width; containerHeight = height; } // Creat a new containing view UIView containerView = new UIView(); // Link ourselves into the UIView hierarchy, inherit the frame, and add the subcontrol AddSubview(containerView); containerView.AddSubview(subControl.BuddyControl); UIBuddyLayoutNode node = new UIBuddyLayoutNode(containerView, subControl, flex, containerHeight, containerWidth); Nodes.Add(node); if (DebugMode) { // Visualise the control containerView.Layer.BorderColor = new CGColor(1, 1, 1, 1); containerView.Layer.BorderWidth = 1.0f; // Visualise the layout view this.Layer.BorderColor = new CGColor(1, 1, 0, 1); this.Layer.BorderWidth = 2.0f; // Visualise the container if (!(subControl is UIBuddyLayoutBase)) { subControl.BuddyControl.Layer.BorderColor = new CGColor(1, 0, 0, 1); subControl.BuddyControl.Layer.BorderWidth = 1.0f; } } return(containerView); }
public UIView AddAbsolute(IUIBuddyControl subControl, int width, int height) { return(Add(subControl, 0, height, width)); }
public UIView AddFlex(IUIBuddyControl subControl, int flex) { return(Add(subControl, flex, 0, 0)); }