/// <summary> /// Move selected items to back (end of the list) /// </summary> /// <returns> /// true if at least one object is moved /// </returns> public bool MoveSelectionToBack() { int n; int i; MokkanObjectList tempList; tempList = new MokkanObjectList(); n = _mokkanObjList.Count; // Read source list in reverse order, add every selected item // to temporary list and remove it from source list for (i = n - 1; i >= 0; i--) { if ((_mokkanObjList[i]).Selected) { tempList.Add(_mokkanObjList[i]); _mokkanObjList.RemoveAt(i); } } // Read temporary list in reverse order and add every item // to the end of the source list n = tempList.Count; for (i = n - 1; i >= 0; i--) { _mokkanObjList.Add(tempList[i]); } return(n > 0); }
/// <summary> /// Move selected items to front (beginning of the list) /// </summary> /// <returns> /// true if at least one object is moved /// </returns> public bool MoveSelectionToFront() { int n; int i; MokkanObjectList tempList; tempList = new MokkanObjectList(); n = _mokkanObjList.Count; // Read source list in reverse order, add every selected item // to temporary list and remove it from source list for (i = n - 1; i >= 0; i--) { if ((_mokkanObjList[i]).Selected) { tempList.Add(_mokkanObjList[i]); _mokkanObjList.RemoveAt(i); } } // Read temporary list in direct order and insert every item // to the beginning of the source list n = tempList.Count; for (i = 0; i < n; i++) { _mokkanObjList.Insert(0, tempList[i]); } return(n > 0); }
/// <summary> /// Clone this instance /// </summary> /// <returns></returns> public MokkanList Clone() { MokkanList ret = (MokkanList)this.MemberwiseClone(); MokkanObjectList list = new MokkanObjectList(); foreach (DrawObject o in MokkanObjectList) { list.Add(o.Clone()); } ret.MokkanObjectList = list; return(ret); }