File: Spinner.chs

package info (click to toggle)
haskell-gtk 0.15.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,964 kB
  • sloc: haskell: 3,346; ansic: 826; makefile: 161
file content (99 lines) | stat: -rw-r--r-- 2,534 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{-# LANGUAGE CPP #-}
-- -*-haskell-*-
--  GIMP Toolkit (GTK) Widget Spinner
--
--  Author : Andy Stewart
--
--  Created: 17 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)
--
-- Report messages of minor importance to the user
--
module Graphics.UI.Gtk.Display.Spinner (
#if GTK_CHECK_VERSION(2,20,0)
-- * Detail
--
-- | A 'Spinner' widget displays an icon-size spinning animation. It is often used as an alternative to
-- a 'ProgressBar' for displaying indefinite activity, instead of actual progress.
--
-- To start the animation, use 'spinnerStart'.

-- * Types
   Spinner,
   SpinnerClass,
   castToSpinner, gTypeSpinner,
   toSpinner,

-- * Constructors
   spinnerNew,

-- * Methods
   spinnerStart,
   spinnerStop,

-- * Attributes
   spinnerActive,
#endif
) 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" #}

#if GTK_CHECK_VERSION(2,20,0)
--------------------
-- Constructors

-- | Returns a new spinner widget. Not yet started.
spinnerNew :: IO Spinner
spinnerNew =
  makeNewObject mkSpinner $
  liftM (castPtr :: Ptr Widget -> Ptr Spinner) $
  {# call unsafe spinner_new #}

--------------------
-- Methods

-- | Starts the animation of the spinner.
spinnerStart :: SpinnerClass spinner => spinner -> IO ()
spinnerStart spinner =
  {#call spinner_start #}
    (toSpinner spinner)

-- | Stops the animation of the spinner.
spinnerStop :: SpinnerClass spinner => spinner -> IO ()
spinnerStop spinner =
  {#call spinner_stop #}
    (toSpinner spinner)

--------------------
-- Attributes

-- | Whether the spinner is active.
--
-- Default value: 'False'
spinnerActive :: SpinnerClass spinner => Attr spinner Bool
spinnerActive = newAttrFromBoolProperty "active"
#endif