1 type ScrollPresenter = 2 inherit Decorator 3 4 def Control.measure w h = 5 if content ? Some control then 6 measure_clamped control w Control.max_size 7 let res_w = control.measure_width 8 measure_width = res_w 9 measure_height = control.measure_height.min h 10 else 11 measure_width = 0 12 measure_height = 0 13 14 def Control.arrange self = 15 if self.content ? Some control then 16 let mut res_w = control.measure_width.min self.width 17 if res_w < self.width && control.align_h == AlignH/Stretch then 18 res_w = self.width 19 20 let mut res_h = control.measure_height.min self.height 21 if res_h < self.height && control.align_h == AlignH/Stretch then 22 res_h = self.height 23 24 control.width = res_w 25 height = res_h 26 arrange 27