packages feed

gtkimageview-0.11.1: Graphics/UI/Gtk/ImageView/ImageScrollWin.chs

{-# LANGUAGE CPP #-}
-- -*-haskell-*-
--  GIMP Toolkit (GTK) Widget ImageScrollWin
--
--  Author : Andy Stewart
--
--  Created: 19 Aug 2010
--
--  Copyright (C) 2010 Andy Stewart
--
--  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)
--
module Graphics.UI.Gtk.ImageView.ImageScrollWin (
-- * Details
-- | 'ImageScrollWin' provides a widget similar in appearance to 'ScrollableWindow' that is more
-- suitable for displaying 'ImageView''s.

-- * Types  
   ImageScrollWin,
   ImageScrollWinClass,

-- * Methods
   imageScrollWinNew,
) where

import Control.Monad	(liftM)
import Data.Maybe    (fromMaybe)

import Graphics.UI.Gtk.Abstract.Object	(makeNewObject)
import Graphics.UI.Gtk.ImageView.Enums
import System.Glib.Attributes
import System.Glib.FFI
import System.Glib.UTFString

{#import Graphics.UI.Gtk.ImageView.Signals#}
{#import Graphics.UI.Gtk.ImageView.Types#}
{#import System.Glib.Properties#}

{# context lib="gtk" prefix="gtk" #}

-- | Creates a new 'ImageScrollWin' containing the 'ImageView'.
-- 
-- The widget is built using four subwidgets arranged inside a 'Table' with two columns and two
-- rows. Two scrollbars, one navigator button (the decorations) and one 'ImageView'.
-- 
-- When the 'ImageView' fits inside the window, the decorations are hidden.
imageScrollWinNew :: ImageViewClass view => view -> IO ImageScrollWin
imageScrollWinNew view = 
  makeNewObject mkImageScrollWin $
  liftM (castPtr :: Ptr Widget -> Ptr ImageScrollWin) $
  {# call unsafe gtk_image_scroll_win_new #}
    (toImageView view)