Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv5941/src/Port
Modified Files:
Controls.hs
Log Message:
Add support for DateEntry control
Index: Controls.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/Controls.hs,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** Controls.hs 23 Nov 2003 10:23:13 -0000 1.27
--- Controls.hs 24 Nov 2003 22:40:41 -0000 1.28
***************
*** 1,3 ****
! {-# OPTIONS -fglasgow-exts -#include Button.h -#include CheckBox.h -#include EditBox.h -#include Label.h -#include ListBox.h -#include PopUp.h -#include RadioBox.h -#include Window.h -#include ProgressBar.h -#include Slider.h -#include Notebook.h -#include GroupBox.h -#include TrackBar.h #-}
-----------------------------------------------------------------------------------------
{-| Module : Controls
--- 1,3 ----
! {-# OPTIONS -fglasgow-exts -#include Button.h -#include CheckBox.h -#include EditBox.h -#include DateEntry.h -#include Label.h -#include ListBox.h -#include PopUp.h -#include RadioBox.h -#include Window.h -#include ProgressBar.h -#include Slider.h -#include Notebook.h -#include GroupBox.h -#include TrackBar.h #-}
-----------------------------------------------------------------------------------------
{-| Module : Controls
***************
*** 19,22 ****
--- 19,24 ----
* Edit box
+ * DateEntry
+
* List box
***************
*** 63,66 ****
--- 65,71 ----
, getEditPassword,setEditPassword
, changeEditBoxFont
+ -- * DateEntry
+ , createDateEntry, getDateEntryRequestSize
+ , getDateEntryValue, setDateEntryValue
-- * Check box
, createCheckBox, getCheckBoxRequestSize
***************
*** 116,119 ****
--- 121,125 ----
import Foreign
import Foreign.C
+ import System.Time
import Control.Concurrent.MVar
import Data.Maybe(fromMaybe)
***************
*** 263,266 ****
--- 269,293 ----
changeEditBoxFont hwnd font = withCFont font (osChangeEditBoxFont hwnd)
foreign import ccall osChangeEditBoxFont :: WindowHandle -> FontHandle -> IO ()
+
+ -----------------------------------------------------------------------------------------
+ -- DateEntry
+ -----------------------------------------------------------------------------------------
+ -- | Create a date entry control.
+ foreign import ccall "osCreateDateEntry" createDateEntry :: WindowHandle -> IO WindowHandle
+
+ getDateEntryRequestSize :: WindowHandle -> IO Size
+ getDateEntryRequestSize hwnd = withCSizeResult (osGetDateEntryReqSize hwnd)
+ foreign import ccall osGetDateEntryReqSize :: WindowHandle -> Ptr CInt -> IO ()
+
+ getDateEntryValue :: WindowHandle -> IO ClockTime
+ getDateEntryValue hwnd = do
+ ctime <- osGetDateEntryValue hwnd
+ return (TOD (fromIntegral ctime) 0)
+ foreign import ccall osGetDateEntryValue :: WindowHandle -> IO CTime
+
+ setDateEntryValue :: WindowHandle -> ClockTime -> IO ()
+ setDateEntryValue hwnd (TOD time 0) = osSetDateEntryValue hwnd (fromIntegral time)
+ foreign import ccall osSetDateEntryValue :: WindowHandle -> CTime -> IO ()
+
-----------------------------------------------------------------------------------------
|