1
0
Fork 0
mirror of https://github.com/diamondburned/cchat-gtk.git synced 2024-10-31 19:44:23 +00:00
cchat-gtk/internal/ui/messages/container/compact/message.go

45 lines
1,009 B
Go
Raw Normal View History

2020-06-06 07:44:36 +00:00
package compact
import (
"github.com/diamondburned/cchat"
"github.com/diamondburned/cchat-gtk/internal/ui/messages/container"
"github.com/diamondburned/cchat-gtk/internal/ui/messages/input"
"github.com/diamondburned/cchat-gtk/internal/ui/messages/message"
"github.com/gotk3/gotk3/gtk"
)
type PresendMessage struct {
2020-06-07 04:27:28 +00:00
message.PresendContainer
Message
2020-06-06 07:44:36 +00:00
}
func NewPresendMessage(msg input.PresendMessage) PresendMessage {
2020-06-07 04:27:28 +00:00
var msgc = message.NewPresendContainer(msg)
2020-06-06 07:44:36 +00:00
return PresendMessage{
2020-06-07 04:27:28 +00:00
PresendContainer: msgc,
Message: Message{msgc.GenericContainer},
2020-06-06 07:44:36 +00:00
}
}
type Message struct {
*message.GenericContainer
}
var _ container.GridMessage = (*Message)(nil)
func NewMessage(msg cchat.MessageCreate) Message {
2020-06-07 04:27:28 +00:00
msgc := message.NewContainer(msg)
message.FillContainer(msgc, msg)
2020-06-07 04:27:28 +00:00
return Message{msgc}
2020-06-06 07:44:36 +00:00
}
func NewEmptyMessage() Message {
2020-06-07 04:27:28 +00:00
return Message{message.NewEmptyContainer()}
2020-06-06 07:44:36 +00:00
}
2020-10-21 23:47:17 +00:00
func (m Message) Attach() []gtk.IWidget {
return []gtk.IWidget{m.Timestamp, m.Username, m.Content}
2020-06-06 07:44:36 +00:00
}