fixed-layout.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #if defined(Hiro_FixedLayout)
  2. struct FixedLayout;
  3. struct FixedLayoutCell;
  4. struct mFixedLayout;
  5. struct mFixedLayoutCell;
  6. using sFixedLayout = shared_pointer<mFixedLayout>;
  7. using sFixedLayoutCell = shared_pointer<mFixedLayoutCell>;
  8. struct mFixedLayout : mSizable {
  9. using type = mFixedLayout;
  10. using mSizable::remove;
  11. auto append(sSizable sizable, Geometry geometry) -> type&;
  12. auto cell(uint position) const -> FixedLayoutCell;
  13. auto cell(sSizable sizable) const -> FixedLayoutCell;
  14. auto cells() const -> vector<FixedLayoutCell>;
  15. auto cellCount() const -> uint;
  16. auto minimumSize() const -> Size override;
  17. auto remove(sSizable sizable) -> type&;
  18. auto remove(sFixedLayoutCell cell) -> type&;
  19. auto reset() -> type& override;
  20. auto resize() -> type&;
  21. auto setEnabled(bool enabled) -> type& override;
  22. auto setFont(const Font& font) -> type& override;
  23. auto setParent(mObject* parent = nullptr, int offset = -1) -> type& override;
  24. auto setVisible(bool visible) ->type& override;
  25. auto synchronize() -> type&;
  26. private:
  27. auto destruct() -> void override;
  28. struct State {
  29. vector<FixedLayoutCell> cells;
  30. } state;
  31. };
  32. struct mFixedLayoutCell : mObject {
  33. using type = mFixedLayoutCell;
  34. auto geometry() const -> Geometry;
  35. auto setEnabled(bool enabled) -> type& override;
  36. auto setFont(const Font& font) -> type& override;
  37. auto setGeometry(Geometry geometry) -> type&;
  38. auto setParent(mObject* parent = nullptr, int offset = -1) -> type& override;
  39. auto setSizable(sSizable sizable) -> type&;
  40. auto setVisible(bool visible) -> type& override;
  41. auto sizable() const -> Sizable;
  42. auto synchronize() -> type&;
  43. private:
  44. auto destruct() -> void override;
  45. struct State {
  46. Geometry geometry;
  47. sSizable sizable;
  48. } state;
  49. friend class mFixedLayout;
  50. };
  51. #endif