<commit_before>{-# OPTIONS -cpp -fglasgow-exts -#include "wxc.h" #-}
-----------------------------------------------------------------------------------------
{-| Module      :  Types
    Copyright   :  (c) <NAME> 2003
    License     :  wxWindows

    Maintainer  :  <EMAIL>
    Stability   :  provisional
    Portability :  portable

    Basic types and marshaling code for the wxWindows C library.
-}
-----------------------------------------------------------------------------------------
module Graphics.UI.WXCore.WxcTypes(
            -- * Object types
              Object, objectNull, objectIsNull, objectCast
            , Managed, managedNull, managedIsNull, managedCast, createManaged, withManaged, managedTouch

            -- * Type synonyms
            , Id
            , Style
            , EventId

            -- * Basic types
            , intFromBool, boolFromInt

            -- ** Point
            , Point(Point,pointX,pointY), point, pt, pointFromVec, pointFromSize, pointZero, pointNull

            -- ** Size
            , Size(Size,sizeW,sizeH), size, sz, sizeFromPoint, sizeFromVec, sizeZero, sizeNull

            -- ** Vector
            , Vector(Vector,vecX,vecY), vector, vec, vecFromPoint, vecFromSize, vecZero, vecNull

            -- * Rectangle
            , Rect(Rect,rectLeft,rectTop,rectWidth,rectHeight)
            , rectTopLeft, rectTopRight, rectBottomLeft, rectBottomRight, rectBottom, rectRight
            , rect, rectBetween, rectFromSize, rectZero, rectNull, rectSize, rectIsEmpty

            -- ** Color
            , Color, rgb, colorRGB, colorRed, colorGreen, colorBlue, colorOk

            -- * Marshalling
            -- ** Basic types
            , withPointResult, toCIntPointX, toCIntPointY, fromCPoint, withCPoint
            , withSizeResult, toCIntSizeW, toCIntSizeH, fromCSize, withCSize
            , withVectorResult, toCIntVectorX, toCIntVectorY, fromCVector, withCVector
            , withRectResult, toCIntRectX, toCIntRectY, toCIntRectW, toCIntRectH, fromCRect, withCRect
            , withArrayString, withArrayInt, withArrayObject
            , withArrayIntResult, withArrayStringResult, withArrayObjectResult

            , Colour, ColourObject
            , colourFromColor, colorFromColour
            , colourCreate, colourCreateRGB, colourDelete, colourRed, colourGreen, colourBlue

            -- ** Managed object types
            , managedAddFinalizer
            , withRefColour, withManagedColourResult, withManagedColour
            , withRefBitmap
            , withRefCursor
            , withRefIcon
            , withRefPen
            , withRefBrush
            , withRefFont
            , withRefDateTime
            , withRefListItem
            , withRefTreeItemId
            , withRefFontData
            , withRefPrintData
            , withRefPageSetupDialogData
            , withRefPrintDialogData
            , withRefGridCellCoordsArray


            -- ** Primitive types
            -- *** CString
            , CString, withCString, withStringResult
            -- *** CInt
            , CInt, toCInt, fromCInt, withIntResult
            -- *** CChar
            , CChar, toCChar, fromCChar, withCharResult
            -- *** CBool
            , CBool, toCBool, fromCBool, withBoolResult
            -- ** Pointers
            , Ptr, ptrNull, ptrIsNull, ptrCast, ForeignPtr, FunPtr, toCFunPtr
            ) where

import System.IO.Unsafe( unsafePerformIO )
import Foreign.C
import Foreign.Ptr
import Foreign.Storable
import Foreign.Marshal.Alloc
import Foreign.Marshal.Array

import Foreign.ForeignPtr hiding (newForeignPtr,addForeignPtrFinalizer)
import Foreign.Concurrent



{-----------------------------------------------------------------------------------------
    Objects
-----------------------------------------------------------------------------------------}
-- | An @Id@ is used to identify objects during event handling.
type Id = Int

-- | An @EventId@ is identifies specific events.
type EventId = Int

-- | A @Style@ is normally used as a flag mask to specify some window style
type Style = Int


{- | An @Object a@ is a pointer to an object of type @a@. The @a@ parameter is used
   to encode the inheritance relation. When the type parameter is unit @()@, it denotes
   an object of exactly that class, when the parameter is a type variable @a@, it
   specifies an object that is at least an instance of that class. For example in 
   wxWindows, we have the following class hierarchy:

   > EvtHandler<commit_msg>[wxhaskell-from-cvs @ 2003-08-20 12:04:50 by dleijen]<commit_after>{-# OPTIONS -cpp -fglasgow-exts -#include "wxc.h" #-}
-----------------------------------------------------------------------------------------
{-| Module      :  Types
    Copyright   :  (c) <NAME> 2003
    License     :  wxWindows

    Maintainer  :  <EMAIL>
    Stability   :  provisional
    Portability :  portable

    Basic types and marshaling code for the wxWindows C library.
-}
-----------------------------------------------------------------------------------------
module Graphics.UI.WXCore.WxcTypes(
            -- * Object types
              Object, objectNull, objectIsNull, objectCast
            , Managed, managedNull, managedIsNull, managedCast, createManaged, withManaged, managedTouch

            -- * Type synonyms
            , Id
            , Style
            , EventId

            -- * Basic types
            , intFromBool, boolFromInt

            -- ** Point
            , Point(Point,pointX,pointY), point, pt, pointFromVec, pointFromSize, pointZero, pointNull

            -- ** Size
            , Size(Size,sizeW,sizeH), size, sz, sizeFromPoint, sizeFromVec, sizeZero, sizeNull

            -- ** Vector
            , Vector(Vector,vecX,vecY), vector, vec, vecFromPoint, vecFromSize, vecZero, vecNull

            -- * Rectangle
            , Rect(Rect,rectLeft,rectTop,rectWidth,rectHeight)
            , rectTopLeft, rectTopRight, rectBottomLeft, rectBottomRight, rectBottom, rectRight
            , rect, rectBetween, rectFromSize, rectZero, rectNull, rectSize, rectIsEmpty

            -- ** Color
            , Color, rgb, colorRGB, colorRed, colorGreen, colorBlue, colorOk

            -- * Marshalling
            -- ** Basic types
            , withPointResult, toCIntPointX, toCIntPointY, fromCPoint, withCPoint
            , withSizeResult, toCIntSizeW, toCIntSizeH, fromCSize, withCSize
            , withVectorResult, toCIntVectorX, toCIntVectorY, fromCVector, withCVector
            , withRectResult, toCIntRectX, toCIntRectY, toCIntRectW, toCIntRectH, fromCRect, withCRect
            , withArrayString, withArrayInt, withArrayObject
            , withArrayIntResult, withArrayStringResult, withArrayObjectResult

            , Colour, ColourObject
            , colourFromColor, colorFromColour
            , colourCreate, colourCreateRGB, colourDelete, colourRed, colourGreen, colourBlue

            -- ** Managed object types
            , managedAddFinalizer
            , withRefColour, withManagedColourResult, withManagedColour
            , withRefBitmap
            , withRefCursor
            , withRefIcon
            , withRefPen
            , withRefBrush
            , withRefFont
            , withRefDateTime
            , withRefListItem
            , withRefTreeItemId
            , withRefFontData
            , withRefPrintData
            , withRefPageSetupDialogData
            , withRefPrintDialogData
            , withRefGridCellCoordsArray


            -- ** Primitive types
            -- *** CString
            , CString, withCString, withStringResult
            -- *** CInt
            , CInt, toCInt, fromCInt, withIntResult
            -- *** CChar
            , CChar, toCChar, fromCChar, withCharResult
            -- *** CBool
            , CBool, toCBool, fromCBool, withBoolResult
            -- ** Pointers
            , Ptr, ptrNull, ptrIsNull, ptrCast, ForeignPtr, FunPtr, toCFunPtr
            ) where

import System.IO.Unsafe( unsafePerformIO )
import Foreign.C
import Foreign.Ptr
import Foreign.Storable
import Foreign.Marshal.Alloc
import Foreign.Marshal.Array

{- note: for GHC 5.04, replace the following two imports by "import Foreign.ForeignPtr" -}
import Foreign.ForeignPtr hiding (newForeignPtr,addForeignPtrFinalizer)
import Foreign.Concurrent



{-----------------------------------------------------------------------------------------
    Objects
-----------------------------------------------------------------------------------------}
-- | An @Id@ is used to identify objects during event handling.
type Id = Int

-- | An @EventId@ is identifies specific events.
type EventId = Int

-- | A @Style@ is normally used as a flag mask to specify some window style
type Style = Int


{- | An @Object a@ is a pointer to an object of type @a@. The @a@ parameter is used
   to encode the inheritance relation. When the type parameter is unit @()@, it denotes
   an object of exactly that class, when the parameter is a type variable @a@, it
   specifies an object that is at least an instance of that class. For example in 
   wxWindows, we have the following class hierarchy:

   > EvtHandler
{'fraction_non_alphanumeric': 0.14947276877921514, 'fraction_numerical': 0.002717686705076639, 'mean_word_length': 1.7299703264094954, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5924945', 'n_tokens_mistral': 2372, 'n_tokens_neox': 2299, 'n_words': 655}