diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2024-11-09 08:50:19 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2024-11-09 17:20:19 +0100 |
commit | 4aebe3b0e5aa8af56b8749f69afc906bcf71c228 (patch) | |
tree | 937824110e177a668895a778fc5ec17d564779d3 /xA/xA.go | |
parent | 4048a346dfa6b84e3b1542872b64b29c69f119f4 (diff) | |
download | xK-4aebe3b0e5aa8af56b8749f69afc906bcf71c228.tar.gz xK-4aebe3b0e5aa8af56b8749f69afc906bcf71c228.tar.xz xK-4aebe3b0e5aa8af56b8749f69afc906bcf71c228.zip |
WIP: xA: topic
Diffstat (limited to 'xA/xA.go')
-rw-r--r-- | xA/xA.go | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -182,6 +182,7 @@ var ( // Widgets: wWindow fyne.Window + wTopic *widget.RichText wRichText *widget.RichText wRichScroll *container.Scroll wEntry *widget.Entry @@ -308,7 +309,20 @@ func refreshIcon() { } func refreshTopic(topic []bufferLineItem) { - // TODO(p): First off, add a topic, second, refresh it. + wTopic.Segments = nil + for _, item := range topic { + wTopic.Segments = append(wTopic.Segments, &widget.TextSegment{ + Text: item.text, + Style: widget.RichTextStyle{ + Alignment: fyne.TextAlignLeading, + ColorName: item.color, + Inline: true, + SizeName: theme.SizeNameText, + TextStyle: item.format, + }, + }) + } + wTopic.Refresh() } func refreshBufferList() { @@ -876,11 +890,14 @@ func main() { // TODO(p): There should also be a widget.NewLabel() next to the entry. // - Probably another Border, even though this seems odd. + wTopic = widget.NewRichText() + wTopic.Truncation = fyne.TextTruncateEllipsis wRichText = widget.NewRichText() wRichText.Wrapping = fyne.TextWrapWord wRichScroll = container.NewVScroll(wRichText) wEntry = widget.NewMultiLineEntry() - wWindow.SetContent(container.NewBorder(nil, wEntry, nil, nil, wRichScroll)) + wWindow.SetContent(container.NewBorder( + wTopic, wEntry, nil, nil, wRichScroll)) go relayRun() |