{-# LINE 2 "./Graphics/UI/Gtk/Selectors/FileSelection.chs" #-}
module Graphics.UI.Gtk.Selectors.FileSelection (
FileSelection,
FileSelectionClass,
castToFileSelection, gTypeFileSelection,
toFileSelection,
fileSelectionNew,
fileSelectionSetFilename,
fileSelectionGetFilename,
fileSelectionShowFileopButtons,
fileSelectionHideFileopButtons,
fileSelectionGetButtons,
fileSelectionComplete,
fileSelectionGetSelections,
fileSelectionSetSelectMultiple,
fileSelectionGetSelectMultiple,
fileSelectionFilename,
fileSelectionShowFileops,
fileSelectionSelectMultiple,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Attributes
import System.Glib.Properties
import Graphics.UI.Gtk.Types
{-# LINE 103 "./Graphics/UI/Gtk/Selectors/FileSelection.chs" #-}
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.General.Structs (fileSelectionGetButtons)
{-# LINE 107 "./Graphics/UI/Gtk/Selectors/FileSelection.chs" #-}
fileSelectionNew :: GlibString string
=> string
-> IO FileSelection
fileSelectionNew title =
makeNewObject mkFileSelection $
liftM (castPtr :: Ptr Widget -> Ptr FileSelection) $
withUTFString title $ \titlePtr ->
gtk_file_selection_new
{-# LINE 125 "./Graphics/UI/Gtk/Selectors/FileSelection.chs" #-}
titlePtr
fileSelectionSetFilename :: (FileSelectionClass self, GlibString string) => self
-> string
-> IO ()
fileSelectionSetFilename self filename =
withUTFString filename $ \filenamePtr ->
(\(FileSelection arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_file_selection_set_filename argPtr1 arg2)
{-# LINE 147 "./Graphics/UI/Gtk/Selectors/FileSelection.chs" #-}
(toFileSelection self)
filenamePtr
fileSelectionGetFilename :: (FileSelectionClass self, GlibString string) => self
-> IO string
fileSelectionGetFilename self =
(\(FileSelection arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_file_selection_get_filename argPtr1)
{-# LINE 162 "./Graphics/UI/Gtk/Selectors/FileSelection.chs" #-}
(toFileSelection self)
>>= peekUTFString
fileSelectionShowFileopButtons :: FileSelectionClass self => self -> IO ()
fileSelectionShowFileopButtons self =
(\(FileSelection arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_file_selection_show_fileop_buttons argPtr1)
{-# LINE 172 "./Graphics/UI/Gtk/Selectors/FileSelection.chs" #-}
(toFileSelection self)
fileSelectionHideFileopButtons :: FileSelectionClass self => self -> IO ()
fileSelectionHideFileopButtons self =
(\(FileSelection arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_file_selection_hide_fileop_buttons argPtr1)
{-# LINE 181 "./Graphics/UI/Gtk/Selectors/FileSelection.chs" #-}
(toFileSelection self)
fileSelectionComplete :: (FileSelectionClass self, GlibString string) => self
-> string
-> IO ()
fileSelectionComplete self pattern =
withUTFString pattern $ \patternPtr ->
(\(FileSelection arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_file_selection_complete argPtr1 arg2)
{-# LINE 197 "./Graphics/UI/Gtk/Selectors/FileSelection.chs" #-}
(toFileSelection self)
patternPtr
fileSelectionGetSelections :: (FileSelectionClass self, GlibString string) => self -> IO [string]
fileSelectionGetSelections self = do
cStrArr <-
(\(FileSelection arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_file_selection_get_selections argPtr1)
{-# LINE 211 "./Graphics/UI/Gtk/Selectors/FileSelection.chs" #-}
(toFileSelection self)
cStrs <- peekArray0 nullPtr cStrArr
result <- mapM peekUTFString cStrs
g_strfreev cStrArr
return result
fileSelectionSetSelectMultiple :: FileSelectionClass self => self
-> Bool
-> IO ()
fileSelectionSetSelectMultiple self selectMultiple =
(\(FileSelection arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_file_selection_set_select_multiple argPtr1 arg2)
{-# LINE 227 "./Graphics/UI/Gtk/Selectors/FileSelection.chs" #-}
(toFileSelection self)
(fromBool selectMultiple)
fileSelectionGetSelectMultiple :: FileSelectionClass self => self
-> IO Bool
fileSelectionGetSelectMultiple self =
liftM toBool $
(\(FileSelection arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_file_selection_get_select_multiple argPtr1)
{-# LINE 239 "./Graphics/UI/Gtk/Selectors/FileSelection.chs" #-}
(toFileSelection self)
fileSelectionFilename :: (FileSelectionClass self, GlibString string) => Attr self string
fileSelectionFilename = newAttr
fileSelectionGetFilename
fileSelectionSetFilename
fileSelectionShowFileops :: FileSelectionClass self => Attr self Bool
fileSelectionShowFileops = newAttrFromBoolProperty "show-fileops"
fileSelectionSelectMultiple :: FileSelectionClass self => Attr self Bool
fileSelectionSelectMultiple = newAttr
fileSelectionGetSelectMultiple
fileSelectionSetSelectMultiple
foreign import ccall unsafe "gtk_file_selection_new"
gtk_file_selection_new :: ((Ptr CChar) -> (IO (Ptr Widget)))
foreign import ccall unsafe "gtk_file_selection_set_filename"
gtk_file_selection_set_filename :: ((Ptr FileSelection) -> ((Ptr CChar) -> (IO ())))
foreign import ccall unsafe "gtk_file_selection_get_filename"
gtk_file_selection_get_filename :: ((Ptr FileSelection) -> (IO (Ptr CChar)))
foreign import ccall safe "gtk_file_selection_show_fileop_buttons"
gtk_file_selection_show_fileop_buttons :: ((Ptr FileSelection) -> (IO ()))
foreign import ccall safe "gtk_file_selection_hide_fileop_buttons"
gtk_file_selection_hide_fileop_buttons :: ((Ptr FileSelection) -> (IO ()))
foreign import ccall safe "gtk_file_selection_complete"
gtk_file_selection_complete :: ((Ptr FileSelection) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_file_selection_get_selections"
gtk_file_selection_get_selections :: ((Ptr FileSelection) -> (IO (Ptr (Ptr CChar))))
foreign import ccall unsafe "g_strfreev"
g_strfreev :: ((Ptr (Ptr CChar)) -> (IO ()))
foreign import ccall safe "gtk_file_selection_set_select_multiple"
gtk_file_selection_set_select_multiple :: ((Ptr FileSelection) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_file_selection_get_select_multiple"
gtk_file_selection_get_select_multiple :: ((Ptr FileSelection) -> (IO CInt))