/// <summary> /// Create a tree view for the sidebar. /// </summary> /// <param name="group">The definition for the tree view.</param> /// <param name="label"></param> /// <param name="panelItem"></param> protected void MakeTree(ChoiceGroup group, string label, ref SideBarPanelItem panelItem) { // TODO: This tree isn't the right size, when the window opens. // Figure out how to make it right. TreeView tree = new TreeView(); tree.Tag = group; tree.AfterSelect += new TreeViewEventHandler(OnTreeNodeSelected); ControlContainerItem containerItem = new ControlContainerItem(group.Id, label); containerItem.AllowItemResize = true; containerItem.Control = tree; panelItem.SubItems.Add(containerItem); }
private ILgWritingSystem[] GetVisibleWritingSystems(string singlePropertySequenceValue) { string[] icuLocales = ChoiceGroup.DecodeSinglePropertySequenceValue(singlePropertySequenceValue); Set <string> icuLocaleSet = new Set <string>(icuLocales); List <int> wsList = new List <int>(); // convert the icu locale ids into hvo ids. foreach (ILgWritingSystem lws in WritingSystemOptionsForDisplay) { if (icuLocaleSet.Contains(lws.ICULocale)) { wsList.Add(lws.Hvo); } } // convert the ws hvos into ws object array. return(LabeledMultiStringView.WssFromHvos(wsList.ToArray(), Cache)); }
/// <summary> /// Add the nodes to the tree. /// </summary> /// <remarks>The first time this is called, the group will be the /// maikn element of the sidebar. /// It will then be called recursively for each node that contains other nodes.</remarks> /// <param name="nodes">Collections of tree view nodes.</param> /// <param name="group">Definition of current set of nodes.</param> protected void FillTreeNodes(TreeNodeCollection nodes, ChoiceGroup group) { if (nodes.Count > 0) //hack...without this, we were losing expansion during OnIdle() { return; } nodes.Clear(); group.PopulateNow(); foreach (ChoiceRelatedClass item in group) { TreeNode node = MakeTreeNode(item); nodes.Add(node); if (item is ChoiceGroup) { FillTreeNodes(node.Nodes, (ChoiceGroup)item); } } }
public Node(Classification classification, IActionType preAction, IActionType action, IActionType postAction, ChoiceGroup children, Direction dir, AttackUI ui) { this.classification = classification; this.preAction = preAction; this.action = action; this.postAction = postAction; if (children != null) { this.children = children; } else { this.children = new ChoiceGroup(); } this.dir = dir; this.ui = ui; }
private void initialize() { ChoiceGroup children = new ChoiceGroup(); Node n = new Node(Classification.getIntermediary(), Direction.Up, attackUI); n.action = new AttackAction(this, interaction); children.up = n; n = new Node(Classification.getFinal(), Direction.Right, attackUI); n.action = new AttackAction(this, interaction); children.right = n; n = new Node(Classification.getFinal(), Direction.Down, attackUI); n.action = new AttackAction(this, interaction); children.down = n; n = new Node(Classification.getFinal(), Direction.Left, attackUI); n.action = new AttackAction(this, interaction); children.left = n; root = new Node(Classification.getNormal(), Direction.Middle, attackUI); root.children = children; children = new ChoiceGroup(); n = new Node(Classification.getFinal(), Direction.Up, attackUI); n.action = new AttackAction(this, interaction); children.up = n; n = new Node(Classification.getFinal(), Direction.Down, attackUI); n.action = new AttackAction(this, interaction); children.down = n; root.children.up.children = children; current = root; //Initialize colors attackUI.setColors(root.children.getColors()); //Initialize shapes attackUI.setShapes(root.children.getShapes()); ready = true; _attackMode = true; }
/// <summary> /// Overrides method to add itmes to the selected main itme in the sidebar. /// </summary> /// <param name="group">The group that defines this part of the sidebar.</param> public override void CreateUIForChoiceGroup(ChoiceGroup group) { SideBarPanelItem panelItem = (SideBarPanelItem)group.ReferenceWidget; if (panelItem.SubItems.Count > 0 && panelItem.SubItems[0] is ControlContainerItem) { ControlContainerItem item = (ControlContainerItem)panelItem.SubItems[0]; TreeView tree = (TreeView)item.Control; if (tree.Nodes.Count == 0) { FillTreeNodes(tree.Nodes, group); } // It keeps growing with this. tree.Size = item.Size; } else if (group.ReferenceWidget is SideBarPanelItem) { panelItem.SubItems.Clear(); foreach (ChoiceRelatedClass item in group) { Debug.Assert(item is ChoiceBase, "Only things that can be made into buttons should be appearing here, else we should have a tree."); MakeButton(panelItem, (ChoiceBase)item); } } }
public MyChoiceGroup(Mediator mediator, IUIAdapter adapter, XmlNode configurationNode, ChoiceGroup parent, string name, string id) : base(mediator, adapter, configurationNode, parent) { var doc = new XmlDocument(); var config = doc.CreateElement("config"); config.SetAttribute("behavior", "command"); config.SetAttribute("id", id); config.SetAttribute("label", name); config.SetAttribute("icon", "iconName"); if (name == "Areas") { config.SetAttribute("message", "TabClick"); } else { config.SetAttribute("message", "ButtonClick"); } config.SetAttribute("list", name); m_configurationNode = config; }
/// <summary> /// Overrides method to add itmes to the selected main itme in the sidebar. /// </summary> /// <param name="group">The group that defines this part of the sidebar.</param> public override void CreateUIForChoiceGroup(ChoiceGroup group) { }
public DetailsListSampleItemWithComponents WithChoiceGroup(ChoiceGroup choiceGroup) { ChoiceGroup = choiceGroup; return(this); }