summaryrefslogtreecommitdiff
path: root/src/rhlibrary/mainwindow.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/rhlibrary/mainwindow.go')
-rw-r--r--src/rhlibrary/mainwindow.go64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/rhlibrary/mainwindow.go b/src/rhlibrary/mainwindow.go
new file mode 100644
index 0000000..bfa0ac7
--- /dev/null
+++ b/src/rhlibrary/mainwindow.go
@@ -0,0 +1,64 @@
+//
+// rhlibrary
+//
+// The Radio Helsinki Rivendell Library
+//
+//
+// Copyright (C) 2016 Christian Pointner <equinox@helsinki.at>
+//
+// This file is part of rhlibrary.
+//
+// rhlibrary is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// rhlibrary is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with rhlibrary. If not, see <http://www.gnu.org/licenses/>.
+//
+
+package main
+
+import (
+ "github.com/gotk3/gotk3/gtk"
+)
+
+func init() {
+ gtk.Init(nil)
+}
+
+type MainWindow struct {
+ win *gtk.Window
+}
+
+func (mw *MainWindow) ShowAndRun() {
+ mw.win.ShowAll()
+ gtk.Main()
+}
+
+func NewMainWindow() (mw *MainWindow, err error) {
+ mw = &MainWindow{}
+ // Create a new toplevel window, set its title, and connect it to the
+ // "destroy" signal to exit the GTK main loop when it is destroyed.
+ if mw.win, err = gtk.WindowNew(gtk.WINDOW_TOPLEVEL); err != nil {
+ return
+ }
+ mw.win.SetTitle("rhlibrary")
+ mw.win.Connect("destroy", func() {
+ gtk.MainQuit()
+ })
+
+ var l *gtk.Label
+ if l, err = gtk.LabelNew("Hello, world!"); err != nil {
+ return
+ }
+ mw.win.Add(l)
+
+ mw.win.SetDefaultSize(800, 600)
+ return
+}