hkgui02/app/Main.hs

69 lines
1.8 KiB
Haskell
Raw Normal View History

{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import Data.GI.Base
import qualified GI.Gtk as Gtk
import System.Directory
main :: IO ()
main = do
_ <- Gtk.init Nothing
win <- Gtk.windowNew Gtk.WindowTypeToplevel
Gtk.setContainerBorderWidth win 10
Gtk.setWindowTitle win "Zenith - full node wallet"
Gtk.setWindowResizable win False
Gtk.setWindowDefaultWidth win 600
Gtk.setWindowDefaultHeight win 450
Gtk.setWindowWindowPosition win Gtk.WindowPositionCenter
-- Gtk.windowSetDecorated win False
home <- getHomeDirectory
img1 <- Gtk.imageNewFromFile $ home ++ "/Development/HaskelDev/hk-gui/hkgui02/zenith-qr.png"
img2 <- Gtk.imageNewFromFile $ home ++ "/Development/HaskelDev/hk-gui/hkgui02/bp32.png"
spacer <- Gtk.labelNew Nothing
Gtk.labelSetMarkup spacer " "
label1 <- Gtk.labelNew Nothing
Gtk.labelSetMarkup label1 "<b>Cancel</b>"
label0 <- Gtk.labelNew Nothing
Gtk.labelSetMarkup label0 "Zenith"
btn <- Gtk.buttonNew
Gtk.buttonSetRelief btn Gtk.ReliefStyleNormal
Gtk.buttonSetImage btn $ Just img2
Gtk.buttonSetImagePosition btn Gtk.PositionTypeLeft
Gtk.widgetSetHexpand btn False
Gtk.buttonSetLabel btn "Cancel"
_ <- on btn #clicked $ do
putStrLn "User choose: close"
Gtk.widgetDestroy win
-- on btn #clicked (set msg [ #label := "Clicked!"])
box <- new Gtk.Box [ #orientation := Gtk.OrientationVertical ]
grid <- Gtk.gridNew
Gtk.gridSetColumnSpacing grid 10
Gtk.gridSetRowSpacing grid 10
Gtk.gridSetColumnHomogeneous grid True
#attach grid spacer 0 0 1 1
#attach grid btn 1 0 1 1
#add win box
#packStart box label0 True False 10
#packStart box img1 True False 10
#packStart box grid True False 10
_ <- Gtk.onWidgetDestroy win Gtk.mainQuit
#showAll win
Gtk.main