private void RemoveGroup(string groupName) { lock (m_Groups) { RosterItemGroup group = (RosterItemGroup)m_Groups[groupName]; group.Remove(); } }
private void AddGroup(string groupName) { lock (m_Groups) { if (!m_Groups.ContainsKey(groupName)) { RosterItemGroup group = new RosterItemGroup(this, groupName); group.SetVisible(false); m_Scene.AddItem(group); m_Groups.Add(groupName, group); ResizeAndRepositionGroups(); } } }
protected override void DragMoveEvent(Qyoto.QGraphicsSceneDragDropEvent arg1) { if (arg1.MimeData() is RosterItemGroupMimeData) { arg1.Accept(); m_Grid.AllGroupsCollapsed = true; var pos = arg1.ScenePos(); m_GroupDropBeforeGroup = null; foreach (var group in m_Grid.SortedGroups) { if (group.IsVisible()) { if (pos.Y() < (group.Y() + (group.BoundingRect().Height() / 2))) { m_GroupDropBeforeGroup = group; break; } } } if (m_GroupDropBeforeGroup != null) { m_GroupDropIndicatorItem.SetLine(0, 0, base.Width(), 0); m_GroupDropIndicatorItem.SetPos(0, m_GroupDropBeforeGroup.Y() - (m_Grid.IconPadding / 2)); m_GroupDropIndicatorItem.SetVisible(true); } else { m_GroupDropIndicatorItem.SetVisible(false); } } else if (arg1.MimeData() is RosterItemMimeData <T> ) { m_Grid.AllGroupsCollapsed = true; base.DragMoveEvent(arg1); } else { base.DragMoveEvent(arg1); } }
public RosterItemGroupMimeData(RosterItemGroup group, QObject parent) { m_Group = group; SetParent(parent); }
private void model_ItemChanged(IAvatarGridModel <T> model, T item) { if (model.ModelUpdating) { return; } QApplication.Invoke(delegate { bool visibilityChanged = false; bool groupsChanged = false; lock (m_Items) { if (!m_Items.ContainsKey(item)) { Console.Error.WriteLine("Item changed before being added: " + item); // model_ItemAdded(model, item); return; } List <string> toRemove = new List <string>(); // Check if item was added to any groups foreach (string groupName in model.GetItemGroups(item)) { if (!m_Items[item].ContainsKey(groupName)) { AddItemToGroup(item, groupName); groupsChanged = true; } } // Check if item needs to be removed from any groups, redraw others. // FIXME: Don't need to redraw items we just added. foreach (RosterItem <T> gitem in m_Items[item].Values.ToArray()) { RosterItemGroup group = (RosterItemGroup)gitem.ParentItem(); var groups = model.GetItemGroups(item); if (groups.Contains(group.Name) || (groups.Count() == 0 && group.Name == "No Group")) { if (model.IsVisible(item) != gitem.IsVisible()) { visibilityChanged = true; } else { gitem.Update(); } } else { toRemove.Add(group.Name); groupsChanged = true; } } foreach (string groupName in toRemove) { RemoveItemFromGroup(item, groupName, false); } } if (visibilityChanged || groupsChanged) { ResizeAndRepositionGroups(); } }); }