    {-# LINE 1 "Graphics/UI/Gtk/Vte/Structs.hsc" #-}
    {-# LANGUAGE CPP, ForeignFunctionInterface #-}
    {-# LINE 2 "Graphics/UI/Gtk/Vte/Structs.hsc" #-}
    -- -*-haskell-*-
    --  GIMP Toolkit (GTK) marshalling of structures for VTE
    --
    --  Author : Axel Simon
    --
    --  Created: 26 Sep 2009
    --
    --  Copyright (C) 2009 Andy Stewart <lazycat.manatee@gmail.com>
    --
    --  This library is free software; you can redistribute it and/or
    --  modify it under the terms of the GNU Lesser General Public
    --  License as published by the Free Software Foundation; either
    --  version 2.1 of the License, or (at your option) any later version.
    --
    --  This library is distributed in the hope that it will be useful,
    --  but WITHOUT ANY WARRANTY; without even the implied warranty of
    --  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    --  Lesser General Public License for more details.
    --
    --
    -- |
    -- Maintainer  : gtk2hs-users@lists.sourceforge.net
    -- Stability   : provisional
    -- Portability : portable (depends on GHC)
    --
    -- Structures for the VTE terminal widget
    --
    -----------------------------------------------------------------------------
    --
    module Graphics.UI.Gtk.Vte.Structs (
    -- * Types
      VteAttributes(..),

    -- * Functions
      gArrayContent
      ) where

    import Data.Char
    import Data.Word

    import System.Glib.FFI
    import Graphics.UI.Gtk.Abstract.Widget (Color)

    {-# LINE 46 "Graphics/UI/Gtk/Vte/Structs.hsc" #-}

    data VteAttributes = VteAttributes {
      vaRow :: Int,
      vaCol :: Int,
      vaFore :: Color,
      vaBack :: Color,
      vaUnderline :: Bool,
      vaStrikethrough :: Bool
      }

    -- these fields are declard as bit fields which we cannot access portably from
    -- Haskell, thus, we define two C helper functions that read these fields
    foreign import ccall "getVteCharAttrUnderline"
      getVteCharAttrUnderline :: Ptr VteAttributes -> IO Int32
    {-# LINE 60 "Graphics/UI/Gtk/Vte/Structs.hsc" #-}

    foreign import ccall "getVteCharAttrStrikethrough"
      getVteCharAttrStrikethrough :: Ptr VteAttributes -> IO Int32
    {-# LINE 63 "Graphics/UI/Gtk/Vte/Structs.hsc" #-}

    instance Storable VteAttributes where
      sizeOf _ = 36
    {-# LINE 66 "Graphics/UI/Gtk/Vte/Structs.hsc" #-}
      alignment _ = alignment (undefined :: Int32)
    {-# LINE 67 "Graphics/UI/Gtk/Vte/Structs.hsc" #-}
      peek ptr = do
        row <- (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr :: IO Int32
    {-# LINE 69 "Graphics/UI/Gtk/Vte/Structs.hsc" #-}
        col <- (\hsc_ptr -> peekByteOff hsc_ptr 4) ptr :: IO Int32
    {-# LINE 70 "Graphics/UI/Gtk/Vte/Structs.hsc" #-}
        fore <- (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr
    {-# LINE 71 "Graphics/UI/Gtk/Vte/Structs.hsc" #-}
        back <- (\hsc_ptr -> peekByteOff hsc_ptr 20) ptr
    {-# LINE 72 "Graphics/UI/Gtk/Vte/Structs.hsc" #-}
        under <- getVteCharAttrUnderline ptr
        strike <- getVteCharAttrStrikethrough ptr
        return VteAttributes {
          vaRow = fromIntegral row,
          vaCol = fromIntegral col,
          vaFore = fore,
          vaBack = back,
          vaUnderline = toBool (fromIntegral under),
          vaStrikethrough = toBool (fromIntegral strike)
          }
      poke ptr VteAttributes {} = error "Storable VteAttributes: not implemented"

    -- | Retrieve the two fields of the GArray structure.
    --
    gArrayContent :: Ptr garray -> IO (Int, Ptr VteAttributes)
    gArrayContent gaPtr = do
      len <- (\hsc_ptr -> peekByteOff hsc_ptr 4) gaPtr :: IO Word32
    {-# LINE 89 "Graphics/UI/Gtk/Vte/Structs.hsc" #-}
      ptr <- (\hsc_ptr -> peekByteOff hsc_ptr 0) gaPtr
    {-# LINE 90 "Graphics/UI/Gtk/Vte/Structs.hsc" #-}
      return (fromIntegral len, ptr)