gtk3 0.14.7 → 0.14.8
raw patch · 5 files changed
+248/−17 lines, 5 filesdep ~gtk3PVP ok
version bump matches the API change (PVP)
Dependency ranges changed: gtk3
API changes (from Hackage documentation)
+ Graphics.UI.Gtk.Misc.Switch: castToSwitch :: GObjectClass obj => obj -> Switch
+ Graphics.UI.Gtk.Misc.Switch: data Switch
+ Graphics.UI.Gtk.Misc.Switch: gTypeSwitch :: GType
+ Graphics.UI.Gtk.Misc.Switch: switchActivate :: SwitchClass self => Signal self (IO ())
+ Graphics.UI.Gtk.Misc.Switch: switchActive :: SwitchClass self => Attr self Bool
+ Graphics.UI.Gtk.Misc.Switch: switchGetActive :: SwitchClass self => self -> IO Bool
+ Graphics.UI.Gtk.Misc.Switch: switchNew :: IO Switch
+ Graphics.UI.Gtk.Misc.Switch: switchSetActive :: SwitchClass self => self -> Bool -> IO ()
+ Graphics.UI.Gtk.Misc.Switch: toSwitch :: SwitchClass o => o -> Switch
Files
- Graphics/UI/Gtk.chs +6/−0
- Graphics/UI/Gtk/Misc/Switch.chs +195/−0
- Graphics/UI/Gtk/Types.chs +28/−0
- gtk3.cabal +18/−17
- hierarchy3.list +1/−0
Graphics/UI/Gtk.chs view
@@ -276,6 +276,9 @@ module Graphics.UI.Gtk.Misc.Tooltips, #endif module Graphics.UI.Gtk.Misc.Viewport,+#if GTK_MAJOR_VERSION >= 3+ module Graphics.UI.Gtk.Misc.Switch,+#endif -- * Abstract base classes module Graphics.UI.Gtk.Abstract.Box, module Graphics.UI.Gtk.Abstract.ButtonBox,@@ -549,6 +552,9 @@ import Graphics.UI.Gtk.Misc.Tooltips #endif import Graphics.UI.Gtk.Misc.Viewport+#if GTK_MAJOR_VERSION >= 3+import Graphics.UI.Gtk.Misc.Switch+#endif --import Accessible -- abstract base classes import Graphics.UI.Gtk.Abstract.Box
+ Graphics/UI/Gtk/Misc/Switch.chs view
@@ -0,0 +1,195 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widgets Switch+--+-- Author : Warlock <internalmike@gmail.com>+--+-- Created: 10 November 2017+--+-- Copyright (C) 2017 Warlock+--+-- 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)+--+-- A "light switch" style toggle+--+module Graphics.UI.Gtk.Misc.Switch (+-- * Detail+--+-- [...]+--+-- * Class Hierarchy+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----'Switch'+-- @++-- * Types+#if GTK_MAJOR_VERSION >= 3+ Switch+ , castToSwitch+ , gTypeSwitch+ , toSwitch++-- * Constructors+ , switchNew++-- * Methods+ , switchSetActive+ , switchGetActive+#if GTK_CHECK_VERSION(3,14,0)+ , switchSetState+ , switchGetState+#endif++-- * Attributes+ , switchActive+#if GTK_CHECK_VERSION(3,14,0)+ , switchState+#endif++-- * Signals+ , switchActivate+#if GTK_CHECK_VERSION(3,14,0)+ , stateSet+#endif+#endif+) where++#if GTK_MAJOR_VERSION >= 3++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#}+{#import Graphics.UI.Gtk.Signals#}++{# context lib="gtk" prefix="gtk" #}++--------------------+-- Constructors++-- | Creates a new 'Switch'.+--+switchNew :: IO Switch+switchNew =+ makeNewObject mkSwitch $+ liftM (castPtr :: Ptr Widget -> Ptr Switch) $+ {# call unsafe switch_new #}++--------------------+-- Methods++-- | Changes the state of control to the desired one.+-- See 'switchGetActive'.+switchSetActive :: SwitchClass self => self+ -> Bool+ -> IO ()+switchSetActive self is_active =+ {# call switch_set_active #}+ (toSwitch self)+ (fromBool is_active)++-- | Gets whether the GtkSwitch is in its on or off state.+switchGetActive :: SwitchClass self => self+ -> IO Bool+switchGetActive self =+ liftM toBool $+ {# call switch_get_active #}+ (toSwitch self)++#if GTK_CHECK_VERSION(3,14,0)+-- | Sets the underlying state of the GtkSwitch.+-- Normally, this is the same as 'switchActive', unless the switch is set up for+-- delayed state changes. This function is typically called+-- from a 'stateSet' signal handler.+--+-- See 'stateSet' for details.+switchSetState :: SwitchClass self => self+ -> Bool+ -> IO ()+switchSetState self state =+ {# call switch_set_state #}+ (toSwitch self)+ (fromBool state)++-- | Gets the underlying state of the GtkSwitch.+-- Set 'switchSetState'.+switchGetState :: SwitchClass self => self+ -> IO Bool+switchGetState self =+ liftM toBool $+ {# call switch_get_state #}+ (toSwitch self)+#endif++--------------------+-- Attributes++-- | Whether the switch is in its on or off state.+--+-- Default value: @False@+--+switchActive :: SwitchClass self => Attr self Bool+switchActive = newAttr+ switchGetActive+ switchSetActive++#if GTK_CHECK_VERSION(3,14,0)+-- | The backend state that is controlled by the switch. See 'stateSet' for details.+--+-- Default value: @False@+--+switchState :: SwitchClass self => Attr self Bool+switchState = newAttr+ switchGetState+ switchSetState+#endif++--------------------+-- Signals+++-- | This signal on GtkSwitch is an action signal and emitting it causes+-- the switch to animate. Applications should never connect to this signal,+-- but use the notify::active signal.+--+switchActivate :: SwitchClass self => Signal self (IO ())+switchActivate = Signal (connect_NONE__NONE "activate")++#if GTK_CHECK_VERSION(3,14,0)+-- | This signal on GtkSwitch is emitted to change the underlying state.+-- It is emitted when the user changes the switch position.+-- The default handler keeps the state in sync with the 'switchActive' property.+--+-- To implement delayed state change, applications can connect to this signal,+-- initiate the change of the underlying state, and call 'switchSetState'+-- when the underlying state change is complete.+-- The signal handler should return @True@ to prevent the default handler from running.+--+-- Visually, the underlying state is represented by the trough color of the switch,+-- while the 'switchActive' property is represented by the position of the switch.+--+stateSet :: SwitchClass self => Signal self (Bool -> IO Bool)+stateSet = Signal (connect_BOOL__BOOL "state-set")+#endif++#endif
Graphics/UI/Gtk/Types.chs view
@@ -198,6 +198,10 @@ toImage, mkImage, unImage, castToImage, gTypeImage,+ Switch(Switch), SwitchClass,+ toSwitch, + mkSwitch, unSwitch,+ castToSwitch, gTypeSwitch, Container(Container), ContainerClass, toContainer, mkContainer, unContainer,@@ -1728,6 +1732,30 @@ gTypeImage :: GType gTypeImage = {# call fun unsafe gtk_image_get_type #}++-- ********************************************************************* Switch++{#pointer *GtkSwitch as Switch foreign newtype #} deriving (Eq,Ord)++mkSwitch = (Switch, objectUnrefFromMainloop)+unSwitch (Switch o) = o++class WidgetClass o => SwitchClass o+toSwitch :: SwitchClass o => o -> Switch+toSwitch = unsafeCastGObject . toGObject++instance SwitchClass Switch+instance WidgetClass Switch+instance GObjectClass Switch where+ toGObject = GObject . castForeignPtr . unSwitch+ unsafeCastGObject = Switch . castForeignPtr . unGObject++castToSwitch :: GObjectClass obj => obj -> Switch+castToSwitch = castTo gTypeSwitch "Switch"++gTypeSwitch :: GType+gTypeSwitch =+ {# call fun unsafe gtk_switch_get_type #} -- ****************************************************************** Container
gtk3.cabal view
@@ -1,5 +1,5 @@ Name: gtk3-Version: 0.14.7+Version: 0.14.8 License: LGPL-2.1 License-file: COPYING Copyright: (c) 2001-2010 The Gtk2Hs Team@@ -268,6 +268,7 @@ Graphics.UI.Gtk.Misc.IMMulticontext Graphics.UI.Gtk.Misc.IMContextSimple Graphics.UI.Gtk.Misc.SizeGroup+ Graphics.UI.Gtk.Misc.Switch Graphics.UI.Gtk.Misc.Tooltip Graphics.UI.Gtk.Misc.Viewport Graphics.UI.Gtk.ModelView@@ -398,7 +399,7 @@ main-is: ActionMenu.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base, transformers, text+ build-depends: gtk3==0.14.8, base, transformers, text Executable gtk2hs-demo-buttonBox default-language: Haskell98@@ -406,7 +407,7 @@ main-is: ButtonBox.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base, transformers+ build-depends: gtk3==0.14.8, base, transformers Executable gtk2hs-demo-carsim default-language: Haskell98@@ -414,7 +415,7 @@ main-is: CarSim.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base, transformers, time, cairo+ build-depends: gtk3==0.14.8, base, transformers, time, cairo Executable gtk2hs-demo-progress default-language: Haskell98@@ -422,7 +423,7 @@ main-is: Progress.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base, transformers+ build-depends: gtk3==0.14.8, base, transformers Executable gtk2hs-demo-progressThreadedRTS default-language: Haskell98@@ -430,7 +431,7 @@ main-is: ProgressThreadedRTS.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base, transformers+ build-depends: gtk3==0.14.8, base, transformers ghc-options: -threaded Executable gtk2hs-demo-fastDraw@@ -439,7 +440,7 @@ main-is: FastDraw.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base, transformers, array, cairo+ build-depends: gtk3==0.14.8, base, transformers, array, cairo Executable gtk2hs-demo-fonts default-language: Haskell98@@ -447,7 +448,7 @@ main-is: Fonts.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base+ build-depends: gtk3==0.14.8, base Executable gtk2hs-demo-builder default-language: Haskell98@@ -455,7 +456,7 @@ main-is: GtkBuilderTest.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base, transformers+ build-depends: gtk3==0.14.8, base, transformers Executable gtk2hs-demo-helloworld default-language: Haskell98@@ -463,7 +464,7 @@ main-is: World.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base, transformers+ build-depends: gtk3==0.14.8, base, transformers Executable gtk2hs-demo-layout default-language: Haskell98@@ -471,7 +472,7 @@ main-is: Layout.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base, transformers, cairo, text+ build-depends: gtk3==0.14.8, base, transformers, cairo, text Executable gtk2hs-demo-menudemo default-language: Haskell98@@ -479,7 +480,7 @@ main-is: MenuDemo.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base, transformers, text+ build-depends: gtk3==0.14.8, base, transformers, text Executable gtk2hs-demo-combodemo default-language: Haskell98@@ -487,7 +488,7 @@ main-is: ComboDemo.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, text, base, transformers+ build-depends: gtk3==0.14.8, text, base, transformers Executable gtk2hs-demo-notebook default-language: Haskell98@@ -495,7 +496,7 @@ main-is: Notebook.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base, transformers, text+ build-depends: gtk3==0.14.8, base, transformers, text Executable gtk2hs-demo-statusIcon default-language: Haskell98@@ -503,7 +504,7 @@ main-is: StatusIcon.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base, transformers+ build-depends: gtk3==0.14.8, base, transformers Executable gtk2hs-demo-arabic default-language: Haskell98@@ -511,7 +512,7 @@ main-is: Arabic.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base, transformers, text+ build-depends: gtk3==0.14.8, base, transformers, text Executable gtk2hs-demo-overlay default-language: Haskell98@@ -519,4 +520,4 @@ main-is: Overlay.hs if !flag(build-demos) buildable: False- build-depends: gtk3==0.14.7, base, transformers+ build-depends: gtk3==0.14.8, base, transformers
hierarchy3.list view
@@ -70,6 +70,7 @@ GtkAccelLabel GtkArrow GtkImage+ GtkSwitch GtkContainer GtkToolPalette GtkToolItemGroup