public override void LoadContent(IScreen screen) { Background.LoadContent(screen); DropButton = new RelativeLayoutButton() { Size = new Vector2(Rect.Height, Rect.Height), Horizontal = HorizontalAlignment.Right, Vertical = VerticalAlignment.Center, Highlightable = true, TransitionObject = this.TransitionObject, }; DropButton.OnClick += CreateDropdownList; var dropImage = new Image() { Texture = Screen.Content.Load <Texture2D>(StyleSheet.DropdownImageResource), Size = new Vector2(Rect.Height, Rect.Height) * 0.75f, Horizontal = HorizontalAlignment.Right, Vertical = VerticalAlignment.Center, FillRect = true, TransitionObject = this.TransitionObject, }; DropButton.AddItem(dropImage); AddItem(DropButton); base.LoadContent(screen); }
/// <summary> /// This method gets called when the parent node is expanded /// </summary> public void AddToTree(IScreen screen) { Items.Clear(); SetScreen(screen); Expanded = false; //get the size of the brick to add for tabs var tab = new Vector2(ItemButton.Rect.Height, ItemButton.Rect.Height) * .5f; //Add a brick for each tab for (int i = 0; i < _indentation; i++) { AddItem(new Shim() { Size = tab, Horizontal = HorizontalAlignment.Left, Vertical = VerticalAlignment.Center, }); } //if there are any sub-items, need to add the expand/collapse button if (ChildItems.Count > 0) { //add the expansion button ExpandCollapseImage = new Image() { Texture = _expandTexture, Size = tab, Horizontal = HorizontalAlignment.Center, Vertical = VerticalAlignment.Center, FillRect = true, }; //create a stack layout to size teh button correctly var expandButton = new RelativeLayoutButton() { Size = tab * 2f, Horizontal = HorizontalAlignment.Center, Vertical = VerticalAlignment.Center, }; expandButton.AddItem(ExpandCollapseImage); expandButton.OnClick += ToggleExpansion; AddItem(expandButton); } else { AddItem(new Shim() { Size = tab * 2f, }); } //add that final button AddItem(ItemButton); }
public TreeItem(T item, ITree <T> tree, TreeItem <T> parent) { Item = item; Alignment = StackAlignment.Left; Horizontal = HorizontalAlignment.Left; Vertical = VerticalAlignment.Center; Tree = tree; _parent = parent; _indentation = (parent == null ? 0 : parent._indentation + 1); ChildItems = new List <TreeItem <T> >(); Expanded = false; ItemButton = new RelativeLayoutButton(); ItemButton.OnClick += ((obj, e) => { tree.SelectedTreeItem = this; }); }
private IButton CreateButton(bool okButton) { //Create the menu entry "Cancel" var label = new Label(okButton ? OkText : CancelText, Content, FontSize.Small) { Horizontal = HorizontalAlignment.Center, Vertical = VerticalAlignment.Center, Layer = 1, }; //check if there is a background image for this button var backgrounImage = okButton ? StyleSheet.MessageBoxOkImageResource : StyleSheet.MessageBoxCancelImageResource; var hasBackgroundImage = !string.IsNullOrEmpty(backgrounImage); //Create the menu entry for "OK" var button = new RelativeLayoutButton() { HasBackground = !hasBackgroundImage, Horizontal = HorizontalAlignment.Center, Vertical = VerticalAlignment.Top, Size = new Vector2(Resolution.TitleSafeArea.Width * 0.4f - 16, label.Rect.Height * 2f) }; button.AddItem(label); if (hasBackgroundImage) { button.AddItem(new Image(Content.Load <Texture2D>(backgrounImage)) { Horizontal = HorizontalAlignment.Center, Vertical = VerticalAlignment.Center, Size = button.Rect.Size.ToVector2(), Highlightable = false, PulsateOnHighlight = false, FillRect = true, Layer = 0 }); } button.LoadContent(this); return(button); }
public TreeItem(TreeItem <T> inst) : base(inst) { Item = inst.Item; ItemButton = new RelativeLayoutButton(inst.ItemButton); Tree = inst.Tree; _parent = inst._parent; _indentation = inst._indentation; Expanded = inst.Expanded; _expandTexture = inst._expandTexture; _collapseTexture = inst._collapseTexture; ExpandCollapseImage = new Image(inst.ExpandCollapseImage); ChildItems = new List <TreeItem <T> >(); foreach (var item in inst.ChildItems) { var treeItem = item.DeepCopy() as TreeItem <T>; if (null != treeItem) { ChildItems.Add(treeItem); } } }
public RelativeLayoutButton(RelativeLayoutButton inst) : base(inst) { Layout = new RelativeLayout(inst.Layout as RelativeLayout); }