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
|
{-# LANGUAGE CPP #-}
-- -*-haskell-*-
-- GIMP Toolkit (GTK) Widgets StackSwitcher
--
-- Author : Moritz Schulte
--
-- Created: 27 April 2016
--
-- Copyright (C) 2016 Moritz Schulte
--
-- 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 widget which controls the alignment and size of its child
--
module Graphics.UI.Gtk.Layout.StackSwitcher (
-- * Detail
--
-- [...]
--
-- * Class Hierarchy
-- |
-- @
-- | 'GObject'
-- | +----'Object'
-- | +----'Widget'
-- | +----'Container'
-- | +----'Box'
-- | +----'StackSwitcher'
-- @
-- * Types
#if GTK_CHECK_VERSION(3,10,0)
StackSwitcher
, castToStackSwitcher
, gTypeStackSwitcher
, toStackSwitcher
-- * Constructors
, stackSwitcherNew
-- * Methods
, stackSwitcherSetStack
, stackSwitcherGetStack
-- * Attributes
, stackSwitcherIconSize
, stackSwitcherStack
#endif
) where
#if GTK_CHECK_VERSION(3,10,0)
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" #}
--------------------
-- Constructors
-- | Creates a new 'StackSwitcher'.
--
stackSwitcherNew :: IO StackSwitcher
stackSwitcherNew =
makeNewObject mkStackSwitcher $
liftM (castPtr :: Ptr Widget -> Ptr StackSwitcher) $
{# call unsafe stack_switcher_new #}
--------------------
-- Methods
-- | Sets the stack to control.
stackSwitcherSetStack :: (StackSwitcherClass self, StackClass stack) => self
-> stack
-> IO ()
stackSwitcherSetStack self stack =
{# call stack_switcher_set_stack #}
(toStackSwitcher self)
(toStack stack)
-- | Retrieves the stack.
stackSwitcherGetStack :: StackSwitcherClass self => self
-> IO (Maybe Stack)
stackSwitcherGetStack self =
maybeNull (makeNewObject mkStack) $
{# call stack_switcher_get_stack #}
(toStackSwitcher self)
--------------------
-- Attributes
-- | Use the "icon-size" property to change the size of the image
-- displayed when a GtkStackSwitcher is displaying icons.
--
-- Default value: @1@
--
stackSwitcherIconSize :: StackSwitcherClass self => Attr self Int
stackSwitcherIconSize = newAttrFromIntProperty "icon-size"
-- | The 'Stack' controlled by this 'StackSwitcher'.
--
stackSwitcherStack :: (StackSwitcherClass self, StackClass stack) =>
ReadWriteAttr self (Maybe Stack) (Maybe stack)
stackSwitcherStack = newAttrFromMaybeObjectProperty "stack" gTypeContainer
#endif
|