module Manatee.Toolkit.Gtk.Notebook where
import Control.Monad
import Graphics.UI.Gtk
import Manatee.Toolkit.General.Basic
import Manatee.Toolkit.General.Functor
import Manatee.Toolkit.General.Maybe
notebookAppendPage_ :: (NotebookClass notebook, WidgetClass child) => notebook -> child -> String -> IO Int
notebookAppendPage_ notebook child str =
widgetShowAll child >> notebookAppendPage notebook child str
notebookAppendPageMenu_ :: (NotebookClass notebook, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel) =>
notebook -> child -> tabLabel -> menuLabel -> IO Int
notebookAppendPageMenu_ notebook child tabLabel menuLabel =
widgetShowAll child >> widgetShowAll tabLabel >> notebookAppendPageMenu notebook child tabLabel menuLabel
notebookAppendPageTab_ :: (NotebookClass notebook, WidgetClass child, WidgetClass tabLabel) =>
notebook -> child -> tabLabel -> IO Int
notebookAppendPageTab_ notebook child tabLabel = do
menuLabel <- labelNew Nothing
widgetShowAll child >> widgetShowAll tabLabel >> notebookAppendPageMenu notebook child tabLabel menuLabel
notebookPrependPage_ :: (NotebookClass notebook, WidgetClass child) => notebook -> child -> String -> IO Int
notebookPrependPage_ notebook child str =
widgetShowAll child >> notebookPrependPage notebook child str
notebookPrependPageMenu_ :: (NotebookClass notebook, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel) =>
notebook -> child -> tabLabel -> menuLabel -> IO Int
notebookPrependPageMenu_ notebook child tabLabel menuLabel =
widgetShowAll child >> widgetShowAll tabLabel >> notebookPrependPageMenu notebook child tabLabel menuLabel
notebookPrependPageTab_ :: (NotebookClass notebook, WidgetClass child, WidgetClass tabLabel) =>
notebook -> child -> tabLabel -> IO Int
notebookPrependPageTab_ notebook child tabLabel = do
menuLabel <- labelNew Nothing
widgetShowAll child >> widgetShowAll tabLabel >> notebookPrependPageMenu notebook child tabLabel menuLabel
notebookInsertPage_ :: (NotebookClass notebook, WidgetClass child) => notebook -> child -> String -> Int -> IO Int
notebookInsertPage_ notebook child str pos =
widgetShowAll child >> notebookInsertPage notebook child str pos
notebookInsertPageMenu_ :: (NotebookClass notebook, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel) =>
notebook -> child -> tabLabel -> menuLabel -> Int -> IO Int
notebookInsertPageMenu_ notebook child tabLabel menuLabel pos =
widgetShowAll child >> widgetShowAll tabLabel >> notebookInsertPageMenu notebook child tabLabel menuLabel pos
notebookInsertPageTab_ :: (NotebookClass notebook, WidgetClass child, WidgetClass tabLabel) =>
notebook -> child -> tabLabel -> Int -> IO Int
notebookInsertPageTab_ notebook child tabLabel pos = do
menuLabel <- labelNew Nothing
widgetShowAll child >> widgetShowAll tabLabel >> notebookInsertPageMenu notebook child tabLabel menuLabel pos
notebookRemoveChild :: (NotebookClass notebook, WidgetClass child) => notebook -> child -> IO ()
notebookRemoveChild notebook child =
notebookPageNum notebook child >>=
(?>= notebookRemovePage notebook)
notebookInsertReorderPage :: (NotebookClass notebook, WidgetClass child) => notebook -> child -> String -> Int -> IO ()
notebookInsertReorderPage notebook child str pos = do
notebookInsertPage_ notebook child str pos
notebookSetTabReorderable notebook child True
notebookFocusCurrentPage :: NotebookClass notebook => notebook -> IO ()
notebookFocusCurrentPage notebook = do
widgetGrabFocus notebook
page <- notebookGetCurrentPage_ notebook
page ?>= widgetGrabFocus
notebookGetCurrentPage_ :: NotebookClass notebook => notebook -> IO (Maybe Widget)
notebookGetCurrentPage_ notebook =
notebookGetCurrentPage notebook
>>= notebookGetNthPage notebook
notebookSelectNextPage :: NotebookClass notebook => notebook -> IO ()
notebookSelectNextPage notebook =
ifF notebook notebookAtEnd notebookSelectFirstPage notebookNextPage
notebookSelectPrevPage :: NotebookClass notebook => notebook -> IO ()
notebookSelectPrevPage notebook =
ifF notebook notebookAtStart notebookSelectLastPage notebookPrevPage
notebookSelectFirstPage :: NotebookClass notebook => notebook -> IO ()
notebookSelectFirstPage notebook =
notebookSetCurrentPage notebook
=<< notebookFirstIndex notebook
notebookSelectLastPage :: NotebookClass notebook => notebook -> IO ()
notebookSelectLastPage notebook =
notebookSetCurrentPage notebook
=<< notebookLastIndex notebook
notebookAtStart :: NotebookClass notebook => notebook -> IO Bool
notebookAtStart notebook =
liftM2 (==) (notebookGetCurrentPage notebook) (notebookFirstIndex notebook)
notebookAtEnd :: NotebookClass notebook => notebook -> IO Bool
notebookAtEnd notebook =
liftM2 (==) (notebookGetCurrentPage notebook) (notebookLastIndex notebook)
notebookFirstIndex :: NotebookClass notebook => notebook -> IO Int
notebookFirstIndex _ = return 0
notebookLastIndex :: NotebookClass notebook => notebook -> IO Int
notebookLastIndex = (<<<=) pred notebookGetNPages
notebookSetTabName :: NotebookClass notebook => notebook -> Int -> String -> IO ()
notebookSetTabName notebook index name =
notebookGetNthPage notebook index
>?>= \child -> notebookSetTabLabelText notebook child name