From: Duncan C. <dun...@us...> - 2005-04-02 19:22:28
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Entry In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20075/gtk/Graphics/UI/Gtk/Entry Modified Files: Editable.chs.pp Entry.chs.pp EntryCompletion.chs.pp HScale.chs SpinButton.chs VScale.chs Log Message: Various minor changes merged in from the generated code. Index: SpinButton.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Entry/SpinButton.chs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- SpinButton.chs 15 Mar 2005 19:59:12 -0000 1.6 +++ SpinButton.chs 2 Apr 2005 19:22:04 -0000 1.7 @@ -24,11 +24,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- A spin button provides the possiblity to enter a numeric value without using --- the keyboard. +-- Retrieve an integer or floating-point number from the user -- module Graphics.UI.Gtk.Entry.SpinButton ( --- * Description +-- * Detail -- -- | A 'SpinButton' is an ideal way to allow the user to set the value of some -- attribute. Rather than having to directly type a number into a 'Entry', @@ -132,7 +131,8 @@ -> Int -- ^ @digits@ - the number of decimal places to display. -> IO SpinButton spinButtonNew adjustment climbRate digits = - makeNewObject mkSpinButton $ liftM castPtr $ + makeNewObject mkSpinButton $ + liftM (castPtr :: Ptr Widget -> Ptr SpinButton) $ {# call unsafe spin_button_new #} adjustment (realToFrac climbRate) @@ -150,7 +150,8 @@ -- widget -> IO SpinButton spinButtonNewWithRange min max step = - makeNewObject mkSpinButton $ liftM castPtr $ + makeNewObject mkSpinButton $ + liftM (castPtr :: Ptr Widget -> Ptr SpinButton) $ {# call unsafe spin_button_new_with_range #} (realToFrac min) (realToFrac max) @@ -234,7 +235,7 @@ -- 'spinButtonSetIncrements'. -- spinButtonGetIncrements :: SpinButtonClass self => self - -> IO (Double, Double) -- ^ @(step, page)@ + -> IO (Double, Double) -- ^ @(step, page)@ - step increment and page increment spinButtonGetIncrements self = alloca $ \stepPtr -> alloca $ \pagePtr -> do @@ -261,7 +262,7 @@ -- | Gets the range allowed for the spin button. See 'spinButtonSetRange'. -- spinButtonGetRange :: SpinButtonClass self => self - -> IO (Double, Double) -- ^ @(min, max)@ + -> IO (Double, Double) -- ^ @(min, max)@ - minimum and maximum allowed value spinButtonGetRange self = alloca $ \minPtr -> alloca $ \maxPtr -> do @@ -273,7 +274,7 @@ max <- peek maxPtr return (realToFrac min, realToFrac max) --- | Retrieve the current value of the spin button as a floating point value. +-- | Get the value of the spin button as a floating point value. -- spinButtonGetValue :: SpinButtonClass self => self -> IO Double spinButtonGetValue self = @@ -281,7 +282,7 @@ {# call unsafe spin_button_get_value #} (toSpinButton self) --- | Retrieve the current value of the spin button as an integral value. +-- | Get the value of the spin button as an integral value. -- spinButtonGetValueAsInt :: SpinButtonClass self => self -> IO Int spinButtonGetValueAsInt self = @@ -289,7 +290,7 @@ {# call unsafe spin_button_get_value_as_int #} (toSpinButton self) --- | Set the value of the SpinButton. +-- | Set the value of the spin button. -- spinButtonSetValue :: SpinButtonClass self => self -> Double -> IO () spinButtonSetValue self value = @@ -409,7 +410,7 @@ -- | The adjustment that holds the value of the spinbutton. -- -spinButtonAdjustment :: Attr SpinButton Adjustment +spinButtonAdjustment :: SpinButtonClass self => Attr self Adjustment spinButtonAdjustment = Attr spinButtonGetAdjustment spinButtonSetAdjustment @@ -420,7 +421,7 @@ -- -- Default value: 0 -- -spinButtonDigits :: Attr SpinButton Int +spinButtonDigits :: SpinButtonClass self => Attr self Int spinButtonDigits = Attr spinButtonGetDigits spinButtonSetDigits @@ -430,7 +431,7 @@ -- -- Default value: @False@ -- -spinButtonSnapToTicks :: Attr SpinButton Bool +spinButtonSnapToTicks :: SpinButtonClass self => Attr self Bool spinButtonSnapToTicks = Attr spinButtonGetSnapToTicks spinButtonSetSnapToTicks @@ -439,7 +440,7 @@ -- -- Default value: @False@ -- -spinButtonNumeric :: Attr SpinButton Bool +spinButtonNumeric :: SpinButtonClass self => Attr self Bool spinButtonNumeric = Attr spinButtonGetNumeric spinButtonSetNumeric @@ -448,7 +449,7 @@ -- -- Default value: @False@ -- -spinButtonWrap :: Attr SpinButton Bool +spinButtonWrap :: SpinButtonClass self => Attr self Bool spinButtonWrap = Attr spinButtonGetWrap spinButtonSetWrap @@ -458,7 +459,7 @@ -- -- Default value: 'UpdateAlways' -- -spinButtonUpdatePolicy :: Attr SpinButton SpinButtonUpdatePolicy +spinButtonUpdatePolicy :: SpinButtonClass self => Attr self SpinButtonUpdatePolicy spinButtonUpdatePolicy = Attr spinButtonGetUpdatePolicy spinButtonSetUpdatePolicy @@ -467,7 +468,7 @@ -- -- Default value: 0 -- -spinButtonValue :: Attr SpinButton Double +spinButtonValue :: SpinButtonClass self => Attr self Double spinButtonValue = Attr spinButtonGetValue spinButtonSetValue @@ -489,14 +490,14 @@ (Just val) -> do poke dPtr ((realToFrac val)::{#type gdouble#}) return 0 - Nothing -> return (toInteger inputError) + Nothing -> return (fromIntegral inputError) afterInput sb user = connect_PTR__INT "input" True sb $ \dPtr -> do mVal <- user case mVal of (Just val) -> do poke dPtr ((realToFrac val)::{#type gdouble#}) return 0 - Nothing -> return (toInteger inputError) + Nothing -> return (fromIntegral inputError) -- | Install a custom output handler. -- Index: Editable.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Entry/Editable.chs.pp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Editable.chs.pp 15 Mar 2005 20:19:56 -0000 1.6 +++ Editable.chs.pp 2 Apr 2005 19:22:03 -0000 1.7 @@ -138,18 +138,19 @@ -- | Inserts text at a given position. -- editableInsertText :: EditableClass self => self - -> String -- ^ @newText@ - the text to insert. - -> Int -- ^ @position@ - the position at which to insert the text. - -> IO Int -- ^ returns the position after the newly inserted text. + -> String -- ^ @newText@ - the text to insert. + -> Int -- ^ @position@ - the position at which to insert the text. + -> IO Int -- ^ returns the position after the newly inserted text. editableInsertText self newText position = - withObject (fromIntegral position) $ \positionPtr -> + with (fromIntegral position) $ \positionPtr -> withUTFStringLen newText $ \(newTextPtr, newTextLength) -> do {# call editable_insert_text #} (toEditable self) newTextPtr (fromIntegral newTextLength) positionPtr - liftM fromIntegral $ peek positionPtr + position <- peek positionPtr + return (fromIntegral position) -- | Deletes a sequence of characters. The characters that are deleted are -- those characters at positions from @startPos@ up to, but not including @@ -266,7 +267,7 @@ -- | \'position\' property. See 'editableGetPosition' and -- 'editableSetPosition' -- -editablePosition :: Attr Editable Int +editablePosition :: EditableClass self => Attr self Int editablePosition = Attr editableGetPosition editableSetPosition @@ -274,7 +275,7 @@ -- | \'editable\' property. See 'editableGetEditable' and -- 'editableSetEditable' -- -editableEditable :: Attr Editable Bool +editableEditable :: EditableClass self => Attr self Bool editableEditable = Attr editableGetEditable editableSetEditable Index: HScale.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Entry/HScale.chs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- HScale.chs 15 Mar 2005 19:59:12 -0000 1.4 +++ HScale.chs 2 Apr 2005 19:22:04 -0000 1.5 @@ -75,7 +75,8 @@ -- the scale. -> IO HScale hScaleNew adjustment = - makeNewObject mkHScale $ liftM castPtr $ + makeNewObject mkHScale $ + liftM (castPtr :: Ptr Widget -> Ptr HScale) $ {# call unsafe hscale_new #} adjustment @@ -91,7 +92,8 @@ -- shortcuts -> IO HScale hScaleNewWithRange min max step = - makeNewObject mkHScale $ liftM castPtr $ + makeNewObject mkHScale $ + liftM (castPtr :: Ptr Widget -> Ptr HScale) $ {# call unsafe hscale_new_with_range #} (realToFrac min) (realToFrac max) Index: Entry.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Entry.chs.pp 15 Mar 2005 19:59:12 -0000 1.6 +++ Entry.chs.pp 2 Apr 2005 19:22:04 -0000 1.7 @@ -133,7 +133,8 @@ -- entryNew :: IO Entry entryNew = - makeNewObject mkEntry $ liftM castPtr $ + makeNewObject mkEntry $ + liftM (castPtr :: Ptr Widget -> Ptr Entry) $ {# call unsafe entry_new #} -------------------- @@ -306,7 +307,7 @@ (toEntry self) (fromBool setting) --- | Retrieve the number of characters the widget should ask for. +-- | Gets the value set by 'entrySetWidthChars'. -- entryGetWidthChars :: EntryClass self => self -> IO Int -- ^ returns number of chars to request space for, or negative if @@ -394,7 +395,7 @@ -- -- Default value: 0 -- -entryMaxLength :: Attr Entry Int +entryMaxLength :: EntryClass self => Attr self Int entryMaxLength = Attr entryGetMaxLength entrySetMaxLength @@ -404,7 +405,7 @@ -- -- Default value: @True@ -- -entryVisibility :: Attr Entry Bool +entryVisibility :: EntryClass self => Attr self Bool entryVisibility = Attr entryGetVisibility entrySetVisibility @@ -413,7 +414,7 @@ -- -- Default value: @True@ -- -entryHasFrame :: Attr Entry Bool +entryHasFrame :: EntryClass self => Attr self Bool entryHasFrame = Attr entryGetHasFrame entrySetHasFrame @@ -422,7 +423,7 @@ -- -- Default value: \'*\' -- -entryInvisibleChar :: Attr Entry Char +entryInvisibleChar :: EntryClass self => Attr self Char entryInvisibleChar = Attr entryGetInvisibleChar entrySetInvisibleChar @@ -432,7 +433,7 @@ -- -- Default value: @False@ -- -entryActivatesDefault :: Attr Entry Bool +entryActivatesDefault :: EntryClass self => Attr self Bool entryActivatesDefault = Attr entryGetActivatesDefault entrySetActivatesDefault @@ -443,7 +444,7 @@ -- -- Default value: -1 -- -entryWidthChars :: Attr Entry Int +entryWidthChars :: EntryClass self => Attr self Int entryWidthChars = Attr entryGetWidthChars entrySetWidthChars @@ -452,14 +453,14 @@ -- -- Default value: \"\" -- -entryText :: Attr Entry String +entryText :: EntryClass self => Attr self String entryText = Attr entryGetText entrySetText -- | \'alignment\' property. See 'entryGetAlignment' and 'entrySetAlignment' -- -entryAlignment :: Attr Entry Float +entryAlignment :: EntryClass self => Attr self Float entryAlignment = Attr entryGetAlignment entrySetAlignment @@ -467,7 +468,7 @@ -- | \'completion\' property. See 'entryGetCompletion' and -- 'entrySetCompletion' -- -entryCompletion :: Attr Entry EntryCompletion +entryCompletion :: EntryClass self => Attr self EntryCompletion entryCompletion = Attr entryGetCompletion entrySetCompletion Index: VScale.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Entry/VScale.chs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- VScale.chs 15 Mar 2005 19:59:12 -0000 1.4 +++ VScale.chs 2 Apr 2005 19:22:04 -0000 1.5 @@ -75,7 +75,8 @@ -- the scale. -> IO VScale vScaleNew adjustment = - makeNewObject mkVScale $ liftM castPtr $ + makeNewObject mkVScale $ + liftM (castPtr :: Ptr Widget -> Ptr VScale) $ {# call unsafe vscale_new #} adjustment @@ -91,7 +92,8 @@ -- shortcuts. Must be nonzero. -> IO VScale vScaleNewWithRange min max step = - makeNewObject mkVScale $ liftM castPtr $ + makeNewObject mkVScale $ + liftM (castPtr :: Ptr Widget -> Ptr VScale) $ {# call unsafe vscale_new_with_range #} (realToFrac min) (realToFrac max) Index: EntryCompletion.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- EntryCompletion.chs.pp 15 Mar 2005 19:59:12 -0000 1.7 +++ EntryCompletion.chs.pp 2 Apr 2005 19:22:04 -0000 1.8 @@ -24,7 +24,7 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- Completion functionality for the 'Entry' widget. +-- Completion functionality for 'Entry' -- -- * Module available since Gtk+ version 2.4 -- @@ -114,7 +114,7 @@ -- entryCompletionNew :: IO EntryCompletion entryCompletionNew = - makeNewGObject mkEntryCompletion $ liftM castPtr $ + makeNewGObject mkEntryCompletion $ {# call gtk_entry_completion_new #} -------------------- @@ -275,7 +275,7 @@ -- | Minimum length of the search key in order to look up matches. -- --- Allowed values: >= -1 +-- Allowed values: >= 0 -- -- Default value: 1 -- |