dfhack/library
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
..
DataStaticsFields Split DataStaticsFields into multiple compilation units 2016-03-22 17:34:25 -04:00
include Adds consistent interface signatures for Maps module 2022-04-21 19:40:58 -07:00
lua add scroll icons to Label widget (#2101) 2022-04-29 06:55:08 -07:00
modules Adds consistent interface signatures for Maps module 2022-04-21 19:40:58 -07:00
proto Remove execute permission on files that are not executables. 2018-07-03 15:37:16 -05:00
xml@b8d48430aa Auto-update submodules 2022-04-19 07:17:48 +00:00
.gitignore Use configure_file to optimize incremental builds for git-describe.h 2018-07-13 16:07:46 +03:00
CMakeLists.txt Improves support for dfhack as a sub-project (#2058) 2022-03-29 10:28:52 -07:00
ColorText.cpp Fix crash in vprinterr due to va_list misuse 2016-07-03 23:33:07 -04:00
CompilerWorkAround.cpp Allow unloading plugins that use std::regex 2018-07-03 15:23:46 +03:00
Console-posix.cpp Enable -Wunused-variable and fix most errors 2021-09-07 01:16:21 -04:00
Console-windows.cpp Make lineedit() fail sooner when another lineedit() call is active 2020-12-03 22:04:00 -05:00
Core.cpp [core] Debug logging facelift (#2060) 2022-03-30 14:46:09 -07:00
DFHackVersion.cpp Add support for DFHACK_BUILD_ID 2018-07-11 11:47:55 -04:00
DataDefs.cpp tagged union support for lua (#1818) 2021-03-30 15:55:06 -05:00
DataStatics.cpp don't crash if the path to an instance-vector contains a null pointer 2020-04-18 20:40:17 -05:00
DataStaticsCtor.cpp Header changes/cleanup. 2011-12-31 12:48:42 +01:00
DataStaticsFields.cpp Remove Core.h include from DataDefs.h 2018-12-30 17:08:42 -05:00
Debug.cpp [core] Debug logging facelift (#2060) 2022-03-30 14:46:09 -07:00
Error.cpp Add function names to NullPointer and InvalidArgument exceptions 2018-05-11 09:49:27 -04:00
Hooks-darwin.cpp Fix some warnings on macOS 2021-09-07 11:58:44 -04:00
Hooks-egg.cpp Fix bug #188, eggy hook 2013-04-24 17:50:34 +02:00
Hooks-linux.cpp Fix some warnings on macOS 2021-09-07 11:58:44 -04:00
Hooks-windows.cpp fix a return statement in FirstCall 2018-07-14 12:15:52 -07:00
LuaApi.cpp Add functions reverse-engineered from ambushing unit code (#1992) 2022-03-13 17:19:35 -07:00
LuaTools.cpp only enable luacov for the core context 2021-03-10 23:31:30 -08:00
LuaTypes.cpp tagged union support for lua (#1818) 2021-03-30 15:55:06 -05:00
LuaWrapper.cpp tagged union support for lua (#1818) 2021-03-30 15:55:06 -05:00
MiscUtils.cpp Use a string and .reserve for normalizing instead of stringbuf 2020-09-24 15:22:58 -07:00
PlugLoad-posix.cpp Support dlsym loading from libgraphics vtables 2018-07-10 17:08:23 +03:00
PlugLoad-windows.cpp Add an error message when LoadLibrary fails 2021-01-01 15:35:59 +01:00
PluginManager.cpp Flush plugin warning messages 2020-08-06 22:45:46 -04:00
PluginStatics.cpp move xlsxreader identity statics to dfhack lib 2020-08-11 14:51:17 -07:00
Process-darwin.cpp Fix some warnings on macOS 2021-09-07 11:58:44 -04:00
Process-linux.cpp Enable -Wunused-variable and fix most errors 2021-09-07 01:16:21 -04:00
Process-windows.cpp More usage of smart pointers throughout core and version info. 2018-07-14 19:55:25 -07:00
RemoteClient.cpp Enable -Wunused-variable and fix most errors 2021-09-07 01:16:21 -04:00
RemoteServer.cpp fix some warnings 2020-02-10 19:35:17 -06:00
RemoteTools.cpp Refactor CoreSuspender to fix Console::lineedit exit hangs 2018-06-22 17:57:37 +03:00
TileTypes.cpp Remove Core.h include from DataDefs.h 2018-12-30 17:08:42 -05:00
Types.cpp update structures 2020-03-02 23:12:03 -06:00
VTableInterpose.cpp Fix follow_jmp for 64-bit code - skip REX prefix if found 2016-09-25 18:29:57 -05:00
VersionInfoFactory.cpp More usage of smart pointers throughout core and version info. 2018-07-14 19:55:25 -07:00
binpatch.cpp Fix the error message produced by binpatch when a mismatch is detected. 2012-10-27 15:35:11 +04:00
dfhack-run.cpp allow dfhack-run to output colors. 2020-03-06 15:02:03 -06:00
git-describe.cmake.in git-describe: fail earlier if git fails to run or doesn't exist (#2061) 2022-03-30 14:49:18 -07:00