public void SetFocusDay(DayNode focusDay, bool animate) { for (int i = 0; i < ChildrenCount; i++) { DayNode each = (DayNode)GetChild(i); each.HasWidthFocus = false; each.HasHeightFocus = false; } if (focusDay == null) { daysExpanded = 0; weeksExpanded = 0; } else { focusDay.HasWidthFocus = true; daysExpanded = 1; weeksExpanded = 1; for (int i = 0; i < numDays; i++) { GetDay(focusDay.Week, i).HasHeightFocus = true; } for (int i = 0; i < numWeeks; i++) { GetDay(i, focusDay.Day).HasWidthFocus = true; } } LayoutChildren(animate); }
private static void Add(this SortedList <int, DayNode> days, DayNode day) { try { days.Add(day.Day, day); } catch (ArgumentException) { days[day.Day].Total += day.Total; } }
public void LayoutChildren(bool animate) { float focusWidth = 0; float focusHeight = 0; if (daysExpanded != 0 && weeksExpanded != 0) { focusWidth = (Width * FOCUS_SIZE_PERCENT) / daysExpanded; focusHeight = (Height * FOCUS_SIZE_PERCENT) / weeksExpanded; } float collapsedWidth = (Width - (focusWidth * daysExpanded)) / (numDays - daysExpanded); float collapsedHeight = (Height - (focusHeight * weeksExpanded)) / (numWeeks - weeksExpanded); float xOffset = 0; float yOffset = 0; float rowHeight = 0; DayNode each = null; for (int week = 0; week < numWeeks; week++) { for (int day = 0; day < numDays; day++) { each = GetDay(week, day); float width = collapsedWidth; float height = collapsedHeight; if (each.HasWidthFocus) { width = focusWidth; } if (each.HasHeightFocus) { height = focusHeight; } if (animate) { each.AnimateToBounds(xOffset, yOffset, width, height, DEFAULT_ANIMATION_MILLIS).StepInterval = 0; } else { each.SetBounds(xOffset, yOffset, width, height); } xOffset += width; rowHeight = height; } xOffset = 0; yOffset += rowHeight; } }
public override void OnMouseUp(PInputEventArgs e) { DayNode pickedDay = (DayNode)e.PickedNode; if (pickedDay.HasWidthFocus && pickedDay.HasHeightFocus) { SetFocusDay(null, true); } else { SetFocusDay(pickedDay, true); } }
public void SetFocusDay(DayNode focusDay, bool animate) { for (int i = 0; i < ChildrenCount; i++) { DayNode each = (DayNode) GetChild(i); each.HasWidthFocus = false; each.HasHeightFocus = false; } if (focusDay == null) { daysExpanded = 0; weeksExpanded = 0; } else { focusDay.HasWidthFocus = true; daysExpanded = 1; weeksExpanded = 1; for (int i = 0; i < numDays; i++) { GetDay(focusDay.Week, i).HasHeightFocus = true; } for (int i = 0; i < numWeeks; i++) { GetDay(i, focusDay.Day).HasWidthFocus = true; } } LayoutChildren(animate); }