Esempio n. 1
0
 public virtual void GetAnchorPointsForChild(Widget child, out float left, out float right, out float top, out float bottom)
 {
     left = LeftAnchorOffset;
     right = RightAnchorOffset;
     top = TopAnchorOffset;
     bottom = BottomAnchorOffset;
 }
Esempio n. 2
0
        public bool AddChildWidget(Widget item)
        {
            if (Capacity > 0 && widgets.Count >= Capacity)
                return false;

            widgets.Add(item);
            item.WidgetGroup = this;
            SortChildWidgets();
            Dirty = true;

            return true;
        }
Esempio n. 3
0
        /// <summary>
        /// Push event in the event queue. Replaces previous events so that only the latest event will be handled.
        /// </summary>
        /// <param name="e">Event type</param>
        /// <param name="widget">The widget calling the event.</param>
        public void RaiseEvent(GuiEvent e, Widget widget, object args = null)
        {
            var eventObj = Tuple.Create(widget, args);

            if(!Events.ContainsKey(e))
            {
                Events.Add(e, eventObj);
            }
            else
            {
                Events[e] = eventObj;
            }
        }
Esempio n. 4
0
        public override void GetAnchorPointsForChild(Widget child, out float left, out float right, out float top, out float bottom)
        {
            left = LeftAnchorOffset;
            right = RightAnchorOffset;
            top = TopAnchorOffset;
            bottom = BottomAnchorOffset;

            int index = Widgets.IndexOf(child);

            if(index > -1)
            {
                top += index * top + GetChildrenTotalHeight(index);
            }
        }
Esempio n. 5
0
        public override void GetAnchorPointsForChild(Widget child, out float left, out float right, out float top, out float bottom)
        {
            left = 0;
            right = 0;
            top = 0;
            bottom = 0;

            int index = Widgets.IndexOf(child);

            if(index > -1)
            {
                int x = index % Columns;
                int y = (index - x) / Columns;

                for(int i = 0; i < x; i++)
                {
                    left += CellWidths[i] + LeftAnchorOffset;
                }

                for (int i = 0; i < y; i++)
                {
                    top += RowHeights[i] + TopAnchorOffset;
                }

                int cellWidth = CellWidths[x];
                int cellHeight = RowHeights[y];

                right = left + cellWidth;
                bottom = top + cellHeight;

                left += LeftAnchorOffset;
                right += RightAnchorOffset;
                top += TopAnchorOffset;
                bottom += BottomAnchorOffset;
            }
        }
Esempio n. 6
0
 public void RemoveWidget(Widget widget)
 {
     widgets.RemoveChildWidget(widget);
 }
Esempio n. 7
0
 public void AddWidget(Widget widget)
 {
     widgets.AddChildWidget(widget);
 }
Esempio n. 8
0
 internal void EnqueueCustomRenderingWidget(Widget widget)
 {
     lock(customRenderingWidgets)
     {
         if (customRenderingWidgets.Count <= customRenderingWidgetCount)
         {
             // No room in queue, add in the end of the queue
             customRenderingWidgets.Add(widget);
         }
         else
         {
             // Insert in queue
             customRenderingWidgets[customRenderingWidgetCount] = widget;
         }
         // Increase queue index
         customRenderingWidgetCount++;
     }
 }
Esempio n. 9
0
        public bool RemoveChildWidget(Widget item)
        {
            if (widgets.Remove(item))
            {
                item.WidgetGroup = null;
                Dirty = true;
                return true;
            }

            return false;
        }