sizable.cpp 824 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #if defined(Hiro_Sizable)
  2. auto mSizable::allocate() -> pObject* {
  3. return new pSizable(*this);
  4. }
  5. auto mSizable::collapsible() const -> bool {
  6. return state.collapsible;
  7. }
  8. auto mSizable::doSize() const -> void {
  9. if(state.onSize) return state.onSize();
  10. }
  11. auto mSizable::geometry() const -> Geometry {
  12. return state.geometry;
  13. }
  14. auto mSizable::minimumSize() const -> Size {
  15. return signal(minimumSize);
  16. }
  17. auto mSizable::onSize(const function<void ()>& callback) -> type& {
  18. state.onSize = callback;
  19. return *this;
  20. }
  21. auto mSizable::setCollapsible(bool collapsible) -> type& {
  22. state.collapsible = collapsible;
  23. signal(setCollapsible, collapsible);
  24. return *this;
  25. }
  26. auto mSizable::setGeometry(Geometry geometry) -> type& {
  27. state.geometry = geometry;
  28. signal(setGeometry, geometry);
  29. return *this;
  30. }
  31. #endif