Exemplo n.º 1
0
 private void InvokeHandleMouseEnter(MouseEventArgs e, TreeNode tn, TreeNodeLayoutItem item)
 {
    if (item != prevMouseOverItem || tn != prevMouseOverTn)
    {
       item.HandleMouseEnter(e, tn);
       prevMouseOverItem = item;
       prevMouseOverTn = tn;
    }
 }
Exemplo n.º 2
0
   internal void BeginNodeTextEdit(TreeNode tn, TreeNodeLayoutItem layoutItem)
   {
      if (tn == null || layoutItem == null)
         return;

      if (this.editingTreeNode != null)
         this.EndNodeTextEdit(true);

      BeforeNodeTextEditEventArgs e = new BeforeNodeTextEditEventArgs(tn);
      this.OnBeforeNodeTextEdit(e);

      if (e.Cancel)
         return;

      this.editingTreeNode = tn;
      this.editTextBoxOpening = true;
      this.editTextBox = new TextBox();

      Rectangle bounds = layoutItem.GetBounds(tn);
      int itemIndex = layoutItem.Layout.LayoutItems.IndexOf(layoutItem);
      if (itemIndex < layoutItem.Layout.LayoutItems.Count - 1)
      {
         TreeNodeLayoutItem nextItem = layoutItem.Layout.LayoutItems[itemIndex + 1];
         if (nextItem is EmptySpace)
         {
            bounds.Width += nextItem.GetWidth(tn);
         }
      }
      this.editTextBox.Location = bounds.Location;
      this.editTextBox.Size = new Size (Math.Max(100, bounds.Width), 18);
      this.editTextBox.Text = e.EditText;
      this.editTextBox.KeyDown += new KeyEventHandler(editTextBox_KeyDown);
      this.editTextBox.LostFocus += new EventHandler(editTextBox_LostFocus);

      this.editTextBox.Parent = this;
      this.editTextBox.Focus();
      this.editTextBox.SelectAll();
      
   }
Exemplo n.º 3
0
   /// <summary>
   /// Handles the TreeView's MouseMove event, passing the event on to the layout items.
   /// </summary>
   public void HandleMouseMove(MouseEventArgs e, TreeNode tn)
   {
      if (e == null)
         return;

      if (this.prevMouseOverItem != null)
      {
         if (tn == this.prevMouseOverTn && this.prevMouseOverItem.GetBounds(tn).Contains(e.Location))
            return;
         else
         {
            prevMouseOverItem.HandleMouseLeave(e, tn);
            this.prevMouseOverItem = null;
            this.prevMouseOverTn = null;
         }
      }

      HandleMouseEvent(e, tn, i => InvokeHandleMouseEnter(e, tn, i));
   }
Exemplo n.º 4
0
 private static String GetItemName(TreeNodeLayoutItem item)
 {
    OutlinerPluginData plugin = OutlinerPlugins.GetPlugin(item.GetType());
    return plugin.DisplayName;
 }