From: Axel S. <si...@co...> - 2008-07-22 20:38:57
|
Sun Jul 13 05:28:51 EDT 2008 ha...@fi... * Missing window focus functions hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 83 + windowGetFocus, + windowSetFocus, + windowSetDefault, hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 501 +-- | Retrieves the current focused widget within the window. +-- | Note that this is the widget that would have the focus if the toplevel +-- | window focused; if the toplevel window is not focused then +-- | 'widgetHasFocus' will not be True for the widget. +-- +windowGetFocus :: WindowClass self => self -> IO (Maybe Widget) +windowGetFocus self = + maybeNull (makeNewObject mkWidget) $ + {# call unsafe gtk_window_get_focus #} + (toWindow self) + +-- | If focus is not the current focus widget, and is focusable, sets it as +-- | the focus widget for the window. If focus is Nothing, unsets the focus +-- | widget for this window. To set the focus to a particular widget in the +-- | toplevel, it is usually more convenient to use 'widgetGrabFocus' instead +-- | of this function. +-- +windowSetFocus :: (WindowClass self, WidgetClass widget) => self + -> Maybe widget + -> IO () +windowSetFocus self focus = + {# call unsafe gtk_window_set_focus #} + (toWindow self) + (maybe (Widget nullForeignPtr) toWidget focus) + +-- | The default widget is the widget that's activated when the user presses +-- | Enter in a dialog (for example). This function sets or unsets the default +-- | widget for a Window about. When setting (rather than unsetting) the +-- | default widget it's generally easier to call widgetGrabDefault on the +-- | widget. Before making a widget the default widget, you must set the +-- | 'widgetCanDefault' flag on the widget. +-- +windowSetDefault :: (WindowClass self, WidgetClass widget) => self + -> Maybe widget + -> IO () +windowSetDefault self defaultWidget = + {# call unsafe gtk_window_set_focus #} + (toWindow self) + (maybe (Widget nullForeignPtr) toWidget defaultWidget) + |