Mercurial > dwindows
comparison ios/dw.m @ 2448:7e1828dd4fe0
iOS: Fix scrollbox content not expanding to take the full area if smaller.
General dwtest code cleanup.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 09 Apr 2021 23:38:59 +0000 |
parents | 8723c01fb87e |
children | 6edaa9382046 |
comparison
equal
deleted
inserted
replaced
2447:8723c01fb87e | 2448:7e1828dd4fe0 |
---|---|
2856 int depth = 0; | 2856 int depth = 0; |
2857 DWScrollBox *scrollbox = (DWScrollBox *)handle; | 2857 DWScrollBox *scrollbox = (DWScrollBox *)handle; |
2858 NSArray *subviews = [scrollbox subviews]; | 2858 NSArray *subviews = [scrollbox subviews]; |
2859 DWBox *contentbox = [subviews firstObject]; | 2859 DWBox *contentbox = [subviews firstObject]; |
2860 Box *thisbox = [contentbox box]; | 2860 Box *thisbox = [contentbox box]; |
2861 CGSize contentsize = [scrollbox contentSize]; | 2861 /* We start with the content being the available size */ |
2862 CGRect frame = [contentbox frame]; | 2862 CGRect frame = CGRectMake(0,0,rect.size.width,rect.size.height); |
2863 | 2863 |
2864 /* Get the required space for the box */ | 2864 /* Get the required space for the box */ |
2865 _dw_resize_box(thisbox, &depth, x, y, 1); | 2865 _dw_resize_box(thisbox, &depth, x, y, 1); |
2866 | 2866 |
2867 if(contentsize.width < thisbox->minwidth) | 2867 /* Expand the content box to the size of the contents */ |
2868 if(frame.size.width < thisbox->minwidth) | |
2868 { | 2869 { |
2869 contentsize.width = thisbox->minwidth; | 2870 frame.size.width = thisbox->minwidth; |
2870 } | 2871 } |
2871 if(contentsize.height < thisbox->minheight) | 2872 if(frame.size.height < thisbox->minheight) |
2872 { | 2873 { |
2873 contentsize.height = thisbox->minheight; | 2874 frame.size.height = thisbox->minheight; |
2874 } | 2875 } |
2875 frame.size = contentsize; | |
2876 [contentbox setFrame:frame]; | 2876 [contentbox setFrame:frame]; |
2877 | 2877 |
2878 /* Layout the content of the scrollbox */ | 2878 /* Layout the content of the scrollbox */ |
2879 _dw_do_resize(thisbox, contentsize.width, contentsize.height); | 2879 _dw_do_resize(thisbox, frame.size.width, frame.size.height); |
2880 _dw_handle_resize_events(thisbox); | 2880 _dw_handle_resize_events(thisbox); |
2881 } | 2881 } |
2882 /* Special handling for spinbutton controls */ | 2882 /* Special handling for spinbutton controls */ |
2883 else if([handle isMemberOfClass:[DWSpinButton class]]) | 2883 else if([handle isMemberOfClass:[DWSpinButton class]]) |
2884 { | 2884 { |