Commit Graph

64 Commits

Author SHA1 Message Date
Trevor Slocum 36671ba7d3 Rename SetBorderPadding and GetBorderPadding as SetPadding and GetPadding 2020-10-26 10:41:47 -07:00
Trevor Slocum 0b2c8f8a5d Allow hiding form items
Resolves #13.
2020-10-19 21:12:22 -07:00
Trevor Slocum d7f1e2ab2a Add SetVisible and GetVisible to all widgets 2020-10-19 19:05:03 -07:00
Trevor Slocum 9c3564dc42 Add Slider 2020-10-11 13:39:04 -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 3d1844e33b Panic when attempting to add an invalid FormItem 2020-10-02 16:31:31 -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 89fa23ab00 Resolve lint warnings 2020-09-23 16:14:53 -07:00
Andreas Bieber 70857602a5 feat(FormItem): Replace `SetFormAttributes` with `SetAttributes`
BREAKING CHANGE:
`SetFormAttributes` has been removed. To migrate your project, use `SetAttributes` which expects any combination of attribute setters.
Example:
`formItem.SetAttributes(cview.WithLabelWidth(10), cview.WithLabelColor(tcell.ColorYellow))`
or
`formItem.SetAttributes(cview.WithBackgroundColor(tcell.ColorBlack))`
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 128c6692d4 fix(form/Draw): Use button colors for focused state 2020-09-23 20:54:48 +02:00
Andreas Bieber 367d377081 fix(form/GetFormItem): Check whether index is out of bounds, if so, return nil 2020-09-23 20:54:48 +02:00
Andreas Bieber f71273b9c8 feat(dropdown): Expose `DropDownOption`
BREAKING CHANGE:
DropDown:
- 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`

Form:
- 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 41a24756f9 feat(FormItems): Allow specifying colors for focused state 2020-09-23 20:46:31 +02:00
Andreas Bieber 02c4995bb2 feat(form): Add `IndexOfFormItem` 2020-09-19 11:25:32 +02:00
Trevor Slocum 8292f9baf2 Upgrade tcell to v2
Resolves #32.
2020-08-30 08:37:17 -07:00
Trevor Slocum cdeff20296 Use sync.RWMutex in all widgets
Resolves #30.
2020-08-02 10:06:34 -07:00
Trevor Slocum fb4953b17a Fix Form.Clear deadlock
Resolves #28.
2020-06-29 21:44:21 -07:00
Trevor Slocum 48c31ff1a0 Remove wiki references 2020-04-26 16:59:33 -07:00
Trevor Slocum de0eb1ea89 Rename CheckBox 2020-04-26 16:55:45 -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 afcd7dcdab Do not wrap around form by default 2020-02-22 10:19:34 -08:00
Trevor Slocum 5f880bc2c7 Migrate to GitLab 2020-01-22 15:28:19 -08:00
Trevor Slocum 51704b9844 Add documentation for GetChildren methods 2020-01-16 22:34:51 -08:00
Oliver 2941d561fb Added GetFocusedItemIndex() to Form. Resolves #293 2020-01-08 16:31:04 -08:00
Trevor Slocum c90e430fdf Add optional message displayed after Checkbox 2020-01-05 09:41:15 -08:00
Chris Miller 74b2573bf9 Added mouse handling 2020-01-01 20:18:40 -08:00
Trevor Slocum b61132eddf Fork tview as cview
See FORK.md for details
2019-12-30 15:18:26 -08:00
Oliver 9c225ecd57 Added GetFormItemCount() to Form. Resolves #298 2019-11-27 19:18:27 +01:00
Oliver f8bc69b903 Every redraw of a Form re-evaluates the focus index. Fixes #144 2019-08-29 18:12:55 +02:00
Mike Schinkel c2c3679add Fix initialization bug in AddDropDown(), issue #290. 2019-06-03 20:40:09 -04:00
Oliver 384f577a62 Added SetFocus() to Form which changes the focus to a specific form element. Resolves #286 2019-06-02 21:31:59 +02:00
Oliver f16ba37c6a Added functions to remove all buttons from forms and from modals. Resolves #259 2019-05-14 16:48:29 +02:00
Oliver 8d5eba0c2f Replaced runewidth.StringWidth() with my own implementation. Fixes #236 2019-03-19 12:13:40 +01:00
Oliver 5991278513 If a Form has no focusable elements, it keeps the focus itself. Fixes #198 2018-12-03 18:28:59 +01:00
Oliver a677b985cc Allowing the use of arrow keys in modal buttons, too. Resolves #167 2018-09-26 11:35:00 +02:00
Oliver 21f50f5bc4 Fixed the docs of FormItem. Fixes #153 2018-08-07 09:25:40 +02:00
Oliver c33dd0cf8e Added form item removal functions and more ways to find items. Resolves #137 2018-07-17 20:18:39 +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 cc84c982fc Added GetFormItemByLabel(). Resolves #94 2018-04-07 12:58:52 +02:00
Oliver 258c9d1f8e Forms will attempt to keep focused form items within available area. Fixes #79 2018-03-15 17:54:17 +01:00
Oliver 2a83b20ce3 Improved documentation. 2018-01-24 21:48:53 +01:00
Oliver 7c086b1113 Updated Form documentation. 2018-01-19 08:37:01 +01:00
Oliver 4db30f9ed4 "FieldLength" is now "FieldWidth" everywhere for clarity and consistency. Sorry for this breaking change. It is better in the long run. 2018-01-17 21:17:59 +01:00
Oliver 258f212e5e Added color tag functionality to all strings. Resolves #25 2018-01-17 17:13:36 +01:00
Oliver aa25839cfa Introduced horizontal item alignment in forms. Resolves #33 2018-01-16 20:45:54 +01:00