Commit Graph

74 Commits (193d29ba672a9c96aa9ac2ceb9a3b9421ab350b9)

Author SHA1 Message Date
Myk a854e379b2
Merge pull request #2354 from myk002/myk_scrollbars_redux
make scrollbars more responsive when dragging
2022-10-22 20:28:52 -07:00
myk002 64b923b9eb
make the materials dialog filter lcase only
this allows the capital letter hotkeys to be processed by the list
widget without the special-casing of the ignore_keys attribute.
2022-10-21 12:43:53 -07:00
myk002 593b80cfa0
make scrollbars more responsive when dragging 2022-10-21 12:22:57 -07:00
myk002 142b45ef49
move list item hotkey hint left by one tile
so it doesn't get covered by the scrollbar
2022-10-19 17:30:51 -07:00
myk002 d650ba2377
ensure scrollbar can never get ahead of the cursor 2022-10-10 16:42:32 -07:00
myk002 ba36e72b33
support click and drag for scrollbars 2022-10-07 16:27:19 -07:00
myk002 35eb4e08dd
hold down the mouse button to continue scrolling 2022-10-07 15:40:05 -07:00
myk002 2bff70a290
add unit tests for widgets.Scrollbar 2022-10-07 13:14:52 -07:00
myk002 5722d6914b
transition Label to use the new generic Scrollbar 2022-10-07 12:45:43 -07:00
myk002 24232e894a
create Scrollbar widget and integrate with List 2022-10-06 11:13:16 -07:00
myk002 6fff83de5a
fix EditField rendering with TWBT 2022-09-16 15:24:33 -07:00
myk002 b88d343ddd
fix off-by-one error on scrollbar click detection 2022-09-14 09:25:43 -07:00
myk002 d4914e7511
implement mouse click reactions for scrollbar 2022-09-11 19:33:01 -07:00
myk002 e2fbade219
fix scrollbar display when all text is visible
also align behavior with documentation when 'left' or 'right' is
explicitly specified (i.e. always show the scrollbar)
2022-09-11 18:56:43 -07:00
myk002 f71f034d1d
show full scrollbars instead of just scroll icons 2022-09-11 17:58:10 -07:00
myk002 074a6ec5cd allow EditFields to ignore specified keys
like "+" and "-", so you can use them as hotkeys in the parent view
2022-08-31 10:22:41 -07:00
myk002 27e189fef2
no cursor position reset when updating list filter 2022-08-29 15:17:17 -07:00
myk002 8acda4d6c8
Interpret '4' & '6' as strings, not movement keys 2022-08-19 22:40:53 -07:00
myk002 7f0791f6c3 use setText() accessor method instead of direct access 2022-08-15 16:24:34 -07:00
myk002 22f9f3b042 add unit tests for new widget functionality 2022-08-15 16:24:34 -07:00
myk002 0ae4fed3cf add mouse support for CycleHotkeyLabel widgets 2022-08-15 16:24:34 -07:00
myk002 79b6cd13e9 support scrolling by half pages in Label 2022-08-15 16:24:34 -07:00
myk002 a5af5a1373 don't bork on no frame, set cursor to end of text 2022-08-15 16:24:34 -07:00
myk002 4e382c7b3b make HotkeyLabels react to clicking
also be better about initializing EditField frame height
2022-08-15 16:24:34 -07:00
myk002 8de8b22566 click to correct cursor position on long strings
where the left side of the string has been trimmed
2022-08-15 16:24:34 -07:00
myk002 b7f74fe2ce allow mouse lclick to select a List item 2022-08-15 16:24:34 -07:00
myk002 1dd3d6656b move the cursor in an EditField on mouse lclick 2022-08-15 16:24:34 -07:00
myk002 0aa9a187cf support cursor movement in EditFields 2022-08-15 16:24:34 -07:00
myk002 43b1abcdcf support submit2 for EditFields 2022-08-15 16:24:34 -07:00
myk002 214dd3c579 reset scroll position when the text is changed 2022-08-15 16:24:34 -07:00
myk002 64b793b409
support EditField:setText() so scripts can use it
and be compatible with both the develop and docs branch
2022-07-20 15:40:49 -07:00
Myk 89d3d45e87
Allow EditField widgets to manage their own activation and keyboard focus (#2147)
* use new focus subsystem in widgets.EditField

* always eat the enter key if we have an on_submit

* add modal attribute

* give EditFields a default height of 1

so they can be autoarranged
2022-06-01 21:48:21 -07:00
Timur Kelman 07f54deb0b
fix wrong `Label.frame_body.x2` value (#2134)
* fix wrong `Label.frame_body.x2` value

`update_scroll_inset` might change `frame_inset`, i.e. we need to `computeFrame` with the new values.

* add tests for Label

* add missing `local`, remove code in comments

* move `TestFramedScreen` outside test functions
2022-05-27 15:25:17 -07:00
myk002 18628ff5b8 make key_sep more configurable
and add more configuration to HotkeyLabel and EditField to take
advantage of it
2022-05-18 16:46:33 -07:00
myk002 53609db1f9 let CycleHotkeyLabels take numeric initial_options
even if all of the option values are non-numeric
2022-05-18 15:39:52 -07:00
myk002 af47434f52
protect against 0 width in string:wrap() 2022-04-29 11:29:19 -07:00
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
myk002 ed5523152c
factor text wrapping out of TooltipLabel into WrappedLabel 2022-04-22 09:53:10 -07:00
myk002 07761e1d5d add some more handy widgets to the library
TooltipLabel
HotkeyLabel
CycleHotkeyLabel
ToggleHotkeyLabel
2022-04-18 17:37:11 -07:00
Myk 10f22ecc27
add ResizingPanel class and autolayout for Panels (#2086)
* add autolayout for Panels and new ResizingPanel
2022-04-11 18:25:00 -07:00
Myk e6299700bf
Handle punctuation in FilteredList filter matching (#2085)
* allow punctuation to be typed into a filter

and allow the filter to match keys with punctuation
2022-04-11 18:22:31 -07:00
myk002 f62ff3ecc0
migrate existing lua code to use new library fns 2021-07-05 15:48:51 -07:00
Warmist b7069a5ebd
Fix label early key detection in scrolling logic
Current logic is because @myk002 fixed it so label would allow other widgets control when label(s) are present. However that breaks label key detection for default scroll keys. This can be worked around by setting scrollkeys to empty.

TBH: label is quite complicated and used everwhere so i'm reluctant to touch it and would love for someone to look over if i'm correct.
2021-06-22 11:31:00 +03:00
lethosor 7e12f3fd3d
Fix off-by-one, adjust changelog, move scroll keys to consistent place
Ref #1748
2021-01-30 19:40:15 -05:00
myk002 5a2181d55e
don't render overflow text 2021-01-13 22:02:22 -08:00
myk002 d4fbf4261f
address review comments 2021-01-12 23:27:14 -08:00
myk002 dac9538fd9
let navigation keys propagate
so other components can use them for simultaneous control
2021-01-11 15:02:12 -08:00
Myk Taylor 2797061b04
scroll Label text when height exceeds viewrect 2021-01-11 14:47:05 -08:00
Myk Taylor 9a3e9d5b12 listbox filter can match strings after punctuation 2020-08-17 21:15:33 -07:00
nicolasayala 141928ead0 Fix gui.FilteredList widget search on plain string choices 2020-02-27 07:56:30 +01:00