horizontalspacer.c 616 B

123456789101112131415161718192021222324252627
  1. // -----------------------------------------------------------
  2. class HorizontalSpacer : SpacerBase
  3. {
  4. reference int Border;
  5. reference int Gap;
  6. override protected void UpdateChild(Widget child, float w, float h, int index)
  7. {
  8. float itemWidth = (w - (Border * 2) - ((m_count - 1) * Gap)) / m_count;
  9. float itemHeight = h - (2 * Border);
  10. child.SetPos(Border + ((itemWidth + Gap) * index), Border);
  11. child.SetSize(itemWidth, itemHeight);
  12. if(child.GetChildren())
  13. {
  14. Widget c = child.GetChildren();
  15. RightGap gap;
  16. c.GetScript(gap);
  17. if(gap)
  18. gap.OnUpdate(c);
  19. //gap.Update();
  20. }
  21. }
  22. };