dfhack/library/lua
Timur Kelman f08a268e8a
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`
2022-04-29 06:55:08 -07:00
..
3rdparty alt_getopt.lua: allow `?` as an option 2021-08-21 13:39:10 +02:00
dfhack only reset extents if they are unusable 2020-12-16 11:10:47 -08:00
gui add scroll icons to Label widget (#2101) 2022-04-29 06:55:08 -07:00
json Lua: Indent array values 2015-03-22 14:04:03 -04:00
test_util make a (shallow) copy of table params 2022-02-18 13:33:08 -08:00
argparse.lua Document and update argparse module (#2089) 2022-04-11 16:16:55 -07:00
binpatch.lua binpatch.lua: check for empty patches 2018-01-31 09:57:11 -05:00
class.lua Add a script to complement the weapon rack binary patch. 2012-10-27 20:16:27 +04:00
dfhack.lua add new global function: ensure_key 2022-04-27 17:35:49 -07:00
dumper.lua Fix whitespace issues 2015-02-14 22:53:06 -05:00
gui.lua add scroll icons to Label widget (#2101) 2022-04-29 06:55:08 -07:00
json.lua json: Improve IO-related error messages 2017-12-25 14:40:06 -05:00
luacov_helper.lua call luacov.runner.init directly and clean up dbg 2021-03-07 08:16:24 -08:00
makeown.lua fix of relations errors. 2017-04-24 07:07:08 -05:00
memscan.lua Fix out-of-bounds access in memscan.field_offset() 2021-08-10 11:26:06 -04:00
persist-table.lua persist-table bug. 2014-12-07 07:56:33 -05:00
profiler.lua Port profiler to lua 5.3 and dfhack 2018-06-06 19:18:18 +03:00
repeat-util.lua Apply initial pre-commit config 2022-04-12 14:48:19 -04:00
syndrome-util.lua Added function to remove syndrome wound data 2018-04-20 17:14:03 +02:00
tile-material.lua Apply initial pre-commit config 2022-04-12 14:48:19 -04:00
utils.lua migrate existing lua code to use new library fns 2021-07-05 15:48:51 -07:00