1
0
Fork 0
mirror of https://github.com/diamondburned/cchat-gtk.git synced 2024-11-10 16:25:00 +00:00
cchat-gtk/internal/ui/messages/message/timestamp.go

28 lines
529 B
Go
Raw Normal View History

2021-01-05 02:05:33 +00:00
package message
import (
"github.com/diamondburned/cchat-gtk/internal/ui/primitives"
"github.com/gotk3/gotk3/gtk"
"github.com/gotk3/gotk3/pango"
)
var timestampCSS = primitives.PrepareClassCSS("message-time", `
.message-time {
opacity: 0.3;
font-size: 0.8em;
margin-top: 0.2em;
margin-bottom: 0.2em;
}
`)
func NewTimestamp() *gtk.Label {
ts, _ := gtk.LabelNew("")
ts.SetEllipsize(pango.ELLIPSIZE_MIDDLE)
ts.SetXAlign(0.5) // centre align
ts.SetVAlign(gtk.ALIGN_END)
ts.Show()
timestampCSS(ts)
return ts
}