2020-05-26 06:51:06 +00:00
|
|
|
package ui
|
|
|
|
|
|
|
|
import (
|
2020-06-06 07:44:36 +00:00
|
|
|
"github.com/diamondburned/cchat-gtk/internal/ui/messages"
|
2020-05-26 06:51:06 +00:00
|
|
|
"github.com/diamondburned/cchat-gtk/internal/ui/service"
|
|
|
|
"github.com/gotk3/gotk3/gtk"
|
|
|
|
)
|
|
|
|
|
|
|
|
type window struct {
|
2020-06-13 21:51:03 +00:00
|
|
|
*gtk.Paned
|
2020-05-26 06:51:06 +00:00
|
|
|
Services *service.View
|
2020-06-06 07:44:36 +00:00
|
|
|
MessageView *messages.View
|
2020-05-26 06:51:06 +00:00
|
|
|
}
|
|
|
|
|
2020-07-14 07:24:55 +00:00
|
|
|
func newWindow(mainctl service.Controller) *window {
|
|
|
|
services := service.NewView(mainctl)
|
2020-06-13 21:51:03 +00:00
|
|
|
services.SetSizeRequest(leftMinWidth, -1)
|
|
|
|
services.Show()
|
2020-05-26 06:51:06 +00:00
|
|
|
|
2020-06-13 21:51:03 +00:00
|
|
|
mesgview := messages.NewView()
|
|
|
|
mesgview.Show()
|
2020-05-28 19:26:55 +00:00
|
|
|
|
2020-06-13 21:51:03 +00:00
|
|
|
pane, _ := gtk.PanedNew(gtk.ORIENTATION_HORIZONTAL)
|
|
|
|
pane.Pack1(services, false, false)
|
|
|
|
pane.Pack2(mesgview, true, false)
|
|
|
|
pane.SetPosition(leftCurrentWidth)
|
|
|
|
pane.Show()
|
2020-05-26 06:51:06 +00:00
|
|
|
|
2020-06-13 21:51:03 +00:00
|
|
|
return &window{pane, services, mesgview}
|
2020-05-26 06:51:06 +00:00
|
|
|
}
|
2020-07-14 07:24:55 +00:00
|
|
|
|
|
|
|
func (w *window) AllServices() []*service.Service {
|
|
|
|
return w.Services.Services.Services
|
|
|
|
}
|