From: Andy S. <And...@co...> - 2010-03-28 07:05:44
|
Sun Mar 28 03:04:40 EDT 2010 Andy Stewart <laz...@gm...> * Add `Speical` modules (include GtkRuler, GtkHRuler, GtkVRuler). Ignore-this: 59613cc2fd00c5b54a2f0d567c115ba0 hunk ./ApiUpdateTodoList.txt 41 -*** TODO Curve.chs +*** DEPRECATED Curve.chs hunk ./ApiUpdateTodoList.txt 57 -*** TODO GammaCurve.chs +*** DEPRECATED GammaCurve.chs hunk ./ApiUpdateTodoList.txt 62 -*** TODO HRuler.chs +*** DONE HRuler.chs hunk ./ApiUpdateTodoList.txt 140 -*** TODO Ruler.chs +*** DONE Ruler.chs hunk ./ApiUpdateTodoList.txt 172 -*** TODO VRuler.chs +*** DONE VRuler.chs hunk ./Makefile.am 734 + gtk/Graphics/UI/Gtk/Special/HRuler.chs.pp \ + gtk/Graphics/UI/Gtk/Special/Ruler.chs.pp \ + gtk/Graphics/UI/Gtk/Special/VRuler.chs.pp \ hunk ./gtk/Graphics/UI/Gtk.hs.pp 181 + -- * Speical [_$_] + module Graphics.UI.Gtk.Special.Ruler, + module Graphics.UI.Gtk.Special.HRuler, + module Graphics.UI.Gtk.Special.VRuler, hunk ./gtk/Graphics/UI/Gtk.hs.pp 409 +-- Speical +import Graphics.UI.Gtk.Special.Ruler +import Graphics.UI.Gtk.Special.HRuler +import Graphics.UI.Gtk.Special.VRuler adddir ./gtk/Graphics/UI/Gtk/Special addfile ./gtk/Graphics/UI/Gtk/Special/HRuler.chs.pp hunk ./gtk/Graphics/UI/Gtk/Special/HRuler.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget HRuler +-- +-- Author : Andy Stewart +-- +-- Created: 28 Mar 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 : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- A horizontal ruler +-- +module Graphics.UI.Gtk.Special.HRuler ( + +-- * Detail +-- +-- | The HRuler widget is a widget arranged horizontally creating a ruler that +-- is utilized around other widgets such as a text widget. The ruler is used to +-- show the location of the mouse on the window and to show the size of the +-- window in specified units. The available units of measurement are 'Pixels', +-- 'Inches' and 'Centimeters'. 'Pixels' is the default. rulers. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Ruler' +-- | +----HRuler +-- @ + +-- * Types + HRuler, + HRulerClass, + castToHRuler, + toHRuler, + +-- * Constructors + hrulerNew, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +{#import Graphics.UI.Gtk.Abstract.Object#} (makeNewObject) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Constructors + +-- | Creates a new horizontal ruler. +-- +hrulerNew :: IO HRuler +hrulerNew = + makeNewObject mkHRuler $ + liftM (castPtr :: Ptr Widget -> Ptr HRuler) $ + {# call gtk_hruler_new #} addfile ./gtk/Graphics/UI/Gtk/Special/Ruler.chs.pp hunk ./gtk/Graphics/UI/Gtk/Special/Ruler.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget Ruler +-- +-- Author : Andy Stewart +-- +-- Created: 28 Mar 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 : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- Base class for horizontal or vertical rulers +-- +module Graphics.UI.Gtk.Special.Ruler ( + +-- * Detail +-- +-- | The GTKRuler widget is a base class for horizontal and vertical rulers. +-- Rulers are used to show the mouse pointer's location in a window. The ruler +-- can either be horizontal or vertical on the window. Within the ruler a small +-- triangle indicates the location of the mouse relative to the horizontal or +-- vertical ruler. See 'HRuler' to learn how to create a new horizontal ruler. +-- See 'VRuler' to learn how to create a new vertical ruler. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----Ruler +-- | +----'HRuler' +-- | +----'VRuler' +-- @ + +-- * Types + Ruler, + RulerClass, + castToRuler, + toRuler, + +-- * Enums + MetricType, + +-- * Methods + rulerSetRange, + rulerGetRange, + rulerDrawPos, + rulerDrawTicks, + +-- * Attributes + rulerLower, + rulerUpper, + rulerPosition, + rulerMaxSize, + rulerMetric, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +{#import Graphics.UI.Gtk.Abstract.Object#} (makeNewObject) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Enums +{#enum MetricType {underscoreToCase} deriving (Bounded,Eq,Show)#} + +-------------------- +-- Interfaces + +-- instance OrientableClass Ruler + +-------------------- +-- Methods + +-- | This sets the range of the ruler. +-- +rulerSetRange :: RulerClass self => self + -> Double -- ^ @lower@ - the lower limit of the ruler + -> Double -- ^ @upper@ - the upper limit of the ruler + -> Double -- ^ @position@ - the mark on the ruler + -> Double -- ^ @maxSize@ - the maximum size of the ruler used when + -- calculating the space to leave for the text + -> IO () +rulerSetRange self lower upper position maxSize = + {# call gtk_ruler_set_range #} + (toRuler self) + (realToFrac lower) + (realToFrac upper) + (realToFrac position) + (realToFrac maxSize) + +-- | Retrieves values indicating the range and current position of a 'Ruler'. +-- See 'rulerSetRange'. +-- +rulerGetRange :: RulerClass self => self + -> IO (Double, Double, Double, Double) -- ^ @(lower, upper, position, + -- maxSize)@ {FIXME: merge return value + -- docs} @lower@ - location to store + -- lower limit of the ruler, or + -- {@NULL@, FIXME: this should probably + -- be converted to a Maybe data + -- type}@upper@ - location to store + -- upper limit of the ruler, or + -- {@NULL@, FIXME: this should probably + -- be converted to a Maybe data + -- type}@position@ - location to store + -- the current position of the mark on + -- the ruler, or {@NULL@, FIXME: this + -- should probably be converted to a + -- Maybe data type}@maxSize@ - location + -- to store the maximum size of the + -- ruler used when calculating the + -- space to leave for the text, or + -- {@NULL@, FIXME: this should probably + -- be converted to a Maybe data type}. +rulerGetRange self = + alloca $ \lowerPtr -> + alloca $ \upperPtr -> + alloca $ \positionPtr -> + alloca $ \maxSizePtr -> do + {# call gtk_ruler_get_range #} + (toRuler self) + lowerPtr + upperPtr + positionPtr + maxSizePtr + lower <- peek lowerPtr + upper <- peek upperPtr + position <- peek positionPtr + maxSize <- peek maxSizePtr + return (realToFrac lower, realToFrac upper, realToFrac position, realToFrac maxSize) + +-- | +-- +rulerDrawPos :: RulerClass self => self -> IO () +rulerDrawPos self = + {# call gtk_ruler_draw_pos #} + (toRuler self) + +-- | +-- +rulerDrawTicks :: RulerClass self => self -> IO () +rulerDrawTicks self = + {# call gtk_ruler_draw_ticks #} + (toRuler self) + +-------------------- +-- Attributes + +-- | +-- +rulerLower :: RulerClass self => Attr self Double +rulerLower = newAttrFromDoubleProperty "lower" + +-- | +-- +rulerUpper :: RulerClass self => Attr self Double +rulerUpper = newAttrFromDoubleProperty "upper" + +-- | +-- +rulerPosition :: RulerClass self => Attr self Double +rulerPosition = newAttrFromDoubleProperty "position" + +-- | +-- +rulerMaxSize :: RulerClass self => Attr self Double +rulerMaxSize = newAttrFromDoubleProperty "max-size" + +-- | +-- +rulerMetric :: RulerClass self => Attr self MetricType +rulerMetric = newAttrFromEnumProperty "metric" + {# call pure unsafe gtk_metric_type_get_type #} addfile ./gtk/Graphics/UI/Gtk/Special/VRuler.chs.pp hunk ./gtk/Graphics/UI/Gtk/Special/VRuler.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget VRuler +-- +-- Author : Andy Stewart +-- +-- Created: 28 Mar 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 : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- A vertical ruler +-- +module Graphics.UI.Gtk.Special.VRuler ( + +-- * Detail +-- +-- | The VRuler widget is a widget arranged vertically creating a ruler that +-- is utilized around other widgets such as a text widget. The ruler is used to +-- show the location of the mouse on the window and to show the size of the +-- window in specified units. The available units of measurement are 'Pixels', +-- 'Inches' and 'Centimeters'. 'Pixels' is the default. rulers. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Ruler' +-- | +----VRuler +-- @ + +-- * Types + VRuler, + VRulerClass, + castToVRuler, + toVRuler, + +-- * Constructors + vrulerNew, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +{#import Graphics.UI.Gtk.Abstract.Object#} (makeNewObject) +{#import Graphics.UI.Gtk.Types#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Constructors + +-- | Creates a new vertical ruler +-- +vrulerNew :: IO VRuler +vrulerNew = + makeNewObject mkVRuler $ + liftM (castPtr :: Ptr Widget -> Ptr VRuler) $ + {# call gtk_vruler_new #} |