From: Duncan C. <dun...@us...> - 2005-04-02 16:52:59
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/MenuComboToolbar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3378/gtk/Graphics/UI/Gtk/MenuComboToolbar Modified Files: CheckMenuItem.chs.pp Combo.chs.pp ComboBox.chs.pp ComboBoxEntry.chs.pp ImageMenuItem.chs Menu.chs.pp MenuBar.chs MenuItem.chs MenuShell.chs OptionMenu.chs.pp RadioMenuItem.chs TearoffMenuItem.chs ToolItem.chs.pp Toolbar.chs.pp Log Message: More merging from the generated modules. Code formatting changes. Documentation changes. One or two actual code changes but nothing that affects the API. Index: Menu.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Menu.chs.pp 13 Mar 2005 19:34:35 -0000 1.4 +++ Menu.chs.pp 2 Apr 2005 16:52:49 -0000 1.5 @@ -34,12 +34,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- A Menu is a vertically aligned set of options that can be selected. There --- are two kinds: Those that are part of a 'MenuBar' and those --- that appear as a context menu (within the work space). +-- A menu widget -- module Graphics.UI.Gtk.MenuComboToolbar.Menu ( --- * Description +-- * Detail -- -- | A 'Menu' is a 'MenuShell' that implements a drop down menu consisting of -- a list of 'MenuItem' objects which can be navigated and activated by the @@ -119,160 +117,233 @@ -------------------- -- Constructors --- | Make an empty Menu. +-- | Creates a new 'Menu'. -- menuNew :: IO Menu -menuNew = makeNewObject mkMenu $ - liftM castPtr {#call unsafe menu_new#} +menuNew = + makeNewObject mkMenu $ + liftM (castPtr :: Ptr Widget -> Ptr Menu) $ + {# call unsafe menu_new #} -------------------- -- Methods --- | Move a child to a new position within the menu. --- --- * The position is counted from 0 to n-1 if the menu contains n entries. +-- | Moves a 'MenuItem' to a new position within the 'Menu'. -- -menuReorderChild :: (MenuClass m, MenuItemClass mi) => m -> mi -> Int -> IO () -menuReorderChild m child pos = {#call menu_reorder_child#} - (toMenu m) (toWidget child) (fromIntegral pos) +menuReorderChild :: (MenuClass self, MenuItemClass child) => self + -> child -- ^ @child@ - the 'MenuItem' to move. + -> Int -- ^ @position@ - the new position to place @child@. Positions are + -- numbered from 0 to n-1. + -> IO () +menuReorderChild self child position = + {# call menu_reorder_child #} + (toMenu self) + (toWidget child) + (fromIntegral position) -- | Popup a context menu where a button press occurred. -- -- -menuPopup :: MenuClass m => m -> Event -> IO () -menuPopup m (Events.Button { time=t, button=b }) = {#call menu_popup#} - (toMenu m) (mkWidget nullForeignPtr) (mkWidget nullForeignPtr) nullFunPtr - nullPtr ((fromIntegral.fromEnum) b) (fromIntegral t) +menuPopup :: MenuClass self => self -> Event -> IO () +menuPopup self (Events.Button { time=t, button=b }) = + {# call menu_popup #} + (toMenu self) + (mkWidget nullForeignPtr) + (mkWidget nullForeignPtr) + nullFunPtr + nullPtr + ((fromIntegral . fromEnum) b) + (fromIntegral t) menuPopup _ _ = error "menuPopup: Button event expected." --- | Set the "AccelGroup" which holds global accelerators for the menu. This +-- | Set the 'AccelGroup' which holds global accelerators for the menu. This -- accelerator group needs to also be added to all windows that this menu is -- being used in with 'windowAddAccelGroup', in order for those windows to -- support all the accelerators contained in this group. -- -menuSetAccelGroup :: MenuClass m => m -> AccelGroup -> IO () -menuSetAccelGroup m accel = - {#call menu_set_accel_group#} (toMenu m) accel +menuSetAccelGroup :: MenuClass self => self + -> AccelGroup -- ^ @accelGroup@ - the 'AccelGroup' to be associated with the + -- menu. + -> IO () +menuSetAccelGroup self accelGroup = + {# call menu_set_accel_group #} + (toMenu self) + accelGroup --- | Gets the "AccelGroup" which holds global accelerators for the menu. See +-- | Gets the 'AccelGroup' which holds global accelerators for the menu. See -- 'menuSetAccelGroup'. -- -menuGetAccelGroup :: MenuClass m => m -> IO AccelGroup -menuGetAccelGroup m = +menuGetAccelGroup :: MenuClass self => self + -> IO AccelGroup -- ^ returns the 'AccelGroup' associated with the menu. +menuGetAccelGroup self = makeNewGObject mkAccelGroup $ - {#call unsafe menu_get_accel_group#} (toMenu m) + {# call unsafe menu_get_accel_group #} + (toMenu self) --- | Sets an accelerator path for this menu from which accelerator paths for its --- immediate children, its menu items, can be constructed. The main purpose of --- this function is to spare the programmer the inconvenience of having to call --- 'menuItemSetAccelPath' on each menu item that should support runtime user --- changable accelerators. Instead, by just calling 'menuSetAccelPath' on their --- parent, each menu item of this menu, that contains a label describing its --- purpose, automatically gets an accel path assigned. +-- | Sets an accelerator path for this menu from which accelerator paths for +-- its immediate children, its menu items, can be constructed. The main purpose +-- of this function is to spare the programmer the inconvenience of having to +-- call 'menuItemSetAccelPath' on each menu item that should support runtime +-- user changable accelerators. Instead, by just calling 'menuSetAccelPath' on +-- their parent, each menu item of this menu, that contains a label describing +-- its purpose, automatically gets an accel path assigned. -- -- For example, a menu containing menu items \"New\" and \"Exit\", will, after -- calling -- -- > menu `menuSetAccelPath` "<Gnumeric-Sheet>/File" -- --- assign its items the accel paths: \"<Gnumeric-Sheet>\/File\/New\" and --- \"<Gnumeric-Sheet>\/File\/Exit\". +-- assign its items the accel paths: @\"\<Gnumeric-Sheet\>\/File\/New\"@ and +-- @\"\<Gnumeric-Sheet\>\/File\/Exit\"@. -- -- Assigning accel paths to menu items then enables the user to change their -- accelerators at runtime. More details about accelerator paths and their -- default setups can be found at 'accelMapAddEntry'. -- -menuSetAccelPath :: MenuClass m => m -> String -> IO () -menuSetAccelPath m accelPath = - withUTFString accelPath $ \strPtr -> - {#call menu_set_accel_path#} (toMenu m) strPtr +menuSetAccelPath :: MenuClass self => self + -> String -- ^ @accelPath@ - a valid accelerator path + -> IO () +menuSetAccelPath self accelPath = + withUTFString accelPath $ \accelPathPtr -> + {# call menu_set_accel_path #} + (toMenu self) + accelPathPtr --- | Set the title of the menu. It is displayed if the menu is shown as a --- tearoff menu. +-- | Sets the title string for the menu. The title is displayed when the menu +-- is shown as a tearoff menu. -- -menuSetTitle :: MenuClass m => m -> String -> IO () -menuSetTitle m title = withUTFString title $ \strPtr -> - {#call unsafe menu_set_title#} (toMenu m) strPtr +menuSetTitle :: MenuClass self => self -> String -> IO () +menuSetTitle self title = + withUTFString title $ \titlePtr -> + {# call unsafe menu_set_title #} + (toMenu self) + titlePtr --- | Returns the title of the menu, orNothing if the menu has no title set on --- it. +-- | Returns the title of the menu. See 'menuSetTitle'. -- -menuGetTitle :: MenuClass m => m -> IO (Maybe String) -menuGetTitle m = - {#call unsafe menu_get_title#} (toMenu m) >>= maybePeek peekUTFString +menuGetTitle :: MenuClass self => self + -> IO (Maybe String) -- ^ returns the title of the menu, or @Nothing@ if the + -- menu has no title set on it. +menuGetTitle self = + {# call unsafe menu_get_title #} + (toMenu self) + >>= maybePeek peekUTFString --- | Remove a context or tearoff menu from the screen. +-- | Removes the menu from the screen. -- -menuPopdown :: MenuClass m => m -> IO () -menuPopdown m = {#call menu_popdown#} (toMenu m) +menuPopdown :: MenuClass self => self -> IO () +menuPopdown self = + {# call menu_popdown #} + (toMenu self) -- | Repositions the menu according to its position function. -- -menuReposition :: MenuClass m => m -> IO () -menuReposition m = {#call menu_reposition#} (toMenu m) +menuReposition :: MenuClass self => self -> IO () +menuReposition self = + {# call menu_reposition #} + (toMenu self) --- | Return the currently selected menu item. +-- | Returns the selected menu item from the menu. This is used by the +-- 'OptionMenu'. -- -menuGetActive :: MenuClass m => m -> IO MenuItem -menuGetActive m = makeNewObject mkMenuItem $ +menuGetActive :: MenuClass self => self + -> IO MenuItem -- ^ returns the 'MenuItem' that was last selected in the menu. + -- If a selection has not yet been made, the first menu item is + -- selected. +menuGetActive self = + makeNewObject mkMenuItem $ throwIfNull "menuGetActive: menu contains no menu items." $ - liftM castPtr $ {#call menu_get_active#} (toMenu m) + liftM castPtr $ + {# call menu_get_active #} + (toMenu self) --- | Select the @n@th item of the menu. +-- | Selects the specified menu item within the menu. This is used by the +-- 'OptionMenu' and should not be used by anyone else. -- -menuSetActive :: MenuClass m => m -> Int -> IO () -menuSetActive m n = {#call menu_set_active#} (toMenu m) (fromIntegral n) +menuSetActive :: MenuClass self => self + -> Int -- ^ @index@ - the index of the menu item to select. Index values + -- are from 0 to n-1. + -> IO () +menuSetActive self index = + {# call menu_set_active #} + (toMenu self) + (fromIntegral index) --- | Specify whether the menu is to be shown as a tearoff menu. +-- | Changes the tearoff state of the menu. A menu is normally displayed as +-- drop down menu which persists as long as the menu is active. It can also be +-- displayed as a tearoff menu which persists until it is closed or reattached. -- -menuSetTearoffState :: MenuClass m => m -> Bool -> IO () -menuSetTearoffState m tornOff = - {#call menu_set_tearoff_state#} (toMenu m) (fromBool tornOff) +menuSetTearoffState :: MenuClass self => self + -> Bool -- ^ @tornOff@ - If @True@, menu is displayed as a tearoff menu. + -> IO () +menuSetTearoffState self tornOff = + {# call menu_set_tearoff_state #} + (toMenu self) + (fromBool tornOff) --- | Returns whether the menu is torn off. +-- | Returns whether the menu is torn off. See 'menuSetTearoffState'. -- -menuGetTearoffState :: MenuClass m => m -> IO Bool -menuGetTearoffState m = liftM toBool $ - {#call unsafe menu_get_tearoff_state#} (toMenu m) +menuGetTearoffState :: MenuClass self => self + -> IO Bool -- ^ returns @True@ if the menu is currently torn off. +menuGetTearoffState self = + liftM toBool $ + {# call unsafe menu_get_tearoff_state #} + (toMenu self) -- | Attach this menu to another widget. -- -menuAttachToWidget :: (MenuClass m, WidgetClass w) => m -> w -> IO () -menuAttachToWidget m w = - {#call menu_attach_to_widget#} (toMenu m) (toWidget w) nullFunPtr +menuAttachToWidget :: (MenuClass self, WidgetClass w) => self -> w -> IO () +menuAttachToWidget self w = + {# call menu_attach_to_widget #} + (toMenu self) + (toWidget w) + nullFunPtr -- | Detach this menu from the widget it is attached to. -- -menuDetach :: MenuClass m => m -> IO () -menuDetach m = {#call menu_detach#} (toMenu m) +menuDetach :: MenuClass self => self -> IO () +menuDetach self = + {# call menu_detach #} + (toMenu self) -- | Get the widget this menu is attached to. Returns Nothing if this is a -- tearoff (context) menu. -- -menuGetAttachWidget :: MenuClass m => m -> IO (Maybe Widget) -menuGetAttachWidget m = do - wPtr <- {#call unsafe menu_get_attach_widget#} (toMenu m) +menuGetAttachWidget :: MenuClass self => self -> IO (Maybe Widget) +menuGetAttachWidget self = do + wPtr <- {#call unsafe menu_get_attach_widget#} (toMenu self) if wPtr==nullPtr then return Nothing else liftM Just $ makeNewObject mkWidget (return wPtr) #if GTK_CHECK_VERSION(2,2,0) --- | Sets the "Screen" on which the menu will be displayed. +-- | Sets the 'Screen' on which the menu will be displayed. -- -menuSetScreen :: MenuClass m => m -> Maybe Screen -> IO () -menuSetScreen m screen = - {#call menu_set_screen#} (toMenu m) +-- * Available since Gtk version 2.2 +-- +menuSetScreen :: MenuClass self => self + -> Maybe Screen -- ^ @screen@ - a 'Screen', or @Nothing@ if the screen should + -- be determined by the widget the menu is attached to. + -> IO () +menuSetScreen self screen = + {# call menu_set_screen #} + (toMenu self) (fromMaybe (Screen nullForeignPtr) screen) - #endif + #if GTK_CHECK_VERSION(2,4,0) --- | Informs GTK+ on which monitor a menu should be popped up. +-- | Informs Gtk+ on which monitor a menu should be popped up. See +-- 'screenGetMonitorGeometry'. -- -menuSetMonitor :: MenuClass m => m - -> Int -- ^ The number of the monitor on which the menu - -- should be popped up - -> IO () -menuSetMonitor m monitorNum = - {#call menu_set_monitor#} (toMenu m) (fromIntegral monitorNum) +-- * Available since Gtk version 2.4 +-- +menuSetMonitor :: MenuClass self => self + -> Int -- ^ @monitorNum@ - the number of the monitor on which the menu + -- should be popped up + -> IO () +menuSetMonitor self monitorNum = + {# call menu_set_monitor #} + (toMenu self) + (fromIntegral monitorNum) #endif -------------------- @@ -280,14 +351,14 @@ -- | -- -menuTearoffState :: Attr Menu Bool +menuTearoffState :: MenuClass self => Attr self Bool menuTearoffState = Attr menuGetTearoffState menuSetTearoffState -- | \'accelGroup\' property. See 'menuGetAccelGroup' and 'menuSetAccelGroup' -- -menuAccelGroup :: Attr Menu AccelGroup +menuAccelGroup :: MenuClass self => Attr self AccelGroup menuAccelGroup = Attr menuGetAccelGroup menuSetAccelGroup Index: ToolItem.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ToolItem.chs.pp 13 Mar 2005 19:34:35 -0000 1.4 +++ ToolItem.chs.pp 2 Apr 2005 16:52:50 -0000 1.5 @@ -24,10 +24,12 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- 'ToolItem' is the base class of widgets that can be added to 'Toolbar'. +-- The base class of widgets that can be added to 'Toolbar' +-- +-- * Module available since Gtk+ version 2.4 -- module Graphics.UI.Gtk.MenuComboToolbar.ToolItem ( --- * Description +-- * Detail -- -- | 'ToolItem's are widgets that can appear on a toolbar. To create a toolbar -- item that contain something else than a button, use 'toolItemNew'. Use @@ -35,8 +37,6 @@ -- -- For toolbar items that contain buttons, see the 'ToolButton', -- 'ToggleToolButton' and 'RadioToolButton' classes. --- --- * Module available since Gtk version 2.4 -- * Class Hierarchy -- | @@ -96,8 +96,6 @@ #endif ) where -#if GTK_CHECK_VERSION(2,4,0) - import Monad (liftM) import System.Glib.FFI @@ -111,14 +109,16 @@ {# context lib="gtk" prefix="gtk" #} +#if GTK_CHECK_VERSION(2,4,0) -------------------- -- Constructors --- | Creates a new "ToolItem". +-- | Creates a new 'ToolItem' -- toolItemNew :: IO ToolItem toolItemNew = - makeNewObject mkToolItem {#call unsafe tool_item_new#} + makeNewObject mkToolItem $ + {# call unsafe tool_item_new #} -------------------- -- Methods @@ -127,162 +127,220 @@ -- homogeneous items. The effect is that all homogeneous items will have the -- same width as the widest of the items. -- -toolItemSetHomogeneous :: ToolItemClass item => item -> Bool -> IO () -toolItemSetHomogeneous item homogeneous = - {#call tool_item_set_homogeneous#} (toToolItem item) (fromBool homogeneous) +toolItemSetHomogeneous :: ToolItemClass self => self + -> Bool -- ^ @homogeneous@ - whether @toolItem@ is the same size as other + -- homogeneous items + -> IO () +toolItemSetHomogeneous self homogeneous = + {# call tool_item_set_homogeneous #} + (toToolItem self) + (fromBool homogeneous) -- | Returns whether the tool item is the same size as other homogeneous items. +-- See 'toolItemSetHomogeneous'. -- -toolItemGetHomogeneous :: ToolItemClass item => item -> IO Bool -toolItemGetHomogeneous item = liftM toBool $ - {#call unsafe tool_item_get_homogeneous#} (toToolItem item) +toolItemGetHomogeneous :: ToolItemClass self => self -> IO Bool +toolItemGetHomogeneous self = + liftM toBool $ + {# call unsafe tool_item_get_homogeneous #} + (toToolItem self) -- | Sets whether the tool item is allocated extra space when there is more room -- on the toolbar then needed for the items. The effect is that the item gets -- bigger when the toolbar gets bigger and smaller when the toolbar gets -- smaller. -- -toolItemSetExpand :: ToolItemClass item => item -> Bool -> IO () -toolItemSetExpand item expand = - {#call tool_item_set_expand#} (toToolItem item) (fromBool expand) +toolItemSetExpand :: ToolItemClass self => self -> Bool -> IO () +toolItemSetExpand self expand = + {# call tool_item_set_expand #} + (toToolItem self) + (fromBool expand) --- | Returns whether the tool item is allocated extra space. +-- | Returns whether the tool item is allocated extra space. See +-- 'toolItemSetExpand'. -- -toolItemGetExpand :: ToolItemClass item => item -> IO Bool -toolItemGetExpand item = liftM toBool $ - {#call unsafe tool_item_get_expand#} (toToolItem item) +toolItemGetExpand :: ToolItemClass self => self -> IO Bool +toolItemGetExpand self = + liftM toBool $ + {# call unsafe tool_item_get_expand #} + (toToolItem self) --- | Sets the "Tooltips" object to be used for the tool item, the text to be +-- | Sets the 'Tooltips' object to be used for the tool item, the text to be -- displayed as tooltip on the item and the private text to be used. See -- 'tooltipsSetTip'. -- -toolItemSetTooltip :: ToolItemClass item => item -> Tooltips - -> String -- ^ - -> String -- ^ - -> IO () -toolItemSetTooltip item tips text private = - withUTFString text $ \strPtr1 -> - withUTFString private $ \strPtr2 -> - {#call tool_item_set_tooltip#} (toToolItem item) tips strPtr1 strPtr2 +toolItemSetTooltip :: ToolItemClass self => self + -> Tooltips -- ^ @tooltips@ - The 'Tooltips' object to be used + -> String -- ^ @tipText@ - text to be used as tooltip text for @toolItem@ + -> String -- ^ @tipPrivate@ - text to be used as private tooltip text + -> IO () +toolItemSetTooltip self tooltips tipText tipPrivate = + withUTFString tipPrivate $ \tipPrivatePtr -> + withUTFString tipText $ \tipTextPtr -> + {# call tool_item_set_tooltip #} + (toToolItem self) + tooltips + tipTextPtr + tipPrivatePtr --- | Sets whether toolitem has a drag window. When True the tool item can be +-- | Sets whether toolitem has a drag window. When @True@ the tool item can be -- used as a drag source through 'dragSourceSet'. When the tool item has a drag -- window it will intercept all events, even those that would otherwise be sent -- to a child widget. -- -toolItemSetUseDragWindow :: ToolItemClass item => item -> Bool -> IO () -toolItemSetUseDragWindow item useDragWin = - {#call tool_item_set_use_drag_window#} (toToolItem item) (fromBool useDragWin) +toolItemSetUseDragWindow :: ToolItemClass self => self -> Bool -> IO () +toolItemSetUseDragWindow self useDragWindow = + {# call tool_item_set_use_drag_window #} + (toToolItem self) + (fromBool useDragWindow) -- | Returns whether the tool item has a drag window. See -- 'toolItemSetUseDragWindow'. -- -toolItemGetUseDragWindow :: ToolItemClass item => item -> IO Bool -toolItemGetUseDragWindow item = liftM toBool $ - {#call unsafe tool_item_get_use_drag_window#} (toToolItem item) +toolItemGetUseDragWindow :: ToolItemClass self => self -> IO Bool +toolItemGetUseDragWindow self = + liftM toBool $ + {# call unsafe tool_item_get_use_drag_window #} + (toToolItem self) -- | Sets whether the tool item is visible when the toolbar is docked -- horizontally. -- -toolItemSetVisibleHorizontal :: ToolItemClass item => item -> Bool -> IO () -toolItemSetVisibleHorizontal item visible = - {#call tool_item_set_visible_horizontal#} (toToolItem item) (fromBool visible) +toolItemSetVisibleHorizontal :: ToolItemClass self => self -> Bool -> IO () +toolItemSetVisibleHorizontal self visibleHorizontal = + {# call tool_item_set_visible_horizontal #} + (toToolItem self) + (fromBool visibleHorizontal) -- | Returns whether the tool item is visible on toolbars that are docked -- horizontally. -- -toolItemGetVisibleHorizontal :: ToolItemClass item => item -> IO Bool -toolItemGetVisibleHorizontal item = liftM toBool $ - {#call unsafe tool_item_get_visible_horizontal#} (toToolItem item) +toolItemGetVisibleHorizontal :: ToolItemClass self => self -> IO Bool +toolItemGetVisibleHorizontal self = + liftM toBool $ + {# call unsafe tool_item_get_visible_horizontal #} + (toToolItem self) --- | Sets whether the tool item is visible when the toolbar is docked --- vertically. Some tool items, such as text entries, are too wide to be useful --- on a vertically docked toolbar. If False the tool item will not appear on --- toolbars that are docked vertically. +-- | Sets whether the tool item is visible when the toolbar is docked vertically. +-- Some tool items, such as text entries, are too wide to be useful on a +-- vertically docked toolbar. If @False@ the tool item will +-- not appear on toolbars that are docked vertically. -- -toolItemSetVisibleVertical :: ToolItemClass item => item -> Bool -> IO () -toolItemSetVisibleVertical item visible = - {#call tool_item_set_visible_vertical#} (toToolItem item) (fromBool visible) +toolItemSetVisibleVertical :: ToolItemClass self => self -> Bool -> IO () +toolItemSetVisibleVertical self visibleVertical = + {# call tool_item_set_visible_vertical #} + (toToolItem self) + (fromBool visibleVertical) -- | Returns whether the tool item is visible when the toolbar is docked --- vertically. +-- vertically. See 'toolItemSetVisibleVertical'. -- -toolItemGetVisibleVertical :: ToolItemClass item => item -> IO Bool -toolItemGetVisibleVertical item = liftM toBool $ - {#call unsafe tool_item_get_visible_vertical#} (toToolItem item) +toolItemGetVisibleVertical :: ToolItemClass self => self -> IO Bool +toolItemGetVisibleVertical self = + liftM toBool $ + {# call unsafe tool_item_get_visible_vertical #} + (toToolItem self) -- | Sets whether the tool item should be considered important. The "ToolButton" -- class uses this property to determine whether to show or hide its label when --- the toolbar style is 'ToolbarBothHoriz'. The result is that only tool buttons --- with the \"is important\" property set have labels, an effect known as --- \"priority text\". +-- the toolbar style is 'ToolbarBothHoriz'. The result is that only tool +-- buttons with the \"is important\" property set have labels, an effect known +-- as \"priority text\". -- -toolItemSetIsImportant :: ToolItemClass item => item -> Bool -> IO () -toolItemSetIsImportant item important = - {#call tool_item_set_is_important#} (toToolItem item) (fromBool important) +toolItemSetIsImportant :: ToolItemClass self => self -> Bool -> IO () +toolItemSetIsImportant self isImportant = + {# call tool_item_set_is_important #} + (toToolItem self) + (fromBool isImportant) --- | Returns whether the tool item is considered important. +-- | Returns whether the tool item is considered important. See +-- 'toolItemSetIsImportant' -- -toolItemGetIsImportant :: ToolItemClass item => item -> IO Bool -toolItemGetIsImportant item = liftM toBool $ - {#call unsafe tool_item_get_is_important#} (toToolItem item) +toolItemGetIsImportant :: ToolItemClass self => self -> IO Bool +toolItemGetIsImportant self = + liftM toBool $ + {# call unsafe tool_item_get_is_important #} + (toToolItem self) -- | Returns the icon size used for the tool item. -- -toolItemGetIconSize :: ToolItemClass item => item -> IO IconSize -toolItemGetIconSize item = liftM (toEnum.fromIntegral) $ - {#call unsafe tool_item_get_icon_size#} (toToolItem item) +toolItemGetIconSize :: ToolItemClass self => self -> IO IconSize +toolItemGetIconSize self = + liftM (toEnum . fromIntegral) $ + {# call unsafe tool_item_get_icon_size #} + (toToolItem self) -- | Returns the orientation used for the tool item. -- -toolItemGetOrientation :: ToolItemClass item => item -> IO Orientation -toolItemGetOrientation item = liftM (toEnum.fromIntegral) $ - {#call unsafe tool_item_get_orientation#} (toToolItem item) +toolItemGetOrientation :: ToolItemClass self => self -> IO Orientation +toolItemGetOrientation self = + liftM (toEnum . fromIntegral) $ + {# call unsafe tool_item_get_orientation #} + (toToolItem self) -- | Returns the toolbar style used for the tool item. -- -toolItemGetToolbarStyle :: ToolItemClass item => item -> IO ToolbarStyle -toolItemGetToolbarStyle item = liftM (toEnum.fromIntegral) $ - {#call unsafe tool_item_get_toolbar_style#} (toToolItem item) +-- Possibilities are: +-- ['ToolbarBoth'] meaning the tool item should show both an icon and a label, +-- stacked vertically +-- ['ToolbarIcons'] meaning the toolbar shows only icons +-- ['ToolbarText'] meaning the tool item should only show text +-- ['ToolbarBothHoriz'] meaning the tool item should show both an icon and a +-- label, arranged horizontally +-- +toolItemGetToolbarStyle :: ToolItemClass self => self -> IO ToolbarStyle +toolItemGetToolbarStyle self = + liftM (toEnum . fromIntegral) $ + {# call unsafe tool_item_get_toolbar_style #} + (toToolItem self) -- | Returns the relief style of the tool item. See 'buttonSetReliefStyle'. -- -toolItemGetReliefStyle :: ToolItemClass item => item -> IO ReliefStyle -toolItemGetReliefStyle item = liftM (toEnum.fromIntegral) $ - {#call unsafe tool_item_get_relief_style#} (toToolItem item) +toolItemGetReliefStyle :: ToolItemClass self => self -> IO ReliefStyle +toolItemGetReliefStyle self = + liftM (toEnum . fromIntegral) $ + {# call unsafe tool_item_get_relief_style #} + (toToolItem self) --- | Returns the "MenuItem" that was last set by 'toolItemSetProxyMenuItem', --- ie. the "MenuItem" that is going to appear in the overflow menu. +-- | Returns the 'MenuItem' that was last set by 'toolItemSetProxyMenuItem', +-- ie. the 'MenuItem' that is going to appear in the overflow menu. -- -toolItemRetrieveProxyMenuItem :: ToolItemClass item => item -> IO (Maybe Widget) -toolItemRetrieveProxyMenuItem item = do - wPtr <- {#call unsafe tool_item_retrieve_proxy_menu_item#} (toToolItem item) - if wPtr==nullPtr then return Nothing else liftM Just $ - makeNewObject mkWidget $ return wPtr +toolItemRetrieveProxyMenuItem :: ToolItemClass self => self -> IO (Maybe Widget) +toolItemRetrieveProxyMenuItem self = + maybeNull (makeNewObject mkWidget) $ + {# call unsafe tool_item_retrieve_proxy_menu_item #} + (toToolItem self) --- | If the menu item identifier string matches the string passed to --- 'toolItemSetProxyMenuItem' the returns the corresponding "MenuItem". +-- | If @menuItemId@ matches the string passed to 'toolItemSetProxyMenuItem' +-- return the corresponding 'MenuItem'. -- -toolItemGetProxyMenuItem :: ToolItemClass item => item -> String -> IO (Maybe Widget) -toolItemGetProxyMenuItem item itemId = - withCString itemId $ \strPtr -> do - wPtr <- {#call unsafe tool_item_get_proxy_menu_item#} (toToolItem item) strPtr - if wPtr==nullPtr then return Nothing else liftM Just $ - makeNewObject mkWidget $ return wPtr +toolItemGetProxyMenuItem :: ToolItemClass self => self + -> String -- ^ @menuItemId@ - a string used to identify the menu + -- item + -> IO (Maybe Widget) -- ^ returns The 'MenuItem' passed to + -- 'toolItemSetProxyMenuItem', if the @menuItemId@s + -- match. +toolItemGetProxyMenuItem self menuItemId = + maybeNull (makeNewObject mkWidget) $ + withCString menuItemId $ \menuItemIdPtr -> + {# call unsafe tool_item_get_proxy_menu_item #} + (toToolItem self) + menuItemIdPtr --- | Sets the "MenuItem" used in the toolbar overflow menu. The menu item identifier +-- | Sets the 'MenuItem' used in the toolbar overflow menu. The @menuItemId@ -- is used to identify the caller of this function and should also be used with -- 'toolItemGetProxyMenuItem'. -- -toolItemSetProxyMenuItem :: (ToolItemClass item, MenuItemClass menuItem) => item - -> String -- ^ Menu item identifier string - -> menuItem -- ^ A "MenuItem" to be used in the - -- overflow menu - -> IO () -toolItemSetProxyMenuItem item menuItemId menuItem = - withCString menuItemId $ \strPtr -> - {#call tool_item_set_proxy_menu_item#} (toToolItem item) - strPtr (toWidget menuItem) +toolItemSetProxyMenuItem :: (ToolItemClass self, MenuItemClass menuItem) => self + -> String -- ^ @menuItemId@ - a string used to identify @menuItem@ + -> menuItem -- ^ @menuItem@ - a 'MenuItem' to be used in the overflow menu + -> IO () +toolItemSetProxyMenuItem self menuItemId menuItem = + withCString menuItemId $ \menuItemIdPtr -> + {# call tool_item_set_proxy_menu_item #} + (toToolItem self) + menuItemIdPtr + (toWidget menuItem) -------------------- -- Properties @@ -292,7 +350,7 @@ -- -- Default value: @True@ -- -toolItemVisibleHorizontal :: Attr ToolItem Bool +toolItemVisibleHorizontal :: ToolItemClass self => Attr self Bool toolItemVisibleHorizontal = Attr toolItemGetVisibleHorizontal toolItemSetVisibleHorizontal @@ -302,7 +360,7 @@ -- -- Default value: @True@ -- -toolItemVisibleVertical :: Attr ToolItem Bool +toolItemVisibleVertical :: ToolItemClass self => Attr self Bool toolItemVisibleVertical = Attr toolItemGetVisibleVertical toolItemSetVisibleVertical @@ -312,14 +370,14 @@ -- -- Default value: @False@ -- -toolItemIsImportant :: Attr ToolItem Bool +toolItemIsImportant :: ToolItemClass self => Attr self Bool toolItemIsImportant = Attr toolItemGetIsImportant toolItemSetIsImportant -- | \'expand\' property. See 'toolItemGetExpand' and 'toolItemSetExpand' -- -toolItemExpand :: Attr ToolItem Bool +toolItemExpand :: ToolItemClass self => Attr self Bool toolItemExpand = Attr toolItemGetExpand toolItemSetExpand @@ -327,7 +385,7 @@ -- | \'homogeneous\' property. See 'toolItemGetHomogeneous' and -- 'toolItemSetHomogeneous' -- -toolItemHomogeneous :: Attr ToolItem Bool +toolItemHomogeneous :: ToolItemClass self => Attr self Bool toolItemHomogeneous = Attr toolItemGetHomogeneous toolItemSetHomogeneous @@ -335,7 +393,7 @@ -- | \'useDragWindow\' property. See 'toolItemGetUseDragWindow' and -- 'toolItemSetUseDragWindow' -- -toolItemUseDragWindow :: Attr ToolItem Bool +toolItemUseDragWindow :: ToolItemClass self => Attr self Bool toolItemUseDragWindow = Attr toolItemGetUseDragWindow toolItemSetUseDragWindow Index: RadioMenuItem.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/MenuComboToolbar/RadioMenuItem.chs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- RadioMenuItem.chs 25 Feb 2005 01:11:35 -0000 1.3 +++ RadioMenuItem.chs 2 Apr 2005 16:52:50 -0000 1.4 @@ -19,19 +19,19 @@ -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- +-- Note: These are not the original Gtk functions as they involve handling a +-- Gtk owned GList. The interface is rather oriented towards the RadioButton +-- widget interface. +-- -- | -- Maintainer : gtk...@li... -- Stability : provisional -- Portability : portable (depends on GHC) -- --- A choice from multiple check menu items. --- --- * These are not the original Gtk functions as they involve handling a Gtk --- owned GList. The interface is rather oriented towards the RadioButton --- widget interface. +-- A choice from multiple check menu items -- module Graphics.UI.Gtk.MenuComboToolbar.RadioMenuItem ( --- * Description +-- * Detail -- -- | A radio menu item is a check menu item that belongs to a group. At each -- instant exactly one of the radio menu items from a group is selected. @@ -82,41 +82,54 @@ -------------------- -- Constructors --- | Create a new radio menu item. +-- | Creates a new 'RadioMenuItem'. -- radioMenuItemNew :: IO RadioMenuItem -radioMenuItemNew = makeNewObject mkRadioMenuItem $ liftM castPtr $ - {#call unsafe radio_menu_item_new#} nullPtr +radioMenuItemNew = + makeNewObject mkRadioMenuItem $ + liftM (castPtr :: Ptr Widget -> Ptr RadioMenuItem) $ + {# call unsafe radio_menu_item_new #} + nullPtr --- | Create a new radio menu item with a label in it. +-- | Creates a new 'RadioMenuItem' whose child is a simple 'Label'. -- radioMenuItemNewWithLabel :: String -> IO RadioMenuItem -radioMenuItemNewWithLabel label = withUTFString label $ \strPtr -> - makeNewObject mkRadioMenuItem $ liftM castPtr $ - {#call unsafe radio_menu_item_new_with_label#} nullPtr strPtr +radioMenuItemNewWithLabel label = + makeNewObject mkRadioMenuItem $ + liftM (castPtr :: Ptr Widget -> Ptr RadioMenuItem) $ + withUTFString label $ \labelPtr -> + {# call unsafe radio_menu_item_new_with_label #} + nullPtr + labelPtr --- | Create a new radio menu item with a label in it. Underscores in the label --- string indicate the mnemonic for the menu item. +-- | Creates a new 'RadioMenuItem' containing a label. The label will be +-- created using 'labelNewWithMnemonic', so underscores in @label@ indicate the +-- mnemonic for the menu item. -- radioMenuItemNewWithMnemonic :: String -> IO RadioMenuItem -radioMenuItemNewWithMnemonic label = withUTFString label $ \strPtr -> - makeNewObject mkRadioMenuItem $ liftM castPtr $ - {#call unsafe radio_menu_item_new_with_mnemonic#} nullPtr strPtr +radioMenuItemNewWithMnemonic label = + makeNewObject mkRadioMenuItem $ + liftM (castPtr :: Ptr Widget -> Ptr RadioMenuItem) $ + withUTFString label $ \labelPtr -> + {# call unsafe radio_menu_item_new_with_mnemonic #} + nullPtr + labelPtr -- | Create a new radio button and attach it to the group of another radio -- button. -- radioMenuItemNewJoinGroup :: RadioMenuItem -> IO RadioMenuItem radioMenuItemNewJoinGroup rmi = do - groupPtr <- {#call unsafe radio_menu_item_get_group#} rmi + groupPtr <- {# call unsafe radio_menu_item_get_group #} rmi makeNewObject mkRadioMenuItem $ liftM castPtr $ {#call unsafe radio_menu_item_new#} groupPtr -- | Create a new radio button with a label and attach it to the group of -- another radio button. -- -radioMenuItemNewJoinGroupWithLabel :: RadioMenuItem -> String -> - IO RadioMenuItem +radioMenuItemNewJoinGroupWithLabel :: RadioMenuItem + -> String + -> IO RadioMenuItem radioMenuItemNewJoinGroupWithLabel rmi label = do groupPtr <- {#call unsafe radio_menu_item_get_group#} rmi withUTFString label $ \strPtr -> @@ -127,8 +140,9 @@ -- another radio button. Underscores in the label string indicate the mnemonic -- for the menu item. -- -radioMenuItemNewJoinGroupWithMnemonic :: RadioMenuItem -> String -> - IO RadioMenuItem +radioMenuItemNewJoinGroupWithMnemonic :: RadioMenuItem + -> String + -> IO RadioMenuItem radioMenuItemNewJoinGroupWithMnemonic rmi label = do groupPtr <- {#call unsafe radio_menu_item_get_group#} rmi withUTFString label $ \strPtr -> Index: MenuBar.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuBar.chs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- MenuBar.chs 25 Feb 2005 01:11:35 -0000 1.3 +++ MenuBar.chs 2 Apr 2005 16:52:50 -0000 1.4 @@ -27,7 +27,7 @@ -- A subclass widget for 'MenuShell' which holds 'MenuItem' widgets -- module Graphics.UI.Gtk.MenuComboToolbar.MenuBar ( --- * Description +-- * Detail -- -- | The 'MenuBar' is a subclass of 'MenuShell' which contains one to many -- 'MenuItem'. The result is a standard menu bar which can hold many menu @@ -66,8 +66,10 @@ -------------------- -- Constructors --- | Create a horizontal bar that contains menu items. +-- | Creates the new 'MenuBar' -- menuBarNew :: IO MenuBar -menuBarNew = makeNewObject mkMenuBar $ - liftM castPtr {#call unsafe menu_bar_new#} +menuBarNew = + makeNewObject mkMenuBar $ + liftM (castPtr :: Ptr Widget -> Ptr MenuBar) $ + {# call unsafe menu_bar_new #} Index: Combo.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/MenuComboToolbar/Combo.chs.pp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Combo.chs.pp 25 Feb 2005 22:53:41 -0000 1.4 +++ Combo.chs.pp 2 Apr 2005 16:52:49 -0000 1.5 @@ -29,10 +29,13 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- A Combo is a text entry field with a dropdown list. +-- A text entry field with a dropdown list +-- +-- * Warning: this module is deprecated and should not be used in +-- newly-written code. -- module Graphics.UI.Gtk.MenuComboToolbar.Combo ( --- * Description +-- * Detail -- -- | The 'Combo' widget consists of a single-line text entry field and a -- drop-down list. The drop-down list is displayed when the user clicks on a @@ -60,11 +63,14 @@ -- | +----'HBox' -- | +----Combo -- @ + #ifndef DISABLE_DEPRECATED -- * Types Combo, ComboClass, castToCombo, + +-- * Constructors comboNew, -- * Methods @@ -76,7 +82,6 @@ comboDisableActivate #endif ) where -#ifndef DISABLE_DEPRECATED import Monad (liftM, mapM_) @@ -91,20 +96,27 @@ {# context lib="gtk" prefix="gtk" #} +#ifndef DISABLE_DEPRECATED -------------------- --- Methods +-- Constructors -- Create a new Combo text entry field. -- comboNew :: IO Combo -comboNew = makeNewObject mkCombo $ liftM castPtr $ {#call unsafe combo_new#} +comboNew = + makeNewObject mkCombo $ + liftM castPtr $ + {# call unsafe combo_new #} + +-------------------- +-- Methods -- | Insert a set of Strings into the -- 'Combo' drop down list. -- -comboSetPopdownStrings :: ComboClass c => c -> [String] -> IO () -comboSetPopdownStrings c strs = do - list <- comboGetList (toCombo c) +comboSetPopdownStrings :: ComboClass self => self -> [String] -> IO () +comboSetPopdownStrings self strs = do + list <- comboGetList (toCombo self) {#call list_clear_items#} list 0 (-1) mapM_ (\str -> do li <- makeNewObject mkWidget $ liftM castPtr $ @@ -113,42 +125,62 @@ containerAdd list li) strs --- | Specify whether the user may enter texts that --- are not in the list of alternatives and if empty entries are allowed. +-- | Specifies whether the value entered in the text entry field must match +-- one of the values in the list. If this is set then the user will not be able +-- to perform any other action until a valid value has been entered. -- -comboSetValueInList :: ComboClass c => c -> Bool -> Bool -> IO () -comboSetValueInList c val okIfEmpty = {#call unsafe combo_set_value_in_list#} - (toCombo c) (fromBool val) (fromBool okIfEmpty) +-- If an empty field is acceptable, the @okIfEmpty@ parameter should be +-- @True@. +-- +comboSetValueInList :: ComboClass self => self + -> Bool -- ^ @val@ - @True@ if the value entered must match one of the + -- values in the list. + -> Bool -- ^ @okIfEmpty@ - @True@ if an empty value is considered valid. + -> IO () +comboSetValueInList self val okIfEmpty = + {# call unsafe combo_set_value_in_list #} + (toCombo self) + (fromBool val) + (fromBool okIfEmpty) --- | Specify if the user may use the cursor keys to --- navigate the list. +-- | Specifies if the arrow (cursor) keys can be used to step through the +-- items in the list. This is on by default. -- -comboSetUseArrows :: ComboClass c => c -> Bool -> IO () -comboSetUseArrows c val = {#call unsafe combo_set_use_arrows#} (toCombo c) - (fromBool val) +comboSetUseArrows :: ComboClass self => self -> Bool -> IO () +comboSetUseArrows self val = + {# call unsafe combo_set_use_arrows #} + (toCombo self) + (fromBool val) --- | Specify if the content entered by the user --- will be replaced by a predefined alternative as soon as the user uses the --- cursor keys. +-- | Obsolete function, does nothing. -- -comboSetUseArrowsAlways :: ComboClass c => c -> Bool -> IO () -comboSetUseArrowsAlways c val = {#call unsafe combo_set_use_arrows_always#} - (toCombo c) (fromBool val) +comboSetUseArrowsAlways :: ComboClass self => self -> Bool -> IO () +comboSetUseArrowsAlways self val = + {# call unsafe combo_set_use_arrows_always #} + (toCombo self) + (fromBool val) --- | Specify whether the entered text is case --- sensitive when it comes to matching the users input with the predefined --- alternatives. +-- | Specifies whether the text entered into the 'Entry' field and the text in +-- the list items is case sensitive. -- -comboSetCaseSensitive :: ComboClass c => c -> Bool -> IO () -comboSetCaseSensitive c val = {#call unsafe combo_set_case_sensitive#} - (toCombo c) (fromBool val) +-- This may be useful, for example, when you have called +-- 'comboSetValueInList' to limit the values entered, but you are not worried +-- about differences in case. +-- +comboSetCaseSensitive :: ComboClass self => self -> Bool -> IO () +comboSetCaseSensitive self val = + {# call unsafe combo_set_case_sensitive #} + (toCombo self) + (fromBool val) --- | Stops the GtkCombo widget from showing the --- popup list when the Entry emits the \"activate\" signal, i.e. when the Return --- key is pressed. This may be useful if, for example, if you want the Return --- key to close a dialog instead. +-- | Stops the 'Combo' widget from showing the popup list when the 'Entry' +-- emits the \"activate\" signal, i.e. when the Return key is pressed. This may +-- be useful if, for example, you want the Return key to close a dialog +-- instead. -- -comboDisableActivate :: ComboClass c => c -> IO () -comboDisableActivate = {#call unsafe combo_disable_activate#}.toCombo +comboDisableActivate :: ComboClass self => self -> IO () +comboDisableActivate self = + {# call unsafe combo_disable_activate #} + (toCombo self) #endif Index: CheckMenuItem.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/MenuComboToolbar/CheckMenuItem.chs.pp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- CheckMenuItem.chs.pp 13 Mar 2005 19:34:34 -0000 1.5 +++ CheckMenuItem.chs.pp 2 Apr 2005 16:52:49 -0000 1.6 @@ -24,10 +24,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- This widget implements a 'MenuItem' with a check next to it. +-- A menu item with a check box -- module Graphics.UI.Gtk.MenuComboToolbar.CheckMenuItem ( --- * Description +-- * Detail -- -- | A 'CheckMenuItem' is a menu item that maintains the state of a boolean -- value in addition to a 'MenuItem''s usual role in activating application @@ -91,75 +91,112 @@ -------------------- -- Constructors --- | Create a new 'MenuItem' with a check next to it. +-- | Creates a new 'CheckMenuItem'. -- checkMenuItemNew :: IO CheckMenuItem -checkMenuItemNew = makeNewObject mkCheckMenuItem $ liftM castPtr $ - {#call unsafe check_menu_item_new#} +checkMenuItemNew = + makeNewObject mkCheckMenuItem $ + liftM (castPtr :: Ptr Widget -> Ptr CheckMenuItem) $ + {# call unsafe check_menu_item_new #} --- | Create a new 'CheckMenuItem' with a 'Label' inside. +-- | Creates a new 'CheckMenuItem' with a label. -- -checkMenuItemNewWithLabel :: String -> IO CheckMenuItem -checkMenuItemNewWithLabel str = withUTFString str $ \strPtr -> - makeNewObject mkCheckMenuItem $ liftM castPtr $ - {#call unsafe check_menu_item_new_with_label#} strPtr +checkMenuItemNewWithLabel :: + String -- ^ @label@ - the string to use for the label. + -> IO CheckMenuItem +checkMenuItemNewWithLabel label = + makeNewObject mkCheckMenuItem $ + liftM (castPtr :: Ptr Widget -> Ptr CheckMenuItem) $ + withUTFString label $ \labelPtr -> + {# call unsafe check_menu_item_new_with_label #} + labelPtr --- | Create a new 'CheckMenuItem' with a 'Label' inside. Underscores in the --- label string indicate the mnemonic for the menu item. +-- | Creates a new 'CheckMenuItem' containing a label. The label will be +-- created using 'labelNewWithMnemonic', so underscores in @label@ indicate the +-- mnemonic for the menu item. -- -checkMenuItemNewWithMnemonic :: String -> IO CheckMenuItem -checkMenuItemNewWithMnemonic str = - withUTFString str $ \strPtr -> - makeNewObject mkCheckMenuItem $ liftM castPtr $ - {#call unsafe check_menu_item_new_with_mnemonic#} strPtr +checkMenuItemNewWithMnemonic :: + String -- ^ @label@ - The text of the button, with an underscore + -- in front of the mnemonic character + -> IO CheckMenuItem +checkMenuItemNewWithMnemonic label = + makeNewObject mkCheckMenuItem $ + liftM (castPtr :: Ptr Widget -> Ptr CheckMenuItem) $ + withUTFString label $ \labelPtr -> + {# call unsafe check_menu_item_new_with_mnemonic #} + labelPtr -------------------- -- Methods -- | Sets the active state of the menu item's check box. -- -checkMenuItemSetActive :: CheckMenuItemClass mi => mi -> Bool -> IO () -checkMenuItemSetActive mi active = {#call check_menu_item_set_active#} - (toCheckMenuItem mi) (fromBool active) +checkMenuItemSetActive :: CheckMenuItemClass self => self -> Bool -> IO () +checkMenuItemSetActive self isActive = + {# call check_menu_item_set_active #} + (toCheckMenuItem self) + (fromBool isActive) --- | Returns whether the check menu item is active. +-- | Returns whether the check menu item is active. See +-- 'checkMenuItemSetActive'. -- -checkMenuItemGetActive :: CheckMenuItemClass mi => mi -> IO Bool -checkMenuItemGetActive mi = - liftM toBool $ {#call unsafe check_menu_item_get_active#} (toCheckMenuItem mi) +checkMenuItemGetActive :: CheckMenuItemClass self => self -> IO Bool +checkMenuItemGetActive self = + liftM toBool $ + {# call unsafe check_menu_item_get_active #} + (toCheckMenuItem self) -- | Emits the toggled signal. -- -checkMenuItemToggled :: CheckMenuItemClass mi => mi -> IO () -checkMenuItemToggled mi = - {#call check_menu_item_toggled#} (toCheckMenuItem mi) +checkMenuItemToggled :: CheckMenuItemClass self => self -> IO () +checkMenuItemToggled self = + {# call check_menu_item_toggled #} + (toCheckMenuItem self) --- | Set the state of the menu item check to \`inconsistent'. +-- | If the user has selected a range of elements (such as some text or +-- spreadsheet cells) that are affected by a boolean setting, and the current +-- values in that range are inconsistent, you may want to display the check in +-- an \"in between\" state. This function turns on \"in between\" display. +-- Normally you would turn off the inconsistent state again if the user +-- explicitly selects a setting. This has to be done manually, +-- 'checkMenuItemSetInconsistent' only affects visual appearance, it doesn't +-- affect the semantics of the widget. -- -checkMenuItemSetInconsistent :: CheckMenuItemClass mi => mi -> Bool -> IO () -checkMenuItemSetInconsistent mi inconsistent = - {#call check_menu_item_set_inconsistent#} (toCheckMenuItem mi) - (fromBool inconsistent) +checkMenuItemSetInconsistent :: CheckMenuItemClass self => self -> Bool -> IO () +checkMenuItemSetInconsistent self setting = + {# call check_menu_item_set_inconsistent #} + (toCheckMenuItem self) + (fromBool setting) --- | Query if the menu check is inconsistent (inbetween). +-- | Query if the menu check is drawn as inconsistent (inbetween). See +-- 'checkMenuItemSetInconsistent'. -- -checkMenuItemGetInconsistent :: CheckMenuItemClass mi => mi -> IO Bool -checkMenuItemGetInconsistent mi = liftM toBool $ - {#call unsafe check_menu_item_get_inconsistent#} (toCheckMenuItem mi) +checkMenuItemGetInconsistent :: CheckMenuItemClass self => self -> IO Bool +checkMenuItemGetInconsistent self = + liftM toBool $ + {# call unsafe check_menu_item_get_inconsistent #} + (toCheckMenuItem self) #if GTK_CHECK_VERSION(2,4,0) -- | Sets whether the menu item is drawn like a 'RadioMenuItem'. -- -checkMenuItemSetDrawAsRadio :: CheckMenuItemClass mi => mi -> Bool -> IO () -checkMenuItemSetDrawAsRadio mi asRadio = - {#call check_menu_item_set_draw_as_radio#} (toCheckMenuItem mi) - (fromBool asRadio) +-- * Available since Gtk version 2.4 +-- +checkMenuItemSetDrawAsRadio :: CheckMenuItemClass self => self -> Bool -> IO () +checkMenuItemSetDrawAsRadio self drawAsRadio = + {# call check_menu_item_set_draw_as_radio #} + (toCheckMenuItem self) + (fromBool drawAsRadio) -- | Returns whether the menu item is drawn like a 'RadioMenuItem'. -- -checkMenuItemGetDrawAsRadio :: CheckMenuItemClass mi => mi -> IO Bool -checkMenuItemGetDrawAsRadio mi = liftM toBool $ - {#call unsafe check_menu_item_get_draw_as_radio#} (toCheckMenuItem mi) +-- * Available since Gtk version 2.4 +-- +checkMenuItemGetDrawAsRadio :: CheckMenuItemClass self => self -> IO Bool +checkMenuItemGetDrawAsRadio self = + liftM toBool $ + {# call unsafe check_menu_item_get_draw_as_radio #} + (toCheckMenuItem self) #endif -------------------- @@ -169,7 +206,7 @@ -- -- Default value: @False@ -- -checkMenuItemActive :: Attr CheckMenuItem Bool +checkMenuItemActive :: CheckMenuItemClass self => Attr self Bool checkMenuItemActive = Attr checkMenuItemGetActive checkMenuItemSetActive @@ -178,7 +215,7 @@ -- -- Default value: @False@ -- -checkMenuItemInconsistent :: Attr CheckMenuItem Bool +checkMenuItemInconsistent :: CheckMenuItemClass self => Attr self Bool checkMenuItemInconsistent = Attr checkMenuItemGetInconsistent checkMenuItemSetInconsistent @@ -187,7 +224,7 @@ -- -- Default value: @False@ -- -checkMenuItemDrawAsRadio :: Attr CheckMenuItem Bool +checkMenuItemDrawAsRadio :: CheckMenuItemClass self => Attr self Bool checkMenuItemDrawAsRadio = Attr checkMenuItemGetDrawAsRadio checkMenuItemSetDrawAsRadio Index: Toolbar.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs.pp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Toolbar.chs.pp 13 Mar 2005 19:34:35 -0000 1.4 +++ Toolbar.chs.pp 2 Apr 2005 16:52:50 -0000 1.5 @@ -24,10 +24,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- Create bars of buttons and other widgets. +-- Create bars of buttons and other widgets -- module Graphics.UI.Gtk.MenuComboToolbar.Toolbar ( --- * Description +-- * Detail -- -- | This widget underwent a signficant overhaul in gtk 2.4 and the -- recommended api changed substantially. The old interface is still supported @@ -37,29 +37,19 @@ -- -- A toolbar is created with a call to 'toolbarNew'. -- --- A toolbar can contain instances of a subclass of "ToolItem". To add a --- "ToolItem" to the a toolbar, use 'toolbarInsert'. To remove an item from the +-- A toolbar can contain instances of a subclass of 'ToolItem'. To add a +-- 'ToolItem' to the a toolbar, use 'toolbarInsert'. To remove an item from the -- toolbar use 'containerRemove'. To add a button to the toolbar, add an --- instance of "ToolButton". +-- instance of 'ToolButton'. -- -- Toolbar items can be visually grouped by adding instances of --- "SeparatorToolItem" to the toolbar. If a "SeparatorToolItem" has the --- \"expand\" property set to True and the \"draw\" property set to False +-- 'SeparatorToolItem' to the toolbar. If a 'SeparatorToolItem' has the +-- \"expand\" property set to @True@ and the \"draw\" property set to @False@ -- the effect is to force all following items to the end of the toolbar. -- -- Creating a context menu for the toolbar can be done using -- 'onPopupContextMenu'. --- * Class Hierarchy --- | --- @ --- | 'GObject' --- | +----'Object' --- | +----'Widget' --- | +----'Container' --- | +----Toolbar --- @ - #ifndef DISABLE_DEPRECATED -- | * The following information applies to the old interface only. -- @@ -80,6 +70,16 @@ -- honored this way. #endif +-- * Class Hierarchy +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Container' +-- | +----Toolbar +-- @ + -- * Types Toolbar, ToolbarClass, @@ -175,11 +175,13 @@ -------------------- -- Constructors --- | Create a new, empty toolbar. +-- | Creates a new toolbar. -- toolbarNew :: IO Toolbar -toolbarNew = makeNewObject mkToolbar $ liftM castPtr - {#call unsafe toolbar_new#} +toolbarNew = + makeNewObject mkToolbar $ + liftM (castPtr :: Ptr Widget -> Ptr Toolbar) $ + {# call unsafe toolbar_new #} -- Make tooltips or not? -- @@ -194,324 +196,446 @@ #ifndef DISABLE_DEPRECATED -- | Insert a new 'Button' into the 'Toolbar'. -- --- * The new 'Button' is created at position @pos@, counting --- from 0. +-- The new 'Button' is created at position @pos@, counting from 0. -- --- * The icon and label for the button is referenced by @stockId@ --- which must be a valid entry in the 'Toolbar's Style or the --- default 'IconFactory'. +-- The icon and label for the button is referenced by @stockId@ +-- which must be a valid entry in the 'Toolbar's Style or the +-- default 'IconFactory'. -- --- * If you whish to have 'Tooltips' added to this button you can --- specify @Just (tipText, tipPrivate)@ , otherwise specify --- @Nothing@. +-- If you whish to have 'Tooltips' added to this button you can +-- specify @Just (tipText, tipPrivate)@ , otherwise specify @Nothing@. -- --- * The newly created 'Button' is returned. Use this button to --- add an action function with @\"connectToClicked\"@. +-- The newly created 'Button' is returned. Use this button to +-- add an action function with @\"connectToClicked\"@. -- -toolbarInsertNewButton :: ToolbarClass tb => tb -> Int -> String -> - Maybe (String,String) -> IO Button -toolbarInsertNewButton tb pos stockId tooltips = +-- * Warning: this function is deprecated and should not be used in +-- newly-written code. +-- +toolbarInsertNewButton :: ToolbarClass self => self + -> Int + -> String + -> Maybe (String,String) + -> IO Button +toolbarInsertNewButton self pos stockId tooltips = withUTFString stockId $ \stockPtr -> mkToolText tooltips $ \textPtr privPtr -> makeNewObject mkButton $ liftM castPtr $ - {#call unsafe toolbar_insert_stock#} (toToolbar tb) stockPtr textPtr privPtr - nullFunPtr nullPtr (fromIntegral pos) + {# call unsafe toolbar_insert_stock #} + (toToolbar self) + stockPtr + textPtr + privPtr + nullFunPtr + nullPtr + (fromIntegral pos) -- | Append a new 'Button' to the 'Toolbar'. -- --- * See 'toolbarInsertNewButton' for details. +-- See 'toolbarInsertNewButton' for details. -- -toolbarAppendNewButton :: ToolbarClass tb => tb -> String -> - Maybe (String,String) -> IO Button -toolbarAppendNewButton tb = toolbarInsertNewButton tb (-1) +-- * Warning: this function is deprecated and should not be used in +-- newly-written code. +-- +toolbarAppendNewButton :: ToolbarClass self => self + -> String + -> Maybe (String, String) + -> IO Button +toolbarAppendNewButton self = toolbarInsertNewButton self (-1) -- | Prepend a new 'Button' to the 'Toolbar'. -- --- * See 'toolbarInsertNewButton' for details. +-- See 'toolbarInsertNewButton' for details. -- -toolbarPrependNewButton :: ToolbarClass tb => tb -> String -> - Maybe (String,String) -> IO Button -toolbarPrependNewButton tb = toolbarInsertNewButton tb 0 +-- * Warning: this function is deprecated and should not be used in +-- newly-written code. +-- +toolbarPrependNewButton :: ToolbarClass self => self + -> String + -> Maybe (String, String) + -> IO Button +toolbarPrependNewButton self = toolbarInsertNewButton self 0 -- | Insert a new 'ToggleButton' into the 'Toolbar'. -- --- * See 'toolbarInsertNewButton' for details. +-- See 'toolbarInsertNewButton' for details. -- --- * Mnemonics in the label of the 'StockItem' are removed as they do --- not work due to the bad interface definition of GtkToolbar. +-- * Warning: this function is deprecated and should not be used in +-- newly-written code. -- -toolbarInsertNewToggleButton :: ToolbarClass tb => tb -> Int -> String -> - Maybe (String,String) -> IO ToggleButton -toolbarInsertNewToggleButton tb pos stockId tooltips = do +toolbarInsertNewToggleButton :: ToolbarClass self => self + -> Int + -> String + -> Maybe (String, String) + -> IO ToggleButton +toolbarInsertNewToggleButton self pos stockId tooltips = do mItem <- stockLookupItem stockId item <- case mItem of (Just item) -> return item Nothing -> liftM fromJust $ stockLookupItem stockMissingImage let label = (filter (/= '_')) $ siLabel item - size <- toolbarGetIconSize (toToolbar tb) + size <- toolbarGetIconSize (toToolbar self) image <- imageNewFromStock stockId size makeNewObject mkToggleButton $ liftM castPtr $ withUTFString label $ \lblPtr -> mkToolText tooltips $ \textPtr privPtr -> - {#call unsafe toolbar_insert_element#} (toToolbar tb) + {#call unsafe toolbar_insert_element#} (toToolbar self) toolbarChildToggleButton (mkWidget nullForeignPtr) lblPtr textPtr privPtr (toWidget image) nullFunPtr nullPtr (fromIntegral pos) -- | Append a new 'ToggleButton' to the 'Toolbar'. -- --- * See 'toolbarInsertNewButton' for details. +-- See 'toolbarInsertNewButton' for details. -- --- * Mnemonics in the label of the 'StockItem' are removed as they do --- not work due to the bad interface definition of GtkToolbar. +-- * Warning: this function is deprecated and should not be used in +-- newly-written code. -- -toolbarAppendNewToggleButton :: ToolbarClass tb => tb -> String -> - Maybe (String,String) -> IO ToggleButton -toolbarAppendNewToggleButton tb = toolbarInsertNewToggleButton tb (-1) +toolbarAppendNewToggleButton :: ToolbarClass self => self + -> String + -> Maybe (String, String) + -> IO ToggleButton +toolbarAppendNewToggleButton self = toolbarInsertNewToggleButton self (-1) -- | Prepend a new 'ToggleButton' to the 'Toolbar'. -- --- * See 'toolbarInsertNewButton' for details. +-- See 'toolbarInsertNewButton' for details. -- --- * Mnemonics in the label of the 'StockItem' are removed as they do --- not work due to the bad interface definition of GtkToolbar. +-- * Warning: this function is deprecated and should not be used in +-- newly-written code. -- -toolbarPrependNewToggleButton :: ToolbarClass tb => tb -> String -> - Maybe (String,String) -> IO ToggleButton -toolbarPrependNewToggleButton tb = toolbarInsertNewToggleButton tb 0 +toolbarPrependNewToggleButton :: ToolbarClass self => self + -> String + -> Maybe (String, String) + -> IO ToggleButton +toolbarPrependNewToggleButton self = toolbarInsertNewToggleButton self 0 -- | Insert a new 'RadioButton' into the 'Toolbar'. -- --- * See 'toolbarInsertNewButton' for details. +-- See 'toolbarInsertNewButton' for details. -- --- * Mnemonics in the label of the 'StockItem' are removed as they do --- not work due to the bad interface definition of GtkToolbar. +-- * Warning: this function is deprecated and should not be used in +-- newly-written code. -- --- * The @parent@ argument must be set to another --- 'RadioButton' in the group. If @Nothing@ is given, --- a new group is generated (which is the desired behavious for the --- first button of a gro... [truncated message content] |