add scroll icons to Label widget (#2101)
* WIP: add scroll icons to Label widget It's an opt-out. The icons are rendered in the right-most column of the 1st and last row. They are only rendered when text can actually be scrolled in the corresponding direction. WIP: Currently, the icons might overlay text characters, there is no mechanism preventing it * gui.lua: expose the `parse_inset()` function * refactor Label's scroll icon code * since `render_scroll_icons` only works with a label, it's now a class function * `update_scroll_inset` ensures `frame_inset.r` or `.l` is at least 1, according to `show_scroll_icons` * `show_scroll_icons` has 4 possible values: `false` for no icons, `left` for icons on the first column on the left (also ensuring `frame_inset.l >= 1`), `right` - last column on the right, `DEFAULT_NIL` - same as `right` if text height greater than `frame_body.height`, else same as `false`. * make `render_scroll_icons` always draw icons The check now happens in `onRenderFrame` * draw frame's background calling `Label.super.onRenderFrame(self, dc, rect)` makes frame's background invisible for some reason * remove trailing spaces * fix scroll icons placed far above/below text With `Label.frame_inset = 1` the text could be vertically centered with plenty of space below and above, but not all rendered. Before this change, the scroll icons would be at the very top and bottom of the frame instead of near the first and last rendered text line. * always `update_scroll_inset` to react to resized window * draw scroll icons next to text * update `Lua API.rst` with new `Label` parameters * move comment separator up This way every scroll related parameter is in one group * list default values for new parameters in docs * add missing description of `Label.scroll_keys`develop
parent
8eb2831b7e
commit
f08a268e8a
Loading…
Reference in New Issue