private void CreateControl <TControlType, TDataType>() where TControlType : BaseTextControl <TDataType>, new()
        {
            var c = new TControlType();

            GetValueDelegate = () => ConvertType <TDataType, TType>(c.value);
            SetValueDelegate = (x) => c.value = ConvertType <TType, TDataType>(x);
            m_Control        = c as BaseTextControl <TType>;
        }
 private static void ConfigureEditor(BaseTextControl editor, string propertyName)
 {
     editor.DataPropertyName         = propertyName;
     editor.IncrementalSearchEnabled = true;
     editor.LeftMargin = 3;
     editor.Trimming   = StringTrimming.EllipsisCharacter;
     editor.UseCompatibleTextRendering = true;
 }
 void AddControl <T1>(BaseTextControl <T1> field, NodeSlot slot)
 {
     if (slot is IHasValue <T1> )
     {
         field.value = ((IHasValue <T1>)slot).value;
     }
     field.OnValueChanged(OnValueChange);
     Add(field);
 }
 private BaseTextControl <T> AddControl <T>(AbstractNode node, BaseTextControl <T> field, ReflectionProperty property)
 {
     field.value = (T)property.GetValue(node);
     field.OnValueChanged(e =>
     {
         node.owner.owner.RegisterCompleteObjectUndo(typeof(T).Name + " Change");
         property.SetValue(node, e.newValue);
         node.Dirty(ModificationScope.Node);
     });
     return(field);
 }
        public void EnableRowColor(int grtIndex)
        {
            rowColorSource = grtIndex;

            foreach (ColumnContent column in columns)
            {
                BaseTextControl textNode = column.control as BaseTextControl;
                if (textNode != null)
                {
                    textNode.DrawText += new EventHandler <DrawEventArgs>(DrawText_cb);

                    // remember node for DetachEvents
                    nodesWithEnabledRowColor.Add(textNode);
                }
            }
        }
        private string GetNodeToolTip(TreeNodeAdvMouseEventArgs args)
        {
            string msg = null;

            BaseTextControl btc = args.Control as BaseTextControl;

            if (btc != null && btc.DisplayHiddenContentInToolTip)
            {
                Size ms = btc.MeasureSize(args.Node, _measureContext);
                if (ms.Width > args.ControlBounds.Size.Width || ms.Height > args.ControlBounds.Size.Height)
                {
                    // [xiperware] || args.ControlBounds.Right - OffsetX > DisplayRectangle.Width)
                    msg = btc.GetLabel(args.Node);
                }
            }

            if (String.IsNullOrEmpty(msg))
            {
                msg = args.Control.GetToolTip(args.Node);
            }

            if (String.IsNullOrEmpty(msg) && DefaultToolTipProvider != null)
            {
                msg = DefaultToolTipProvider.GetToolTip(args.Node, args.Control);
            }

            return(msg);

            /*  [xiperware]  give displayhiddencontent higher priority than custom tooltip
             *
             * string msg = args.Control.GetToolTip(args.Node);
             *
             *                BaseTextControl btc = args.Control as BaseTextControl;
             *                if (btc != null && btc.DisplayHiddenContentInToolTip && String.IsNullOrEmpty(msg))
             *                {
             *                        Size ms = btc.MeasureSize(args.Node, _measureContext);
             *                        if (ms.Width > args.ControlBounds.Size.Width || ms.Height > args.ControlBounds.Size.Height
             || args.ControlBounds.Right - OffsetX > DisplayRectangle.Width)
             ||                               msg = btc.GetLabel(args.Node);
             ||               }
             ||
             ||               if (String.IsNullOrEmpty(msg) && DefaultToolTipProvider != null)
             ||                       msg = DefaultToolTipProvider.GetToolTip(args.Node, args.Control);
             ||
             ||               return msg;
             */
        }
        private string GetNodeToolTip(TreeNodeAdvMouseEventArgs args)
        {
            string msg = args.Control.GetToolTip(args.Node);

            BaseTextControl btc = args.Control as BaseTextControl;

            if (btc != null && btc.DisplayHiddenContentInToolTip && String.IsNullOrEmpty(msg))
            {
                Size ms = btc.GetActualSize(args.Node, _measureContext);
                if (ms.Width > args.ControlBounds.Size.Width || ms.Height > args.ControlBounds.Size.Height ||
                    args.ControlBounds.Right - OffsetX > DisplayRectangle.Width)
                {
                    msg = btc.GetLabel(args.Node);
                }
            }

            if (String.IsNullOrEmpty(msg) && DefaultToolTipProvider != null)
            {
                msg = DefaultToolTipProvider.GetToolTip(args.Node, args.Control);
            }

            return(msg);
        }
 /// <summary>
 /// Returns the caption of the given node in the first (main) column.
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 private string GetCaption(TreeNodeAdv node)
 {
     foreach (NodeControl control in Tree.NodeControls)
     {
         if (!Tree.UseColumns || control.ParentColumn.Index == 0)
         {
             BaseTextControl bindable = control as BaseTextControl;
             if (bindable == null)
             {
                 continue;
             }
             object value = bindable.GetValue(node);
             if (value != null)
             {
                 string result = value.ToString();
                 if (result.Length > 0)
                 {
                     return(result);
                 }
             }
         }
     }
     return("");
 }