Language-Haskell

 view release on metacpan or  search on metacpan

hugs98-Nov2003/fptools/libraries/GLUT/Graphics/UI/GLUT.hs  view on Meta::CPAN

--   freedom, three axes of rotation and three axes of translation. It also
--   supports a number of buttons. The device is a hand-sized ball attached to
--   a base. By cupping the ball with one\'s hand and applying torsional or
--   directional force on the ball, rotations and translationsare generated.
--
-- * /Stereo:/ A frame buffer capability providing left and right color buffers
--   for creating stereoscopic renderings. Typically, the user wears LCD
--   shuttered goggles synchronized with the alternating display on the screen
--   of the left and right color buffers.
--
-- * /Sub-menu:/ A menu cascaded from some sub-menu trigger.
--
-- * /Sub-menu trigger:/ A menu item that the user can enter to cascade another
--   pop-up menu.
--
-- * /Subwindow:/ A type of window that is the child window of a top-level
--   window or other subwindow. The drawing and visible region of a subwindow
--   is limited by its parent window.
--
-- * /Tablet:/ A precise 2D input device. Like a mouse, 2D coordinates are
--   returned. The absolute position of the tablet \"puck\" on the tablet is
--   returned. Tablets also support a number of buttons.
--

hugs98-Nov2003/fptools/libraries/GLUT/Graphics/UI/GLUT/Menu.hs  view on Meta::CPAN


-- | A menu is simply a list of menu items.
newtype Menu = Menu [MenuItem]

-- | A single item within a menu can either be a plain menu entry or a sub-menu
-- entry, allowing for arbitrarily deep nested menus.
data MenuItem
   = MenuEntry String MenuCallback -- ^ A plain menu entry with an associated
                                   --   callback, which is triggered when the
                                   --   user selects the entry
   | SubMenu   String Menu         -- ^ A sub-menu, which is cascaded when the
                                   --   user selects the entry, allowing
                                   --   sub-menu entries to be selected

type MenuCallback = IO ()

-- | Create a new pop-up menu for the /current window,/ attaching it to the
-- given mouse button. A previously attached menu (if any), is detached before
-- and won\'t receive callbacks anymore.
--
-- It is illegal to call 'attachMenu' while any (sub-)menu is in use, i.e.

hugs98-Nov2003/fptools/libraries/GLUT/Graphics/UI/GLUT/Menu.hs  view on Meta::CPAN


addMenuEntry :: String -> Value -> IO ()
addMenuEntry name value = withCString name $ \n -> glutAddMenuEntry n value

foreign import CALLCONV unsafe "glutAddMenuEntry" glutAddMenuEntry ::
   CString -> Value -> IO ()

-- | Add a sub-menu trigger to the bottom of the /current menu./ The given
-- string will be displayed for the newly added sub-menu trigger. If the
-- sub-menu trigger is entered, the sub-menu specified by the given menu
-- identifier will be cascaded, allowing sub-menu menu items to be selected.

addSubMenu :: String -> MenuID -> IO ()
addSubMenu name menuID = withCString name $ \n -> glutAddSubMenu n menuID

foreign import CALLCONV unsafe "glutAddSubMenu" glutAddSubMenu ::
   CString -> MenuID -> IO ()

--------------------------------------------------------------------------------

{- UNUSED

hugs98-Nov2003/fptools/libraries/GLUT/Graphics/UI/GLUT/Menu.hs  view on Meta::CPAN

-- menu\'s callback if this menu entry is selected.

foreign import CALLCONV unsafe "glutChangeToMenuEntry" glutChangeToMenuEntry ::
   Item -> CString -> Value -> IO ()

-- | Change the specified menu item in the /current menu/ into a sub-menu
-- trigger. The  given position determines which menu item should be changed and
-- must be between 1 and 'Graphics.UI.GLUT.State.getNumMenuItems' inclusive. The
-- menu item to change does not have to be a sub-menu trigger already. The
-- given name will be displayed for the newly changed sub-menu trigger. The
-- given menu identifier names the sub-menu to cascade from the newly added
-- sub-menu trigger.

foreign import CALLCONV unsafe "glutChangeToSubMenu" glutChangeToSubMenu ::
   Item -> CString -> MenuID -> IO ()
-}

--------------------------------------------------------------------------------

-- | Remove the menu item at the given position, regardless of whether it is a
-- menu entry or sub-menu trigger. The position must be between 1 (the topmost



( run in 0.572 second using v1.01-cache-2.11-cpan-49f99fa48dc )