module System.Taffybar.Widget.Decorators where
import Control.Monad.IO.Class
import qualified Graphics.UI.Gtk as Gtk
import System.Taffybar.Widget.Util
buildPadBox :: (Gtk.WidgetClass widget, MonadIO m) => widget -> m Gtk.Widget
buildPadBox contents = liftIO $ do
innerBox <- Gtk.hBoxNew False 0
outerBox <- Gtk.eventBoxNew
Gtk.containerAdd innerBox contents
Gtk.containerAdd outerBox innerBox
_ <- widgetSetClass innerBox "inner-pad"
_ <- widgetSetClass outerBox "outer-pad"
Gtk.widgetShow outerBox
Gtk.widgetShow innerBox
return $ Gtk.toWidget outerBox
buildContentsBox :: (Gtk.WidgetClass widget, MonadIO m) => widget -> m Gtk.Widget
buildContentsBox widget = liftIO $ do
contents <- Gtk.hBoxNew False 0
Gtk.containerAdd contents widget
_ <- widgetSetClass contents "contents"
Gtk.widgetShowAll contents
buildPadBox contents