|
From: <kr_...@us...> - 2003-08-24 23:59:00
|
Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv6171/port/src/Port
Modified Files:
Controls.hs
Log Message:
Implementation for Notebook control
Index: Controls.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/Controls.hs,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** Controls.hs 21 Aug 2003 17:34:01 -0000 1.18
--- Controls.hs 24 Aug 2003 13:57:34 -0000 1.19
***************
*** 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 #-}
-----------------------------------------------------------------------------------------
{-| Module : Controls
--- 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 #-}
-----------------------------------------------------------------------------------------
{-| Module : Controls
***************
*** 30,33 ****
--- 30,37 ----
* CompoundControl
+
+ * Notebook
+
+ * NotebookPage
-}
-----------------------------------------------------------------------------------------
***************
*** 85,88 ****
--- 89,102 ----
-- * CompoundControl
, createCompoundControl, getCompoundControlRequestSize
+ -- * Notebook
+ , createNotebook, getNotebookRequestSize
+ , getNotebookLabelsPosition, setNotebookLabelsPosition
+ , getNotebookSelection, setNotebookSelection
+ -- * NotebookPage
+ , insertNotebookPage
+ , getNotebookPageTitle, setNotebookPageTitle
+ , getNotebookPagePos
+ , destroyNotebookPage
+ , getNotebookPageSize
) where
***************
*** 91,95 ****
import Graphics.UI.Port.Types
import Graphics.UI.Port.Handlers -- just for haddock
!
-----------------------------------------------------------------------------------------
--- 105,109 ----
import Graphics.UI.Port.Types
import Graphics.UI.Port.Handlers -- just for haddock
! import Data.Maybe(fromMaybe)
-----------------------------------------------------------------------------------------
***************
*** 233,238 ****
-- RadioBox
-----------------------------------------------------------------------------------------
! -- | Create a radio box. Takes a parent window handle, whether it is the first
! -- radio control of its group and a label as its arguments.
-- An event handler for radio box clicks can be
-- installed with 'setControlCommandHandler'.
--- 247,251 ----
-- RadioBox
-----------------------------------------------------------------------------------------
! -- | Create a radio box.
-- An event handler for radio box clicks can be
-- installed with 'setControlCommandHandler'.
***************
*** 435,436 ****
--- 448,501 ----
getCompoundControlRequestSize hwnd = withCSizeResult (osGetCompoundControlReqSize hwnd)
foreign import ccall osGetCompoundControlReqSize :: WindowHandle -> Ptr CInt -> IO ()
+
+ -----------------------------------------------------------------------------------------
+ -- Notebook
+ -----------------------------------------------------------------------------------------
+
+ -- | Create a new notebook control.
+ foreign import ccall "osCreateNotebook" createNotebook :: WindowHandle -> IO WindowHandle
+
+ getNotebookRequestSize :: WindowHandle -> IO Size
+ getNotebookRequestSize hwnd = withCSizeResult (osGetNotebookReqSize hwnd)
+ foreign import ccall osGetNotebookReqSize :: WindowHandle -> Ptr CInt -> IO ()
+
+ setNotebookLabelsPosition :: WindowHandle -> PositionType -> IO ()
+ setNotebookLabelsPosition hwnd position = osSetNotebookLabelsPosition hwnd (toCPositionType position)
+ foreign import ccall osSetNotebookLabelsPosition :: WindowHandle -> CInt -> IO ()
+
+ getNotebookLabelsPosition :: WindowHandle -> IO PositionType
+ getNotebookLabelsPosition hwnd = fmap fromCPositionType (osGetNotebookLabelsPosition hwnd)
+ foreign import ccall osGetNotebookLabelsPosition :: WindowHandle -> IO CInt
+
+ getNotebookSelection :: WindowHandle -> IO Int
+ getNotebookSelection hwnd
+ = do ci <- osGetNotebookSelection hwnd
+ return (fromCInt ci)
+ foreign import ccall osGetNotebookSelection :: WindowHandle -> IO CInt
+
+ setNotebookSelection :: WindowHandle -> Int -> IO ()
+ setNotebookSelection hwnd i
+ = osSetNotebookSelection hwnd (toCInt i)
+ foreign import ccall osSetNotebookSelection :: WindowHandle -> CInt -> IO ()
+
+ insertNotebookPage :: WindowHandle -> Maybe Int -> IO WindowHandle
+ insertNotebookPage hwnd mb_pos = osInsertNotebookPage hwnd (fromMaybe (-1) mb_pos)
+ foreign import ccall osInsertNotebookPage :: WindowHandle -> Int -> IO WindowHandle
+
+ -- | Get the label of the notebook page.
+ getNotebookPageTitle :: WindowHandle -> IO String
+ getNotebookPageTitle hwnd = resultCString (osGetNotebookPageTitle hwnd)
+ foreign import ccall osGetNotebookPageTitle :: WindowHandle -> IO CString
+
+ -- | Set the label of the notebook page.
+ setNotebookPageTitle :: WindowHandle -> String -> IO ()
+ setNotebookPageTitle hwnd title = withCString title (osSetNotebookPageTitle hwnd)
+ foreign import ccall osSetNotebookPageTitle :: WindowHandle -> CString -> IO ()
+
+ foreign import ccall "osGetNotebookPagePos" getNotebookPagePos :: WindowHandle -> IO Int
+
+ foreign import ccall "osDestroyNotebookPage" destroyNotebookPage :: WindowHandle -> IO ()
+
+ getNotebookPageSize :: WindowHandle -> IO Size
+ getNotebookPageSize hwnd = withCSizeResult (osGetNotebookPageSize hwnd)
+ foreign import ccall osGetNotebookPageSize :: WindowHandle -> Ptr CInt -> IO ()
|