module Manatee.UI.UIFrame where
import Graphics.UI.Gtk hiding (Statusbar, statusbarNew)
import Manatee.Types
import Manatee.Toolkit.Gtk.Gtk
import Manatee.Toolkit.Gtk.Notebook
import Manatee.Toolkit.Widget.Interactivebar
import Manatee.Toolkit.Widget.NotebookTab
import Manatee.Toolkit.Widget.Outputbar
import Manatee.Toolkit.Widget.Statusbar
uiFrameStick :: NotebookClass notebook => notebook -> Maybe UIFrame -> IO UIFrame
uiFrameStick notebook frame = do
uiFrame <- case frame of
Just f -> uiFrameClone f
Nothing -> uiFrameNew
let notebookTab = uiFrameNotebookTab uiFrame
notebookAppendPageTab_ notebook (uiFrameBox uiFrame) (ntBox notebookTab)
notebookSetTabReorderable notebook (uiFrameBox uiFrame) False
notebookTabStart notebookTab
return uiFrame
uiFrameNew :: IO UIFrame
uiFrameNew = do
box <- vBoxNew False 0
interactivebar <- interactivebarNew
frame <- frameNewWithShadowType Nothing
boxPackStart box frame PackGrow 0
outputbar <- outputbarNew
statusbar <- statusbarNew box
notebookTab <- notebookTabNew Nothing Nothing
return $ UIFrame box interactivebar frame outputbar statusbar notebookTab
uiFrameClone :: UIFrame -> IO UIFrame
uiFrameClone oldUIFrame = do
box <- vBoxNew False 0
interactivebar <- interactivebarClone box (uiFrameInteractivebar oldUIFrame)
frame <- frameNewWithShadowType Nothing
boxPackStart box frame PackGrow 0
outputbar <- outputbarNew
statusbar <- statusbarClone box (uiFrameStatusbar oldUIFrame)
notebookTab <- notebookTabNew Nothing Nothing
return $ UIFrame box interactivebar frame outputbar statusbar notebookTab
uiFrameShowInteractivebar :: UIFrame -> IO ()
uiFrameShowInteractivebar uiFrame =
interactivebarShow (uiFrameBox uiFrame)
(uiFrameInteractivebar uiFrame)
uiFrameHideInteractivebar :: UIFrame -> IO ()
uiFrameHideInteractivebar uiFrame =
interactivebarExit (uiFrameBox uiFrame)
(uiFrameInteractivebar uiFrame)
uiFrameIsFocusInteractivebar :: UIFrame -> IO Bool
uiFrameIsFocusInteractivebar =
widgetGetIsFocus . interactivebarEntry . uiFrameInteractivebar
uiFrameShowOutputbar :: UIFrame -> String -> IO ()
uiFrameShowOutputbar uiFrame =
outputbarShow (uiFrameBox uiFrame)
(uiFrameOutputbar uiFrame)
uiFrameUpdateStatusbar :: UIFrame -> String -> String -> IO ()
uiFrameUpdateStatusbar uiFrame =
statusbarInfoItemUpdate (uiFrameStatusbar uiFrame)
uiFrameUpdateProgress :: UIFrame -> Double -> IO ()
uiFrameUpdateProgress uiFrame =
statusbarProgressUpdate (uiFrameStatusbar uiFrame)