public void itemRemoved(ButtonGridItem item) { if (item == SelectedItem) { SelectedItem = null; } }
internal void itemActivated(ButtonGridItem item) { if (ItemActivated != null) { ItemActivated.Invoke(item); } }
public void itemChosen(ButtonGridItem item) { if (ItemChosen != null) { ItemChosen.Invoke(item); } }
public void itemRemoved(ButtonGridItem item) { if (item == SelectedItem) { setSelected(null); } selectedItems.Remove(item); }
public void removeSelected(ButtonGridItem item) { if (item != null) { selectedItems.Remove(item); item.StateCheck = false; setSelected(); } }
public void addSelected(ButtonGridItem item) { if (item != null && !selectedItems.Contains(item)) { selectedItems.Add(item); item.StateCheck = true; setSelected(); } }
/// <summary> /// Remove an item from the group. /// </summary> /// <param name="item"></param> public void removeItem(ButtonGridItem item) { items.Remove(item); item.Dispose(); toggleCaptionVisibility(); if (items.Count == 0) { grid.NonEmptyGroupCount--; } }
public void alignItem(ButtonGridItem item) { if (allowNewlines && currentPosition.x + ItemWidth > canvasSize.Width) { currentPosition.x = xStartPosition; currentPosition.y += ItemHeight + ItemPaddingY; } item.setPosition(currentPosition, ItemWidth, ItemHeight); currentPosition.x += item.Width + calculatedPadding; allowNewlines = true; }
/// <summary> /// Remove an item. /// </summary> /// <param name="item">The item to remove.</param> public void removeItem(ButtonGridItem item) { if (ItemRemoved != null) { ItemRemoved.Invoke(this, item); } selectionStrategy.itemRemoved(item); itemCount--; item.Group.removeItem(item); layout(); }
/// <summary> /// Find an item based on the UserObject assigned to it. /// </summary> /// <param name="userObject">The user object to search for.</param> /// <returns>The first item matching the user object.</returns> public ButtonGridItem findItemByUserObject(Object userObject) { foreach (ButtonGridGroup group in groups) { ButtonGridItem item = group.findItemByUserObject(userObject); if (item != null) { return(item); } } return(null); }
/// <summary> /// Find an item based on its caption. /// </summary> /// <param name="caption">The caption to search for.</param> /// <returns>The first item matching the caption.</returns> public ButtonGridItem findItemByCaption(String caption) { foreach (ButtonGridGroup group in groups) { ButtonGridItem item = group.findItemByCaption(caption); if (item != null) { return(item); } } return(null); }
/// <summary> /// Add an item to the group. /// </summary> /// <param name="caption">The caption to add.</param> /// <returns>The newly created ButtonGridItem.</returns> public ButtonGridItem addItem(String caption) { ButtonGridItem item = new ButtonGridItem(this, grid); item.Caption = caption; items.Add(item); toggleCaptionVisibility(); if (items.Count == 1) { grid.NonEmptyGroupCount++; } return(item); }
/// <summary> /// Insert an item into the group. /// </summary> /// <param name="index">The index to insert at.</param> /// <param name="caption">The caption to use.</param> /// <returns>The newly created ButtonGridItem.</returns> public ButtonGridItem insertItem(int index, String caption) { ButtonGridItem item = new ButtonGridItem(this, grid); item.Caption = caption; items.Insert(index, item); toggleCaptionVisibility(); if (items.Count == 1) { grid.NonEmptyGroupCount++; } return(item); }
/// <summary> /// Insert an item into a ButtonGridGroup. /// </summary> /// <param name="index">The index in the group to put the item</param> /// <param name="group">The group to add the item to</param> /// <param name="caption">The caption for the item</param> /// <param name="imageResource">The image resource for the item</param> /// <returns></returns> public ButtonGridItem insertItem(int index, String group, String caption, String imageResource = null) { ButtonGridGroup addGroup = findGroup(group); ButtonGridItem item = addGroup.insertItem(index, caption); item.setImage(imageResource); itemCount++; layout(); if (ItemAdded != null) { ItemAdded.Invoke(this, item); } return(item); }
public void setSelection(ButtonGridItem primary, IEnumerable <ButtonGridItem> secondary) { uncheckSelectedAndClear(); if (primary != null) { selectedItems.Add(primary); } selectedItems.AddRange(secondary); foreach (ButtonGridItem item in selectedItems) { item.StateCheck = true; } setSelected(primary); }
private void setSelected(ButtonGridItem value) { if (selectedItem != value) { selectedItem = value; if (selectedItem != null) { selectedItem.StateCheck = true; } if (SelectedValueChanged != null) { SelectedValueChanged.Invoke(this, EventArgs.Empty); } } }
/// <summary> /// Add an item. /// </summary> /// <param name="group">The group to add the item to.</param> /// <param name="caption">The caption for the item.</param> /// <param name="imageResource">The image resource for the item</param> /// <returns></returns> public ButtonGridItem addItem(String group, String caption, String imageResource = null, Object userObject = null) { ButtonGridGroup addGroup = findGroup(group); ButtonGridItem item = addGroup.addItem(caption); item.setImage(imageResource); item.UserObject = userObject; itemCount++; layout(); if (ItemAdded != null) { ItemAdded.Invoke(this, item); } return(item); }
public void alignItem(ButtonGridItem item) { int finalWidth = ItemWidth; int textSize = (int)item.TextSize.Width + 10 + extraPadding; if (textSize > finalWidth) { finalWidth = textSize; } if (currentPosition.x + finalWidth > canvasSize.Width) { currentPosition.x = 0; currentPosition.y += ItemHeight + ItemPaddingY; } item.setPosition(currentPosition, finalWidth, ItemHeight); currentPosition.x += item.Width + ItemPaddingX; }
public void itemChosen(ButtonGridItem item) { if (InputManager.Instance.isControlPressed()) { int index = selectedItems.IndexOf(item); if (index == -1) { selectedItems.Add(item); item.StateCheck = true; setSelected(item); } else if (selectedItems.Count > 1) { selectedItems.RemoveAt(index); item.StateCheck = false; if (item == SelectedItem) { if (index < selectedItems.Count) { setSelected(selectedItems[index]); } else if (index - 1 >= 0) { setSelected(selectedItems[index - 1]); } else { setSelected(null); } } } } else { uncheckSelectedAndClear(); item.StateCheck = true; selectedItems.Add(item); setSelected(item); } }
public void itemRemoved(ButtonGridItem item) { selectedItems.Remove(item); }
public void addSelected(ButtonGridItem item) { multiSelection.addSelected(item); }
public void alignItem(ButtonGridItem item) { item.setPosition(currentPosition, ItemWidth, ItemHeight); currentPosition.x = 0; currentPosition.y += ItemHeight + ItemPaddingY; }
internal void itemChosen(ButtonGridItem item) { selectionStrategy.itemChosen(item); }
public void removeSelected(ButtonGridItem item) { multiSelection.removeSelected(item); }
public void itemChosen(ButtonGridItem item) { SelectedItem = item; }
public void itemChosen(ButtonGridItem item) { }
public void itemRemoved(ButtonGridItem item) { }
public void setSelection(ButtonGridItem primary, IEnumerable <ButtonGridItem> secondary) { multiSelection.setSelection(primary, secondary); }