hasHorizontalScroller = NO; ignored if autohidesScrollers = YES;
When 'autohidesScrollers = YES;' the horizontal scroll is shown even if 'hasHorizontalScroller = NO;'
It would really help, if somebody could detail the behaviour of these settings on macOS and more specifically on different versions of macOS. How do these two values (plus verticalScroller) relate to each other, when an NSScrollView gets resized? With autohidesScrollers being NO, things should be easy the scrollers get controlled manually. But with that value being YES things might get complicated. Our expectation is that this not only hides scrollers but also displays them when needed. If you read through the documentation by Apple you will see that they are rather unspecific on what happens.
The behavior of macOS is complex, and it depends on whether a magic mouse or a trackpad is available, or if only a traditional mouse is being used.
If only a traditional mouse is available, the scroll bars are displayed if they are configured and necessary:
In this example (ScrollBar-Mouse00), only the vertical bar is visible with this configuration:
hasVerticalScroller = YES;
hasHorizontalScroller = NO;
autohidesScrollers = YES;
In this example (ScrollBar-Mouse01), both are shown, with this configuration because the horizontal is necessary:
hasVerticalScroller = YES;
hasHorizontalScroller = YES;
autohidesScrollers = YES;
However, with the same configuration, when the horizontal is not necessary, it is not displayed (ScrollBar-Mouse02):
hasVerticalScroller = YES;
hasHorizontalScroller = YES;
autohidesScrollers = YES;
When the value of autohidesScrollers is changed to NO, the space for the bar is still drawn, but the scrollbar is only visible if necessary (ScrollBar-Mouse03):
self.hasVerticalScroller = YES;
self.hasHorizontalScroller = YES;
self.autohidesScrollers = NO;
However, the above configurations are not very common, as most users have a trackpad or a magic mouse. In that case, the scroll bars behave like this:
autohidesScrollers seems not to affect the behavior or the display, the bars always automatically hide and are shown when dragging the content or changing the size of the available space (usually when resizing the window)
even if the bars are configured with hasVerticalScroller/hasHorizontalScroller to NO, the scrolls are not drawn but the content can be moved with the trackpad as if they were active. (ScrollBar-Trackpad04):
self.hasVerticalScroller = NO;
self.hasHorizontalScroller = NO;
self.autohidesScrollers = NO;
https://github.com/gnustep/libs-gui/assets/7429620/403ce7fd-77a7-4898-9740-add570e6f2b5
Leaving NO to the vertical scroll, or horizontal the behavior is the same as the previous one, but the scroll configured as visible is drawn, and also, you can interact with the mouse and the trackpad. (ScrollBar-Trackpad05):
self.hasVerticalScroller = YES;
self.hasHorizontalScroller = NO;
self.autohidesScrollers = NO;
https://github.com/gnustep/libs-gui/assets/7429620/d8d4b8c0-edae-481f-9ee8-696cd1236a09
The next example shows the behavior when resizing the available space (ScrollBar-Trackpad06):
self.hasVerticalScroller = YES;
self.hasHorizontalScroller = YES;
self.autohidesScrollers = NO;
https://github.com/gnustep/libs-gui/assets/7429620/eb7bd041-9423-4103-8cf6-7caf29ce7875
It is important to note, that in the case of the trackpad/magic-mouse there are two visualizations, the one that shows only the scroll bar which is thinner and has a transparent background and the one that is shown while interacting which is thicker and shows the background bar as when only a traditional mouse is available (ScrollBar-Trackpad07)
https://github.com/gnustep/libs-gui/assets/7429620/46dc0bbf-0fe4-4d88-aa08-0e240383ddb5
Finally, remember that all these configurations, it seems that they are only possible with the implementation of Layers and CoreAnimation.
Perhaps it would be fantastic to have a theme configuration, type:
NSScrollViewInterfaceStyle = NSWindows95InterfaceStyle;
NSScrollerInterfaceStyle = NSWindows95InterfaceStyle;
But adapted to the behaviors and captures described above, something like:
NSScrollViewInterfaceStyle = NSMacOSInterfaceStyle;
NSScrollerInterfaceStyle = NSMacOSInterfaceStyle;