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; }
public bool AddChildWidget(Widget item) { if (Capacity > 0 && widgets.Count >= Capacity) return false; widgets.Add(item); item.WidgetGroup = this; SortChildWidgets(); Dirty = true; return true; }
/// <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; } }
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); } }
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; } }
public void RemoveWidget(Widget widget) { widgets.RemoveChildWidget(widget); }
public void AddWidget(Widget widget) { widgets.AddChildWidget(widget); }
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++; } }
public bool RemoveChildWidget(Widget item) { if (widgets.Remove(item)) { item.WidgetGroup = null; Dirty = true; return true; } return false; }