Esempio n. 1
0
        void IAttachable.AttachProperties(VisualTreeElement element, XmlNode node)
        {
            var gridRow = node.Attribute("Grid.Row");

            if (gridRow != null)
            {
                element.AttachedProperties.Add("Row", int.Parse(gridRow.Value));
            }
            var gridColumn = node.Attribute("Grid.Column");

            if (gridColumn != null)
            {
                element.AttachedProperties.Add("Column", int.Parse(gridColumn.Value));
            }
            var gridRowSpan = node.Attribute("Grid.RowSpan");

            if (gridRowSpan != null)
            {
                element.AttachedProperties.Add("RowSpan", int.Parse(gridRowSpan.Value));
            }
            var gridColumnSpan = node.Attribute("Grid.ColumnSpan");

            if (gridColumnSpan != null)
            {
                element.AttachedProperties.Add("ColumnSpan", int.Parse(gridColumnSpan.Value));
            }
        }
Esempio n. 2
0
        internal VisualTreeElement AddItem(VisualTreeElement element)
        {
            int x = BindPanelX(element);
            int y = BindPanelY(element);

            _frame.Put(element.Widget, x, y);
            this.PlaceItem(element, x, y);
            return(this.AddChildren(element));
        }
Esempio n. 3
0
        internal VisualTreeElement AddItem(VisualTreeElement element)
        {
            uint row        = (uint)(element.AttachedProperties.ContainsKey("Row") ? (int)element.AttachedProperties["Row"] : 0);
            uint column     = (uint)(element.AttachedProperties.ContainsKey("Column") ? (int)element.AttachedProperties["Column"] : 0);
            uint rowSpan    = (uint)(element.AttachedProperties.ContainsKey("RowSpan") ? (int)element.AttachedProperties["RowSpan"] : 1);
            uint columnSpan = (uint)(element.AttachedProperties.ContainsKey("columnSpan") ? (int)element.AttachedProperties["columnSpan"] : 1);

            _table.Attach(element.Widget, column, column + columnSpan, row, row + rowSpan);
            return(AddChildren(element));
        }
        internal VisualTreeElement AddChild(params VisualTreeElement[] children)
        {
            var childElement = children.Single();

            if (child != null)
            {
                RemoveChild(children);
            }
            child = childElement;
            ((Gtk.Bin)Widget).Child = childElement.Widget;
            return(base.AddChildren(children));
        }
Esempio n. 5
0
        internal VisualTreeElement PlaceItem(VisualTreeElement element, int?xIn, int?yIn)
        {
            int x = xIn ?? 0;
            int y = yIn ?? 0;

            if (xIn != null)
            {
                element.AttachedProperties ["X"] = x;
            }
            if (yIn != null)
            {
                element.AttachedProperties ["Y"] = y;
            }
            _frame.Put(element.Widget, x, y);
            _frame.Move(element.Widget, x, y);
            return(this);
        }
Esempio n. 6
0
        private int BindPanelY(VisualTreeElement element)
        {
            object y = element.AttachedProperties ["Y"];

            if (y is string)
            {
                element.AttachedProperties ["Y"] = 0;
                Action <EventHandler> subscribe = func => { };
                this.BindingContext.BindProperty(
                    subscribe,
                    () => (int)element.AttachedProperties ["Y"],
                    value => this.PlaceItem(element, element.AttachedProperties["X"] as int?, (int)value),
                    "Panel.Y",
                    (string)y);
            }
            return((int)element.AttachedProperties ["Y"]);
        }
Esempio n. 7
0
        internal void AttachX(VisualTreeElement element, XmlNode node)
        {
            var posX = node.Attribute("Panel.X");

            if (posX != null)
            {
                int position;
                if (int.TryParse(posX.Value, out position))
                {
                    element.AttachedProperties.Add("X", position);
                }
                else
                {
                    element.AttachedProperties.Add("X", posX.Value);
                }
            }
            else
            {
                element.AttachedProperties.Add("X", 0);
            }
        }
 internal VisualTreeElement RemoveChild(params VisualTreeElement[] children)
 {
     child = null;
     ((Gtk.Bin)Widget).Child = null;
     return(base.RemoveChildren(children));
 }
Esempio n. 9
0
 public ElementPair(VisualTreeElement element, Func <VisualTreeElement, VisualTreeElement> add)
 {
     Element      = element;
     AddToElement = add;
 }
Esempio n. 10
0
 public override void AddControl(VisualTreeElement element)
 {
     form.Controls.Add(element.Control);
     AddChild(element);
 }
Esempio n. 11
0
 void IAttachable.AttachProperties(VisualTreeElement element, XmlNode node)
 {
     this.AttachX(element, node);
     this.AttachY(element, node);
 }