Exemplo n.º 1
0
        private void UltraTree1_AfterCheck(object sender, NodeEventArgs e)
        {
            UltraTreeNode  node       = new UltraTreeNode();
            NodeEnumerator enumerator = e.TreeNode.Nodes.GetEnumerator();

            while (enumerator.MoveNext())
            {
                enumerator.Current.CheckedState = e.TreeNode.CheckedState;
            }
        }
Exemplo n.º 2
0
        public void Oznaci()
        {
            UltraTreeNode  node       = new UltraTreeNode();
            NodeEnumerator enumerator = this.UltraTree1.Nodes.GetEnumerator();

            while (enumerator.MoveNext())
            {
                enumerator.Current.CheckedState = CheckState.Checked;
            }
        }
Exemplo n.º 3
0
        internal bool Contains(object value)
        {
            NodeEnumerator enumerator = GetEnumerator();

            while (enumerator.MoveNext())
            {
                if (object.Equals(enumerator.Current, value))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 4
0
        private void BilancaSmartPart_Load(object sender, EventArgs e)
        {
            this.POCETNI = mipsed.application.framework.Application.Pocetni;
            this.ZAVRSNI = mipsed.application.framework.Application.Zavrsni;
            this.RadioButton3.Checked = true;
            this.dtPocetni.Value      = this.POCETNI;
            this.dtZavrsni.Value      = this.ZAVRSNI;
            new ORGJEDDataAdapter().Fill(this.OrgjedDataSet1);
            new MJESTOTROSKADataAdapter().Fill(this.MjestotroskaDataSet1);
            new DOKUMENTDataAdapter().Fill(this.DokumentDataSet1);
            InfraCustom.PostaviSelectAllSvimEditKontrolama(this);
            InfraCustom.PostaviEnterUTabSvimEditKontrolama(this);
            this.PopulateTree();
            this.Oznaci();
            this.UltraTree1.ExpandAll(ExpandAllType.OnlyNodesWithChildren);
            this.UltraTree1.Focus();
            UltraTree tree = this.UltraTree1;

            tree.Appearance.BackColor = Color.WhiteSmoke;
            tree.ExpandAll();
            NodeEnumerator enumerator = tree.Nodes.GetEnumerator();

            while (enumerator.MoveNext())
            {
                UltraTreeNode current = enumerator.Current;
                if (current.HasNodes)
                {
                    current.Override.NodeAppearance.FontData.Bold         = DefaultableBoolean.True;
                    current.Override.NodeAppearance.FontData.Name         = "Verdana";
                    current.Override.NodeAppearance.FontData.SizeInPoints = 8f;
                    NodeEnumerator enumerator2 = current.Nodes.GetEnumerator();
                    while (enumerator2.MoveNext())
                    {
                        UltraTreeNode node2 = enumerator2.Current;
                        node2.Override.NodeAppearance.FontData.Bold         = DefaultableBoolean.False;
                        node2.Override.NodeAppearance.FontData.Name         = "Verdana";
                        node2.Override.NodeAppearance.FontData.SizeInPoints = 7f;
                    }
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Adds an item to the <c>ILinkedList</c> collection immediately
        /// before the node containing the specified value.
        /// </summary>
        /// <param name="insertValue">
        /// The object to add to the <c>ILinkedList</c> collection.
        /// </param>
        /// <param name="testValue">
        /// The method finds the first node in the <c>ILinkedList</c>
        /// collection that contains a value equal to this value.
        /// If found, the new value is inserted before the node.
        /// </param>
        public virtual void AddBefore(object insertValue, object testValue)
        {
            if (this.IsReadOnly)
            {
                throw new NotSupportedException();
            }

            enumerator.Reset();

            while (enumerator.MoveNext())
            {
                ListNode current = enumerator.Current as ListNode;

                if (current.Value.Equals(testValue))
                {
                    this.InsertNode(insertValue, current);
                    return;
                }
            }
        }
Exemplo n.º 6
0
            public bool MoveNext()
            {
                if (currentValueIndex >= 0)
                {
                    if (++currentValueIndex < enumerator.Current.Value.Count)
                    {
                        return(true);
                    }
                }

                while (enumerator.MoveNext())
                {
                    if (enumerator.Current.Value != null)
                    {
                        currentValueIndex = 0;
                        return(true);
                    }
                }

                currentValueIndex = -1;

                return(false);
            }
Exemplo n.º 7
0
 public virtual Boolean MoveNext()
 {
     return(NodeEnumerator.MoveNext());
 }
Exemplo n.º 8
0
		// Returns true if we dont have vertical space to draw all the items.
		private bool GetNeedVScrollBar()
		{
			int fullNodes = VisibleCount;
			NodeEnumerator nodes = new NodeEnumerator(Nodes);
			while (nodes.MoveNext())
			{
				if (--fullNodes == 0)
				{
					return true;
				}
			}
			return false;
		}
Exemplo n.º 9
0
		// Render the treeview starting from startingLine
		internal void Draw(Graphics g, TreeNode startNode)
		{
			if (updating > 0)
			{
				return;
			}

			Rectangle clientRectangle = ClientRectangle;
			int drawableHeight = clientRectangle.Height;
			int drawableWidth = clientRectangle.Width - xOffset;

			// We count the visible rows to see if we need the v scrollbar but we wait before deciding if we need the h scroll bar.
			bool needsHScrollBar = false;
			bool needsVScrollBar = GetNeedVScrollBar() && scrollable;
			bool createNewVScrollBar = false;
			bool createNewHScrollBar = false;

			if (needsVScrollBar)
			{
				// Don't allow drawing on the area that is going to be the scroll bar.
				// Create the scroll bar so we can get its width.
				if (vScrollBar == null)
				{
					vScrollBar = new VScrollBar();
					createNewVScrollBar = true;
				}
				drawableWidth -= vScrollBar.Width;
				Rectangle rect = new Rectangle(drawableWidth + xOffset, 0, vScrollBar.Width, clientRectangle.Height);
				g.ExcludeClip(rect);
			}
			else
			{
				// Check to see if the top node is not the first node and we have room for the whole tree.
				// If so, abandon the draw and redraw the whole tree from the top.
				if (topNode != null && topNode != this.nodes[0])
				{
					topNode = null;
					Invalidate();
					return;
				}
				if (vScrollBar != null)
				{
					// We don't need the scroll bar anymore.
					Controls.Remove(vScrollBar);
					vScrollBar.Dispose();
					vScrollBar = null;
				}
			}
			// Is the node being processed on the screen.
			bool drawing = false;
			// Start counting from the top.
			int nodeFromTop = -1;
			// Number of nodes.
			int nodeCount = 0;
			int topNodePosition = 0;
			// The maximum width of a displayed node.
			int maxWidth = 0;
			StringFormat format = new StringFormat(StringFormatFlags.NoWrap);
			if (topNode == null && this.nodes.Count > 0)
			{
				topNode = this.nodes[0];
			}
			Rectangle textBounds = Rectangle.Empty;

			NodeEnumerator nodes = new NodeEnumerator(this.nodes);
			using (Pen markerPen = new Pen(SystemColors.ControlLight))
			{
				markerPen.DashStyle = DashStyle.Dot;
				while (nodes.MoveNext())
				{
					// If we havnt started drawing yet, then see if we need to and if so clear the background.
					if (!drawing)
					{
						if (nodes.currentNode  == topNode)
						{
							// We are at the top node.
							nodeFromTop = 0;
							topNodePosition = nodeCount;
						}
					
						// Check to see if we must start drawing. Clear the background.
						if (nodeFromTop >= 0 && (nodes.currentNode == startNode || startNode == root))
						{
							// Clear background.
							int y = ItemHeight * nodeFromTop;
							using (SolidBrush b = new SolidBrush(BackColor))
							{
								g.FillRectangle(b, 0, y, ClientSize.Width, ClientSize.Height - y);
							}
							drawing = true;
						}
					}

					// Even if we arnt drawing nodes yet, we need to measure if the nodes are visible, for hscrollbar purposes.
					if (nodeFromTop >= 0 && drawableHeight > 0)
					{
						textBounds = GetTextBounds(g, nodes.currentNode, nodeFromTop, nodes.level);
						// Is the text too wide to fit in - if so we need an h scroll bar.
						if (textBounds.Right > drawableWidth && !needsHScrollBar && scrollable)
						{
							needsHScrollBar = true;
							if (hScrollBar == null)
							{
								hScrollBar = new HScrollBar();
								createNewHScrollBar = true;
							}
							drawableHeight -= hScrollBar.Height;
							// Don't allow drawing on the area that is going to be the scroll bar.
							Rectangle rect = new Rectangle(0, clientRectangle.Height - hScrollBar.Height, clientRectangle.Width, hScrollBar.Height);
							g.ExcludeClip(rect);
						}
						if (textBounds.Right > maxWidth)
						{
							maxWidth = textBounds.Right;
						}

					}

					// Draw the node if we still have space.
					if (drawing && drawableHeight > 0)
					{
						Rectangle bounds;
						// Draw the lines and the expander.
						DrawExpanderMarker(g, markerPen, nodes.currentNode, nodeFromTop, nodes.level);
						// Draw checkboxes.
						if (checkBoxes)
						{
							bounds = GetCheckBounds(nodeFromTop, nodes.level);
							ButtonState state;
							if (nodes.currentNode.isChecked)
							{
								state = ButtonState.Checked;
							}
							else
							{
								state = ButtonState.Normal;
							}
							ControlPaint.DrawCheckBox(g, bounds, state);
						}
						// Draw the node image.
						if (imageList != null)
						{
							bounds = GetImageBounds(nodeFromTop, nodes.level);
							int index = GetDisplayIndex(nodes.currentNode );
						
							if (index < imageList.Images.Count)
							{
								Image image = imageList.Images[index];
								g.DrawImage(image, bounds.X, bounds.Y);
							
							}
						}
						bounds = textBounds;
						// The height may be too small now.
						// If we are currently editing a node then dont draw it.
						if (drawableHeight > 0 && nodes.currentNode != editNode)
						{
							// Draw the node text.
							if (nodes.currentNode  == selectedNode && (Focused || !hideSelection))
							{
								Rectangle r;

								// **TODO**
								// Running into a chicken and egg issue here where if
								// we fill the rect here, we're overdrawing the
								// checkBoxes or ExpanderMarker of above

								// Draw FullRowSelect if we qualify
								if(fullRowSelect && !showLines)
								{
									int left = 1;
//									if(nodes.currentNode)
//									{
//										left = 10;
//									}
									g.FillRectangle(SystemBrushes.Highlight, new Rectangle(left, bounds.Y, drawableWidth - 1, bounds.Height));
								}
								else
								{
									g.FillRectangle(SystemBrushes.Highlight, bounds);
								}
								g.DrawString(nodes.currentNode.Text, Font, SystemBrushes.HighlightText, bounds, format);

								// Draw the focus rectangle.
								if(FullRowSelect && !ShowLines)
								{
									r = new Rectangle(0, bounds.Y - 1, drawableWidth, bounds.Height + 1);
								}
								else
								{
									r = new Rectangle(bounds.X - 1, bounds.Y - 1, bounds.Width + 1, bounds.Height + 1);
								}
								ControlPaint.DrawFocusRectangle(g, r);
							}
							else
							{
								g.DrawString(nodes.currentNode .Text, Font, SystemBrushes.ControlText, bounds,format);
							}
						}
						drawableHeight -= ItemHeight;
					}

					if (nodeFromTop >= 0)
					{
						nodeFromTop++;
					}
					nodeCount++;
				}
			}
			// If we need a v scroll bar, then set it up.
			if (needsVScrollBar)
			{
				SetupVScrollBar(nodeCount, needsHScrollBar, createNewVScrollBar, topNodePosition);
			}
			if (needsHScrollBar)
			{
				SetupHScrollBar(needsVScrollBar, maxWidth, createNewHScrollBar, g);
			}
			else if (hScrollBar != null)
			{
				// We dont need the scroll bar.
				// If we have scrolled then we need to reset the position.
				if (xOffset != 0)
				{
					xOffset = 0;
					Invalidate();
				}
				Controls.Remove(hScrollBar);
				hScrollBar.Dispose();
				hScrollBar = null;
			}
		}
Exemplo n.º 10
0
		protected override bool ProcessDialogKey(Keys keyData)
		{
			if ((keyData & Keys.Alt) == 0)
			{
				Keys key = keyData & Keys.KeyCode;
				bool shiftKey = (keyData & Keys.Shift) != 0;
				bool controlKey = (keyData & Keys.Control) != 0;
				TreeNode selectedNode = SelectedNode;

				switch (key)
				{
					case Keys.Left:
						if (selectedNode != null)
						{
							if (selectedNode.IsExpanded)
							{
								selectedNode.Collapse();
							}
							else if (selectedNode.Parent != null)
							{
								SelectedNode = selectedNode.Parent;
							}
						}
						return true;
					case Keys.Right:
						if (selectedNode != null && selectedNode.Nodes.Count != 0)
						{
							if (selectedNode.IsExpanded)
							{
								SelectedNode = selectedNode.NextVisibleNode;
							}
							else
							{
								selectedNode.Expand();
							}
						}
						return true;
					case Keys.Up:
						if (selectedNode != null)
						{
							selectedNode = selectedNode.PrevVisibleNode;
							if (selectedNode != null)
							{
								SelectedNode = selectedNode;
							}
						}
						return true;
					case Keys.Down:
						if (selectedNode != null)
						{
							selectedNode = selectedNode.NextVisibleNode;
							if (selectedNode != null)
							{
								SelectedNode = selectedNode;
							}
						}	
						return true;
					case Keys.Home:
						if (Nodes[0] != null)
						{
							SelectedNode = Nodes[0];
						}
						return true;
					case Keys.End:
					{
						NodeEnumerator nodes = new NodeEnumerator(this.nodes);
						while (nodes.MoveNext())
						{
						}
						SelectedNode = nodes.currentNode;
						return true;
					}
					case Keys.Prior:
					{
						int nodePosition = 0;
						// Get the position of the current selected node.
						NodeEnumerator nodes = new NodeEnumerator(this.nodes);
						while (nodes.MoveNext())
						{
							if (nodes.currentNode == selectedNode)
							{
								break;
							}
							nodePosition++;
						}

						nodePosition -= VisibleCountActual - 1;
						if (nodePosition < 0)
						{
							nodePosition = 0;
						}

						// Get the node that corresponds to the position.
						nodes.Reset();
						while (nodes.MoveNext())
						{
							if (nodePosition-- == 0)
							{
								break;
							}
						}

						// Set the selectedNode.
						SelectedNode = nodes.currentNode;

					}
						return true;
					case Keys.Next:
					{
						int rows = 0;
						int rowsPerPage = VisibleCountActual;
						NodeEnumerator nodes = new NodeEnumerator(this.nodes);
						while (nodes.MoveNext())
						{
							if (nodes.currentNode == selectedNode || rows > 0)
							{
								rows++;
								if (rows >= rowsPerPage)
								{
									break;
								}
							}
						}
						SelectedNode = nodes.currentNode;
						
						return true;
					}
				}
	
			}
			return base.ProcessDialogKey(keyData);
		}