File: SeparatorToolItem.chs

package info (click to toggle)
haskell-gtk 0.11.0-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,920 kB
  • ctags: 82
  • sloc: haskell: 1,929; ansic: 714; sh: 5; makefile: 3
file content (129 lines) | stat: -rw-r--r-- 3,767 bytes parent folder | download | duplicates (3)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
{-# LANGUAGE CPP #-}
-- -*-haskell-*-
--  GIMP Toolkit (GTK) Widget SeparatorToolItem
--
--  Author : Duncan Coutts
--
--  Created: 7 April 2005
--
--  Copyright (C) 2005 Duncan Coutts
--
--  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 toolbar item that separates groups of other toolbar items
--
-- * Module available since Gtk+ version 2.4
--
module Graphics.UI.Gtk.MenuComboToolbar.SeparatorToolItem (
-- * Detail
-- 
-- | A 'SeparatorToolItem' is a 'ToolItem' that separates groups of other
-- 'ToolItem's. Depending on the theme, a 'SeparatorToolItem' will often look
-- like a vertical line on horizontally docked toolbars.
--
-- If the property \"expand\" is @True@ and the property \"draw\" is
-- @False@, a 'SeparatorToolItem' will act as a \"spring\" that forces other
-- items to the ends of the toolbar.
--
-- Use 'separatorToolItemNew' to create a new 'SeparatorToolItem'.

-- * Class Hierarchy
-- |
-- @
-- |  'GObject'
-- |   +----'Object'
-- |         +----'Widget'
-- |               +----'Container'
-- |                     +----'Bin'
-- |                           +----'ToolItem'
-- |                                 +----SeparatorToolItem
-- @

#if GTK_CHECK_VERSION(2,4,0)
-- * Types
  SeparatorToolItem,
  SeparatorToolItemClass,
  castToSeparatorToolItem, gTypeSeparatorToolItem,
  toSeparatorToolItem,

-- * Constructors
  separatorToolItemNew,

-- * Methods
  separatorToolItemSetDraw,
  separatorToolItemGetDraw,

-- * Attributes
  separatorToolItemDraw,
#endif
  ) where

import Control.Monad	(liftM)

import System.Glib.FFI
import System.Glib.Attributes
import Graphics.UI.Gtk.Abstract.Object	(makeNewObject)
{#import Graphics.UI.Gtk.Types#}

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

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

-- | Create a new 'SeparatorToolItem'
--
separatorToolItemNew :: IO SeparatorToolItem
separatorToolItemNew =
  makeNewObject mkSeparatorToolItem $
  liftM (castPtr :: Ptr ToolItem -> Ptr SeparatorToolItem) $
  {# call gtk_separator_tool_item_new #}

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

-- | Whether the separator tool item is drawn as a vertical line, or just
-- blank. Setting this @False@ along with
-- 'Graphics.UI.Gtk.MenuComboToolbar.ToolItem.toolItemSetExpand' is useful to
-- create an item that forces following items to the end of the toolbar.
--
separatorToolItemSetDraw :: SeparatorToolItemClass self => self -> Bool -> IO ()
separatorToolItemSetDraw self draw =
  {# call gtk_separator_tool_item_set_draw #}
    (toSeparatorToolItem self)
    (fromBool draw)

-- | Returns whether the separator tool item is drawn as a line, or just blank.
-- See 'separatorToolItemSetDraw'.
--
separatorToolItemGetDraw :: SeparatorToolItemClass self => self -> IO Bool
separatorToolItemGetDraw self =
  liftM toBool $
  {# call gtk_separator_tool_item_get_draw #}
    (toSeparatorToolItem self)

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

-- | Whether the separator is drawn, or just blank.
--
-- Default value: @True@
--
separatorToolItemDraw :: SeparatorToolItemClass self => Attr self Bool
separatorToolItemDraw = newAttr
  separatorToolItemGetDraw
  separatorToolItemSetDraw
#endif