{-# LINE 2 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}-- -*-haskell-*--- GIMP Toolkit (GTK) Widget OptionMenu---- Author : Axel Simon---- Created: 15 May 2001---- Copyright (C) 1999-2005 Axel Simon---- 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 used to choose from a list of valid choices---- * Warning: this module is deprecated and should not be used in-- newly-written code.--moduleGraphics.UI.Gtk.MenuComboToolbar.OptionMenu(-- * Detail---- | A 'OptionMenu' is a widget that allows the user to choose from a list of-- valid choices. The 'OptionMenu' displays the selected choice. When activated-- the 'OptionMenu' displays a popup 'Menu' which allows the user to make a new-- choice.---- Using a 'OptionMenu' is simple; build a 'Menu', by calling-- 'Graphics.UI.Gtk.MenuComboToolbar.Menu.menuNew', then appending menu items-- to it with 'Graphics.UI.Gtk.MenuComboToolbar.MenuShell.menuShellAppend'.-- Set that menu on the option menu with 'optionMenuSetMenu'. Set the selected-- menu item with 'optionMenuSetHistory'; connect to the \"changed\" signal on-- the option menu; in the \"changed\" signal, check the new selected menu-- item with 'optionMenuGetHistory'.---- As of Gtk+ 2.4, 'OptionMenu' has been deprecated in favor of 'ComboBox'.-- * Class Hierarchy-- |-- @-- | 'GObject'-- | +----'Object'-- | +----'Widget'-- | +----'Container'-- | +----'Bin'-- | +----'Button'-- | +----OptionMenu-- @-- * TypesOptionMenu,OptionMenuClass,castToOptionMenu,gTypeOptionMenu,toOptionMenu,-- * ConstructorsoptionMenuNew,-- * MethodsoptionMenuGetMenu,optionMenuSetMenu,optionMenuRemoveMenu,optionMenuSetHistory,optionMenuGetHistory,-- * AttributesoptionMenuMenu,-- * SignalsonOMChanged,afterOMChanged)whereimportControl.Monad(liftM)importSystem.Glib.FFIimportSystem.Glib.AttributesimportSystem.Glib.PropertiesimportGraphics.UI.Gtk.Abstract.Object(makeNewObject)importGraphics.UI.Gtk.Types{-# LINE 94 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}importGraphics.UI.Gtk.Signals{-# LINE 95 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}{-# LINE 97 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}---------------------- Constructors-- | Create a new option menu.--optionMenuNew::IOOptionMenuoptionMenuNew=makeNewObjectmkOptionMenu$liftMcastPtrgtk_option_menu_new{-# LINE 109 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}---------------------- Methods-- | Returns the 'Menu' associated with the 'OptionMenu'.--optionMenuGetMenu::OptionMenuClassself=>self->IOMenuoptionMenuGetMenuself=makeNewObjectmkMenu$liftMcastPtr$throwIfNull"optionMenuGetMenu: no menu associated with this option menu."$(\(OptionMenuarg1)->withForeignPtrarg1$\argPtr1->gtk_option_menu_get_menuargPtr1){-# LINE 121 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}(toOptionMenuself)-- | Provides the 'Menu' that is popped up to allow the user to choose a new-- value. You should provide a simple menu avoiding the use of tearoff menu-- items, submenus, and accelerators.--optionMenuSetMenu::(OptionMenuClassself,MenuClassmenu)=>self->menu->IO()optionMenuSetMenuselfmenu=(\(OptionMenuarg1)(Widgetarg2)->withForeignPtrarg1$\argPtr1->withForeignPtrarg2$\argPtr2->gtk_option_menu_set_menuargPtr1argPtr2){-# LINE 130 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}(toOptionMenuself)(toWidgetmenu)-- | Removes the menu from the option menu.--optionMenuRemoveMenu::OptionMenuClassself=>self->IO()optionMenuRemoveMenuself=(\(OptionMenuarg1)->withForeignPtrarg1$\argPtr1->gtk_option_menu_remove_menuargPtr1){-# LINE 138 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}(toOptionMenuself)-- | Selects the menu item specified by @index@ making it the newly selected-- value for the option menu.--optionMenuSetHistory::OptionMenuClassself=>self->Int-- ^ @index@ - the index of the menu item to select. Index values-- are from 0 to n-1.->IO()optionMenuSetHistoryselfindex=(\(OptionMenuarg1)arg2->withForeignPtrarg1$\argPtr1->gtk_option_menu_set_historyargPtr1arg2){-# LINE 149 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}(toOptionMenuself)(fromIntegralindex)-- | Retrieves the index of the currently selected menu item. The menu items-- are numbered from top to bottom, starting with 0.--optionMenuGetHistory::OptionMenuClassself=>self->IOInt-- ^ returns index of the selected menu item, or -1 if there are no-- menu itemsoptionMenuGetHistoryself=liftMfromIntegral$(\(OptionMenuarg1)->withForeignPtrarg1$\argPtr1->gtk_option_menu_get_historyargPtr1){-# LINE 161 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}(toOptionMenuself)---------------------- Attributes-- | The menu of options.--optionMenuMenu::(OptionMenuClassself,MenuClassmenu)=>ReadWriteAttrselfMenumenuoptionMenuMenu=newAttrFromObjectProperty"menu"gtk_menu_get_type{-# LINE 171 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}---------------------- Signals-- | This signal is called if the selected option has changed.--onOMChanged,afterOMChanged::OptionMenuClassself=>self->IO()->IO(ConnectIdself)onOMChanged=connect_NONE__NONE"changed"FalseafterOMChanged=connect_NONE__NONE"changed"Trueforeignimportccallunsafe"gtk_option_menu_new"gtk_option_menu_new::(IO(PtrWidget))foreignimportccallunsafe"gtk_option_menu_get_menu"gtk_option_menu_get_menu::((PtrOptionMenu)->(IO(PtrWidget)))foreignimportccallsafe"gtk_option_menu_set_menu"gtk_option_menu_set_menu::((PtrOptionMenu)->((PtrWidget)->(IO())))foreignimportccallunsafe"gtk_option_menu_remove_menu"gtk_option_menu_remove_menu::((PtrOptionMenu)->(IO()))foreignimportccallsafe"gtk_option_menu_set_history"gtk_option_menu_set_history::((PtrOptionMenu)->(CUInt->(IO())))foreignimportccallunsafe"gtk_option_menu_get_history"gtk_option_menu_get_history::((PtrOptionMenu)->(IOCInt))foreignimportccallunsafe"gtk_menu_get_type"gtk_menu_get_type::CUInt