vertical-layout.hpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #if defined(Hiro_VerticalLayout)
  2. struct VerticalLayout;
  3. struct VerticalLayoutCell;
  4. struct mVerticalLayout;
  5. struct mVerticalLayoutCell;
  6. using sVerticalLayout = shared_pointer<mVerticalLayout>;
  7. using sVerticalLayoutCell = shared_pointer<mVerticalLayoutCell>;
  8. struct mVerticalLayout : mSizable {
  9. using type = mVerticalLayout;
  10. using mSizable::remove;
  11. auto alignment() const -> maybe<float>;
  12. auto append(sSizable sizable, Size size, float spacing = 5_sy) -> type&;
  13. auto cell(uint position) const -> VerticalLayoutCell;
  14. auto cell(sSizable sizable) const -> VerticalLayoutCell;
  15. auto cells() const -> vector<VerticalLayoutCell>;
  16. auto cellCount() const -> uint;
  17. auto minimumSize() const -> Size override;
  18. auto padding() const -> Geometry;
  19. auto remove(sSizable sizable) -> type&;
  20. auto remove(sVerticalLayoutCell cell) -> type&;
  21. auto reset() -> type& override;
  22. auto resize() -> type&;
  23. auto setAlignment(maybe<float> alignment) -> type&;
  24. auto setEnabled(bool enabled) -> type& override;
  25. auto setFont(const Font& font) -> type& override;
  26. auto setGeometry(Geometry geometry) -> type& override;
  27. auto setPadding(Geometry padding) -> type&;
  28. auto setParent(mObject* parent = nullptr, int offset = -1) -> type& override;
  29. auto setSpacing(float spacing) -> type&;
  30. auto setVisible(bool visible) -> type& override;
  31. auto spacing() const -> float;
  32. auto synchronize() -> type&;
  33. private:
  34. auto destruct() -> void override;
  35. struct State {
  36. maybe<float> alignment;
  37. vector<VerticalLayoutCell> cells;
  38. Geometry padding;
  39. float spacing = 5_sy;
  40. } state;
  41. };
  42. struct mVerticalLayoutCell : mObject {
  43. using type = mVerticalLayoutCell;
  44. auto alignment() const -> maybe<float>;
  45. auto collapsible() const -> bool;
  46. auto setAlignment(maybe<float> alignment) -> type&;
  47. auto setEnabled(bool enabled) -> type& override;
  48. auto setFont(const Font& font) -> type& override;
  49. auto setParent(mObject* parent = nullptr, int offset = -1) -> type& override;
  50. auto setSizable(sSizable sizable) -> type&;
  51. auto setSize(Size size) -> type&;
  52. auto setSpacing(float spacing) -> type&;
  53. auto setVisible(bool visible) -> type& override;
  54. auto sizable() const -> Sizable;
  55. auto size() const -> Size;
  56. auto spacing() const -> float;
  57. auto synchronize() -> type&;
  58. private:
  59. auto destruct() -> void override;
  60. struct State {
  61. maybe<float> alignment;
  62. sSizable sizable;
  63. Size size;
  64. float spacing = 5_sy;
  65. } state;
  66. friend class mVerticalLayout;
  67. };
  68. #endif