Specifying the peephole's size

x::w::new_scrollable_peepholelayoutmanager nsplm{create_peephole_container};

nsplm.width({20, 100, 300});
nsplm.height({20, 100, 300});

width() and height() set the peephole's size, given as a x::w::dim_axis_arg parameter. peepholelayoutmanager.C gives an example of only specifying the width. An unspecified width or height results in the peephole always sizing its width or height to be the same as the peepholed widget's. peepholelayoutmanager.C's peepholes don't have a specified height, so the peepholes' height matches their peepholed elements' height, so the peepholes scroll only in the horizontal direction.

x::w::new_peepholelayoutmanager nplm{create_peephole_container};

// ...


The only way for a peephole without scroll-bars to scroll the peephole is by tabbing the keyboard focus to a focusable widget that's not visible. This causes the peephole layout manager to automatically scroll it into view. The peephole scrolls only as much as needed to make the new widget with the keyboard focus visible at the nearest peephole edge.

Setting scroll to x::w::peephole_scroll::centered scrolls the widget with the current keyboard focus to the center of the peephole, if possible.


This is done only when keyboard focus is moved by Tabing. Bringing the keyboard focus to a visible widget by clicking on it with a pointer does not re-center the peephole on the new widget with the keyboard focus. It would be rather rude to have the widget jump away from the pointer as soon as it gets clicked on.