~ubuntu-branches/ubuntu/lucid/gtk2hs/lucid

« back to all changes in this revision

Viewing changes to gtk/Graphics/UI/Gtk/Buttons/CheckButton.chs

  • Committer: Bazaar Package Importer
  • Author(s): Liyang HU
  • Date: 2006-07-22 21:31:58 UTC
  • Revision ID: james.westby@ubuntu.com-20060722213158-he81wo6uam30m9aw
Tags: upstream-0.9.10
ImportĀ upstreamĀ versionĀ 0.9.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- -*-haskell-*-
 
2
--  GIMP Toolkit (GTK) Widget CheckButton
 
3
--
 
4
--  Author : Axel Simon
 
5
--
 
6
--  Created: 15 May 2001
 
7
--
 
8
--  Version $Revision: 1.6 $ from $Date: 2005/10/19 12:57:36 $
 
9
--
 
10
--  Copyright (C) 1999-2005 Axel Simon
 
11
--
 
12
--  This library is free software; you can redistribute it and/or
 
13
--  modify it under the terms of the GNU Lesser General Public
 
14
--  License as published by the Free Software Foundation; either
 
15
--  version 2.1 of the License, or (at your option) any later version.
 
16
--
 
17
--  This library is distributed in the hope that it will be useful,
 
18
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
20
--  Lesser General Public License for more details.
 
21
--
 
22
-- |
 
23
-- Maintainer  : gtk2hs-users@lists.sourceforge.net
 
24
-- Stability   : provisional
 
25
-- Portability : portable (depends on GHC)
 
26
--
 
27
-- Create widgets with a discrete toggle button
 
28
--
 
29
module Graphics.UI.Gtk.Buttons.CheckButton (
 
30
-- * Detail
 
31
-- 
 
32
-- | A 'CheckButton' places a discrete 'ToggleButton' next to a widget,
 
33
-- (usually a 'Label'). See the section on 'ToggleButton' widgets for more
 
34
-- information about toggle\/check buttons.
 
35
--
 
36
-- The important signal (\'toggled\') is also inherited from 'ToggleButton'.
 
37
 
 
38
-- * Class Hierarchy
 
39
-- |
 
40
-- @
 
41
-- |  'GObject'
 
42
-- |   +----'Object'
 
43
-- |         +----'Widget'
 
44
-- |               +----'Container'
 
45
-- |                     +----'Bin'
 
46
-- |                           +----'Button'
 
47
-- |                                 +----'ToggleButton'
 
48
-- |                                       +----CheckButton
 
49
-- |                                             +----'RadioButton'
 
50
-- @
 
51
 
 
52
-- * Types
 
53
  CheckButton,
 
54
  CheckButtonClass,
 
55
  castToCheckButton,
 
56
  toCheckButton,
 
57
 
 
58
-- * Constructors
 
59
  checkButtonNew,
 
60
  checkButtonNewWithLabel,
 
61
  checkButtonNewWithMnemonic,
 
62
  ) where
 
63
 
 
64
import Monad    (liftM)
 
65
 
 
66
import System.Glib.FFI
 
67
import System.Glib.UTFString
 
68
import Graphics.UI.Gtk.Abstract.Object  (makeNewObject)
 
69
{#import Graphics.UI.Gtk.Types#}
 
70
{#import Graphics.UI.Gtk.Signals#}
 
71
 
 
72
{# context lib="gtk" prefix="gtk" #}
 
73
 
 
74
--------------------
 
75
-- Constructors
 
76
 
 
77
-- | Creates a new 'CheckButton'.
 
78
--
 
79
checkButtonNew :: IO CheckButton
 
80
checkButtonNew =
 
81
  makeNewObject mkCheckButton $
 
82
  liftM (castPtr :: Ptr Widget -> Ptr CheckButton) $
 
83
  {# call unsafe check_button_new #}
 
84
 
 
85
-- | Creates a new 'CheckButton' with a 'Label' to the right of it.
 
86
--
 
87
checkButtonNewWithLabel :: 
 
88
    String         -- ^ @label@ - the text for the check button.
 
89
 -> IO CheckButton
 
90
checkButtonNewWithLabel label =
 
91
  makeNewObject mkCheckButton $
 
92
  liftM (castPtr :: Ptr Widget -> Ptr CheckButton) $
 
93
  withUTFString label $ \labelPtr ->
 
94
  {# call unsafe check_button_new_with_label #}
 
95
    labelPtr
 
96
 
 
97
-- | Creates a new 'CheckButton' containing a label. The label will be created
 
98
-- using 'labelNewWithMnemonic', so underscores in @label@ indicate the
 
99
-- mnemonic for the check button.
 
100
--
 
101
checkButtonNewWithMnemonic :: 
 
102
    String         -- ^ @label@ - The text of the button, with an underscore
 
103
                   -- in front of the mnemonic character
 
104
 -> IO CheckButton
 
105
checkButtonNewWithMnemonic label =
 
106
  makeNewObject mkCheckButton $
 
107
  liftM (castPtr :: Ptr Widget -> Ptr CheckButton) $
 
108
  withUTFString label $ \labelPtr ->
 
109
  {# call unsafe check_button_new_with_mnemonic #}
 
110
    labelPtr