|
From: Wolfgang T. <wol...@gm...> - 2005-07-23 02:07:45
|
> There's just one problem left: When I demand the state of a button,
> it returns an IO Int, the according constants are of type
> NSCellStateValue. Is there a way to "cast" those values?
The InterfaceGenerator generates the following:
data NSCellStateValue = NSMixedState
| NSOffState
| NSOnState
instance ObjCArgument NSCellStateValue CInt where
exportArgument NSMixedState = return (-1)
exportArgument NSOffState = return 0
exportArgument NSOnState = return 1
importArgument (-1) = return NSMixedState
importArgument 0 = return NSOffState
importArgument 1 = return NSOnState
objCTypeString _ = "i"
You can use those, but it is obviously necessary to design something
"proper".
Haskell's Enum class would not be appropriate because the succ, pred,
enumFromTo, etc. functions aren't appropriate for everything that is
defined using C enum.
And while we're at it, there's the question of what to do with
anonymous enums (I'm just ignoring them so far).
Cheers,
Wolfgang
|