public void Populate() { if (this.folderEntry == null || this.Nodes.Count > 0) { return; } CheckedState defaultState = this.State == CheckedState.Unchecked ? this.State : CheckedState.Checked; this.parentTree.InvokeEx(f => { foreach (TreeTraverser.FolderEntry folder in this.folderEntry.GetFolders()) { this.Nodes.Add(new TreeNodeTri(folder, this.imageList, this.ignoredFiles, this.ignoredFolders, this.parentTree, defaultState)); } foreach (TreeTraverser.FileEntry file in this.folderEntry.GetFiles()) { this.Nodes.Add(new TreeNodeTri(file, this.imageList, this.ignoredFiles, this.ignoredFolders, this.parentTree, defaultState)); } }); // Each node might be in some strange state but won't have had a chance to update its parent // due to not yet being in the tree, and therefore having no idea what its parent is... // This needs to be done after UpdateChildren, otherwise parents are enabled by children... this.parentTree.InvokeEx(f => { foreach (TreeNodeTri node in this.Nodes) { node.UpdateParent(); } }); }
public TreeNodeTri(TreeTraverser.FileEntry fileEntry, ImageList imageList, HashSet <string> ignoredFiles, HashSet <string> ignoredFolders, TreeView parentTree, CheckedState defaultState = CheckedState.Checked) : base(fileEntry.Filename) { this.imageList = imageList; if (ignoredFiles.Contains(fileEntry.FullPath)) { this.State = CheckedState.Unchecked; } else { this.State = defaultState; } this.StateImageIndex = (int)this.State; this.ignoredFiles = ignoredFiles; this.ignoredFolders = ignoredFolders; this.parentTree = parentTree; this.fileEntry = fileEntry; if (!imageList.Images.ContainsKey(fileEntry.Extension)) { Icon icon = Icon.ExtractAssociatedIcon(fileEntry.FullPath); imageList.Images.Add(fileEntry.Extension, icon); } this.ImageKey = fileEntry.Extension; this.SelectedImageKey = fileEntry.Extension; }
public void Click() { CheckedState state = this.State == CheckedState.Checked ? CheckedState.Unchecked : CheckedState.Checked; this.ChangeState(state); this.UpdateParent(); this.UpdateChildren(); }
internal void SetChecked(CheckedState state) { if (_checkedState != state) { _checkedState = state; OnCheckedStateChanged(); } }
public void draw(SpriteBatch spriteBatch, Texture2D img, int posX, int posY, int width, int height, string text, GraphicsDeviceManager gfx, SpriteFont setFont = null) { oms = ms; ms = Mouse.GetState(); SpriteFont font = GlobalVariables.MediumFont; if (setFont != null) { font = setFont; } int textWidth = Convert.ToInt32(font.MeasureString(text).X); int textHeight = Convert.ToInt32(font.MeasureString(text).Y); Rect = new Rectangle(posX, posY, width, height); spriteBatch.DrawString(font, text, new Vector2(Rect.X - (textWidth + (int)(gfx.PreferredBackBufferWidth * .005)), Rect.Y - (int)(textHeight * .35)), Color.WhiteSmoke); spriteBatch.Draw(img, Rect, Color.White); if (Game1.In(ms, Rect)) { spriteBatch.Draw(img, new Rectangle((int)(Rect.X) + (int)(gfx.PreferredBackBufferWidth * .002), (int)(Rect.Y + (gfx.PreferredBackBufferHeight * .003)), (int)(Rect.Width * .7), (int)(Rect.Height * .7)), Color.SlateGray); if (ms.LeftButton == ButtonState.Pressed && oms.LeftButton == ButtonState.Released) { if (CheckState == CheckedState.Checked) { CheckState = CheckedState.UnChecked; } else { CheckState = CheckedState.Checked; if (ClickedChecked != null) { ClickedChecked(this, EventArgs.Empty); } } } } else { if (CheckState == CheckedState.Checked) { spriteBatch.Draw(img, new Rectangle((int)(Rect.X) + (int)(gfx.PreferredBackBufferWidth * .002), (int)(Rect.Y + (gfx.PreferredBackBufferHeight * .003)), (int)(Rect.Width * .7), (int)(Rect.Height * .7)), Color.Black); } else { spriteBatch.Draw(img, new Rectangle((int)(Rect.X) + (int)(gfx.PreferredBackBufferWidth * .002), (int)(Rect.Y + (gfx.PreferredBackBufferHeight * .003)), (int)(Rect.Width * .7), (int)(Rect.Height * .7)), Color.WhiteSmoke); } } if (CheckState == CheckedState.Checked) { spriteBatch.Draw(GlobalVariables.CheckMark, Rect, Color.White); } }
private Bitmap drawCheckBox(CheckedState state) { Bitmap bmp = new Bitmap(16, 16); Graphics g = Graphics.FromImage(bmp); System.Windows.Forms.VisualStyles.CheckBoxState boxState = state == CheckedState.Unchecked ? System.Windows.Forms.VisualStyles.CheckBoxState.UncheckedNormal : (state == CheckedState.Checked ? System.Windows.Forms.VisualStyles.CheckBoxState.CheckedNormal : System.Windows.Forms.VisualStyles.CheckBoxState.MixedNormal); CheckBoxRenderer.DrawCheckBox(Graphics.FromImage(bmp), new Point(0, 1), boxState); return bmp; }
/// <summary>Initializes a new instance of the <see cref="CustomListBoxItem"/> class.</summary> public CustomListBoxItem() { _cachedLevel = -1; _items = new CustomListBoxItemsCollection(null, this); _checkedState = CheckedState.Unchecked; _items.Changing += OnItemsChanging; _items.Changed += OnItemsChanged; }
/// <summary>Initializes a new instance of the <see cref="CustomListBoxItem"/> class.</summary> public CustomListBoxItem() { _cachedLevel = -1; Items = new CustomListBoxItemsCollection(null, this); _checkedState = CheckedState.Unchecked; Items.Changing += OnItemsChanging; Items.Changed += OnItemsChanged; }
public GUIRRadio(int x, int y, string groupID, CheckedState initialState, GUIContainer container) { _GUINum = GUINums.GUIRRadio; X = x; Y = y; Width = 5; Height = 5; GroupID = groupID; InitialState = initialState; Container = container; }
private CheckedState SetAllNodeImages(TreeNode tNode) { if (tNode.Nodes.Count == 0) { if (tNode.Checked) { tNode.StateImageIndex = (int)CheckedState.Checked; return(CheckedState.Checked); } else { tNode.StateImageIndex = (int)CheckedState.UnChecked; return(CheckedState.UnChecked); } } bool isChecked = false; bool isUnchecked = false; foreach (TreeNode node in tNode.Nodes) { CheckedState tState = SetAllNodeImages(node); if (tState == CheckedState.Checked) { isChecked = true; } if (tState == CheckedState.UnChecked) { isUnchecked = true; } if (tState == CheckedState.Mixed) { isChecked = true; isUnchecked = true; } } CheckedState rState; if (isChecked && isUnchecked) { rState = CheckedState.Mixed; } else if (isChecked) { rState = CheckedState.Checked; } else { rState = CheckedState.UnChecked; } tNode.StateImageIndex = (int)rState; return(rState); }
private void InsertCheckbox(Body body) { SdtRun sdtRun1 = new SdtRun(); SdtProperties sdtProperties1 = new SdtProperties(); SdtId sdtId1 = new SdtId() { Val = -1636166143 }; SdtContentCheckBox sdtContentCheckBox1 = new SdtContentCheckBox(); DocumentFormat.OpenXml.Office2010.Word.Checked checked1 = new DocumentFormat.OpenXml.Office2010.Word.Checked() { Val = OnOffValues.Zero }; CheckedState checkedState1 = new CheckedState() { Font = "MS Gothic", Val = "2612" }; UncheckedState uncheckedState1 = new UncheckedState() { Font = "MS Gothic", Val = "2610" }; sdtContentCheckBox1.Append(checked1); sdtContentCheckBox1.Append(checkedState1); sdtContentCheckBox1.Append(uncheckedState1); sdtProperties1.Append(sdtId1); sdtProperties1.Append(sdtContentCheckBox1); SdtContentRun sdtContentRun1 = new SdtContentRun(); Run run1 = new Run(); RunProperties runProperties1 = new RunProperties(); RunFonts runFonts1 = new RunFonts() { Hint = FontTypeHintValues.EastAsia, Ascii = "MS Gothic", HighAnsi = "MS Gothic", EastAsia = "MS Gothic" }; runProperties1.Append(runFonts1); Text text1 = new Text(); text1.Text = "☐"; run1.Append(runProperties1); run1.Append(text1); sdtContentRun1.Append(run1); body.AppendChild(sdtContentRun1); }
public GUIRCheckbox(int x, int y, string groupID, CheckedState initialState, string title, GUIContainer container) { _GUINum = GUINums.GUIRCheckbox; X = x; Y = y; Width = 5; Height = 5; GroupID = groupID; InitialState = initialState; Title = title; Container = container; }
private Bitmap drawCheckBox(CheckedState state) { Bitmap bmp = new Bitmap(16, 16); Graphics g = Graphics.FromImage(bmp); System.Windows.Forms.VisualStyles.CheckBoxState boxState = state == CheckedState.Unchecked ? System.Windows.Forms.VisualStyles.CheckBoxState.UncheckedNormal : (state == CheckedState.Checked ? System.Windows.Forms.VisualStyles.CheckBoxState.CheckedNormal : System.Windows.Forms.VisualStyles.CheckBoxState.MixedNormal); CheckBoxRenderer.DrawCheckBox(Graphics.FromImage(bmp), new Point(0, 1), boxState); return(bmp); }
public void Clear() { list.Clear(); work = CheckedState.Indeterminate; template = null; stage = null; staff = null; id = null; number = null; date = null; dtype = DocumentSearchDate.Create; title = null; //IsCurrent = true; OnPropertyChanged(string.Empty); }
protected override void OnNodeMouseClick(TreeNodeMouseClickEventArgs e) { base.OnNodeMouseClick(e); TreeViewHitTestInfo info = HitTest(e.X, e.Y); if (info == null || info.Location != TreeViewHitTestLocations.StateImage) { return; } CheckedState rState = (CheckedState)e.Node.StateImageIndex; SetChildNodes(e.Node, rState == CheckedState.UnChecked); UpdateBase(); }
public void ChildChangedState(CheckedState childState) { // If all children checked, then we're checked. Ditto unchecked. If bit of both or neither, then we're mixed CheckedState state = childState; // Good starting point, at least one node has this state foreach (TreeNodeTri node in this.Nodes) { if (state != node.State) { state = CheckedState.Mixed; break; } } this.ChangeState(state); this.UpdateParent(); }
private void AddTreeNode(GeoTreeNode treeNode, NodeType type, CheckedState state) { TreeNode inputNode = new TreeNode(treeNode.Name); inputNode.Tag = treeNode.Tag; inputNode.StateImageIndex = (int) treeNode.CheckedState; this.BuildSubNodes(inputNode, treeNode.ChildrenNodes); TreeNode rootTreeNodeByType = this.GetRootTreeNodeByType(type); if (((type == NodeType.Polygons) || (type == NodeType.Lines)) || (type == NodeType.Points)) { rootTreeNodeByType.Nodes.Add(inputNode); } else { rootTreeNodeByType.Nodes.Insert(0, inputNode); } (this.m_PlaNetTreeNode.TreeView as ITriStateTreeViewContorller).AddNodeDragdropEvent(inputNode, new EventHandler(this.HandleNodeDragdrop)); this.SetDynamicNodeProperties(state, inputNode); this.RefreshParentTreeNode(rootTreeNodeByType, inputNode); }
public TreeNodeTri(TreeTraverser.FolderEntry folderEntry, ImageList imageList, HashSet <string> ignoredFiles, HashSet <string> ignoredFolders, TreeView parentTree, CheckedState defaultState = CheckedState.Checked) : base(folderEntry.Name) { this.imageList = imageList; if (ignoredFolders.Contains(folderEntry.FullPath)) { this.State = CheckedState.Unchecked; // No children yet to update } else { this.State = defaultState; } this.StateImageIndex = (int)this.State; this.ignoredFiles = ignoredFiles; this.ignoredFolders = ignoredFolders; this.parentTree = parentTree; this.folderEntry = folderEntry; this.ImageIndex = 0; this.SelectedImageIndex = 0; }
private void SetDynamicNodeProperties(CheckedState state, TreeNode node) { this.SetDynamicNodeProperty(node); foreach (TreeNode node2 in node.Nodes) { node2.StateImageIndex = (int) state; this.SetDynamicNodeProperty(node2); this.SetDynamicNodeProperties(state, node2); } }
public TreeNodeTri(TreeTraverser.FileEntry fileEntry, ImageList imageList, HashSet<string> ignoredFiles, HashSet<string> ignoredFolders, TreeView parentTree, CheckedState defaultState=CheckedState.Checked) : base(fileEntry.Filename) { this.imageList = imageList; if (ignoredFiles.Contains(fileEntry.FullPath)) this.State = CheckedState.Unchecked; else this.State = defaultState; this.StateImageIndex = (int)this.State; this.ignoredFiles = ignoredFiles; this.ignoredFolders = ignoredFolders; this.parentTree = parentTree; this.fileEntry = fileEntry; if (!imageList.Images.ContainsKey(fileEntry.Extension)) { Icon icon = Icon.ExtractAssociatedIcon(fileEntry.FullPath); imageList.Images.Add(fileEntry.Extension, icon); } this.ImageKey = fileEntry.Extension; this.SelectedImageKey = fileEntry.Extension; }
public TreeNodeTri(TreeTraverser.FolderEntry folderEntry, ImageList imageList, HashSet<string> ignoredFiles, HashSet<string> ignoredFolders, TreeView parentTree, CheckedState defaultState=CheckedState.Checked) : base(folderEntry.Name) { this.imageList = imageList; if (ignoredFolders.Contains(folderEntry.FullPath)) { this.State = CheckedState.Unchecked; // No children yet to update } else this.State = defaultState; this.StateImageIndex = (int)this.State; this.ignoredFiles = ignoredFiles; this.ignoredFolders = ignoredFolders; this.parentTree = parentTree; this.folderEntry = folderEntry; this.ImageIndex = 0; this.SelectedImageIndex = 0; }
public void ChangeState(CheckedState state) { this.State = state; this.StateImageIndex = (int)state; this.UpdateChildren(); }
public void SetCheckedState(CheckedState checkedState) { Checked = CheckedState.Checked == checkedState; }
internal void SetChecked(CheckedState state) { if(_checkedState != state) { _checkedState = state; OnCheckedStateChanged(); } }
public void ChildChangedState(CheckedState childState) { // If all children checked, then we're checked. Ditto unchecked. If bit of both or neither, then we're mixed CheckedState state = childState; // Good starting point, at least one node has this state foreach (TreeNodeTri node in this.Nodes) { if (state != node.State) { state = CheckedState.Mixed; break; } } this.ChangeState(state); this.UpdateParent(); }
public void Uncheck() { CheckState = CheckedState.UnChecked; }
public void Check() { CheckState = CheckedState.Checked; }
public void ChangeState(CheckedState state) { this.State = state; this.StateImageIndex = (int)state; this.UpdateChildren(); }
private void ModifyTreeNode(string newName, CheckedState newState, List<CheckedState> childrenStates, int id, NodeType type) { TreeNode rootTreeNodeByType = this.GetRootTreeNodeByType(type); TreeNode treeNode = this.GetTreeNode(rootTreeNodeByType, id); if (treeNode != null) { if (newName != null) { treeNode.Text = newName; } treeNode.StateImageIndex = (int) newState; if ((childrenStates != null) && (childrenStates.Count == treeNode.Nodes.Count)) { for (int i = 0; i < treeNode.Nodes.Count; i++) { treeNode.Nodes[i].StateImageIndex = (int)childrenStates[i]; } } } }
/// <summary> /// Constructor /// </summary> /// <param name="node"></param> /// <param name="checkedState"></param> public CheckedStateChangedEventArgs(TreeNode node, CheckedState checkedState, TreeViewAction action) : base(node, action) { this.CheckedState = checkedState; }
public void DrawCheckBox(CheckedState formated, Rectangle bound, Color color) { DrawGlyph(formated == CheckedState.Checked ? GlyphType.CheckSquareO : formated == CheckedState.Unchecked ? GlyphType.SquareO : GlyphType.Square, bound, color); }
/// <summary> /// Constructor /// </summary> /// <param name="node"></param> /// <param name="checkedState"></param> public CheckedStateChangedEventArgs(TreeNode node, CheckedState checkedState) : base(node) { this.CheckedState = checkedState; }