Commit Graph

66 Commits (master)

Author SHA1 Message Date
Trevor Slocum d5de9a7b0a Fix DropDown.SetCurrentOption Unlock of unlocked RWMutex panic 2023-09-11 19:50:26 -07:00
Garrett D'Amore 7fbbefd986 Improved drop down list usability. 2022-07-29 19:10:30 -07:00
Trevor Slocum 454d759a42 Add Button.SetCursorRune and CheckBox.SetCursorRune
Cursors are now shown within Buttons and CheckBoxes by default.

Resolves #62.
2021-06-05 10:24:43 -07:00
Trevor Slocum 71e3cc57f7 Add relevant info to pages of the presentation demo
Also, only draw DropDown symbols when focused by default.

Resolves #61.
2021-06-04 20:42:44 -07:00
Trevor Slocum 4ac48a9748 Replace FormItem.SetAttributes with individual methods 2020-10-09 08:37:54 -07:00
Trevor Slocum ed5e6d94dd Remove return values from methods which return their primitive (breaks chaining) 2020-10-07 16:35:21 -07:00
Trevor Slocum 6b34a95e75 Print text using []byte instead of string, calculate string width using runewidth instead of uniseg 2020-10-06 13:16:37 -07:00
Trevor Slocum db81e43e00 Remove wrapper methods 2020-10-02 16:28:32 -07:00
Trevor Slocum 357a49e9e7 Do not set focus-related style attributes by default 2020-09-29 13:24:12 -07:00
Trevor Slocum a709a929d9 Fix FormItem.SetAttributes race condition
Resolves #35.
2020-09-28 22:34:38 -07:00
Trevor Slocum 97f450fc34 Set DropDown options list width to at least as wide as the originating field 2020-09-23 16:22:12 -07:00
Trevor Slocum 89fa23ab00 Resolve lint warnings 2020-09-23 16:14:53 -07:00
Andreas Bieber 70857602a5 feat(FormItem): Replace `SetFormAttributes` with `SetAttributes`
`SetFormAttributes` has been removed. To migrate your project, use `SetAttributes` which expects any combination of attribute setters.
`formItem.SetAttributes(cview.WithLabelWidth(10), cview.WithLabelColor(tcell.ColorYellow))`
2020-09-23 20:54:48 +02:00
Andreas Bieber 9142563f22 feat(inputfield): Add ability to show a note below the inputfield 2020-09-23 20:54:48 +02:00
Andreas Bieber 8bd1023ddc feat(dropdown): Add additional field for setting an optional reference (like in TreeView) 2020-09-23 20:54:48 +02:00
Andreas Bieber 6e9f09aec1 feat(dropdown): Draw rune at the end of the field to indicate that this field is a dropdown 2020-09-23 20:54:43 +02:00
Andreas Bieber 6fa4370332 fix(dropdown): Use `getFieldWidth` during draw 2020-09-23 20:51:46 +02:00
Andreas Bieber dedc2da113 feat(dropdown): Abbreviate text of current option when not fitting into field 2020-09-23 20:51:43 +02:00
Andreas Bieber 4ab3586259 feat(dropdown): Introduce `SetChangedFunc` 2020-09-23 20:46:36 +02:00
Andreas Bieber 40efd84aad feat(dropdown): Trigger `selected` when drop down list selection is cancelled 2020-09-23 20:46:36 +02:00
Andreas Bieber e716d0acb9 fix(dropdown): Select previous option in dropdown list when cancelling selection 2020-09-23 20:46:36 +02:00
Andreas Bieber f71273b9c8 feat(dropdown): Expose `DropDownOption`
- The signature of `GetCurrentOption` has been changed to return the index and the newly exposed `DropDownOption`
- `AddOption` has been renamed to `AddOptions` and accepts now multiple `DropDownOption`s. A convenience func called `AddOptionsSimple` has been added to simply add options by only providing its text.
- The signature of `SetOptions` has been changed to accept the global `selected` handler with the newly exposed `DropDownOption` and multiple `DropDownOption`s to set. A convenience func, namely `SetOptionsSimple`, has been added to simply add options by only providing its text.
- The signature of `SetSelectedFunc` has been changed to accept a handler expecting an index and the newly exposed `DropDownOption`

- The signature of `AddDropDown` has been changed to accept an array of the newly exposed `DropDownOption`. A convenience func, namely `AddDropDownSimple`, has been added to simply add a DropDown by only providing the option's text.
2020-09-23 20:46:36 +02:00
Andreas Bieber d315a5c5b3 feat(List): Expose `ListItem`
- The signature of `SetChangedFunc` and `SetSelectedFunc` has changed to pass the newly exposed `ListItem` instead of its properties
- The signature of `AddItem` and `InsertItem` has changed to expect a `ListItem` instead of the properties them self
2020-09-23 20:46:36 +02:00
Andreas Bieber 1b44920167 feat(dropdown): Add setters for dropdown list colors 2020-09-23 20:46:36 +02:00
Andreas Bieber 41a24756f9 feat(FormItems): Allow specifying colors for focused state 2020-09-23 20:46:31 +02:00
Trevor Slocum 8292f9baf2 Upgrade tcell to v2
Resolves #32.
2020-08-30 08:37:17 -07:00
Trevor Slocum 48c31ff1a0 Remove wiki references 2020-04-26 16:59:33 -07:00
rivo 1f765c8695 Merge pull request #422 from rivo/mouse
Add mouse support
2020-03-30 10:22:55 -07:00
Trevor Slocum e29d4b73b9 Make cview thread-safe 2020-03-25 14:32:57 +00:00
Trevor Slocum de6819cc76 Fix applying ScrollBarNever to DropDown or InputField 2020-02-13 15:08:36 -08:00
Trevor Slocum 96f3c15040 Add scroll bar to List, DropDown, Table and TreeView 2020-02-01 07:27:15 -08:00
Trevor Slocum 5f880bc2c7 Migrate to GitLab 2020-01-22 15:28:19 -08:00
Trevor Slocum 6d9b735867 Fix dropdown mouse capture behavior 2020-01-04 21:43:26 -08:00
Chris Miller a52eae5a0d Refactor EventMouse 2020-01-01 20:24:34 -08:00
Chris Miller ad59b43801 Get mouse actions rather than just mouse state 2020-01-01 20:18:40 -08:00
Chris Miller 806d63d900 Fix dropdown focus 2020-01-01 20:18:40 -08:00
Chris Miller 5bac390ebc Dismiss dropdown by click 2020-01-01 20:18:40 -08:00
Chris Miller b243f370d8 DropDown mouse support 2020-01-01 20:18:40 -08:00
Chris Miller 5b47ba1f32 More mouse handling for primitives 2020-01-01 20:18:40 -08:00
Trevor Slocum b61132eddf Fork tview as cview
See for details
2019-12-30 15:18:26 -08:00
Oliver c3d1d4bcf9 Added autocomplete functionality to InputField. Resolves #299, resolves #77 2019-07-08 09:34:06 +01:00
Oliver 95de965571 Selection bar in DropDown stretches entire width now. Also added SetTextOptions() with prefixes/suffixes etc. Resolves #289 2019-07-05 10:48:25 +01:00
Oliver 9d616aee87 DropDown's SetCurrentOption() will also trigger the selected event. Closes #256, resolves #260 2019-04-05 23:20:22 +02:00
Oliver 8d5eba0c2f Replaced runewidth.StringWidth() with my own implementation. Fixes #236 2019-03-19 12:13:40 +01:00
Oliver 997b18eeff Introduced a separate class-wide "selected" handler for DropDown. Resolves #206 2019-01-23 16:51:16 +01:00
Oliver 768070ef7b Hitting Escape on a drop-down selection resets it. 2018-07-19 12:46:48 +02:00
Oliver 7d789421e3 DropDown now only uses List's main selected callback. Fixes #115 2018-05-12 16:35:32 +02:00
Oliver f855bee020 Separated form item "done" function from "finished" function. Resolves #39 2018-04-19 21:34:03 +02:00
Oliver 5bd22542e5 For Form.GetFormItemByLabel() to work, we must not modify the label text. Fixes #94, fixes #99 2018-04-09 21:07:03 +02:00
Oliver 761e3d72da Added Primitive demo to go along with the GitHub Wiki entry on how to create your own primitive. 2018-03-19 21:25:30 +01:00