From: <72...@in...> - 2003-08-14 17:35:03
|
Hi Daan. Thanks for the information about creating the wxcXXX.hs files. This time I report a quasi-nonbug, since it is no possible to watch all the methods are correctly typed. In the automatically generated wxcClasses, dcGetPixel is given this type: dcGetPixel :: DC a -> Point -> Color -> IO Int However, this is absurd since we are getting, not putting, the pixel color. I do not know the way your marshaling code generator works, but making an ad hoc fix whenever necessary is straightforward: import Graphics.UI.WXH import qualified Graphics.UI.WXH.WxcTypes as WXHT foreign import ccall "wxDC_GetPixel" wxDC_GetPixel :: DC a -> CInt -> CInt -> WXHT.ColourObject c -> IO CInt newDCGetPixel :: DC a -> Point -> IO Color newDCGetPixel dc p = WXHT.withRefColour $ \col->(wxDC_GetPixel dc (WXHT.toCIntPointX p) (WXHT.toCIntPointY p) col) >> return () Next point: I think it is very annoying that wxDC objects cannot be persistent. The entire state needs to be set everytime you want to draw. In order to fix it, I have been developing for my library some code for marshalling a wxDC state (yours in WXH.Draw is incomplete, lacks background brush, clipping and logical function state), in order to give windows persistent wxDC states. Everytime I create a wxDC, I transfer the previously saved state to it, and vice versa. However, my code needs to attach someway this state to the window. I do this by defining my drawable controls as records and storing the state in a IORef in a field of the record, but I do not know if it is possible to attach Haskell data someway to a (Window a) object, which you use to represent and handle controls. If it is possible and you think of the wxDC non persistent behaviour as me, I wonder you would want my code for modifying your WX.Draw interface --------------------------------------------- Este mensaje lo ha enviado un Alumno de la Universidad de Malaga. http://www.alumnos.uma.es/ |