{-# LINE 2 "./Graphics/UI/Gtk/WebKit/HitTestResult.chs" #-}
-- -*-haskell-*-
-----------------------------------------------------------------------------
-- Module : Graphics.UI.Gtk.WebKit.HitTestResult
-- Author : Andy Stewart
-- Copyright : (c) 2010 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)
--
-- Access to the WebKit Web Resource
-----------------------------------------------------------------------------

module Graphics.UI.Gtk.WebKit.HitTestResult (
-- * Description
-- | This class holds context information about the coordinates specified by a GDK event.

-- * Types
  HitTestResult,
  HitTestResultClass,

-- * Enums.
  HitTestResultContext(..),
) where

import System.Glib.FFI
import System.Glib.GList
import System.Glib.GError
import Graphics.UI.Gtk.Gdk.Events

import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.WebKit.Types
{-# LINE 45 "./Graphics/UI/Gtk/WebKit/HitTestResult.chs" #-}
import System.Glib.GObject
{-# LINE 46 "./Graphics/UI/Gtk/WebKit/HitTestResult.chs" #-}


{-# LINE 48 "./Graphics/UI/Gtk/WebKit/HitTestResult.chs" #-}

-- * Enums.

data HitTestResultContext = HitTestResultContextDocument
                          | HitTestResultContextLink
                          | HitTestResultContextImage
                          | HitTestResultContextMedia
                          | HitTestResultContextSelection
                          | HitTestResultContextEditable
                          
instance Enum HitTestResultContext where
  fromEnum HitTestResultContextDocument = 2
  fromEnum HitTestResultContextLink = 4
  fromEnum HitTestResultContextImage = 8
  fromEnum HitTestResultContextMedia = 16
  fromEnum HitTestResultContextSelection = 32
  fromEnum HitTestResultContextEditable = 64

  toEnum 2 = HitTestResultContextDocument
  toEnum 4 = HitTestResultContextLink
  toEnum 8 = HitTestResultContextImage
  toEnum 16 = HitTestResultContextMedia
  toEnum 32 = HitTestResultContextSelection
  toEnum 64 = HitTestResultContextEditable
  toEnum unmatched = error ("HitTestResultContext.toEnum: Cannot match " ++ show unmatched)

  succ HitTestResultContextDocument = HitTestResultContextLink
  succ HitTestResultContextLink = HitTestResultContextImage
  succ HitTestResultContextImage = HitTestResultContextMedia
  succ HitTestResultContextMedia = HitTestResultContextSelection
  succ HitTestResultContextSelection = HitTestResultContextEditable
  succ _ = undefined

  pred HitTestResultContextLink = HitTestResultContextDocument
  pred HitTestResultContextImage = HitTestResultContextLink
  pred HitTestResultContextMedia = HitTestResultContextImage
  pred HitTestResultContextSelection = HitTestResultContextMedia
  pred HitTestResultContextEditable = HitTestResultContextSelection
  pred _ = undefined

  enumFromTo x y | fromEnum x == fromEnum y = [ y ]
                 | otherwise = x : enumFromTo (succ x) y
  enumFrom x = enumFromTo x HitTestResultContextEditable
  enumFromThen _ _ =     error "Enum HitTestResultContext: enumFromThen not implemented"
  enumFromThenTo _ _ _ =     error "Enum HitTestResultContext: enumFromThenTo not implemented"

{-# LINE 52 "./Graphics/UI/Gtk/WebKit/HitTestResult.chs" #-}