private KTreeNodeMeasurements(KTreeNodeMeasurements orig, int x, int y)
        {
            this._node          = orig._node;
            this._options       = orig._options;
            this._paddingOveral = orig._paddingOveral;
            this._sizes         = (Size[])orig._sizes.Clone();

            // The node rectangle is the sum of the widths, and the maximum height (plus padding).
            // TODO: special handling for control part, make that fit with e.g. a Dock option?
            _nodeRect = new Rectangle(orig._nodeRect.X + x, y + orig._nodeRect.Y,
                                      _sizes.Select((i) => i.Width).Sum() + _paddingOveral.Horizontal,
                                      _sizes.Select((i) => i.Height).Max() + _paddingOveral.Vertical);

            for (int i = 0; i < (int)Part.None; ++i)
            {
                _paddingInternal[i] = new Padding();

                // Align any parts whose height does not match the total height
                if (_sizes[i].Height != InnerRect.Height)
                {
                    _paddingInternal[i].Bottom = (InnerRect.Height - _sizes[i].Height) / 2;
                    _paddingInternal[i].Top    = (InnerRect.Height - _sizes[i].Height) - _paddingInternal[i].Bottom;

                    // Quick hack to make sure checkboxes are properly aligned, make the rect square again
                    // TODO: use padding/dock modes for this
                    if (i == (int)Part.CheckBox && !_sizes[i].IsEmpty && _sizes[i].IsSquare())
                    {
                        _paddingInternal[i].Left  = _paddingInternal[i].Bottom;
                        _paddingInternal[i].Right = _paddingInternal[i].Top;
                    }
                }
            }
        }
 public KTreeNodeMeasurements(KTreeNode node, KTree options)
 {
     this._node     = node;
     this._options  = options;
     this._nodeRect = new Rectangle(_node.Depth * _options.NodeIndent, 0, 0, 0);
     _paddingOveral = options.NodePadding;
 }
Example #3
0
 internal KTreeNodes(KTree owner)
 {
     this._parent = null;
     this._owner  = owner;
 }
Example #4
0
 public void Init(Rectangle clientRect, KTree tree)
 {
     this._clientRect = clientRect;
     this._tree       = tree;
     _totalRect       = new Rectangle(0, 0, 0, 0);
 }
Example #5
0
 internal KTreeNodes(KTreeNode parent)
 {
     this._parent = parent;
     this._owner  = null;
 }