|
From: <kr_...@us...> - 2003-04-26 20:56:36
|
Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv3345/port/src/Port
Modified Files:
CommonDialogs.hs
Log Message:
Add owner window as parameter for each function in CommonDialog
Index: CommonDialogs.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/CommonDialogs.hs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CommonDialogs.hs 26 Apr 2003 20:19:31 -0000 1.1
--- CommonDialogs.hs 26 Apr 2003 20:56:33 -0000 1.2
***************
*** 30,67 ****
-- | Run a dialog to select an input file. Returns 'Nothing' when cancelled.
! runInputFileDialog :: String -> [(String,[String])] -> IO (Maybe FilePath)
! runInputFileDialog title filter
= withCString title $ \ctitle ->
withCFilter filter $ \cfilter ->
! do cin <- osSelectInputFile ctitle cfilter
maybeCString cin
! foreign import ccall osSelectInputFile :: CString -> Ptr CChar -> IO CString
-- | Run a dialog to select multiple input files. Returns empty list when canceled.
! runInputFilesDialog :: String -> [(String,[String])] -> IO [FilePath]
! runInputFilesDialog title filter
= withCString title $ \ctitle ->
withCFilter filter $ \cfilter ->
! do cin <- osSelectInputFiles ctitle cfilter
peekCStrings cin
! foreign import ccall osSelectInputFiles :: CString -> Ptr CChar -> IO (Ptr CChar)
-- | Run a dialog to select an output file. Takes both a dialog title and a
-- suggested filename as arguments. Returns 'Nothing' when cancelled.
! runOutputFileDialog :: String -> [(String,[String])] -> FilePath -> IO (Maybe FilePath)
! runOutputFileDialog title filter fname
= withCString title $ \ctitle ->
withCString fname $ \cname ->
withCFilter filter $ \cfilter ->
! do cout <- osSelectOutputFile ctitle cfilter cname
maybeCString cout
! foreign import ccall osSelectOutputFile :: CString -> Ptr CChar -> CString -> IO CString
-- | Runs a dialog to select a directory. Returns 'Nothing' when cancelled.
! runDirectoryDialog :: String -> IO (Maybe FilePath)
! runDirectoryDialog title
! = do cdir <- withCString title osSelectDirectory
maybeCString cdir
! foreign import ccall osSelectDirectory :: CString -> IO CString
maybeCString :: CString -> IO (Maybe String)
--- 30,68 ----
-- | Run a dialog to select an input file. Returns 'Nothing' when cancelled.
! runInputFileDialog :: String -> [(String,[String])] -> WindowHandle -> IO (Maybe FilePath)
! runInputFileDialog title filter owner
= withCString title $ \ctitle ->
withCFilter filter $ \cfilter ->
! do cin <- osSelectInputFile ctitle cfilter owner
maybeCString cin
! foreign import ccall osSelectInputFile :: CString -> Ptr CChar -> WindowHandle -> IO CString
-- | Run a dialog to select multiple input files. Returns empty list when canceled.
! runInputFilesDialog :: String -> [(String,[String])] -> WindowHandle -> IO [FilePath]
! runInputFilesDialog title filter owner
= withCString title $ \ctitle ->
withCFilter filter $ \cfilter ->
! do cin <- osSelectInputFiles ctitle cfilter owner
peekCStrings cin
! foreign import ccall osSelectInputFiles :: CString -> Ptr CChar -> WindowHandle -> IO (Ptr CChar)
-- | Run a dialog to select an output file. Takes both a dialog title and a
-- suggested filename as arguments. Returns 'Nothing' when cancelled.
! runOutputFileDialog :: String -> [(String,[String])] -> FilePath -> WindowHandle -> IO (Maybe FilePath)
! runOutputFileDialog title filter fname owner
= withCString title $ \ctitle ->
withCString fname $ \cname ->
withCFilter filter $ \cfilter ->
! do cout <- osSelectOutputFile ctitle cfilter cname owner
maybeCString cout
! foreign import ccall osSelectOutputFile :: CString -> Ptr CChar -> CString -> WindowHandle -> IO CString
-- | Runs a dialog to select a directory. Returns 'Nothing' when cancelled.
! runDirectoryDialog :: String -> WindowHandle -> IO (Maybe FilePath)
! runDirectoryDialog title owner
! = withCString title $ \ctitle ->
! do cdir <- osSelectDirectory ctitle owner
maybeCString cdir
! foreign import ccall osSelectDirectory :: CString -> WindowHandle -> IO CString
maybeCString :: CString -> IO (Maybe String)
***************
*** 101,107 ****
-- | Run a dialog to select a color. Returns 'Nothing' when cancelled.
! runColorDialog :: IO (Maybe Color)
! runColorDialog = alloca $ \cref -> do
! res <- osRunColorDialog cref
if res
then do
--- 102,108 ----
-- | Run a dialog to select a color. Returns 'Nothing' when cancelled.
! runColorDialog :: WindowHandle -> IO (Maybe Color)
! runColorDialog owner = alloca $ \cref -> do
! res <- osRunColorDialog cref owner
if res
then do
***************
*** 109,113 ****
return (Just (fromCColor c))
else return Nothing
! foreign import ccall osRunColorDialog :: Ptr CColor -> IO Bool
-----------------------------------------------------------------------------------------
--- 110,114 ----
return (Just (fromCColor c))
else return Nothing
! foreign import ccall osRunColorDialog :: Ptr CColor -> WindowHandle -> IO Bool
-----------------------------------------------------------------------------------------
***************
*** 116,121 ****
-- | Run a dialog to select a font. Returns 'Nothing' when cancelled.
! runFontDialog :: IO (Maybe FontDef)
! runFontDialog =
alloca $ \fnameref ->
alloca $ \fsizeref ->
--- 117,122 ----
-- | Run a dialog to select a font. Returns 'Nothing' when cancelled.
! runFontDialog :: WindowHandle -> IO (Maybe FontDef)
! runFontDialog owner =
alloca $ \fnameref ->
alloca $ \fsizeref ->
***************
*** 124,130 ****
alloca $ \funderlineref ->
alloca $ \fstrikeoutref -> do
! print 1
! res <- osRunFontDialog fnameref fsizeref fweightref fstyleref funderlineref fstrikeoutref
! print 2
if res
then do
--- 125,129 ----
alloca $ \funderlineref ->
alloca $ \fstrikeoutref -> do
! res <- osRunFontDialog fnameref fsizeref fweightref fstyleref funderlineref fstrikeoutref owner
if res
then do
***************
*** 139,142 ****
return (Just fontdef)
else return Nothing
! foreign import ccall osRunFontDialog :: Ptr CString -> Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CBool -> Ptr CBool -> IO Bool
--- 138,141 ----
return (Just fontdef)
else return Nothing
! foreign import ccall osRunFontDialog :: Ptr CString -> Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CBool -> Ptr CBool -> WindowHandle -> IO Bool
|