1{-# LANGUAGE CPP #-}
2-- -*-haskell-*-
3--  GIMP Toolkit (GTK) Widget SeparatorToolItem
4--
5--  Author : Duncan Coutts
6--
7--  Created: 7 April 2005
8--
9--  Copyright (C) 2005 Duncan Coutts
10--
11--  This library is free software; you can redistribute it and/or
12--  modify it under the terms of the GNU Lesser General Public
13--  License as published by the Free Software Foundation; either
14--  version 2.1 of the License, or (at your option) any later version.
15--
16--  This library is distributed in the hope that it will be useful,
17--  but WITHOUT ANY WARRANTY; without even the implied warranty of
18--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19--  Lesser General Public License for more details.
20--
21-- |
22-- Maintainer  : gtk2hs-users@lists.sourceforge.net
23-- Stability   : provisional
24-- Portability : portable (depends on GHC)
25--
26-- A toolbar item that separates groups of other toolbar items
27--
28-- * Module available since Gtk+ version 2.4
29--
30module Graphics.UI.Gtk.MenuComboToolbar.SeparatorToolItem (
31-- * Detail
32--
33-- | A 'SeparatorToolItem' is a 'ToolItem' that separates groups of other
34-- 'ToolItem's. Depending on the theme, a 'SeparatorToolItem' will often look
35-- like a vertical line on horizontally docked toolbars.
36--
37-- If the property \"expand\" is @True@ and the property \"draw\" is
38-- @False@, a 'SeparatorToolItem' will act as a \"spring\" that forces other
39-- items to the ends of the toolbar.
40--
41-- Use 'separatorToolItemNew' to create a new 'SeparatorToolItem'.
42
43-- * Class Hierarchy
44-- |
45-- @
46-- |  'GObject'
47-- |   +----'Object'
48-- |         +----'Widget'
49-- |               +----'Container'
50-- |                     +----'Bin'
51-- |                           +----'ToolItem'
52-- |                                 +----SeparatorToolItem
53-- @
54
55#if GTK_CHECK_VERSION(2,4,0)
56-- * Types
57  SeparatorToolItem,
58  SeparatorToolItemClass,
59  castToSeparatorToolItem, gTypeSeparatorToolItem,
60  toSeparatorToolItem,
61
62-- * Constructors
63  separatorToolItemNew,
64
65-- * Methods
66  separatorToolItemSetDraw,
67  separatorToolItemGetDraw,
68
69-- * Attributes
70  separatorToolItemDraw,
71#endif
72  ) where
73
74import Control.Monad    (liftM)
75
76import System.Glib.FFI
77import System.Glib.Attributes
78import Graphics.UI.Gtk.Abstract.Object  (makeNewObject)
79{#import Graphics.UI.Gtk.Types#}
80
81{# context lib="gtk" prefix="gtk" #}
82
83#if GTK_CHECK_VERSION(2,4,0)
84--------------------
85-- Constructors
86
87-- | Create a new 'SeparatorToolItem'
88--
89separatorToolItemNew :: IO SeparatorToolItem
90separatorToolItemNew =
91  makeNewObject mkSeparatorToolItem $
92  liftM (castPtr :: Ptr ToolItem -> Ptr SeparatorToolItem) $
93  {# call gtk_separator_tool_item_new #}
94
95--------------------
96-- Methods
97
98-- | Whether the separator tool item is drawn as a vertical line, or just
99-- blank. Setting this @False@ along with
100-- 'Graphics.UI.Gtk.MenuComboToolbar.ToolItem.toolItemSetExpand' is useful to
101-- create an item that forces following items to the end of the toolbar.
102--
103separatorToolItemSetDraw :: SeparatorToolItemClass self => self -> Bool -> IO ()
104separatorToolItemSetDraw self draw =
105  {# call gtk_separator_tool_item_set_draw #}
106    (toSeparatorToolItem self)
107    (fromBool draw)
108
109-- | Returns whether the separator tool item is drawn as a line, or just blank.
110-- See 'separatorToolItemSetDraw'.
111--
112separatorToolItemGetDraw :: SeparatorToolItemClass self => self -> IO Bool
113separatorToolItemGetDraw self =
114  liftM toBool $
115  {# call gtk_separator_tool_item_get_draw #}
116    (toSeparatorToolItem self)
117
118--------------------
119-- Attributes
120
121-- | Whether the separator is drawn, or just blank.
122--
123-- Default value: @True@
124--
125separatorToolItemDraw :: SeparatorToolItemClass self => Attr self Bool
126separatorToolItemDraw = newAttr
127  separatorToolItemGetDraw
128  separatorToolItemSetDraw
129#endif
130