From: Axel S. <si...@co...> - 2009-11-15 21:13:21
|
Sun Nov 15 14:39:09 EST 2009 Axel Simon <Axe...@en...> * Add functions to Window. hunk ./gtk/Graphics/UI/Gtk/General/Structs.hsc 67 + windowGetFrame, hunk ./gtk/Graphics/UI/Gtk/General/Structs.hsc 723 +-- Window related methods + +-- | Retrieves the frame 'DrawWindow' that contains a 'Window'. +-- +windowGetFrame :: WindowClass widget => widget -> IO (Maybe DrawWindow) +windowGetFrame da = + withForeignPtr (unWidget.toWidget $ da) $ \da' -> do + drawWindowPtr <- #{peek GtkWindow, frame} da' + if drawWindowPtr == nullPtr + then return Nothing + else liftM Just $ makeNewGObject mkDrawWindow (return $ castPtr drawWindowPtr) + hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModelFilter.chs.pp 141 --- model, not of the 'TreeModelFilter' model that is passed as the first +-- model, not of the 'TreeModelFilter' model that is passed in as the first hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 58 - windowSetTitle, - windowGetTitle, - windowSetResizable, - windowGetResizable, hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 60 - windowSetModal, - windowGetModal, hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 62 -#ifndef DISABLE_DEPRECATED - windowSetPolicy, -#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 64 - windowSetTransientFor, - windowGetTransientFor, - windowSetDestroyWithParent, - windowGetDestroyWithParent, hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 69 - windowGetFocus, - windowSetFocus, hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 76 - windowSetMnemonicModifier, - windowGetMnemonicModifier, - -- windowActivateKey, - -- windowPropagateKeyEvent, + windowActivateKey, + windowPropagateKeyEvent, hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 86 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 91 - windowSetSkipTaskbarHint, - windowGetSkipTaskbarHint, - windowSetSkipPagerHint, - windowGetSkipPagerHint, -#endif -#if GTK_CHECK_VERSION(2,4,0) - windowSetAcceptFocus, - windowGetAcceptFocus, -#endif -#if GTK_CHECK_VERSION(2,6,0) - windowSetFocusOnMap, - windowGetFocusOnMap, -#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 94 - windowSetDecorated, - windowGetDecorated, - windowSetDeletable, - windowGetDeletable, + windowGetFrame, hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 97 - windowSetHasFrame, - windowGetHasFrame, - windowSetRole, - windowGetRole, hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 101 - windowSetIcon, - windowSetIconList, - windowGetIconList, hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 103 -#if GTK_CHECK_VERSION(2,6,0) - windowSetIconName, - windowGetIconName, - windowSetDefaultIconName, -#endif +#if GTK_CHECK_VERSION(2,4,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 105 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 108 + windowSetDefaultIconName, hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 136 - windowSetUrgencyHint, - windowGetUrgencyHint, hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 138 -#if GTK_CHECK_VERSION(2,12,0) - windowSetOpacity, - windowGetOpacity, -#endif +#if GTK_CHECK_VERSION(2,10,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 140 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 153 +#if GTK_CHECK_VERSION(2,12,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 155 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 186 + windowFocus, + windowHasFrame, + windowIconList, + windowMnemonicModifier, hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 200 - onFrameEvent, - afterFrameEvent, + windowSetTitle, + windowGetTitle, + windowSetResizable, + windowGetResizable, + windowSetModal, + windowGetModal, + windowSetPolicy, + windowSetTransientFor, + windowGetTransientFor, + windowSetDestroyWithParent, + windowGetDestroyWithParent, + windowGetFocus, + windowSetFocus, + windowSetMnemonicModifier, + windowGetMnemonicModifier, +#if GTK_CHECK_VERSION(2,2,0) + windowSetSkipTaskbarHint, + windowGetSkipTaskbarHint, + windowSetSkipPagerHint, + windowGetSkipPagerHint, +#if GTK_CHECK_VERSION(2,4,0) + windowSetAcceptFocus, + windowGetAcceptFocus, +#if GTK_CHECK_VERSION(2,6,0) + windowSetFocusOnMap, + windowGetFocusOnMap, +#endif +#endif +#endif + windowSetDecorated, + windowGetDecorated, +#if GTK_CHECK_VERSION(2,10,0) + windowSetDeletable, + windowGetDeletable, +#endif + windowSetHasFrame, + windowGetHasFrame, + windowSetRole, + windowGetRole, + windowSetIcon, + windowSetIconList, + windowGetIconList, +#if GTK_CHECK_VERSION(2,6,0) + windowSetIconName, + windowGetIconName, +#endif +#if GTK_CHECK_VERSION(2,8,0) + windowSetUrgencyHint, + windowGetUrgencyHint, +#if GTK_CHECK_VERSION(2,12,0) + windowSetOpacity, + windowGetOpacity, +#endif +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 263 +import System.Glib.Flags hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 271 +import Graphics.UI.Gtk.General.Structs (windowGetFrame) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 275 -import Graphics.UI.Gtk.Gdk.Events (Event, EventKey, marshalEvent, MouseButton, - TimeStamp) +import Graphics.UI.Gtk.Gdk.EventM (EventM, EAny, EKey, MouseButton, TimeStamp) +import Control.Monad.Reader ( runReaderT, ask ) +import Control.Monad.Trans ( liftIO ) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 475 - -> Modifier -- ^ @modifier@ - the modifiers [_$_] + -> [Modifier] -- ^ @modifier@ - the modifiers [_$_] hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 481 - (fromIntegral (fromEnum modifier)) + (fromIntegral (fromFlags modifier)) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 485 - -> Modifier -- ^ @modifier@ - the modifier mask used to activate mnemonics on this window. [_$_] + -> [Modifier] -- ^ @modifier@ - the modifier mask used to activate mnemonics on this window. [_$_] hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 490 - (fromIntegral (fromEnum modifier)) + (fromIntegral (fromFlags modifier)) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 494 - -> IO Modifier -- ^ return the modifier mask used to activate mnemonics on this window. [_$_] -windowGetMnemonicModifier self = liftM (toEnum.fromIntegral) $ + -> IO [Modifier] -- ^ return the modifier mask used to activate mnemonics on this window. [_$_] +windowGetMnemonicModifier self = liftM (toFlags . fromIntegral) $ hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 503 --- windowActivateKey :: WindowClass self => self --- -> EventKey -- ^ @event@ - 'EventKey' --- -> IO Bool -- ^ return @True@ if a mnemonic or accelerator was found and activated. [_$_] --- windowActivateKey self event = liftM toBool $ --- {# call window_activate_key #} --- (toWindow self) --- event +windowActivateKey :: WindowClass self => self -> EventM EKey Bool + -- ^ return @True@ if a mnemonic or accelerator was found and activated. [_$_] +windowActivateKey self = do + ptr <- ask + liftIO $ liftM toBool $ + {# call window_activate_key #} + (toWindow self) + (castPtr ptr) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 516 --- windowPropagateKeyEvent :: WindowClass self => self --- -> EventKey -- ^ @event@ - 'EventKey' --- -> IO Bool -- ^ return @True@ if a widget in the focus chain handled the event. [_$_] --- windowPropagateKeyEvent self event = liftM toBool $ --- {# call window_propagate_key_event #} --- (toWindow self) --- event +windowPropagateKeyEvent :: WindowClass self => self + -> EventM EKey Bool + -- ^ return @True@ if a widget in the focus chain handled the event. [_$_] +windowPropagateKeyEvent self = do + ptr <- ask + liftIO $ liftM toBool $ + {# call window_propagate_key_event #} + (toWindow self) + (castPtr ptr) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1074 --- | (Note: this is a special-purpose function intended for the framebuffer port; see 'windowSetHasFrame'. [_$_] +-- | Retrieves the dimensions of the frame window for this toplevel. See [_$_] +-- 'windowSetHasFrame', 'windowSetFrameDimensions'. +-- +-- (Note: this is a special-purpose function intended for the framebuffer port; +-- see 'windowSetHasFrame'. [_$_] hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1083 --- Retrieves the dimensions of the frame window for this toplevel. See 'windowSetHasFrame', 'windowSetFrameDimensions'. hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1084 +-- hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1086 - -> IO (Maybe (Int - ,Int - ,Int - ,Int)) -- ^ return @(left, top, right, bottom)@ is location to store size frame. @left@ is width of the frame at the left, @top@ is height of the frame at the top, @right@ is width of the frame at the right, @bottom@ is height of the frame at the bottom. + -> IO (Int, Int, Int, Int) + -- ^ return @(left, top, right, bottom)@ is location to store size frame. @left@ is + -- width of the frame at the left, @top@ is height of the frame at the top, @right@ + -- is width of the frame at the right, @bottom@ is height of the frame at the bottom. hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1091 - alloca $ \lPtr -> alloca $ \tPtr -> alloca $ \rPtr -> alloca $ \bPtr -> [_$_] - do - {# call window_get_frame_dimensions #} (toWindow self) lPtr tPtr rPtr bPtr - if lPtr == nullPtr || tPtr == nullPtr || rPtr == nullPtr || bPtr == nullPtr - then return Nothing - else do - lv <- peek lPtr - tv <- peek tPtr - rv <- peek rPtr - bv <- peek bPtr - return (Just (fromIntegral lv, fromIntegral tv, fromIntegral rv, fromIntegral bv)) + alloca $ \lPtr -> alloca $ \tPtr -> alloca $ \rPtr -> alloca $ \bPtr -> do + {# call window_get_frame_dimensions #} (toWindow self) lPtr tPtr rPtr bPtr + lv <- peek lPtr + tv <- peek tPtr + rv <- peek rPtr + bv <- peek bPtr + return (fromIntegral lv, fromIntegral tv, fromIntegral rv, fromIntegral bv) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1099 --- | (Note: this is a special-purpose function for the framebuffer port, that causes GTK+ to draw its own window border. [_$_] --- For most applications, you want 'windowSetDecorated' instead, which tells the window manager whether to draw the window border.) +-- | If this function is called on a window with setting of @True@, before it is realized +-- or showed, it will have a "frame" window around its 'DrawWindow', +-- accessible using 'windowGetFrame'. Using the signal 'windowFrameEvent' you can +-- receive all events targeted at the frame. hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1104 --- If this function is called on a window with setting of @True@, before it is realized or showed, it will have a "frame" window around window->window, --- accessible in window->frame. Using the signal frame_event you can receive all events targeted at the frame. +-- (Note: this is a special-purpose function for the framebuffer port, that causes GTK+ to draw its own window border. [_$_] +-- For most applications, you want 'windowSetDecorated' instead, which tells the window manager whether to draw the window border.) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1108 --- but it could conceivably be used by X-programs that want to do their own window decorations. +-- but it could conceivably be used by X-programs that want to do their own window +-- decorations. hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1353 +#if GTK_CHECK_VERSION(2,4,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1363 - +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1907 +#if GTK_CHECK_VERSION(2,10,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1917 - [_$_] +#endif [_$_] hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1986 +-- | 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. +-- +windowFocus :: WindowClass self => Attr self (Maybe Widget) +windowFocus = newAttr + windowGetFocus + windowSetFocus + +-- | (Note: this is a special-purpose function for the framebuffer port, that +-- causes Gtk+ to draw its own window border. For most applications, you want +-- 'windowSetDecorated' instead, which tells the window manager whether to draw +-- the window border.) +-- +-- If this function is called on a window with setting of @True@, before it +-- is realized or showed, it will have a \"frame\" window around +-- its 'DrawWindow', accessible using 'windowGetFrame'. Using the signal +-- 'windowFrameEvent' you can receive all events targeted at the frame. +-- +-- This function is used by the linux-fb port to implement managed windows, +-- but it could conceivably be used by X-programs that want to do their own +-- window decorations. +-- +windowHasFrame :: WindowClass self => Attr self Bool +windowHasFrame = newAttr + windowGetHasFrame + windowSetHasFrame + +-- | Sets up the icon representing a 'Window'. The icon is used when the +-- window is minimized (also known as iconified). Some window managers or +-- desktop environments may also place it in the window frame, or display it in +-- other contexts. +-- +-- By passing several sizes, you may improve the final image quality of the +-- icon, by reducing or eliminating automatic image scaling. +-- +-- Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and larger +-- images (64x64, 128x128) if you have them. +-- +-- See also 'windowSetDefaultIconList' to set the icon for all windows in +-- your application in one go. +-- +-- Note that transient windows (those who have been set transient for +-- another window using 'windowSetTransientFor') will inherit their icon from +-- their transient parent. So there's no need to explicitly set the icon on +-- transient windows. +-- +windowIconList :: WindowClass self => Attr self [Pixbuf] +windowIconList = newAttr + windowGetIconList + windowSetIconList + +-- | The mnemonic modifier for this window. +-- +windowMnemonicModifier :: WindowClass self => Attr self [Modifier] +windowMnemonicModifier = newAttr + windowGetMnemonicModifier + windowSetMnemonicModifier + hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 2053 --- | The :startup-id is a write-only property for setting window's startup notification identifier. See 'windowSetStartupId' for more details. +#if GTK_CHECK_VERSION(2,12,0) +-- | The 'windowStartupId' is a write-only property for setting window's startup notification identifier. hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 2062 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 2115 --- | The :icon-name property specifies the name of the themed icon to use as the window icon. See GtkIconTheme for more details. +-- | The 'windowIconName' property specifies the name of the themed icon to use as the window icon. See 'IconTheme' for more details. hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 2247 --- | [_$_] +-- | Observe events that are emitted on the frame of this window. hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 2249 -frameEvent :: WindowClass self => Signal self (Event -> IO Bool) -frameEvent = Signal (connect_BOXED__BOOL "frame_event" marshalEvent) +frameEvent :: WindowClass self => Signal self (EventM EAny Bool) +frameEvent = Signal (\after obj fun -> + connect_PTR__BOOL "frame_event" after obj (runReaderT fun)) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 2258 --- | [_$_] +-- | Observe a change in input focus. hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 2265 --- | [_$_] --- -onFrameEvent, afterFrameEvent :: WindowClass self => self - -> (Event -> IO Bool) - -> IO (ConnectId self) -onFrameEvent = connect_BOXED__BOOL "frame_event" marshalEvent False -afterFrameEvent = connect_BOXED__BOOL "frame_event" marshalEvent True - --- | [_$_] +-- | Observe a change in input focus. |