mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Add support for a new 'border' property on widgets
Sets whether or not the widget should be drawn with a border (and by extension a title). If 'true', the border is drawn. If 'false', no border is drawn. Defaults. to 'true'. Optional.
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
)
|
||||
|
||||
type TextWidget struct {
|
||||
bordered bool
|
||||
commonSettings *cfg.Common
|
||||
enabled bool
|
||||
focusable bool
|
||||
@@ -25,6 +26,7 @@ func NewTextWidget(app *tview.Application, commonSettings *cfg.Common, focusable
|
||||
commonSettings: commonSettings,
|
||||
|
||||
app: app,
|
||||
bordered: commonSettings.Bordered,
|
||||
enabled: commonSettings.Enabled,
|
||||
focusable: focusable,
|
||||
focusChar: commonSettings.FocusChar(),
|
||||
@@ -33,12 +35,18 @@ func NewTextWidget(app *tview.Application, commonSettings *cfg.Common, focusable
|
||||
}
|
||||
|
||||
widget.View = widget.addView()
|
||||
widget.View.SetBorder(widget.bordered)
|
||||
|
||||
return widget
|
||||
}
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
// Bordered returns whether or not this widget should be drawn with a border
|
||||
func (widget *TextWidget) Bordered() bool {
|
||||
return widget.bordered
|
||||
}
|
||||
|
||||
func (widget *TextWidget) BorderColor() string {
|
||||
if widget.Focusable() {
|
||||
return widget.commonSettings.Colors.BorderFocusable
|
||||
|
||||
Reference in New Issue
Block a user