/// <summary> /// 체크박스의 값을 toggle한다. /// </summary> /// <param name="node"></param> /// <param name="itemIndex"></param> internal void SetCheckboxIfItemIsCheckbox(wTreeNode node, int itemIndex) { if (node.Items[itemIndex] != null && node.Items[itemIndex].ItemType == wTreeNodeItemTypes.CheckBox) { wTreeNodeItem item = node.Items[itemIndex]; bool? value = (bool?)item.Value; if (value == true) { item.Value = false; } else if (value == false) { item.Value = true; } else { item.Value = true; //중간상태일 때는 true로 바꿈. } bool newValue = (bool)item.Value; node.ControlChildChecks(itemIndex, newValue); node.ControlParentChecks(itemIndex); node.DrawBuffer(); _ownerTree.wDrawHandler.ReDrawTree(false); if (E_CheckItemChanged != null) { E_CheckItemChanged(node, item, newValue); } } }
/// <summary> /// 특정 값으로 체크박스를 셋팅한다. /// </summary> /// <param name="node"></param> /// <param name="itemIndex"></param> /// <param name="checkBoxValue"></param> internal void SetCheckboxValueIfItemIsCheckbox(wTreeNode node, int itemIndex, bool checkBoxValue) { if (node.Items[itemIndex] != null && node.Items[itemIndex].ItemType == wTreeNodeItemTypes.CheckBox) { wTreeNodeItem item = node.Items[itemIndex]; item.Value = checkBoxValue; bool newValue = (bool)item.Value; node.ControlChildChecks(itemIndex, newValue); node.ControlParentChecks(itemIndex); node.DrawBuffer(); _ownerTree.wDrawHandler.ReDrawTree(false); if (E_CheckItemChanged != null) { E_CheckItemChanged(node, item, newValue); } } }
/// <summary> /// 체크박스의 값을 toggle한다. /// </summary> /// <param name="parentNode"></param> /// <param name="itemIndex"></param> internal void SetCheckboxIfItemIsCheckbox(IwTreeNodeCollectionParent parentNode, int childStart, int childEnd, int itemIndex) { int min = childStart < childEnd ? childStart : childEnd; int max = childStart < childEnd ? childEnd : childStart; Dictionary <wTreeNodeItem, bool> itemValues = new Dictionary <wTreeNodeItem, bool>(); for (int i = min; i <= max; i++) { if (i == childStart) { continue; } wTreeNode child = parentNode.Children[i]; if (child.Items[itemIndex] != null && child.Items[itemIndex].ItemType == wTreeNodeItemTypes.CheckBox) { wTreeNodeItem item = child.Items[itemIndex]; bool? value = (bool?)item.Value; if (value == true) { item.Value = false; } else if (value == false) { item.Value = true; } else { item.Value = true; //중간상태일 때는 true로 바꿈. } bool newValue = (bool)item.Value; child.ControlChildChecks(itemIndex, newValue); child.DrawBuffer(); itemValues.Add(item, newValue);//toggle이니까 무조건 바뀐다. } } parentNode.Children[0].ControlParentChecks(itemIndex); _ownerTree.wDrawHandler.ReDrawTree(false); if (itemValues.Count > 0) { if (E_CheckItemChanged != null) { E_CheckItemsChanged(parentNode as wTreeNode, itemValues); } } }
/// <summary> /// 특정 값으로 체크박스를 셋팅한다. /// </summary> /// <param name="node"></param> /// <param name="itemIndex"></param> /// <param name="checkBoxValue"></param> internal void SetCheckboxValueIfItemIsCheckbox(IwTreeNodeCollectionParent parentNode, int childStart, int childEnd, int itemIndex, bool checkBoxValue) { int min = childStart < childEnd ? childStart : childEnd; int max = childStart < childEnd ? childEnd : childStart; Dictionary <wTreeNodeItem, bool> itemValues = new Dictionary <wTreeNodeItem, bool>(); for (int i = min; i <= max; i++) { wTreeNode child = parentNode.Children[i]; if (child.Items[itemIndex] != null && child.Items[itemIndex].ItemType == wTreeNodeItemTypes.CheckBox) { wTreeNodeItem item = child.Items[itemIndex]; bool? oldValue = (bool?)item.Value; if (checkBoxValue != oldValue) { item.Value = checkBoxValue; bool newValue = (bool)item.Value; child.ControlChildChecks(itemIndex, newValue); child.DrawBuffer(); if (oldValue != newValue) { itemValues.Add(item, newValue); //값이 바뀔 때만 추가한다. } } } } parentNode.Children[0].ControlParentChecks(itemIndex); _ownerTree.wDrawHandler.ReDrawTree(false); if (itemValues.Count > 0) { if (E_CheckItemChanged != null) { E_CheckItemsChanged(parentNode as wTreeNode, itemValues); } } }