You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
(68) |
Aug
(4) |
Sep
|
Oct
(23) |
Nov
(95) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(3) |
Feb
|
Mar
|
Apr
(51) |
May
(81) |
Jun
(2) |
Jul
(86) |
Aug
(143) |
Sep
(3) |
Oct
(31) |
Nov
(63) |
Dec
(90) |
2005 |
Jan
(277) |
Feb
(157) |
Mar
(99) |
Apr
(195) |
May
(151) |
Jun
(148) |
Jul
(98) |
Aug
(123) |
Sep
(20) |
Oct
(174) |
Nov
(155) |
Dec
(26) |
2006 |
Jan
(51) |
Feb
(19) |
Mar
(16) |
Apr
(12) |
May
(5) |
Jun
|
Jul
(11) |
Aug
(7) |
Sep
(10) |
Oct
(31) |
Nov
(174) |
Dec
(56) |
2007 |
Jan
(45) |
Feb
(52) |
Mar
(10) |
Apr
(5) |
May
(47) |
Jun
(16) |
Jul
(80) |
Aug
(29) |
Sep
(14) |
Oct
(59) |
Nov
(46) |
Dec
(16) |
2008 |
Jan
(10) |
Feb
(1) |
Mar
|
Apr
|
May
(49) |
Jun
(26) |
Jul
(8) |
Aug
(4) |
Sep
(25) |
Oct
(53) |
Nov
(9) |
Dec
(1) |
2009 |
Jan
(66) |
Feb
(11) |
Mar
(1) |
Apr
(14) |
May
(8) |
Jun
(1) |
Jul
(2) |
Aug
(2) |
Sep
(9) |
Oct
(23) |
Nov
(35) |
Dec
|
2010 |
Jan
(7) |
Feb
(2) |
Mar
(39) |
Apr
(19) |
May
(161) |
Jun
(19) |
Jul
(32) |
Aug
(65) |
Sep
(113) |
Oct
(120) |
Nov
(2) |
Dec
|
2012 |
Jan
|
Feb
(5) |
Mar
(4) |
Apr
(7) |
May
(9) |
Jun
(14) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(12) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
(17) |
Mar
(4) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(8) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Axel S. <si...@co...> - 2009-11-17 08:51:42
|
Mon Nov 16 14:45:29 EST 2009 John Millikin <jmi...@gm...> * Add support for get/set_prgname and get/set_application_name. Ignore-this: 76c96d55ae04408764dca1c887af08b4 hunk ./Makefile.am 304 - glib/System/Glib/GDateTime.chs.pp + glib/System/Glib/GDateTime.chs.pp \ + glib/System/Glib/Utils.chs.pp hunk ./glib/System/Glib.hs 10 - module System.Glib.GDateTime + module System.Glib.GDateTime, + module System.Glib.Utils hunk ./glib/System/Glib.hs 22 +import System.Glib.Utils addfile ./glib/System/Glib/Utils.chs hunk ./glib/System/Glib/Utils.chs 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Miscellaneous utilities +-- +-- Author : John Millikin +-- +-- Created: 15 November 2009 +-- +-- Copyright (C) 2009 John Millikin +-- +-- 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 : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- This module binds GLib-specific utility procedures. +-- +module System.Glib.Utils + ( getApplicationName + , setApplicationName + , getProgramName + , setProgramName + ) where + +import System.Glib.FFI +import System.Glib.UTFString + +{# context lib="glib" prefix="g" #} + +-- | +-- Gets a human-readable name for the application, as set by +-- 'setApplicationName'. This name should be localized if possible, and is +-- intended for display to the user. Contrast with 'getProgramName', which +-- gets a non-localized name. If 'setApplicationName' has not been performed, +-- returns the result of 'getProgramName' (which may be 'Nothing' if +-- 'setProgramName' has also not been performed). +-- +getApplicationName :: IO (Maybe String) +getApplicationName = {#call unsafe get_application_name #} >>= maybePeek peekUTFString + +-- | +-- Sets a human-readable name for the application. This name should be +-- localized if possible, and is intended for display to the user. Contrast +-- with 'setProgramName', which sets a non-localized name. 'setProgramName' +-- will be performed automatically by 'initGUI', but 'setApplicationName' +-- will not. +-- +-- Note that for thread safety reasons, this computation can only be performed +-- once. +-- +-- The application name will be used in contexts such as error messages, or +-- when displaying an application's name in the task list. +-- +setApplicationName :: String -> IO () +setApplicationName = flip withUTFString {#call unsafe set_application_name #} + +-- | +-- Gets the name of the program. This name should /not/ be localized, contrast +-- with 'getApplicationName'. If you are using GDK or GTK+, the program name +-- is set in 'initGUI' to the last component of argv[0]. +-- +getProgramName :: IO (Maybe String) +getProgramName = {#call unsafe get_prgname #} >>= maybePeek peekUTFString + +-- | +-- Sets the name of the program. This name should /not/ be localized, contrast +-- with 'setApplicationName'. Note that for thread-safety reasons this +-- computation can only be performed once. +-- +setProgramName :: String -> IO () +setProgramName = flip withUTFString {#call unsafe set_prgname #} |
From: Axel S. <si...@co...> - 2009-11-17 08:28:39
|
Tue Nov 17 03:25:31 EST 2009 Axel Simon <Axe...@en...> * Add a forgotten dependency of Cairo on array. hunk ./configure.ac 249 - CAIRO_SPLITBASE_DEPENDS="bytestring-${PKG_BYTESTRING_VERSION}" hunk ./configure.ac 251 + CAIRO_SPLITBASE_DEPENDS="bytestring-${PKG_BYTESTRING_VERSION} array-${PKG_ARRAY_VERSION}" |
From: Andy S. <And...@co...> - 2009-11-16 16:30:58
|
Mon Nov 16 09:56:42 EST 2009 Andy Stewart <laz...@gm...> * Update Graphics.UI.Gtk.Embedding modules to Gtk+ 2.18.3 Ignore-this: d560619a2b3f3d5cb64ef2e794097fcb hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 4 --- Author : Axel Simon +-- Author : Axel Simon, Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 9 +-- Copyright (C) 2009 Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 60 +#if GTK_CHECK_VERSION(2,2,0) + plugNewForDisplay, +#endif hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 66 +#if GTK_CHECK_VERSION(2,14,0) + plugGetEmbedded, + plugGetSocketWindow, +#endif + +-- * Attributes + plugAttrEmbedded, + plugAttrSocketWindow, hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 76 + plugEmbedded, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 83 +#endif hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 90 +import System.Glib.Attributes +import System.Glib.Properties hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 124 +#if GTK_CHECK_VERSION(2,2,0) +-- | Create a new plug widget inside the 'Socket' identified by socket_id. +-- +-- * Available since Gtk+ version 2.2 +-- +plugNewForDisplay :: + Display -- ^ @display@ - the 'Display' on which @socketId@ is + -- displayed + -> Maybe NativeWindowId -- ^ @socketId@ - the XID of the socket's window. + -> IO Plug +plugNewForDisplay display socketId = + makeNewObject mkPlug $ + liftM (castPtr :: Ptr Widget -> Ptr Plug) $ + {# call gtk_plug_new_for_display #} + display + (fromNativeWindowId (fromMaybe nativeWindowIdNone socketId)) +#endif + hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 156 +#if GTK_CHECK_VERSION(2,14,0) +-- | Determines whether the plug is embedded in a socket. +-- +-- * Available since Gtk+ version 2.14 +-- +plugGetEmbedded :: PlugClass self => self + -> IO Bool -- ^ returns @True@ if the plug is embedded in a socket +plugGetEmbedded self = + liftM toBool $ + {# call gtk_plug_get_embedded #} + (toPlug self) + +-- | Retrieves the socket the plug is embedded in. +-- +-- * Available since Gtk+ version 2.14 +-- +plugGetSocketWindow :: PlugClass self => self + -> IO DrawWindow -- ^ returns the window of the socket, or {@NULL@, FIXME: + -- this should probably be converted to a Maybe data type} +plugGetSocketWindow self = + makeNewGObject mkDrawWindow $ + {# call gtk_plug_get_socket_window #} + (toPlug self) +#endif + +-------------------- +-- Attributes + +-- | @True@ if the plug is embedded in a socket. +-- +-- Default value: FALSE +-- [_$_] +-- * Available since Gtk+ version 2.12 +-- +plugAttrEmbedded :: PlugClass self => ReadAttr self Bool +plugAttrEmbedded = readAttrFromBoolProperty "embedded" + +-- | The window of the socket the plug is embedded in. +-- +-- * Available since Gtk+ version 2.14 +-- [_$_] +plugAttrSocketWindow :: PlugClass self => ReadAttr self DrawWindow +plugAttrSocketWindow = readAttrFromObjectProperty "socket-window" + {# call pure unsafe gdk_window_object_get_type #} + hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 204 --- | This plug received another application. +-- | Gets emitted when the plug becomes embedded in a socket and when the +-- embedding ends. hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 207 -onEmbedded, afterEmbedded :: PlugClass self => self +plugEmbedded :: PlugClass self => Signal self (IO ()) +plugEmbedded = Signal (connect_NONE__NONE "embedded") + +-------------------- +-- Deprecated Signals + +#ifndef DISABLE_DEPRECATED +onEmbedded :: PlugClass self => self hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 218 -afterEmbedded = connect_NONE__NONE "embedded" True +{-# DEPRECATED onEmbedded "instead of 'onEmbedded obj' use 'on obj plugEmbedded'" #-} hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 220 +afterEmbedded :: PlugClass self => self + -> IO () + -> IO (ConnectId self) +afterEmbedded = connect_NONE__NONE "embedded" True +{-# DEPRECATED afterEmbedded "instead of 'afterEmbedded obj' use 'after obj plugEmbedded'" #-} hunk ./gtk/Graphics/UI/Gtk/Embedding/Plug.chs.pp 227 +#endif hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 4 --- Author : Axel Simon +-- Author : Axel Simon, Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 9 +-- Copyright (C) 2009 Andy Stewart hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 99 +#if GTK_CHECK_VERSION(2,14,0) + socketGetPlugWindow, +#endif hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 104 + socketPlugAdded, + socketPlugRemoved, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 114 +#endif hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 120 +import System.Glib.Attributes +import System.Glib.Properties hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 185 +#if GTK_CHECK_VERSION(2,14,0) +-- | Retrieves the window of the plug. Use this to check if the plug has been +-- created inside of the socket. +-- +-- * Available since Gtk+ version 2.14 +-- +socketGetPlugWindow :: SocketClass self => self + -> IO DrawWindow -- ^ returns the window of the plug if available, or + -- {@NULL@, FIXME: this should probably be converted to a + -- Maybe data type} +socketGetPlugWindow self = + makeNewGObject mkDrawWindow $ + {# call gtk_socket_get_plug_window #} + (toSocket self) +#endif + hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 206 -onPlugAdded, afterPlugAdded :: SocketClass self => self +socketPlugAdded :: SocketClass self => Signal self (IO ()) +socketPlugAdded = Signal (connect_NONE__NONE "plug-added") + +-- | This signal is emitted when a client is removed from the socket. The +-- default action is to destroy the 'Socket' widget, so if you want to reuse it +-- you must add a signal handler that returns @True@. +-- +socketPlugRemoved :: SocketClass self => Signal self (IO Bool) +socketPlugRemoved = Signal (connect_NONE__BOOL "plug-removed") + +-------------------- +-- Deprecated Signals + +#ifndef DISABLE_DEPRECATED +onPlugAdded :: SocketClass self => self hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 224 -afterPlugAdded = connect_NONE__NONE "plug-added" True +{-# DEPRECATED onPlugAdded "instead of 'onPlugAdded obj' use 'on obj socketPlugAdded'" #-} hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 226 --- | This signal is emitted when a client is removed from the socket. --- -onPlugRemoved, afterPlugRemoved :: SocketClass self => self +afterPlugAdded :: SocketClass self => self hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 229 -onPlugRemoved = connect_NONE__NONE "plug-removed" False -afterPlugRemoved = connect_NONE__NONE "plug-removed" True +afterPlugAdded = connect_NONE__NONE "plug-added" True +{-# DEPRECATED afterPlugAdded "instead of 'afterPlugAdded obj' use 'after obj socketPlugAdded'" #-} + +onPlugRemoved :: SocketClass self => self + -> IO Bool + -> IO (ConnectId self) +onPlugRemoved = connect_NONE__BOOL "plug-removed" False +{-# DEPRECATED onPlugRemoved "instead of 'onPlugRemoved obj' use 'on obj socketPlugRemoved'" #-} hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 238 +afterPlugRemoved :: SocketClass self => self + -> IO Bool + -> IO (ConnectId self) +afterPlugRemoved = connect_NONE__BOOL "plug-removed" True +{-# DEPRECATED afterPlugRemoved "instead of 'afterPlugRemoved obj' use 'after obj socketPlugRemoved'" #-} hunk ./gtk/Graphics/UI/Gtk/Embedding/Socket.chs.pp 245 +#endif |
From: Axel S. <si...@co...> - 2009-11-16 09:40:20
|
Mon Nov 16 04:39:10 EST 2009 Axel Simon <Axe...@en...> * Do not export functions that don't exist. hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 106 -#if GTK_CHECK_VERSION(2,12,0) - aboutDialogGetProgramName, - aboutDialogSetProgramName, -#endif hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 173 +#if GTK_CHECK_VERSION(2,12,0) + {# call gtk_about_dialog_get_program_name #} +#else hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 177 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 189 +#if GTK_CHECK_VERSION(2,12,0) + {# call gtk_about_dialog_set_program_name #} +#else hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 193 +#endif |
From: Axel S. <si...@co...> - 2009-11-15 21:13:53
|
Sun Nov 15 15:35:05 EST 2009 Axel Simon <Axe...@en...> * Add new types for PixbufAnimation and Co. hunk ./tools/hierarchyGen/hierarchy.list 44 + GdkPixbufAnimation + GdkPixbufSimpleAnim + GdkPixbufAnimationIter |
From: Axel S. <si...@co...> - 2009-11-15 21:13:33
|
Sun Nov 15 15:14:08 EST 2009 Axel Simon <Axe...@en...> * Bring AboutDialog up to date. hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 46 +-- Since 2.18 'AboutDialog' provides default website and email hooks that +-- use 'showURI'. +-- +-- Note that Gtk+ sets a default title of @_(\"About %s\")@ on the dialog +-- window (where %s is replaced by the name of the application, but in order to +-- ensure proper translation of the title, applications should set the title +-- property explicitly when constructing a 'AboutDialog', as shown in the +-- following example: +-- +-- Note that prior to Gtk+ 2.12, the 'aboutDialogProgramName' property was called +-- 'aboutDialogName'. Both names may be used in Gtk2Hs. hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 82 + aboutDialogSetEmailHook, + aboutDialogSetUrlHook, + +-- * Attributes + aboutDialogProgramName, + aboutDialogName, + aboutDialogVersion, + aboutDialogCopyright, + aboutDialogComments, + aboutDialogLicense, + aboutDialogWebsite, + aboutDialogWebsiteLabel, + aboutDialogAuthors, + aboutDialogDocumenters, + aboutDialogArtists, + aboutDialogTranslatorCredits, + aboutDialogLogo, + aboutDialogLogoIconName, +#if GTK_CHECK_VERSION(2,8,0) + aboutDialogWrapLicense, +#endif + +-- * Deprecated +#ifndef DISABLE_DEPRECATED +#if GTK_CHECK_VERSION(2,12,0) + aboutDialogGetProgramName, + aboutDialogSetProgramName, +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 136 - aboutDialogSetEmailHook, - aboutDialogSetUrlHook, hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 140 - --- * Attributes - aboutDialogName, - aboutDialogVersion, - aboutDialogCopyright, - aboutDialogComments, - aboutDialogLicense, - aboutDialogWebsite, - aboutDialogWebsiteLabel, - aboutDialogAuthors, - aboutDialogDocumenters, - aboutDialogArtists, - aboutDialogTranslatorCredits, - aboutDialogLogo, - aboutDialogLogoIconName, hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 141 -#if GTK_CHECK_VERSION(2,8,0) - aboutDialogWrapLicense, hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 150 +import System.Glib.Properties hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 504 -aboutDialogName = newAttr - aboutDialogGetName - aboutDialogSetName +aboutDialogName = newAttrFromStringProperty "name" + +-- | The name of the program. If this is not set, it defaults to +-- 'gGetApplicationName'. +-- +#if GTK_CHECK_VERSION(2,12,0) +aboutDialogProgramName :: AboutDialogClass self => Attr self String +aboutDialogProgramName = newAttrFromStringProperty "program-name" +#else +aboutDialogProgramName :: AboutDialogClass self => Attr self String +aboutDialogProgramName = newAttrFromStringProperty "name" +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 520 -aboutDialogVersion = newAttr - aboutDialogGetVersion - aboutDialogSetVersion +aboutDialogVersion = newAttrFromStringProperty "version" hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 525 -aboutDialogCopyright = newAttr - aboutDialogGetCopyright - aboutDialogSetCopyright +aboutDialogCopyright = newAttrFromStringProperty "copyright" hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 532 -aboutDialogComments = newAttr - aboutDialogGetComments - aboutDialogSetComments +aboutDialogComments = newAttrFromStringProperty "comments" hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 543 -aboutDialogLicense = newAttr - aboutDialogGetLicense - aboutDialogSetLicense +aboutDialogLicense = newAttrFromMaybeStringProperty "license" hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 549 -aboutDialogWebsite = newAttr - aboutDialogGetWebsite - aboutDialogSetWebsite +aboutDialogWebsite = newAttrFromStringProperty "website" hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 555 -aboutDialogWebsiteLabel = newAttr - aboutDialogGetWebsiteLabel - aboutDialogSetWebsiteLabel +aboutDialogWebsiteLabel = newAttrFromStringProperty "website-label" hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 589 -aboutDialogTranslatorCredits = newAttr - aboutDialogGetTranslatorCredits - aboutDialogSetTranslatorCredits +aboutDialogTranslatorCredits = newAttrFromStringProperty "translator-credits" hunk ./gtk/Graphics/UI/Gtk/Windows/AboutDialog.chs.pp 616 -aboutDialogWrapLicense = newAttr - aboutDialogGetWrapLicense - aboutDialogSetWrapLicense +aboutDialogWrapLicense = newAttrFromBoolProperty "wrap-license" |
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. |
From: Axel S. <si...@co...> - 2009-11-15 20:14:56
|
Sat Nov 14 02:37:47 EST 2009 ar...@rp... * AddGdkPixbufAnimation Ignore-this: d5b7b2b309eff252143efb00af09863e hunk ./Makefile.am 773 + gtk/Graphics/UI/Gtk/Gdk/PixbufAnimation.chs.pp \ hunk ./gtk/Graphics/UI/Gtk/Display/Image.chs.pp 98 + imageNewFromAnimation, hunk ./gtk/Graphics/UI/Gtk/Display/Image.chs.pp 108 + imageSetFromAnimation, hunk ./gtk/Graphics/UI/Gtk/Display/Image.chs.pp 126 + imageAnimation, hunk ./gtk/Graphics/UI/Gtk/Display/Image.chs.pp 165 -{# enum ImageType {underscoreToCase} #} +{# enum ImageType {underscoreToCase} deriving (Show, Eq) #} hunk ./gtk/Graphics/UI/Gtk/Display/Image.chs.pp 210 + +imageNewFromAnimation :: (PixbufAnimationClass animation) => animation -> IO Image +imageNewFromAnimation pba = makeNewObject mkImage $ + liftM (castPtr :: Ptr Widget -> Ptr Image) $ + {# call unsafe image_new_from_animation #} (toPixbufAnimation pba) + + hunk ./gtk/Graphics/UI/Gtk/Display/Image.chs.pp 220 -imageNewFromStock :: [_$_] +imageNewFromStock :: hunk ./gtk/Graphics/UI/Gtk/Display/Image.chs.pp 247 -imageNewFromIconName :: [_$_] +imageNewFromIconName :: hunk ./gtk/Graphics/UI/Gtk/Display/Image.chs.pp 281 + +imageSetFromAnimation :: (PixbufAnimationClass animation) => Image -> animation -> IO () +imageSetFromAnimation self pba = + {# call unsafe gtk_image_set_from_animation #} + self + (toPixbufAnimation pba) + hunk ./gtk/Graphics/UI/Gtk/Display/Image.chs.pp 375 + +imageAnimation :: (PixbufClass pixbuf, PixbufAnimationClass animation) => ReadWriteAttr Image animation pixbuf +imageAnimation = newAttrFromObjectProperty "pixbuf-animation" + {# call pure unsafe gdk_pixbuf_get_type #} + hunk ./gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs.pp 26 --- the animation functions hunk ./gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs.pp 45 --- 'Pixbuf's and to scale and crop a 'Pixbuf' and [_$_] +-- 'Pixbuf's and to scale and crop a 'Pixbuf' and hunk ./gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs.pp 119 +import System.Glib.GDateTime hunk ./gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs.pp 263 -pixbufNewFromFile fname = [_$_] +pixbufNewFromFile fname = hunk ./gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs.pp 318 -pixbufNewFromFileAtScale :: [_$_] +pixbufNewFromFileAtScale :: hunk ./gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs.pp 395 - constructNewGObject mkPixbuf $ [_$_] + constructNewGObject mkPixbuf $ hunk ./gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs.pp 423 --- @png@ and run: [_$_] +-- @png@ and run: hunk ./gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs.pp 529 - constructNewGObject mkPixbuf $ liftM castPtr $ [_$_] - {#call pixbuf_scale_simple#} (toPixbuf pb) [_$_] + constructNewGObject mkPixbuf $ liftM castPtr $ + {#call pixbuf_scale_simple#} (toPixbuf pb) hunk ./gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs.pp 708 - {#call unsafe pixbuf_get_from_drawable#} [_$_] + {#call unsafe pixbuf_get_from_drawable#} addfile ./gtk/Graphics/UI/Gtk/Gdk/PixbufAnimation.chs.pp hunk ./gtk/Graphics/UI/Gtk/Gdk/PixbufAnimation.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Pixbuf Animation +-- +-- Author : Matthew Arsenault +-- +-- Created: 14 November 2009 +-- +-- Copyright (C) 2009 Matthew Arsenault +-- +-- 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 : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +module Graphics.UI.Gtk.Gdk.PixbufAnimation ( +-- * Class Hierarchy +-- | +-- @ +-- | 'GObject' +-- | +----'PixbufAnimation' +-- | +----'PixbufSimpleAnim' +-- @ + +-- * Types + PixbufAnimation, + PixbufAnimationClass, + castToPixbufAnimation, + toPixbufAnimation, + + PixbufAnimationIter, + PixbufAnimationIterClass, + castToPixbufAnimationIter, + toPixbufAnimationIter, + + PixbufSimpleAnim, + PixbufSimpleAnimClass, + castToPixbufSimpleAnim, + toPixbufSimpleAnim, + +-- * Constructors + pixbufAnimationNewFromFile, +#if GTK_CHECK_VERSION(2,8,0) + pixbufSimpleAnimNew, +#endif + +-- * Methods + pixbufAnimationGetWidth, + pixbufAnimationGetHeight, + pixbufAnimationGetIter, + pixbufAnimationIsStaticImage, + pixbufAnimationGetStaticImage, + pixbufAnimationIterAdvance, + pixbufAnimationIterGetDelayTime, + pixbufAnimationIterOnCurrentlyLoadingFrame, + pixbufAnimationIterGetPixbuf, +#if GTK_CHECK_VERSION(2,8,0) + pixbufSimpleAnimAddFrame, +#endif + +#if GTK_CHECK_VERSION(2,18,0) + pixbufSimpleAnimSetLoop, + pixbufSimpleAnimGetLoop +#endif + ) where + +import Control.Monad (liftM) +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.GDateTime +import System.Glib.GObject +{#import Graphics.UI.Gtk.Types#} +import System.Glib.GError (GError(..), GErrorClass(..), GErrorDomain, + propagateGError) +{# import Graphics.UI.Gtk.Gdk.Pixbuf #} + +{# context prefix="gdk" #} + + +--CHECKME: Domain error doc, GFileError ??? +-- | Creates a new animation by loading it from a file. The file +-- format is detected automatically. If the file's format does not +-- support multi-frame images, then an animation with a single frame +-- will be created. Possible errors are in the 'PixbufError' and +-- 'GFileError' domains. +-- +-- Any of several error conditions may occur: the file could not be +-- opened, there was no loader for the file's format, there was not +-- enough memory to allocate the image buffer, or the image file +-- contained invalid data. +-- +-- * If an error occurs, the function will throw an exception that can +-- be caught using e.g. 'System.Glib.GError.catchGErrorJust' and one of the +-- error codes in 'PixbufError' or 'GFileError' +-- +pixbufAnimationNewFromFile :: FilePath -- ^ Name of file to load, in the GLib file name encoding + -> IO PixbufAnimation -- ^ A newly-created animation +pixbufAnimationNewFromFile fname = + constructNewGObject mkPixbufAnimation $ + propagateGError $ \errPtrPtr -> + withUTFString fname $ \strPtr -> + {#call unsafe pixbuf_animation_new_from_file#} strPtr errPtrPtr + + +-- | Queries the width of the bounding box of a pixbuf animation. +pixbufAnimationGetWidth :: PixbufAnimation -- ^ An animation. + -> IO Int -- ^ Width of the bounding box of the animation. +pixbufAnimationGetWidth self = liftM fromIntegral $ {#call unsafe pixbuf_animation_get_width#} self + +-- | Queries the height of the bounding box of a pixbuf animation. +pixbufAnimationGetHeight :: PixbufAnimation -- ^ An animation. + -> IO Int -- ^ Height of the bounding box of the animation. +pixbufAnimationGetHeight self = liftM fromIntegral $ {#call unsafe pixbuf_animation_get_height#} self + + +-- | Get an iterator for displaying an animation. The iterator +-- provides the frames that should be displayed at a given time. The +-- start time would normally come from 'gGetCurrentTime', and marks +-- the beginning of animation playback. After creating an iterator, +-- you should immediately display the pixbuf returned by +-- 'pixbufAnimationIterGetPixbuf'. Then, you should install a +-- timeout (with 'timeoutAdd') or by some other mechanism ensure +-- that you'll update the image after +-- 'pixbufAnimationIterGetDelayTime' milliseconds. Each time the +-- image is updated, you should reinstall the timeout with the new, +-- possibly-changed delay time. +-- +-- As a shortcut, if start_time is @Nothing@, the result of +-- 'gGetCurrentTime' will be used automatically. +-- +-- To update the image (i.e. possibly change the result of +-- 'pixbufAnimationIterGetPixbuf' to a new frame of the animation), +-- call 'pixbufAnimationIterAdvance'. +-- +-- If you're using 'PixbufLoader', in addition to updating the image +-- after the delay time, you should also update it whenever you +-- receive the area_updated signal and +-- 'pixbufAnimationIterOnCurrentlyLoadingFrame' returns @True@. In +-- this case, the frame currently being fed into the loader has +-- received new data, so needs to be refreshed. The delay time for a +-- frame may also be modified after an area_updated signal, for +-- example if the delay time for a frame is encoded in the data after +-- the frame itself. So your timeout should be reinstalled after any +-- area_updated signal. +-- +-- A delay time of -1 is possible, indicating "infinite." +-- +pixbufAnimationGetIter :: PixbufAnimation -- ^ a 'PixbufAnimation' + -> Maybe GTimeVal -- ^ time when the animation starts playing + -> IO PixbufAnimationIter -- ^ an iterator to move over the animation +pixbufAnimationGetIter self tv = maybeWith with tv $ \stPtr -> + constructNewGObject mkPixbufAnimationIter $ + {#call unsafe pixbuf_animation_get_iter#} self (castPtr stPtr) + + + +-- | If you load a file with 'pixbufAnimationNewFromFile' and it turns +-- out to be a plain, unanimated image, then this function will +-- return @True@. Use 'pixbufAnimationGetStaticImage' to retrieve +-- the image. +-- +pixbufAnimationIsStaticImage :: PixbufAnimation + -> IO Bool -- ^ TRUE if the "animation" was really just an image +pixbufAnimationIsStaticImage self = liftM toBool $ {#call unsafe pixbuf_animation_is_static_image#} self + + +-- | If an animation is really just a plain image (has only one +-- frame), this function returns that image. If the animation is an +-- animation, this function returns a reasonable thing to display as +-- a static unanimated image, which might be the first frame, or +-- something more sophisticated. If an animation hasn't loaded any +-- frames yet, this function will return @Nothing@. +-- +pixbufAnimationGetStaticImage :: PixbufAnimation + -> IO (Maybe Pixbuf) -- ^ unanimated image representing the animation +pixbufAnimationGetStaticImage self = + maybeNull (constructNewGObject mkPixbuf) $ {#call unsafe pixbuf_animation_get_static_image#} self + + + +-- | Possibly advances an animation to a new frame. Chooses the frame +-- based on the start time passed to 'pixbufAnimationGetIter'. +-- +-- current_time would normally come from 'gGetCurrentTime', and must +-- be greater than or equal to the time passed to +-- 'pixbufAnimationGetIter', and must increase or remain unchanged +-- each time 'pixbufAnimationIterGetPixbuf' is called. That is, you +-- can't go backward in time; animations only play forward. +-- +-- As a shortcut, pass @Nothing@ for the current time and +-- 'gGetCurrentTime' will be invoked on your behalf. So you only need +-- to explicitly pass current_time if you're doing something odd like +-- playing the animation at double speed. +-- +-- If this function returns @False@, there's no need to update the +-- animation display, assuming the display had been rendered prior to +-- advancing; if @True@, you need to call 'animationIterGetPixbuf' and +-- update the display with the new pixbuf. +-- +pixbufAnimationIterAdvance :: PixbufAnimationIter -- ^ A 'PixbufAnimationIter' + -> Maybe GTimeVal -- ^ current time + -> IO Bool -- ^ @True@ if the image may need updating +pixbufAnimationIterAdvance iter currentTime = liftM toBool $ maybeWith with currentTime $ \tvPtr -> + {# call unsafe pixbuf_animation_iter_advance #} iter (castPtr tvPtr) + + +-- | Gets the number of milliseconds the current pixbuf should be +-- displayed, or -1 if the current pixbuf should be displayed +-- forever. 'timeoutAdd' conveniently takes a timeout in +-- milliseconds, so you can use a timeout to schedule the next +-- update. +-- +pixbufAnimationIterGetDelayTime :: PixbufAnimationIter -- ^ an animation iterator + -> IO Int -- ^ delay time in milliseconds (thousandths of a second) +pixbufAnimationIterGetDelayTime self = liftM fromIntegral $ + {#call unsafe pixbuf_animation_iter_get_delay_time#} self + + +-- | Used to determine how to respond to the area_updated signal on +-- 'PixbufLoader' when loading an animation. area_updated is emitted +-- for an area of the frame currently streaming in to the loader. So +-- if you're on the currently loading frame, you need to redraw the +-- screen for the updated area. +-- +pixbufAnimationIterOnCurrentlyLoadingFrame :: PixbufAnimationIter + -> IO Bool -- ^ @True@ if the frame we're on is partially loaded, or the last frame +pixbufAnimationIterOnCurrentlyLoadingFrame iter = liftM toBool $ + {# call unsafe pixbuf_animation_iter_on_currently_loading_frame #} iter + +--CHECKME: referencing, usage of constructNewGObject +-- | Gets the current pixbuf which should be displayed; the pixbuf will +-- be the same size as the animation itself +-- ('pixbufAnimationGetWidth', 'pixbufAnimationGetHeight'). This +-- pixbuf should be displayed for 'pixbufAnimationIterGetDelayTime' +-- milliseconds. The caller of this function does not own a reference +-- to the returned pixbuf; the returned pixbuf will become invalid +-- when the iterator advances to the next frame, which may happen +-- anytime you call 'pixbufAnimationIterAdvance'. Copy the pixbuf to +-- keep it (don't just add a reference), as it may get recycled as you +-- advance the iterator. +-- +pixbufAnimationIterGetPixbuf :: PixbufAnimationIter -- ^ an animation iterator + -> IO Pixbuf -- ^ the pixbuf to be displayed +pixbufAnimationIterGetPixbuf iter = constructNewGObject mkPixbuf $ + {# call unsafe pixbuf_animation_iter_get_pixbuf #} iter + + +#if GTK_CHECK_VERSION(2,8,0) +-- | Creates a new, empty animation. +-- +-- * Available since Gtk+ version 2.8 +-- +pixbufSimpleAnimNew :: Int -- ^ the width of the animation + -> Int -- ^ the height of the animation + -> Float -- ^ the speed of the animation, in frames per second + -> IO PixbufSimpleAnim -- ^ a newly allocated 'PixbufSimpleAnim' +pixbufSimpleAnimNew width height rate = constructNewGObject mkPixbufSimpleAnim $ + {#call unsafe pixbuf_simple_anim_new#} (fromIntegral width) (fromIntegral height) (realToFrac rate) + + +-- | Adds a new frame to animation. The pixbuf must have the +-- dimensions specified when the animation was constructed. +-- +-- * Available since Gtk+ version 2.8 +-- +pixbufSimpleAnimAddFrame :: PixbufSimpleAnim -- ^ a 'PixbufSimpleAnim' + -> Pixbuf -- ^ the pixbuf to add + -> IO () +pixbufSimpleAnimAddFrame psa pb = {#call unsafe pixbuf_simple_anim_add_frame#} psa pb + +#endif + +#if GTK_CHECK_VERSION(2,18,0) + +-- | Sets whether animation should loop indefinitely when it reaches +-- the end. +-- +-- * Available since Gtk+ version 2.18 +-- +pixbufSimpleAnimSetLoop :: PixbufSimpleAnim -- ^ a 'PixbufSimpleAnim' + -> Bool -- ^ whether to loop the animation + -> IO () +pixbufSimpleAnimSetLoop animation loop = {#call unsafe pixbuf_simple_anim_set_loop#} animation (fromBool loop) + + +-- | Gets whether animation should loop indefinitely when it reaches +-- the end. +-- +-- * Available since Gtk+ version 2.18 +-- +pixbufSimpleAnimGetLoop :: PixbufSimpleAnim -- ^ a 'PixbufSimpleAnim' + -> IO Bool -- ^ @True@ if the animation loops forever, @False@ otherwise +pixbufSimpleAnimGetLoop animation = liftM toBool $ {#call unsafe pixbuf_simple_anim_get_loop#} animation + +#endif + hunk ./gtk/Graphics/UI/Gtk/ModelView/CellLayout.chs.pp 71 +import System.Glib.GList |
From: Axel S. <si...@co...> - 2009-11-15 09:32:28
|
Sun Nov 15 04:25:25 EST 2009 Axe...@en... * Swap the width and height parameters of the compositing function. hunk ./gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs.pp 597 - (fromIntegral destX) (fromIntegral destY) (fromIntegral destHeight) - (fromIntegral destWidth) (realToFrac offsetX) (realToFrac offsetY) + (fromIntegral destX) (fromIntegral destY) (fromIntegral destWidth) + (fromIntegral destHeight) (realToFrac offsetX) (realToFrac offsetY) |
From: Axel S. <si...@co...> - 2009-11-13 23:16:43
|
Thu Nov 12 17:45:38 EST 2009 Axe...@en... * Add yet another property for read access. hunk ./glib/System/Glib/Properties.chs 86 + readAttrFromObjectProperty, hunk ./glib/System/Glib/Properties.chs 334 + +readAttrFromObjectProperty :: (GObjectClass gobj, GObjectClass gobj') => String -> GType -> ReadAttr gobj gobj' +readAttrFromObjectProperty propName gtype = + readAttr (objectGetPropertyGObject gtype propName) |
Fri Nov 13 18:13:19 EST 2009 Axel Simon <Axe...@en...> * Add a name field to Attributes, whenever this is possible. Add a function to set the attributes of CellRenderer using ColumnIds, thereby allowing exactly the same column-based interface as Gtk does. hunk ./glib/System/Glib/Attributes.hs 72 + newNamedAttr, + readNamedAttr, + writeNamedAttr, hunk ./glib/System/Glib/Attributes.hs 92 -data ReadWriteAttr o a b = Attr !(o -> IO a) !(o -> b -> IO ()) +data ReadWriteAttr o a b = Attr String !(o -> IO a) !(o -> b -> IO ()) hunk ./glib/System/Glib/Attributes.hs 94 +instance Show (ReadWriteAttr o a b) where + show (Attr str _ _) = str + +-- | Create a new attribute with a getter and setter function. +newNamedAttr :: String -> (o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b +newNamedAttr prop getter setter = Attr prop getter setter + +-- | Create a new read-only attribute. +readNamedAttr :: String -> (o -> IO a) -> ReadAttr o a +readNamedAttr prop getter = Attr prop getter (\_ _ -> return ()) + +-- | Create a new write-only attribute. +writeNamedAttr :: String -> (o -> b -> IO ()) -> WriteAttr o b +writeNamedAttr prop setter = Attr prop (\_ -> return ()) setter hunk ./glib/System/Glib/Attributes.hs 111 -newAttr getter setter = Attr getter setter +newAttr getter setter = Attr "unnamed attribute" getter setter hunk ./glib/System/Glib/Attributes.hs 115 -readAttr getter = Attr getter (\_ _ -> return ()) +readAttr getter = Attr "unnamed attribute" getter (\_ _ -> return ()) hunk ./glib/System/Glib/Attributes.hs 119 -writeAttr setter = Attr (\_ -> return ()) setter - +writeAttr setter = Attr "unnamed attribute" (\_ -> return ()) setter hunk ./glib/System/Glib/Attributes.hs 148 - app (Attr getter setter := x) = setter obj x - app (Attr getter setter :~ f) = getter obj >>= \v -> setter obj (f v) - app (Attr getter setter :=> x) = x >>= setter obj - app (Attr getter setter :~> f) = getter obj >>= f >>= setter obj + app (Attr _ getter setter := x) = setter obj x + app (Attr _ getter setter :~ f) = getter obj >>= \v -> setter obj (f v) + app (Attr _ getter setter :=> x) = x >>= setter obj + app (Attr _ getter setter :~> f) = getter obj >>= f >>= setter obj hunk ./glib/System/Glib/Attributes.hs 153 - app (Attr getter setter ::= f) = setter obj (f obj) - app (Attr getter setter ::~ f) = getter obj >>= \v -> setter obj (f obj v) + app (Attr _ getter setter ::= f) = setter obj (f obj) + app (Attr _ getter setter ::~ f) = getter obj >>= \v -> setter obj (f obj v) hunk ./glib/System/Glib/Attributes.hs 158 -get o (Attr getter setter) = getter o +get o (Attr _ getter setter) = getter o hunk ./glib/System/Glib/GObject.chs.pp 72 -import System.Glib.Attributes (newAttr, Attr) +import System.Glib.Attributes (newNamedAttr, Attr) hunk ./glib/System/Glib/GObject.chs.pp 205 - attr <- quarkFromString ("Gtk2HsAttr"++show cnt) - return (newAttr (objectGetAttributeUnsafe attr) - (objectSetAttribute attr)) [_$_] + let propName = "Gtk2HsAttr"++show cnt + attr <- quarkFromString propName + return (newNamedAttr propName (objectGetAttributeUnsafe attr) + (objectSetAttribute attr)) [_$_] hunk ./glib/System/Glib/Properties.chs 104 - newAttr, readAttr, writeAttr) + newNamedAttr, readNamedAttr, writeNamedAttr) hunk ./glib/System/Glib/Properties.chs 233 - newAttr (objectGetPropertyInt propName) (objectSetPropertyInt propName) + newNamedAttr propName (objectGetPropertyInt propName) (objectSetPropertyInt propName) hunk ./glib/System/Glib/Properties.chs 237 - readAttr (objectGetPropertyInt propName) + readNamedAttr propName (objectGetPropertyInt propName) hunk ./glib/System/Glib/Properties.chs 241 - newAttr (objectGetPropertyUInt propName) (objectSetPropertyUInt propName) + newNamedAttr propName (objectGetPropertyUInt propName) (objectSetPropertyUInt propName) hunk ./glib/System/Glib/Properties.chs 245 - newAttr (objectGetPropertyChar propName) (objectSetPropertyChar propName) + newNamedAttr propName (objectGetPropertyChar propName) (objectSetPropertyChar propName) hunk ./glib/System/Glib/Properties.chs 249 - writeAttr (objectSetPropertyUInt propName) + writeNamedAttr propName (objectSetPropertyUInt propName) hunk ./glib/System/Glib/Properties.chs 253 - newAttr (objectGetPropertyBool propName) (objectSetPropertyBool propName) + newNamedAttr propName (objectGetPropertyBool propName) (objectSetPropertyBool propName) hunk ./glib/System/Glib/Properties.chs 257 - readAttr (objectGetPropertyBool propName) + readNamedAttr propName (objectGetPropertyBool propName) hunk ./glib/System/Glib/Properties.chs 261 - newAttr (objectGetPropertyFloat propName) (objectSetPropertyFloat propName) + newNamedAttr propName (objectGetPropertyFloat propName) (objectSetPropertyFloat propName) hunk ./glib/System/Glib/Properties.chs 265 - newAttr (objectGetPropertyDouble propName) (objectSetPropertyDouble propName) + newNamedAttr propName (objectGetPropertyDouble propName) (objectSetPropertyDouble propName) hunk ./glib/System/Glib/Properties.chs 269 - newAttr (objectGetPropertyEnum gtype propName) (objectSetPropertyEnum gtype propName) + newNamedAttr propName (objectGetPropertyEnum gtype propName) (objectSetPropertyEnum gtype propName) hunk ./glib/System/Glib/Properties.chs 273 - readAttr (objectGetPropertyEnum gtype propName) + readNamedAttr propName (objectGetPropertyEnum gtype propName) hunk ./glib/System/Glib/Properties.chs 277 - writeAttr (objectSetPropertyEnum gtype propName) + writeNamedAttr propName (objectSetPropertyEnum gtype propName) hunk ./glib/System/Glib/Properties.chs 281 - newAttr (objectGetPropertyFlags gtype propName) (objectSetPropertyFlags gtype propName) + newNamedAttr propName (objectGetPropertyFlags gtype propName) (objectSetPropertyFlags gtype propName) hunk ./glib/System/Glib/Properties.chs 285 - newAttr (objectGetPropertyString propName) (objectSetPropertyString propName) + newNamedAttr propName (objectGetPropertyString propName) (objectSetPropertyString propName) hunk ./glib/System/Glib/Properties.chs 289 - readAttr (objectGetPropertyString propName) + readNamedAttr propName (objectGetPropertyString propName) hunk ./glib/System/Glib/Properties.chs 293 - writeAttr (objectSetPropertyString propName) + writeNamedAttr propName (objectSetPropertyString propName) hunk ./glib/System/Glib/Properties.chs 297 - newAttr (objectGetPropertyMaybeString propName) (objectSetPropertyMaybeString propName) + newNamedAttr propName (objectGetPropertyMaybeString propName) (objectSetPropertyMaybeString propName) hunk ./glib/System/Glib/Properties.chs 301 - readAttr (objectGetPropertyMaybeString propName) + readNamedAttr propName (objectGetPropertyMaybeString propName) hunk ./glib/System/Glib/Properties.chs 305 - writeAttr (objectSetPropertyMaybeString propName) + writeNamedAttr propName (objectSetPropertyMaybeString propName) hunk ./glib/System/Glib/Properties.chs 309 - newAttr (objectGetPropertyBoxedOpaque peek gtype propName) (objectSetPropertyBoxedOpaque with gtype propName) + newNamedAttr propName (objectGetPropertyBoxedOpaque peek gtype propName) (objectSetPropertyBoxedOpaque with gtype propName) hunk ./glib/System/Glib/Properties.chs 313 - readAttr (objectGetPropertyBoxedOpaque peek gtype propName) + readNamedAttr propName (objectGetPropertyBoxedOpaque peek gtype propName) hunk ./glib/System/Glib/Properties.chs 317 - writeAttr (objectSetPropertyBoxedOpaque with gtype propName) + writeNamedAttr propName (objectSetPropertyBoxedOpaque with gtype propName) hunk ./glib/System/Glib/Properties.chs 321 - newAttr (objectGetPropertyBoxedStorable gtype propName) (objectSetPropertyBoxedStorable gtype propName) + newNamedAttr propName (objectGetPropertyBoxedStorable gtype propName) (objectSetPropertyBoxedStorable gtype propName) hunk ./glib/System/Glib/Properties.chs 325 - newAttr (objectGetPropertyGObject gtype propName) (objectSetPropertyGObject gtype propName) + newNamedAttr propName (objectGetPropertyGObject gtype propName) (objectSetPropertyGObject gtype propName) hunk ./glib/System/Glib/Properties.chs 329 - newAttr (objectGetPropertyMaybeGObject gtype propName) (objectSetPropertyMaybeGObject gtype propName) + newNamedAttr propName (objectGetPropertyMaybeGObject gtype propName) (objectSetPropertyMaybeGObject gtype propName) hunk ./glib/System/Glib/Properties.chs 333 - writeAttr (objectSetPropertyGObject gtype propName) + writeNamedAttr propName (objectSetPropertyGObject gtype propName) hunk ./glib/System/Glib/Properties.chs 337 - readAttr (objectGetPropertyGObject gtype propName) + readNamedAttr propName (objectGetPropertyGObject gtype propName) hunk ./gtk/Graphics/UI/Gtk/ModelView/CellLayout.chs.pp 60 + cellLayoutClearAttributes, +#if GTK_CHECK_VERSION(2,12,0) + cellLayoutGetCells, +#endif + cellLayoutAddColumnAttribute, hunk ./gtk/Graphics/UI/Gtk/ModelView/CellLayout.chs.pp 67 - cellLayoutClearAttributes hunk ./gtk/Graphics/UI/Gtk/ModelView/CellLayout.chs.pp 150 +#if GTK_CHECK_VERSION(2,12,0) +-- | Returns the cell renderers which have been added to @cellLayout@. +-- +-- * Available since Gtk+ version 2.12 +-- +cellLayoutGetCells :: CellLayoutClass self => self + -> IO [CellRenderer] -- ^ returns a list of cell renderers +cellLayoutGetCells self = + {# call gtk_cell_layout_get_cells #} + (toCellLayout self) + >>= fromGList + >>= mapM (makeNewGObject mkCellRenderer . return) +#endif + +-- | Adds an attribute mapping to the renderer @cell@. The @column@ is +-- the 'ColumnId' of the model to get a value from, and the @attribute@ is the +-- parameter on @cell@ to be set from the value. So for example if column 2 of +-- the model contains strings, you could have the \"text\" attribute of a +-- 'CellRendererText' get its values from column 2. +-- +cellLayoutAddColumnAttribute :: (CellLayoutClass self, CellRendererClass cell) => self + -> cell -- ^ @cell@ - A 'CellRenderer'. + -> ReadWriteAttr cell a v -- ^ @attribute@ - An attribute of a renderer. + -> ColumnId row v -- ^ @column@ - The virtual column of the model from which to [_$_] + -- retrieve the attribute. + -> IO () +cellLayoutAddColumnAttribute self cell attr column = + withCString (show attr) $ \attributePtr -> + {# call gtk_cell_layout_add_attribute #} + (toCellLayout self) + (toCellRenderer cell) + attributePtr + (fromIntegral (columnIdToNumber column)) + + |
From: Axel S. <si...@co...> - 2009-11-13 23:16:39
|
Thu Nov 12 17:38:02 EST 2009 Axel Simon <Axe...@en...> * Make compile with Gtk+ 2.10 move ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp move ./gtk/Graphics/UI/Gtk/Windows/WindowGroup.chs ./gtk/Graphics/UI/Gtk/Windows/WindowGroup.chs.pp hunk ./Makefile.am 695 - gtk/Graphics/UI/Gtk/Multiline/TextMark.chs \ + gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp \ hunk ./Makefile.am 763 - gtk/Graphics/UI/Gtk/Windows/WindowGroup.chs \ + gtk/Graphics/UI/Gtk/Windows/WindowGroup.chs.pp \ hunk ./glib/System/Glib/Properties.chs 77 - writeAttrFromMaybeStringProperty, hunk ./glib/System/Glib/Properties.chs 78 + readAttrFromMaybeStringProperty, + writeAttrFromMaybeStringProperty, hunk ./glib/System/Glib/Properties.chs 294 -writeAttrFromMaybeStringProperty :: GObjectClass gobj => String -> WriteAttr gobj (Maybe String) -writeAttrFromMaybeStringProperty propName = - writeAttr (objectSetPropertyMaybeString propName) - hunk ./glib/System/Glib/Properties.chs 298 +readAttrFromMaybeStringProperty :: GObjectClass gobj => String -> ReadAttr gobj (Maybe String) +readAttrFromMaybeStringProperty propName = + readAttr (objectGetPropertyMaybeString propName) + +writeAttrFromMaybeStringProperty :: GObjectClass gobj => String -> WriteAttr gobj (Maybe String) +writeAttrFromMaybeStringProperty propName = + writeAttr (objectSetPropertyMaybeString propName) + hunk ./gtk/Graphics/UI/Gtk/Gdk/Enums.chs.pp 264 + hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 65 +#if GTK_CHECK_VERSION(2,12,0) hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 67 +#endif hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 144 -import Graphics.UI.Gtk.General.Enums ( DestDefaults(..), DragProtocol(..), - DragResult(..) ) +import Graphics.UI.Gtk.General.Enums ( DestDefaults(..), DragProtocol(..) +#if GTK_CHECK_VERSION(2,12,0) + + , DragResult(..) +#endif + ) hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 38 +#if GTK_CHECK_VERSION(2,12,0) hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 40 +#endif hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 179 +#if GTK_CHECK_VERSION(2,12,0) hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 181 --- obtained by connecting to the 'Graphics.UI.Gtk.General.Drag.dragFailed' --- signal. +-- obtained by connecting to the 'dragFailed' signal. hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 197 +#endif hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 93 +#if GTK_CHECK_VERSION(2,12,0) hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 95 +#endif hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 497 --- | Adds the mark at position where. [_$_] --- The mark must not be added to another buffer, [_$_] --- and if its name is not empty then there must not be another mark in the buffer nwith the same name. +#if GTK_CHECK_VERSION(2,12,0) +-- | Adds the mark at position given by the 'TextIter'. [_$_] +-- The mark may not be added to any other buffer. hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 501 --- Emits the "mark-set" signal as notification of the mark's initial placement. +-- Emits the 'markSet' signal as notification of the mark's initial placement. hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 509 +#endif hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 511 --- | Moves @mark@ to the new location @where@. Emits the \"mark_set\" signal +-- | Moves @mark@ to the new location @where@. Emits the 'markSet' signal hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1069 -textBufferTagTable :: (TextBufferClass self, TextTagTableClass textTagTable) => ReadWriteAttr self TextTagTable textTagTable +textBufferTagTable :: (TextBufferClass self, TextTagTableClass textTagTable) + => ReadWriteAttr self TextTagTable textTagTable hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1084 --- | \'modified\' property. See 'textBufferGetModified' and +-- | The \'modified\' property. See 'textBufferGetModified' and hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 1270 + hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 36 --- 'Graphics.UI.Gtk.Multiline.TextBuffer.textBufferGetIterAtMark'. Unlike +-- 'textBufferGetIterAtMark'. Unlike hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 45 --- 'Graphics.UI.Gtk.Multiline.TextBuffer.textBufferDeleteMark'. Once deleted +-- 'textBufferDeleteMark'. Once deleted hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 52 --- 'Graphics.UI.Gtk.Multiline.TextBuffer.textBufferCreateMark' function. +-- 'textBufferCreateMark' function. hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 69 +#if GTK_CHECK_VERSION(2,12,0) hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 71 +#endif hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 90 +import System.Glib.Properties hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 96 +-- | The name of a mark. hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 101 --- | Creates a text mark. [_$_] --- Add it to a buffer using 'textBufferAddMark'. [_$_] --- If name is NULL, the mark is anonymous; otherwise, the mark can be retrieved by name using 'textBufferGetMark'. [_$_] --- If a mark has left gravity, and text is inserted at the mark's current location, [_$_] --- the mark will be moved to the left of the newly-inserted text. [_$_] --- If the mark has right gravity (left_gravity = FALSE), the mark will end up on the right of newly-inserted text. [_$_] --- The standard left-to-right cursor is a mark with right gravity (when you type, the cursor stays on the right side of the text you're typing). + +#if GTK_CHECK_VERSION(2,12,0) +-- | Creates a text mark. Add it to a buffer using 'textBufferAddMark'. If +-- @name@ is @Nothing@, the mark is anonymous; otherwise, the mark can be retrieved by +-- this name +-- using 'textBufferGetMark'. If a mark has left gravity, and text is inserted +-- at the mark's current location, the mark will be moved to the left of the +-- newly-inserted text. If the mark has right gravity (@leftGravity@ = +-- @False@), the mark will end up on the right of newly-inserted text. The +-- standard left-to-right cursor is a mark with right gravity (when you type, +-- the cursor stays on the right side of the text you\'re typing). +-- +-- * Available since Gtk+ version 2.12 hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 125 +#endif hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 150 --- 'Graphics.UI.Gtk.Multiline.TextBuffer.textBufferDeleteMark'. Marks can't +-- 'textBufferDeleteMark'. Marks can't hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 190 --- | \'visible\' property. See 'textMarkGetVisible' and 'textMarkSetVisible' +-- | Retreives the name of a mark. +-- +textMarkName :: TextMarkClass self => ReadAttr self (Maybe MarkName) +textMarkName = readAttrFromMaybeStringProperty "name" + +-- | The \'visible\' property. See 'textMarkGetVisible' and 'textMarkSetVisible' hunk ./gtk/Graphics/UI/Gtk/Multiline/TextMark.chs.pp 202 +-- | Determines whether the mark keeps to the left when text is inserted at its position. +-- +textMarkLeftGravity :: TextMarkClass self => ReadAttr self Bool +textMarkLeftGravity = readAttrFromBoolProperty "left-gravity" + + hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 85 +#if GTK_CHECK_VERSION(2,14,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 87 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 120 +#if GTK_CHECK_VERSION(2,12,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 122 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 148 +#if GTK_CHECK_VERSION(2,2,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 150 +#if GTK_CHECK_VERSION(2,16,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 152 +#endif +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 181 +#if GTK_CHECK_VERSION(2,12,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 184 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 194 +#if GTK_CHECK_VERSION(2,12,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 196 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 653 +#if GTK_CHECK_VERSION(2,14,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 664 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 959 +#if GTK_CHECK_VERSION(2,12,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 962 --- Normally, startup identifier is managed automatically and you should only use this function in special cases like transferring focus from other processes. You should use this function before calling gtk_window_present() or any equivalent function generating a window map event. +-- Normally, startup identifier is managed automatically and you should only use this function in special cases like transferring focus from other processes. You should use this function before calling 'windowPresent' or any equivalent function generating a window map event. hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 976 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1341 --- | Sets an icon to be used as fallback for windows that haven't had 'windowSetIconList' called on them from a file on disk. [_$_] -windowSetDefaultIconFromFile :: [_$_] - String [_$_] - -> GError [_$_] - -> IO Bool -windowSetDefaultIconFromFile filename error = liftM toBool $ - withUTFString filename $ \filePtr -> [_$_] - with error $ \gErrorPtr -> [_$_] - {# call window_set_default_icon_from_file #} - filePtr - (castPtr gErrorPtr) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1342 --- | Returns the fallback icon name for windows that has been set with 'windowSetDefaultIconName'. [_$_] --- The returned string is owned by GTK+ and should not be modified. [_$_] --- It is only valid until the next call to 'windowSetDefaultIconName'. +#if GTK_CHECK_VERSION(2,2,0) +-- | Sets an icon to be used as fallback for windows that haven't had +-- 'windowSetIconList' called on them from a file on disk. May throw a 'GError' if +-- the file cannot be loaded. +-- +-- * Available since Gtk+ version 2.2 +-- +windowSetDefaultIconFromFile :: + String -- ^ @filename@ - location of icon file + -> IO Bool -- ^ returns @True@ if setting the icon succeeded. +windowSetDefaultIconFromFile filename = + liftM toBool $ + propagateGError $ \errPtr -> + withUTFString filename $ \filenamePtr -> + {# call gtk_window_set_default_icon_from_file #} + filenamePtr + errPtr +#endif + +#if GTK_CHECK_VERSION(2,16,0) +-- | Returns the fallback icon name for windows that has been set with +-- 'windowSetDefaultIconName'. hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1367 -windowGetDefaultIconName :: IO String -windowGetDefaultIconName = [_$_] - {# call window_get_default_icon_name #} >>= peekCString +windowGetDefaultIconName :: + IO String -- ^ returns the fallback icon name for windows +windowGetDefaultIconName = + {# call window_get_default_icon_name #} + >>= peekUTFString +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1857 +#if GTK_CHECK_VERSION(2,12,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1860 --- On X11 this has any effect only on X screens with a compositing manager running. See gtk_widget_is_composited(). --- On Windows it should work always. +-- On X11 this has any effect only on X screens with a compositing manager running. +-- See 'widgetIsComposited'. On Windows it should work always. hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1863 --- Note that setting a window's opacity after the window has been shown causes it to flicker once on Windows. +-- Note that setting a window's opacity after the window has been shown causes it to +-- flicker once on Windows. hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1882 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1949 +#if GTK_CHECK_VERSION(2,12,0) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1960 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/WindowGroup.chs.pp 48 +#if GTK_CHECK_VERSION(2,14,0) hunk ./gtk/Graphics/UI/Gtk/Windows/WindowGroup.chs.pp 50 +#endif hunk ./gtk/Graphics/UI/Gtk/Windows/WindowGroup.chs.pp 95 --- | Returns a list of the GtkWindows that belong to window_group. +#if GTK_CHECK_VERSION(2,14,0) +-- | Returns a list of the 'Window's that belong to @windowGroup@. hunk ./gtk/Graphics/UI/Gtk/Windows/WindowGroup.chs.pp 100 -windowGroupListWindows :: WindowGroupClass self => self - -> IO [Pixbuf] -- ^ return A newly-allocated list of windows inside the group. [_$_] +windowGroupListWindows :: WindowGroupClass self + => self -- ^ @windowGroup@ - the window group + -> IO [Window] -- ^ returns the list of windows inside this group hunk ./gtk/Graphics/UI/Gtk/Windows/WindowGroup.chs.pp 106 - mapM (makeNewGObject mkPixbuf . return) ptrList + mapM (makeNewGObject mkWindow . return) ptrList +#endif |
From: Axel S. <si...@co...> - 2009-11-13 23:16:39
|
Fri Nov 13 18:14:56 EST 2009 Axe...@en... * Add the TreeModelFilter module and a demo. addfile ./demo/treeList/FilterDemo.hs hunk ./demo/treeList/FilterDemo.hs 1 +-- a demo that shows how to create a normal tree view and a tree view in +-- which only a chosen subset of rows are shown (namely those with upper case letters) +module Main ( main ) where + +import Graphics.UI.Gtk +import Data.List +import Data.Char +import Debug.Trace + +-- | Define a virtual column of the model that determines the visibility of a row in +-- the model. +visCol :: ColumnId String Bool +visCol = makeColumnIdBool 0 + +main = do + initGUI + [_$_] + win <- windowNew + onDestroy win mainQuit + [_$_] + content <- readFile "FilterDemo.hs" + + -- create a view that shows all lines + model <- listStoreNew (lines content) + viewAll <- treeViewNewWithModel model + col <- treeViewColumnNew + ren <- cellRendererTextNew + cellLayoutPackStart col ren True + cellLayoutSetAttributes col ren model $ \row -> [ cellText := row ] + treeViewAppendColumn viewAll col + + -- create a view that only shows lines with upper case characters + fModel <- treeModelFilterNew model [] + + -- create a virtual column 'visCol' that contains @True@ if a certain row has + -- upper case letters. Then set this column to determine the visibility of a row. + customStoreSetColumn model visCol (any isUpper) + treeModelFilterSetVisibleColumn fModel visCol + +{- + -- this is an alternative way to determine the visibility of a row. In this case, + -- it is not necessary to create the column 'visCol'. + treeModelFilterSetVisibleFunc fModel $ Just $ \iter -> do + row <- treeModelGetRow model iter + return (any isUpper row) +-} + -- note: it is important to insert the model into the view after the visibility + -- row or the visibility function have been set. Otherwise, the view is filled + -- first and setting a new visibility column/function will not update the view. + viewFew <- treeViewNewWithModel fModel + col <- treeViewColumnNew + ren <- cellRendererTextNew + cellLayoutPackStart col ren True + cellLayoutSetAttributes col ren model $ \row -> [ cellText := row ] + + treeViewAppendColumn viewFew col + [_$_] + [_$_] + [_$_] + box <- vBoxNew False 0 + swAll <- scrolledWindowNew Nothing Nothing + containerAdd swAll viewAll + boxPackStart box swAll PackGrow 4 + + swFew <- scrolledWindowNew Nothing Nothing + containerAdd swFew viewFew + boxPackEnd box swFew PackGrow 4 + [_$_] + containerAdd win box + widgetShowAll win + mainGUI hunk ./demo/treeList/Makefile 3 - listdnd + listdnd filterdemo hunk ./demo/treeList/Makefile 6 - TreeSort.hs Completion.hs ListDND.hs + TreeSort.hs Completion.hs ListDND.hs FilterDemo.hs hunk ./demo/treeList/Makefile 34 +filterdemo : FilterDemo.hs + $(HC_RULE) + hunk ./gtk/Graphics/UI/Gtk.hs.pp 119 + module Graphics.UI.Gtk.ModelView.TreeModelFilter, hunk ./gtk/Graphics/UI/Gtk.hs.pp 317 +import Graphics.UI.Gtk.ModelView.TreeModelFilter addfile ./gtk/Graphics/UI/Gtk/ModelView/TreeModelFilter.chs.pp hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModelFilter.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget TreeModelFilter +-- +-- Author : Axel Simon +-- +-- Created: 14 January 2008 +-- +-- Copyright (C) 2008 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 : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- A 'TreeModel' which hides parts of an underlying tree model +-- +-- * Module available since Gtk+ version 2.4 +-- +module Graphics.UI.Gtk.ModelView.TreeModelFilter ( + +-- * Detail +-- +-- | A 'TreeModelFilter' is a tree model which wraps another tree model, and +-- can do the following things: +-- +-- * Filter specific rows, based on a function that examines each row +-- indicating whether the row should be shown or not, or +-- based on the return value of a visibility function, which is passed +-- the 'TreeIter' of the row and returns a Boolean indicating whether the row should +-- be shown or not. +-- +-- * Set a different root node, also known as a \"virtual root\". You can +-- pass in a 'TreePath' indicating the root node for the filter at construction +-- time. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----TreeModelFilter +-- @ + +#if GTK_CHECK_VERSION(2,4,0) +-- * Types + TreeModelFilter, + TreeModelFilterClass, + castToTreeModelFilter, + toTreeModelFilter, + +-- * Constructors + treeModelFilterNew, + +-- * Methods + treeModelFilterSetVisibleFunc, + treeModelFilterSetVisibleColumn, + treeModelFilterGetModel, + treeModelFilterConvertChildIterToIter, + treeModelFilterConvertIterToChildIter, + treeModelFilterConvertChildPathToPath, + treeModelFilterConvertPathToChildPath, + treeModelFilterRefilter, + treeModelFilterClearCache, + +-- * Attributes + treeModelFilterChildModel, + treeModelFilterVirtualRoot, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.GObject (constructNewGObject) +import System.Glib.Attributes +import System.Glib.Properties +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.ModelView.TreeModel#} +{#import Graphics.UI.Gtk.ModelView.CustomStore#} +{#import Graphics.UI.Gtk.ModelView.Types#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,4,0) +-------------------- +-- Interfaces + +instance TreeModelClass (TypedTreeModelFilter a) +instance TreeModelFilterClass (TypedTreeModelFilter a) +instance GObjectClass (TypedTreeModelFilter a) where + toGObject (TypedTreeModelFilter tm) = GObject (castForeignPtr tm) + unsafeCastGObject = TypedTreeModelFilter . castForeignPtr . unGObject + +-------------------- +-- Constructors + +-- %hash c:81e3 d:42cf +-- | Creates a new 'TreeModel', with @childModel@ as the child model and +-- @root@ as the virtual root. +-- +treeModelFilterNew :: (TreeModelClass (childModel row), + TypedTreeModelClass childModel) => + childModel row -- ^ @childModel@ - A 'TreeModel'. + -> TreePath -- ^ @root@ - A 'TreePath' or @[]@. + -> IO (TypedTreeModelFilter row) +treeModelFilterNew childModel [] = + liftM unsafeTreeModelFilterToGeneric $ + constructNewGObject mkTreeModelFilter $ [_$_] + liftM (castPtr :: Ptr TreeModel -> Ptr TreeModelFilter) $ + {# call gtk_tree_model_filter_new #} + (toTreeModel childModel) + (NativeTreePath nullPtr) +treeModelFilterNew childModel root = + liftM unsafeTreeModelFilterToGeneric $ + constructNewGObject mkTreeModelFilter $ [_$_] + liftM (castPtr :: Ptr TreeModel -> Ptr TreeModelFilter) $ + withTreePath root $ \root -> + {# call gtk_tree_model_filter_new #} + (toTreeModel childModel) + root + + + +-------------------- +-- Methods + +-- %hash c:2349 d:864a +-- | Sets the visible function used when filtering the rows to be @func@. +-- The function should return @True@ if the given row should be visible and +-- @False@ otherwise. The passed-in iterator is an iterator of the child +-- model, not of the 'TreeModelFilter' model that is passed as the first +-- argument to this function. +-- +-- If the condition calculated by the function changes over time (e.g. +-- because it depends on some global parameters), you must call +-- 'treeModelFilterRefilter' to keep the visibility information of the model +-- up to date. +-- +treeModelFilterSetVisibleFunc :: TreeModelFilterClass self => self + -> Maybe (TreeIter -> IO Bool) -- ^ @func@ - The visible function or + -- @Nothing@ to reset this function. + -> IO () +treeModelFilterSetVisibleFunc self Nothing = + {# call gtk_tree_model_filter_set_visible_func #} + (toTreeModelFilter self) nullFunPtr nullPtr nullFunPtr +treeModelFilterSetVisibleFunc self (Just func) = do + funcPtr <- mkTreeModelFilterVisibleFunc $ \_ tiPtr _ -> do + ti <- peekTreeIter tiPtr + liftM fromBool $ func ti + destroyPtr <- mkFunPtrDestroyNotify funcPtr + {# call gtk_tree_model_filter_set_visible_func #} + (toTreeModelFilter self) funcPtr nullPtr destroyPtr + +{#pointer TreeModelFilterVisibleFunc #} + +foreign import ccall "wrapper" mkTreeModelFilterVisibleFunc :: + (Ptr TreeModelFilter -> Ptr TreeIter -> Ptr () -> IO {#type gboolean#}) -> + IO TreeModelFilterVisibleFunc + +-- %hash c:a56d d:b42e +-- | Sets @column@ of the child model to be the column where the filter model +-- should look for visibility information. A row containing @True@ means +-- that this row should be shown. +-- +treeModelFilterSetVisibleColumn :: [_$_] + (TreeModelFilterClass (self row), + TypedTreeModelClass self) + => self row + -> ColumnId row Bool -- ^ @column@ - A column of Booleans that determines + -- if a row is visible + -> IO () +treeModelFilterSetVisibleColumn self col = + {# call gtk_tree_model_filter_set_visible_column #} + (toTreeModelFilter self) + ((fromIntegral . columnIdToNumber) col) + +-- %hash c:85fb d:a36 +-- | Returns a pointer to the child model of @filter@. +-- +treeModelFilterGetModel :: TreeModelFilterClass self => self + -> IO (Maybe TreeModel) -- ^ returns a 'TreeModel'. +treeModelFilterGetModel self = + maybeNull (makeNewGObject mkTreeModel) $ + {# call gtk_tree_model_filter_get_model #} + (toTreeModelFilter self) + +-- %hash c:1b93 d:5689 +-- | Return an iterator in the sorted model that points to the row pointed to +-- by the given iter from the unfiltered model. +-- +treeModelFilterConvertChildIterToIter :: TreeModelFilterClass self => self + -> TreeIter + -> IO TreeIter +treeModelFilterConvertChildIterToIter self childIter = + with childIter $ \childIterPtr -> [_$_] + alloca $ \filterIterPtr -> do + {# call tree_model_filter_convert_child_iter_to_iter #} + (toTreeModelFilter self) + filterIterPtr + childIterPtr + peek filterIterPtr + +-- %hash c:c754 d:c058 +-- | Return an iterator in the unfiltered model that points to the row pointed to +-- by the given iter from the filtered model. +-- +treeModelFilterConvertIterToChildIter :: TreeModelFilterClass self => self + -> TreeIter + -> IO TreeIter +treeModelFilterConvertIterToChildIter self filteredIter = + with filteredIter $ \filteredIterPtr -> + alloca $ \childIterPtr -> do + {# call tree_model_filter_convert_iter_to_child_iter #} + (toTreeModelFilter self) + childIterPtr + filteredIterPtr + peek childIterPtr + +-- %hash c:e4e3 d:57be +-- | Converts the given path to a path relative to the given filtered model. +-- +-- * The given path points to a row in the child model. The returned path will +-- point to the same row in the filtered model. +-- +treeModelFilterConvertChildPathToPath :: TreeModelFilterClass self => self + -> TreePath + -> IO TreePath +treeModelFilterConvertChildPathToPath self [] = return [] +treeModelFilterConvertChildPathToPath self childPath = + withTreePath childPath $ \childPath -> + {# call unsafe tree_model_filter_convert_child_path_to_path #} + (toTreeModelFilter self) + childPath + >>= fromTreePath + +-- %hash c:446d d:db70 +-- | Converts path in the filtered model to a path on the unfiltered model on which +-- the given 'TreeModelFilter' is based. That is, the given path points to a +-- location in the given 'TreeModelFilter'. The returned path will point to the +-- same location in the underlying unfiltered model. +-- +treeModelFilterConvertPathToChildPath :: TreeModelFilterClass self => self + -> TreePath + -> IO TreePath +treeModelFilterConvertPathToChildPath self [] = return [] +treeModelFilterConvertPathToChildPath self filteredPath = + withTreePath filteredPath $ \filteredPath -> + {# call tree_model_filter_convert_path_to_child_path #} + (toTreeModelFilter self) + filteredPath + >>= fromTreePath + +-- %hash c:ed0b d:1a19 +-- | Emits 'rowChanged' for each row in the child model, which causes the +-- filter to re-evaluate whether a row is visible or not. +-- +treeModelFilterRefilter :: TreeModelFilterClass self => self -> IO () +treeModelFilterRefilter self = + {# call gtk_tree_model_filter_refilter #} + (toTreeModelFilter self) + +-- %hash c:ae64 d:a3b3 +-- | This function should almost never be called. It clears the @filter@ of +-- any cached iterators that haven't been reffed with 'treeModelRefNode'. This +-- might be useful if the child model being filtered is static (and doesn't +-- change often) and there has been a lot of unreffed access to nodes. As a +-- side effect of this function, all unreffed iters will be invalid. +-- +treeModelFilterClearCache :: TreeModelFilterClass self + => self -- ^ @filter@ - the filter model + -> IO () +treeModelFilterClearCache self = + {# call gtk_tree_model_filter_clear_cache #} + (toTreeModelFilter self) + +-------------------- +-- Attributes + +-- %hash c:8630 d:81a7 +-- | The model for the filtermodel to filter. +-- +treeModelFilterChildModel :: TreeModelFilterClass self => ReadAttr self TreeModel +treeModelFilterChildModel = readAttrFromObjectProperty "child-model" + {# call pure unsafe gtk_tree_model_get_type #} + +-- %hash c:263d d:2dd5 +-- | The virtual root (relative to the child model) for this filtermodel. +-- +treeModelFilterVirtualRoot :: TreeModelFilterClass self => ReadAttr self TreePath +treeModelFilterVirtualRoot = readAttrFromBoxedOpaqueProperty (peekTreePath . castPtr) + "virtual-root" [_$_] + {#call pure unsafe gtk_tree_path_get_type#} +#endif |
From: Axel S. <si...@co...> - 2009-11-13 23:16:39
|
Thu Nov 12 17:41:13 EST 2009 Axe...@en... * Fix build problems of Cairo (dep on array package) and documentation. hunk ./Makefile.am 751 + gtk/Graphics/UI/Gtk/ModelView/TreeModelFilter.chs.pp \ hunk ./Makefile.am 845 + gtk/Graphics/UI/Gtk/ModelView/TreeModelFilter_stub.o \ hunk ./Makefile.am 866 -if ENABLE_CAIRO -if HAVE_GTK_VERSION_2_8 -libHSgtk_a_LIBADD += \ - gtk/Graphics/UI/Gtk/Cairo_stub.o [_$_] -endif -endif - hunk ./Makefile.am 1808 -libHScairo_a_EXTERNALDEPS += bytestring-$(PKG_BYTESTRING_VERSION) +libHScairo_a_EXTERNALDEPS += bytestring-$(PKG_BYTESTRING_VERSION) array-$(PKG_ARRAY_VERSION) hunk ./Makefile.am 2562 + gstreamer/Media/Streaming/GStreamer/Core/HierarchyBase.hs \ hunk ./Makefile.am 2837 - docs/reference/haddock.js \ hunk ./Makefile.am 2853 + docs/reference/haddock.js \ |
Sun Nov 1 13:14:31 EST 2009 Axe...@en... * Remove the two broken functions that were meant to interface Pixbuf and Cairo surfaces. Add an array access function for image surfaces so that pixel values can be copied manually. hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 1 +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE FlexibleInstances #-} hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 173 +#if CAIRO_CHECK_VERSION(1,6,0) + , formatStrideForWidth +#endif hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 180 + , imageSurfaceGetFormat hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 185 + , SurfaceData + , imageSurfaceGetPixels hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 253 -import Control.Monad (unless) +import Control.Monad (unless, when) hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 256 -import Foreign.Ptr (castPtr) +import Foreign.Ptr (Ptr, nullPtr, castPtr) +import Foreign.Storable (Storable(..)) +import Foreign.ForeignPtr ( touchForeignPtr ) hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 262 +import Data.Ix +-- internal module of GHC +import Data.Array.Base ( MArray, newArray, newArray_, unsafeRead, unsafeWrite, +#if __GLASGOW_HASKELL__ < 605 + HasBounds, bounds +#else + getBounds +#endif +#if __GLASGOW_HASKELL__ >= 608 + ,getNumElements +#endif + ) hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 1552 +#if CAIRO_CHECK_VERSION(1,6,0) +-- | This function provides a stride value that will respect all alignment +-- requirements of the accelerated image-rendering code within cairo. +-- +formatStrideForWidth :: + Format -- ^ format of pixels in the surface to create + -> Int -- ^ width of the surface, in pixels + -> Int -- ^ the stride (number of bytes necessary to store one line) [_$_] + -- or @-1@ if the format is invalid or the width is too large +formatStrideForWidth = Internal.formatStrideForWidth +#endif + hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 1621 + +-- | Get the format of the surface. +-- +imageSurfaceGetFormat :: MonadIO m => Surface -> m Format +imageSurfaceGetFormat a = liftIO $ Internal.imageSurfaceGetFormat a + hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 1643 + + +-- | Retrieve the internal array of raw image data. +-- +-- * Image data in an image surface is stored in memory in uncompressed, +-- packed format. Rows in the image are stored top to bottom, and in each +-- row pixels are stored from left to right. There may be padding at the end +-- of a row. The value returned by 'imageSurfaceGetStride' indicates the +-- number of bytes between rows. +-- +-- * The returned array is a flat representation of a three dimensional array: +-- x-coordiante, y-coordinate and several channels for each color. The +-- format depends on the 'Format' of the surface: +-- +-- 'FormatARGB32': each pixel is 32 bits with alpha in the upper 8 bits, +-- followed by 8 bits for red, green and blue. Pre-multiplied alpha is used. +-- (That is, 50% transparent red is 0x80800000, not 0x80ff0000.) +-- +-- 'FormatRGB24': each pixel is 32 bits with the upper 8 bits being unused, +-- followed by 8 bits for red, green and blue. +-- +-- 'FormatA8': each pixel is 8 bits holding an alpha value +-- +-- 'FormatA1': each pixel is one bit where pixels are packed into 32 bit +-- quantities. The ordering depends on the endianes of the platform. On a +-- big-endian machine, the first pixel is in the uppermost bit, on a +-- little-endian machine the first pixel is in the least-significant bit. +-- +-- * To read or write a specific pixel use the formula: +-- @p = y * (rowstride `div` 4) + x@ for the pixel and force the array to +-- have 32-bit words or integers. +-- +-- * Calling this function without explicitly giving it a type will often lead +-- to a compiler error since the type parameter @e@ is underspecified. If +-- this happens the function can be explicitly typed: +-- @surData <- (imageSurfaceGetPixels pb :: IO (SurfaceData Int Word32))@ +-- +-- * If modifying an image through Haskell\'s array interface is not fast +-- enough, it is possible to use 'unsafeRead' and 'unsafeWrite' which have +-- the same type signatures as 'readArray' and 'writeArray'. Note that these +-- are internal functions that might change with GHC. +-- +-- * After each write access to the array, you need to inform Cairo that +-- about the area that has changed using 'surfaceMarkDirty'. +-- +-- * The function will return an error if the surface is not an image +-- surface of if 'surfaceFinish' has been called on the surface. +-- [_$_] +imageSurfaceGetPixels :: Storable e => Surface -> IO (SurfaceData Int e) +imageSurfaceGetPixels pb = do + pixPtr_ <- Internal.imageSurfaceGetData pb + when (pixPtr_==nullPtr) $ do + fail "imageSurfaceGetPixels: image surface not available" + fmt <- imageSurfaceGetFormat pb + let bits = case fmt of + FormatARGB32 -> 32 + FormatRGB24 -> 32 + FormatA8 -> 8 + FormatA1 -> 1 + h <- imageSurfaceGetHeight pb + r <- imageSurfaceGetStride pb + let pixPtr = castPtr pixPtr_ + let bytes = h*((r*bits)+7) `div` 8 + return (mkSurfaceData pb pixPtr bytes) + +-- | An array that stores the raw pixel data of an image 'Surface'. +-- +data Ix i => SurfaceData i e = SurfaceData !Surface + {-# UNPACK #-} !(Ptr e) + !(i,i) + {-# UNPACK #-} !Int + +mkSurfaceData :: Storable e => Surface -> Ptr e -> Int -> SurfaceData Int e +mkSurfaceData pb (ptr :: Ptr e) size = + SurfaceData pb ptr (0, count) count + where count = fromIntegral (size `div` sizeOf (undefined :: e)) + +#if __GLASGOW_HASKELL__ < 605 +instance HasBounds SurfaceData where + bounds (SurfaceData pb ptr bd cnt) = bd +#endif + +-- | 'SurfaceData' is a mutable array. +instance Storable e => MArray SurfaceData e IO where + newArray (l,u) e = error "Graphics.Rendering.Cairo.newArray: not implemented" + newArray_ (l,u) = error "Graphics.Rendering.Cairo.newArray_: not implemented" + {-# INLINE unsafeRead #-} + unsafeRead (SurfaceData (Surface pb) pixPtr _ _) idx = do + e <- peekElemOff pixPtr idx + touchForeignPtr pb + return e + {-# INLINE unsafeWrite #-} + unsafeWrite (SurfaceData (Surface pb) pixPtr _ _) idx elem = do + pokeElemOff pixPtr idx elem + touchForeignPtr pb +#if __GLASGOW_HASKELL__ >= 605 + {-# INLINE getBounds #-} + getBounds (SurfaceData _ _ bd _) = return bd +#endif +#if __GLASGOW_HASKELL__ >= 608 + {-# INLINE getNumElements #-} + getNumElements (SurfaceData _ _ _ count) = return count +#endif + + hunk ./cairo/Graphics/Rendering/Cairo/Internal/Surfaces/Image.chs.pp 28 +{#fun image_surface_get_format as imageSurfaceGetFormat { withSurface* `Surface' } -> `Format' cToEnum#} hunk ./cairo/Graphics/Rendering/Cairo/Internal/Surfaces/Image.chs.pp 30 +#if CAIRO_CHECK_VERSION(1,6,0) +{#fun pure format_stride_for_width as formatStrideForWidth { cFromEnum `Format', `Int' } -> `Int'#} +#endif hunk ./gtk/Graphics/UI/Gtk/Cairo.chs.pp 49 - -- * Using 'Graphics.UI.Gtk.Gdk.Pixbuf.Pixbuf' functions together with Cairo - cairoImageSurfaceFromPixbuf, -#if CAIRO_CHECK_VERSION(1,2,0) - pixbufFromImageSurface, -#endif hunk ./gtk/Graphics/UI/Gtk/Cairo.chs.pp 96 --- | Treat a 'Graphics.UI.Gtk.Gdk.Pixbuf.Pixbuf' as an image --- 'Graphics..Rendering.Cairo.Surface'. --- --- * The image data is shared between the two objects. Note that everytime you --- use 'Graphics.UI.Gtk.Gdk.Pixbuf.Pixbuf' functions on the image, it is --- necessary to tell Cairo that the image data has changed using --- 'Graphics..Rendering.Cairo.surfaceMarkDirty' since it might cache certain areas of --- an image. --- -cairoImageSurfaceFromPixbuf :: Pixbuf -> IO Surface -cairoImageSurfaceFromPixbuf pb = do - alpha <- pixbufGetHasAlpha pb - chan <- pixbufGetNChannels pb - cs <- pixbufGetColorSpace pb - width <- pixbufGetWidth pb - height <- pixbufGetHeight pb - stride <- pixbufGetRowstride pb - cairoFormat <- case (alpha, chan, cs) of - (True, 4, ColorspaceRgb) -> return FormatARGB32 - (False, 3, ColorspaceRgb) -> return FormatRGB24 - (_, 1, _) -> return FormatA8 -- pixbuf doesn't actually do that - _ -> error "cairoImageSurfaceFromPixbuf: cannot create cairo context form given format" - dPtr <- {#call unsafe pixbuf_get_pixels#} pb - sfPtr <- {#call cairo_image_surface_create_for_data#} dPtr - (fromIntegral (fromEnum cairoFormat)) (fromIntegral width) - (fromIntegral height) (fromIntegral stride) - sf <- mkSurface sfPtr - let pbPtr = unsafeForeignPtrToPtr (unPixbuf pb) - objectRef pbPtr - {#call cairo_surface_set_user_data#} sf (castPtr pbPtr) - (castPtr pbPtr) objectUnref - manageSurface sf - return sf - -#if CAIRO_CHECK_VERSION(1,2,0) --- | Treat an image 'Graphics.Rendering.Cairo.Surface' as a --- 'Graphics.UI.Gtk.Gdk.Pixbuf.Pixbuf'. --- --- * The image data is shared between the two objects. Note that everytime you --- use 'Graphics.UI.Gtk.Gdk.Pixbuf.Pixbuf' functions on the image, it is --- necessary to tell Cairo that the image data has changed using --- 'Graphics.Rendering.Cairo.surfaceMarkDirty' since it might cache certain --- areas of an image. This function throws an error if the --- 'Graphics.Rendering.Cairo.Surface' has any other format than --- 'Graphics.Rendering.Cairo.FormatARGB32' or --- 'Graphics.Rendering.Cairo.FormatRGB32' since --- 'Graphics.UI.Gtk.Gdk.Pixbuf.Pixbuf' can currently only handle these two --- formats. --- --- * Requires Cairo 1.2 or higher. --- -pixbufFromImageSurface :: Surface -> IO Pixbuf -pixbufFromImageSurface sf = do - con <- Cairo.Internal.surfaceGetContent sf - hasAlpha <- case con of - Cairo.Internal.ContentColor -> return False - Cairo.Internal.ContentColorAlpha -> return True - _ -> error ("pixbufFromImageSurface: Pixbufs do not support Cairo format "++show con) [_$_] - width <- Cairo.Internal.imageSurfaceGetWidth sf - height <- Cairo.Internal.imageSurfaceGetHeight sf - stride <- Cairo.Internal.imageSurfaceGetStride sf - dPtr <- Cairo.Internal.imageSurfaceGetData sf - let (Cairo.Surface sfFPtr) = sf - let sfPtr = unsafeForeignPtrToPtr sfFPtr - Cairo.Internal.surfaceReference sf - fPtrRef <- newIORef nullFunPtr - fPtr <- mkPixbufDestroyNotify $ \_ _ -> do - Cairo.Internal.surfaceDestroy sf - fPtr <- readIORef fPtrRef - freeHaskellFunPtr fPtr - writeIORef fPtrRef fPtr - makeNewGObject mkPixbuf $ - {#call unsafe gdk_pixbuf_new_from_data#} dPtr 0 (fromBool hasAlpha) - 8 (fromIntegral width) (fromIntegral height) (fromIntegral stride) - fPtr nullPtr -#endif - --- the following should be ifdef'd out as well but then we need to conditionally --- link in the _stub.o file of that is then only sometimes generated... -{#pointer GdkPixbufDestroyNotify as PixbufDestroyNotify#} - -foreign import ccall "wrapper" mkPixbufDestroyNotify :: - (Ptr () -> Ptr Surface -> IO ()) -> IO PixbufDestroyNotify - hunk ./gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs.pp 196 --- fast enough, it is possible to use 'Data.Array.Base.unsafeRead' and --- 'Data.Array.Base.unsafeWrite' which have the same type signatures --- as 'Data.Array.MArray.readArray' and 'Data.Array.MArray.writeArray'. +-- fast enough, it is possible to use 'unsafeRead' and +-- 'unsafeWrite' which have the same type signatures +-- as 'readArray' and 'writeArray'. |
From: <du...@co...> - 2009-10-31 14:02:09
|
Sat Oct 31 09:58:49 EDT 2009 Duncan Coutts <du...@ha...> * Fix C-side memory leaks in functions that take a GList Ignore-this: 8703764bb7a8314d9d7dd0ec5f42836e The C functions do not take ownership of the GList (they make a copy) It is the responsibility of the caller to allocate and free the GList. hunk ./glib/System/Glib/GList.chs 35 + withGList, + hunk ./glib/System/Glib/GList.chs 137 +-- Temporarily allocate a list of something +-- +withGList :: [Ptr a] -> (GSList -> IO b) -> IO b +withGList xs = bracket (toGList xs) {# call unsafe g_list_free #} + hunk ./gtk/Graphics/UI/Gtk/Abstract/Container.chs.pp 205 -import System.Glib.GList (fromGList, toGList) +import System.Glib.GList (fromGList, withGList) hunk ./gtk/Graphics/UI/Gtk/Abstract/Container.chs.pp 315 - withForeignPtrs (map unWidget chain) $ \wPtrs -> do - glist <- toGList wPtrs + withForeignPtrs (map unWidget chain) $ \wPtrs -> + withGList wPtrs $ \glist -> hunk ./gtk/Graphics/UI/Gtk/Windows/Invisible.chs.pp 59 -import System.Glib.GList (fromGList, toGList) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 241 -import System.Glib.GList (fromGList, toGList) +import System.Glib.GList (fromGList, withGList) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1233 - withForeignPtrs (map unPixbuf list) $ \ptrList -> do - glist <- toGList ptrList + withForeignPtrs (map unPixbuf list) $ \ptrList -> + withGList ptrList $ \glist -> hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1255 - withForeignPtrs (map unPixbuf list) $ \ptrList -> do - glist <- toGList ptrList + withForeignPtrs (map unPixbuf list) $ \ptrList -> + withGList ptrList $ \glist -> hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 2163 + hunk ./gtk/Graphics/UI/Gtk/Windows/WindowGroup.chs 53 -import System.Glib.GList (fromGList, toGList) +import System.Glib.GList (fromGList) |
From: Axel S. <si...@co...> - 2009-10-30 17:02:36
|
Mon Oct 26 14:43:38 EDT 2009 Axe...@en... * Remove internal signals in Notebook. hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 30 --- createWindow hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 31 --- switchPage hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 1230 -pageAdded :: NotebookClass self => Signal self (Widget -> Int -> IO ()) -pageAdded = Signal (connect_OBJECT_INT__NONE "page_added") +pageReordered :: NotebookClass self => Signal self (Widget -> Int -> IO ()) +pageReordered = Signal (connect_OBJECT_INT__NONE "page_reordered") hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 1235 +-- * Available since Gtk+ version 2.10 +-- hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 1240 --- | The 'pageReordered' signal is emitted in the notebook right after a page has been reordered. --- -pageReordered :: NotebookClass self => Signal self (Widget -> Int -> IO ()) -pageReordered = Signal (connect_OBJECT_INT__NONE "page_reordered") - --- | +-- | The 'pageAdded' signal is emitted in the notebook right after a page is added to the notebook. hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 1242 -reorderTab :: NotebookClass self => Signal self (DirectionType -> Bool -> IO Bool) -reorderTab = Signal (connect_ENUM_BOOL__BOOL "reorder_tab") - --- | +-- * Available since Gtk+ version 2.10 hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 1244 -selectPage :: NotebookClass self => Signal self (Bool -> IO Bool) -selectPage = Signal (connect_BOOL__BOOL "select_page") +pageAdded :: NotebookClass self => Signal self (Widget -> Int -> IO ()) +pageAdded = Signal (connect_OBJECT_INT__NONE "page_added") +#endif |
From: Axel S. <si...@co...> - 2009-10-30 17:02:30
|
Fri Oct 30 12:54:45 EDT 2009 Axe...@en... * Add Visual and Device to the type list. hunk ./tools/hierarchyGen/hierarchy.list 30 + GdkVisual + GdkDevice |
From: Axel S. <si...@co...> - 2009-10-30 17:02:26
|
Mon Oct 26 13:50:06 EDT 2009 Axe...@en... * Fix gtkglext to use the new mk... functions. hunk ./gtkglext/Graphics/UI/Gtk/OpenGL/Context.chs 87 - (maybe (mkGLContext nullForeignPtr) toGLContext shareList) + (maybe (GLContext nullForeignPtr) toGLContext shareList) hunk ./gtkglext/Graphics/UI/Gtk/OpenGL/DrawingArea.chs 140 - (maybe (mkGLContext nullForeignPtr) toGLContext shareList) + (maybe (GLContext nullForeignPtr) toGLContext shareList) |
From: Axel S. <si...@co...> - 2009-10-30 17:02:26
|
Mon Oct 26 14:43:23 EDT 2009 Axe...@en... * Complete the Screen module and add the Display module. hunk ./Makefile.am 774 + gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp \ hunk ./Makefile.am 791 + gtk/Graphics/UI/Gtk/General/RcStyle.chs.pp \ hunk ./glib/System/Glib/GTypeConstants.hsc 27 + none, hunk ./glib/System/Glib/GTypeConstants.hsc 42 -invalid, uint, int, uint64, int64, uchar, char, bool, enum, flags, +invalid, none, uint, int, uint64, int64, uchar, char, bool, enum, flags, hunk ./glib/System/Glib/GTypeConstants.hsc 46 +none = #const G_TYPE_NONE hunk ./glib/System/Glib/Types.chs 45 -{#pointer *GObject foreign newtype #} +{#pointer *GObject foreign newtype #} deriving (Eq) hunk ./gtk/Graphics/UI/Gtk.hs.pp 50 + module Graphics.UI.Gtk.General.RcStyle, hunk ./gtk/Graphics/UI/Gtk.hs.pp 64 + module Graphics.UI.Gtk.Gdk.Display, hunk ./gtk/Graphics/UI/Gtk.hs.pp 240 +import Graphics.UI.Gtk.General.RcStyle hunk ./gtk/Graphics/UI/Gtk.hs.pp 252 +import Graphics.UI.Gtk.Gdk.Display addfile ./gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp hunk ./gtk/Graphics/UI/Gtk/Gdk/Display.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Display - a description of a keyboard/mouse/monitors combination +-- +-- Author : Axel Simon +-- +-- Created: 22 October 2009 +-- +-- Copyright (C) 2009 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 : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- Controls the keyboard\/mouse\/monitors combination. +-- +-- * Module available since Gdk version 2.2 +-- +module Graphics.UI.Gtk.Gdk.Display ( + +-- * Detail +-- +-- | 'Display' objects purpose are two fold: +-- +-- * To grab\/ungrab keyboard focus and mouse pointer +-- +-- * To manage and provide information about the 'Screen'(s) available for +-- this 'Display' +-- +-- 'Display' objects are the GDK representation of the X Display which can +-- be described as /a workstation consisting of a keyboard a pointing device +-- (such as a mouse) and one or more screens/. It is used to open and keep +-- track of various 'Screen' objects currently instanciated by the application. +-- It is also used to grab and release the keyboard and the mouse pointer. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----Display +-- @ + +#if GTK_CHECK_VERSION(2,2,0) +-- * Types + Display, + DisplayClass, + castToDisplay, + toDisplay, + +-- * Methods + displayOpen, + displayGetDefault, + displayGetName, + displayGetNScreens, + displayGetScreen, + displayGetDefaultScreen, + displayPointerUngrab, + displayKeyboardUngrab, + displayPointerIsGrabbed, + displayBeep, + displaySync, +#if GTK_CHECK_VERSION(2,4,0) + displayFlush, +#endif + displayClose, + displayListDevices, + displaySetDoubleClickTime, +#if GTK_CHECK_VERSION(2,4,0) + displaySetDoubleClickDistance, +#endif + displayGetPointer, + displayGetWindowAtPointer, +#if GTK_CHECK_VERSION(2,8,0) + displayWarpPointer, +#endif +#if GTK_CHECK_VERSION(2,4,0) + displaySupportsCursorColor, + displaySupportsCursorAlpha, + displayGetDefaultCursorSize, + displayGetMaximalCursorSize, + displayGetDefaultGroup, +#if GTK_CHECK_VERSION(2,6,0) + displaySupportsSelectionNotification, + displayRequestSelectionNotification, + displaySupportsClipboardPersistence, + displayStoreClipboard, +#if GTK_CHECK_VERSION(2,10,0) + displaySupportsShapes, + displaySupportsInputShapes, +#if GTK_CHECK_VERSION(2,12,0) + displaySupportsComposite, +#endif +#endif +#endif +#endif + +-- * Signals + displayClosed, + +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.Flags +import System.Glib.GList +{#import Graphics.UI.Gtk.Types#} +import Graphics.UI.Gtk.Signals +import Graphics.UI.Gtk.Gdk.EventM +import Graphics.UI.Gtk.Gdk.Enums (Modifier(..)) +import Graphics.UI.Gtk.General.DNDTypes (SelectionTag, TargetTag, Atom(..)) + +{# context lib="gdk" prefix="gdk" #} + +#if GTK_CHECK_VERSION(2,2,0) +-------------------- +-- Methods + +-- | Opens a display. +-- +displayOpen :: + String -- ^ @displayName@ - the name of the display to open + -> IO (Maybe Display) + -- ^ returns a 'Display', or @Nothing@ if the display + -- could not be opened. +displayOpen displayName = + maybeNull (makeNewGObject mkDisplay) $ + withUTFString displayName $ \displayNamePtr -> + {# call gdk_display_open #} + displayNamePtr + +-- | Gets the default 'Display'. This is a convenience function for +-- @displayManagerGetDefaultDisplay displayManagerGet@. +-- +displayGetDefault :: + IO (Maybe Display) + -- ^ returns a 'Display', or @Nothing@ if there is no + -- default display. +displayGetDefault = + maybeNull (makeNewGObject mkDisplay) $ + {# call gdk_display_get_default #} + +-- | Gets the name of the display. +-- +displayGetName :: Display + -> IO String -- ^ returns a string representing the display name +displayGetName self = + {# call gdk_display_get_name #} + self + >>= peekUTFString + +-- | Gets the number of screen managed by the @display@. +-- +displayGetNScreens :: Display + -> IO Int -- ^ returns number of screens. +displayGetNScreens self = + liftM fromIntegral $ + {# call gdk_display_get_n_screens #} + self + +-- | Returns a screen object for one of the screens of the display. +-- +displayGetScreen :: Display + -> Int -- ^ @screenNum@ - the screen number + -> IO Screen -- ^ returns the 'Screen' object +displayGetScreen self screenNum = + makeNewGObject mkScreen $ + {# call gdk_display_get_screen #} + self + (fromIntegral screenNum) + +-- | Get the default 'Screen' for @display@. +-- +displayGetDefaultScreen :: Display + -> IO Screen -- ^ returns the default 'Screen' object for @display@ +displayGetDefaultScreen self = + makeNewGObject mkScreen $ + {# call gdk_display_get_default_screen #} + self + +-- | Release any pointer grab. +-- +displayPointerUngrab :: Display + -> TimeStamp -- ^ @time@ - a timestap (e.g. 'currentTime'). + -> IO () +displayPointerUngrab self time = + {# call gdk_display_pointer_ungrab #} + self + (fromIntegral time) + +-- | Release any keyboard grab +-- +displayKeyboardUngrab :: Display + -> TimeStamp -- ^ @time@ - a timestap (e.g 'currentTime'). + -> IO () +displayKeyboardUngrab self time = + {# call gdk_display_keyboard_ungrab #} + self + (fromIntegral time) + +-- | Test if the pointer is grabbed. +-- +displayPointerIsGrabbed :: Display + -> IO Bool -- ^ returns @True@ if an active X pointer grab is in effect +displayPointerIsGrabbed self = + liftM toBool $ + {# call gdk_display_pointer_is_grabbed #} + self + +-- | Emits a short beep on @display@ +-- +displayBeep :: Display -> IO () +displayBeep self = + {# call gdk_display_beep #} + self + +-- | Flushes any requests queued for the windowing system and waits until all +-- requests have been handled. This is often used for making sure that the +-- display is synchronized with the current state of the program. Calling +-- 'displaySync' before 'errorTrapPop' makes sure that any errors generated +-- from earlier requests are handled before the error trap is removed. +-- +-- This is most useful for X11. On windowing systems where requests are +-- handled synchronously, this function will do nothing. +-- +displaySync :: Display -> IO () +displaySync self = + {# call gdk_display_sync #} + self + +#if GTK_CHECK_VERSION(2,4,0) +-- | Flushes any requests queued for the windowing system; this happens +-- automatically when the main loop blocks waiting for new events, but if your +-- application is drawing without returning control to the main loop, you may +-- need to call this function explicitely. A common case where this function +-- needs to be called is when an application is executing drawing commands from +-- a thread other than the thread where the main loop is running. +-- +-- This is most useful for X11. On windowing systems where requests are +-- handled synchronously, this function will do nothing. +-- +-- * Available since Gdk version 2.4 +-- +displayFlush :: Display -> IO () +displayFlush self = + {# call gdk_display_flush #} + self +#endif + +-- | Closes the connection to the windowing system for the given display, and +-- cleans up associated resources. +-- +displayClose :: Display -> IO () +displayClose self = + {# call gdk_display_close #} + self + +-- | Returns the list of available input devices attached to @display@. +-- +displayListDevices :: Display + -> IO [Device] -- ^ returns a list of 'Device' +displayListDevices self = + {# call gdk_display_list_devices #} + self + >>= readGList + >>= mapM (makeNewGObject mkDevice . return) + + +-- | Sets the double click time (two clicks within this time interval count as +-- a double click and result in an 'eventButton' where 'eventClick' is +-- 'DoubleClick'). Applications should /not/ set this, it is a global +-- user-configured setting. +-- +displaySetDoubleClickTime :: Display + -> Int -- ^ @msec@ - double click time in milliseconds (thousandths of a + -- second) + -> IO () +displaySetDoubleClickTime self msec = + {# call gdk_display_set_double_click_time #} + self + (fromIntegral msec) + +#if GTK_CHECK_VERSION(2,4,0) +-- | Sets the double click distance (two clicks within this distance count as +-- a double click and result in an 'eventButton' where 'eventClick' is +-- 'DoubleClick'). See also 'displaySetDoubleClickTime'. Applications should +-- /not/ set this, it is a global user-configured setting. +-- +-- * Available since Gdk version 2.4 +-- +displaySetDoubleClickDistance :: Display + -> Int -- ^ @distance@ - distance in pixels + -> IO () +displaySetDoubleClickDistance self distance = + {# call gdk_display_set_double_click_distance #} + self + (fromIntegral distance) +#endif + +-- | Gets the current location of the pointer and the current modifier mask +-- for a given display. +-- +displayGetPointer :: Display + -> IO (Screen, [Modifier], Int, Int) + -- ^ @(s, m, x, y)@ - the screen @s@, the modifier mask @m@ and the @x@ and + -- @y@ coordinates of the pointer +displayGetPointer self = + alloca $ \sPtr -> + alloca $ \xPtr -> + alloca $ \yPtr -> + alloca $ \mPtr -> + {# call gdk_display_get_pointer #} + self + (castPtr sPtr) + xPtr + yPtr + mPtr >> + makeNewGObject mkScreen (peek sPtr) >>= \s -> + peek xPtr >>= \x -> + peek yPtr >>= \y -> + peek mPtr >>= \m -> + return (s, toFlags (fromIntegral m), fromIntegral x, fromIntegral y) + +-- | Obtains the window underneath the mouse pointer, returning the location +-- of the pointer in that window in @winX@, @winY@ for @screen@. Returns +-- @Nothing@ if +-- the window under the mouse pointer is not known to GDK (for example, belongs +-- to another application). +-- +displayGetWindowAtPointer :: Display + -> IO (Maybe (DrawWindow, Int, Int)) + -- ^ @(screen, winX, winY)@ returns the window under the mouse + -- pointer, or @Nothing@. The @winX@ and @winY@ denote the pointer location + -- relative to the window origin +displayGetWindowAtPointer self = + alloca $ \winXPtr -> + alloca $ \winYPtr -> do + wPtr <- {# call gdk_display_get_window_at_pointer #} + self + winXPtr + winYPtr + if wPtr==nullPtr then return Nothing else + peek winXPtr >>= \winX -> + peek winYPtr >>= \winY -> + makeNewGObject mkDrawWindow (return wPtr) >>= \win -> + return (Just (win, fromIntegral winX, fromIntegral winY)) + +{- not worth the trouble + +-- | This function allows for hooking into the operation of getting the +-- current location of the pointer on a particular display. This is only useful +-- for such low-level tools as an event recorder. Applications should never +-- have any reason to use this facility. +-- +displaySetPointerHooks :: Display + -> {-const-GdkDisplayPointerHooks*-} -- ^ @newHooks@ - a table of pointers to + -- functions for getting quantities + -- related to the current pointer + -- position, or {@NULL@, FIXME: this + -- should probably be converted to a + -- Maybe data type} to restore the + -- default table. + -> IO {-GdkDisplayPointerHooks*-} -- ^ returns the previous pointer hook + -- table +displaySetPointerHooks self newHooks = + {# call gdk_display_set_pointer_hooks #} + self + {-newHooks-} +-} + +#if GTK_CHECK_VERSION(2,8,0) +-- | Moves the pointer of @display@ to the point @x@,@y@ on the screen +-- @screen@, unless the pointer is confined to a window by a grab, in which +-- case it will be moved as far as allowed by the grab. Warping the pointer +-- creates events as if the user had moved the mouse instantaneously to the +-- destination. +-- +-- Note that the pointer should normally be under the control of the user. +-- This function was added to cover some rare use cases like keyboard +-- navigation support for the color picker in the 'ColorSelectionDialog'. +-- +-- * Available since Gdk version 2.8 +-- +displayWarpPointer :: Display + -> Screen -- ^ @screen@ - the screen of @display@ to warp the pointer to + -> Int -- ^ @x@ - the x coordinate of the destination + -> Int -- ^ @y@ - the y coordinate of the destination + -> IO () +displayWarpPointer self screen x y = + {# call gdk_display_warp_pointer #} + self + screen + (fromIntegral x) + (fromIntegral y) +#endif + +#if GTK_CHECK_VERSION(2,4,0) +-- | Returns @True@ if multicolored cursors are supported on @display@. +-- Otherwise, cursors have only a forground and a background color. +-- +-- * Available since Gdk version 2.4 +-- +displaySupportsCursorColor :: Display + -> IO Bool -- ^ returns whether cursors can have multiple colors. +displaySupportsCursorColor self = + liftM toBool $ + {# call gdk_display_supports_cursor_color #} + self + +-- | Returns @True@ if cursors can use an 8bit alpha channel on @display@. +-- Otherwise, cursors are restricted to bilevel alpha (i.e. a mask). +-- +-- * Available since Gdk version 2.4 +-- +displaySupportsCursorAlpha :: Display + -> IO Bool -- ^ returns whether cursors can have alpha channels. +displaySupportsCursorAlpha self = + liftM toBool $ + {# call gdk_display_supports_cursor_alpha #} + self + +-- | Returns the default size to use for cursors on @display@. +-- +-- * Available since Gdk version 2.4 +-- +displayGetDefaultCursorSize :: Display + -> IO Int -- ^ returns the default cursor size. +displayGetDefaultCursorSize self = + liftM fromIntegral $ + {# call gdk_display_get_default_cursor_size #} + self + +-- | Gets the maximal size to use for cursors on @display@. +-- +-- * Available since Gdk version 2.4 +-- +displayGetMaximalCursorSize :: Display + -> IO (Int, Int) -- ^ @(width, height)@ + -- maximal @width@ and @height@ of the cursor +displayGetMaximalCursorSize self = + alloca $ \widthPtr -> + alloca $ \heightPtr -> + {# call gdk_display_get_maximal_cursor_size #} + self + widthPtr + heightPtr >> + peek widthPtr >>= \width -> + peek heightPtr >>= \height -> + return (fromIntegral width, fromIntegral height) + +-- | Returns the default group leader window for all toplevel windows on +-- @display@. This window is implicitly created by GDK. See 'windowSetGroup'. +-- +-- * Available since Gdk version 2.4 +-- +displayGetDefaultGroup :: Display + -> IO DrawWindow -- ^ returns The default group leader window for @display@ +displayGetDefaultGroup self = + makeNewGObject mkDrawWindow $ + {# call gdk_display_get_default_group #} + self + +#if GTK_CHECK_VERSION(2,6,0) +-- | Returns whether 'EOwnerChange' events will be +-- sent when the owner of a selection changes. +-- +-- * Available since Gdk version 2.6 +-- +displaySupportsSelectionNotification :: Display + -> IO Bool -- ^ returns whether 'EOwnerChange' + -- events will be sent. +displaySupportsSelectionNotification self = + liftM toBool $ + {# call gdk_display_supports_selection_notification #} + self + +-- | Request 'EOwnerChange' events for ownership +-- changes of the selection named by the given atom. +-- +-- * Available since Gdk version 2.6 +-- +displayRequestSelectionNotification :: Display + -> SelectionTag -- ^ @selection@ - the 'Atom' naming + -- the selection for which ownership change notification is + -- requested + -> IO Bool -- ^ returns whether 'EOwnerChange' + -- events will be sent. +displayRequestSelectionNotification self (Atom selection) = + liftM toBool $ + {# call gdk_display_request_selection_notification #} + self + selection + +-- | Returns whether the speicifed display supports clipboard persistance; +-- i.e. if it's possible to store the clipboard data after an application has +-- quit. On X11 this checks if a clipboard daemon is running. +-- +-- * Available since Gdk version 2.6 +-- +displaySupportsClipboardPersistence :: Display + -> IO Bool -- ^ returns @True@ if the display supports clipboard persistance. +displaySupportsClipboardPersistence self = + liftM toBool $ + {# call gdk_display_supports_clipboard_persistence #} + self + +-- | Issues a request to the clipboard manager to store the clipboard data. On +-- X11, this is a special program that works according to the freedesktop +-- clipboard specification, available at +-- http:\/\/www.freedesktop.org\/Standards\/clipboard-manager-spec. +-- +-- * Available since Gdk version 2.6 +-- +displayStoreClipboard :: Display + -> DrawWindow -- ^ @clipboardWindow@ - a 'DrawWindow' belonging to + -- the clipboard owner + -> Word32 -- ^ @time@ - a timestamp + -> (Maybe [TargetTag]) -- ^ @targets@ - an array of targets that should be + -- saved, or @Nothing@ if all available + -- targets should be saved. + -> IO () +displayStoreClipboard self clipboardWindow time (Just targets) = + withArrayLen (map (\(Atom a) -> a) targets) $ \nTargets tPtr -> + {# call gdk_display_store_clipboard #} + self + clipboardWindow + (fromIntegral time) + tPtr + (fromIntegral nTargets) +displayStoreClipboard self clipboardWindow time Nothing = + {# call gdk_display_store_clipboard #} + self + clipboardWindow + (fromIntegral time) + nullPtr + 0 + +#if GTK_CHECK_VERSION(2,10,0) +-- | Returns @True@ if 'windowShapeCombineMask' can be used to create shaped +-- windows on @display@. +-- +-- * Available since Gdk version 2.10 +-- +displaySupportsShapes :: Display + -> IO Bool -- ^ returns @True@ if shaped windows are supported +displaySupportsShapes self = + liftM toBool $ + {# call gdk_display_supports_shapes #} + self + +-- | Returns @True@ if 'windowInputShapeCombineMask' can be used to modify the +-- input shape of windows on @display@. +-- +-- * Available since Gdk version 2.10 +-- +displaySupportsInputShapes :: Display + -> IO Bool -- ^ returns @True@ if windows with modified input shape are + -- supported +displaySupportsInputShapes self = + liftM toBool $ + {# call gdk_display_supports_input_shapes #} + self + +#if GTK_CHECK_VERSION(2,12,0) +-- | Returns @True@ if 'windowSetComposited' can be used to redirect drawing +-- on the window using compositing. +-- +-- Currently this only works on X11 with XComposite and XDamage extensions +-- available. +-- +-- * Available since Gdk version 2.12 +-- +displaySupportsComposite :: Display + -> IO Bool -- ^ returns @True@ if windows may be composited. +displaySupportsComposite self = + liftM toBool $ + {# call gdk_display_supports_composite #} + self +#endif +#endif +#endif +#endif + +-------------------- +-- Signals + +-- | The 'displayClosed' signal is emitted when the connection to the windowing +-- system for @display@ is closed. +-- +displayClosed :: DisplayClass self => Signal self (Bool -> IO ()) +displayClosed = Signal (connect_BOOL__NONE "closed") + +#endif hunk ./gtk/Graphics/UI/Gtk/Gdk/Screen.chs.pp 393 -screenGetMonitorPlugName self monitorNum = - maybeNull readUTFString $ +screenGetMonitorPlugName self monitorNum = do + sPtr <- hunk ./gtk/Graphics/UI/Gtk/Gdk/Screen.chs.pp 398 + if sPtr==nullPtr then return Nothing else liftM Just $ readUTFString sPtr hunk ./gtk/Graphics/UI/Gtk/Gdk/Screen.chs.pp 517 --- | The ::composited_changed signal is emitted when the composited status of +-- | The 'screenCompositedChanged' signal is emitted when the composited status of addfile ./gtk/Graphics/UI/Gtk/General/RcStyle.chs.pp hunk ./gtk/Graphics/UI/Gtk/General/RcStyle.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) RcStyle +-- +-- Author : Axel Simon +-- +-- Created: 22 October 2009 +-- +-- Copyright (C) 2009 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 : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- Routines for handling resource files +-- +module Graphics.UI.Gtk.General.RcStyle ( + +-- * Detail +-- +-- | Gtk+ provides resource file mechanism for configuring various aspects of +-- the operation of a Gtk+ program at runtime. + +-- ** Default files +-- +-- | An application can cause Gtk+ to parse a specific RC file by calling +-- 'rcParse'. In addition to this, certain files will be read at the end of +-- 'initGUI'. Unless modified, the files looked for will be +-- @\<SYSCONFDIR>\/gtk-2.0\/gtkrc@ and @.gtkrc-2.0@ in the users home directory. +-- @(\<SYSCONFDIR>@ defaults to @\/usr\/local\/etc@. It can be changed with the +-- --prefix or --sysconfdir options when configuring Gtk+.) Note that although +-- the filenames contain the version number 2.0, all 2.x versions of Gtk+ look +-- for these files. +-- +-- The set of these default files can be retrieved with 'rcGetDefaultFiles' +-- and modified with 'rcAddDefaultFile' and 'rcSetDefaultFiles'. Additionally, +-- the @GTK2_RC_FILES@ environment variable can be set to a +-- @G_SEARCHPATH_SEPARATOR_S@-separated list of +-- files in order to overwrite the set of default files at runtime. +-- +-- For each RC file, in addition to the file itself, Gtk+ will look for a +-- locale-specific file that will be parsed after the main file. For instance, +-- if @LANG@ is set to @ja_JP.ujis@, when loading the default file @~\/.gtkrc@ then +-- Gtk+ looks for @~\/.gtkrc.ja_JP@ and @~\/.gtkrc.ja@, and parses the first of +-- those that exists. + +-- ** Pathnames and patterns +-- +-- | A resource file defines a number of styles and key bindings and attaches +-- them to particular widgets. The attachment is done by the @widget@, +-- @widget_class@, and @class@ declarations. As an example of such a statement: +-- attaches the style @\"my-entry-class\"@ to all widgets whose widget path +-- matches the pattern @\"mywindow.*.GtkEntry\"@. That is, all 'Entry' widgets +-- which are part of a 'Window' named @\"mywindow\"@. +-- +-- > widget "mywindow.*.GtkEntry" style "my-entry-class" +-- +-- The patterns here are given in the standard shell glob syntax. The +-- @\"?\"@ wildcard matches any character, while @\"*\"@ matches zero or more +-- of any character. The three types of matching are against the widget path, +-- the class path and the class hierarchy. Both the widget path and the class +-- path consist of a @\".\"@ separated list of all the parents of the widget +-- and the widget itself from outermost to innermost. The difference is that in +-- the widget path, the name assigned by 'widgetSetName' is used if present, +-- otherwise the class name of the widget, while for the class path, the class +-- name is always used. +-- +-- Since Gtk+ 2.10, @widget_class@ paths can also contain @\<classname>@ +-- substrings, which are matching the class with the given name and any derived +-- classes. For instance, will match 'Label' widgets which are contained in any +-- kind of menu item. +-- +-- > widget_class "*GtkMenuItem.GtkLabel" style "my-style" +-- +-- So, if you have a 'Entry' named @\"myentry\"@, inside of a horizontal box +-- in a window named @\"mywindow\"@, then the widget path is: +-- @\"mywindow.GtkHBox.myentry\"@ while the class path is: +-- @\"GtkWindow.GtkHBox.GtkEntry\"@. +-- +-- Matching against class is a little different. The pattern match is done +-- against all class names in the widgets class hierarchy (not the layout +-- hierarchy) in sequence, so the pattern: will match not just 'Button' +-- widgets, but also 'ToggleButton' and 'CheckButton' widgets, since those +-- classes derive from 'Button'. +-- +-- > class "GtkButton" style "my-style" +-- +-- Additionally, a priority can be specified for each pattern, and styles +-- override other styles first by priority, then by pattern type and then by +-- order of specification (later overrides earlier). The priorities that can be +-- specified are (highest to lowest): +-- +-- * @highest@ +-- +-- * @rc@ +-- +-- * @theme@ +-- +-- * @application@ +-- +-- * @gtk@ +-- +-- * @lowest@ +-- +-- @rc@ is the default for styles read from an RC file, @theme@ is the +-- default for styles read from theme RC files, @application@ should be used +-- for styles an application sets up, and @gtk@ is used for styles that Gtk+ +-- creates internally. + +-- ** Optimizing RC Style Matches +-- +-- | Everytime a widget is created and added to the layout hierarchy of a +-- 'Window' (\"anchored\" to be exact), a list of matching RC styles out of all +-- RC styles read in so far is composed. For this, every RC style is matched +-- against the widgets class path, the widgets name path and widgets +-- inheritance hierarchy. As a consequence, significant slowdown can be caused +-- by utilization of many RC styles and by using RC style patterns that are +-- slow or complicated to match against a given widget. The following ordered +-- list provides a number of advices (prioritized by effectiveness) to reduce +-- the performance overhead associated with RC style matches: +-- +-- Move RC styles for specific applications into RC files dedicated to those +-- applications and parse application specific RC files only from applications +-- that are affected by them. This reduces the overall amount of RC styles that +-- have to be considered for a match across a group of applications. +-- +-- Merge multiple styles which use the same matching rule, for instance: is +-- faster to match as: +-- +-- > style "Foo" { foo_content } +-- > class "X" style "Foo" +-- > style "Bar" { bar_content } +-- > class "X" style "Bar" +-- +-- > style "FooBar" { foo_content bar_content } +-- > class "X" style "FooBar" +-- +-- Use of wildcards should be avoided, this can reduce the individual RC +-- style match to a single integer comparison in most cases. +-- +-- To avoid complex recursive matching, specification of full class names +-- (for @class@ matches) or full path names (for @widget@ and @widget_class@ +-- matches) is to be preferred over shortened names containing @\"*\"@ or +-- @\"?\"@. +-- +-- If at all necessary, wildcards should only be used at the tail or head of +-- a pattern. This reduces the match complexity to a string comparison per RC +-- style. +-- +-- When using wildcards, use of @\"?\"@ should be preferred over @\"*\"@. +-- This can reduce the matching complexity from O(n^2) to O(n). For example +-- @\"Gtk*Box\"@ can be turned into @\"Gtk?Box\"@ and will still match 'HBox' +-- and 'VBox'. +-- +-- The use of @\"*\"@ wildcards should be restricted as much as possible, +-- because matching @\"A*B*C*RestString\"@ can result in matching complexities +-- of O(n^2) worst case. + +-- ** Toplevel declarations +-- +-- | An RC file is a text file which is composed of a sequence of +-- declarations. @\'#\'@ characters delimit comments and the portion of a line +-- after a @\'#\'@ is ignored when parsing an RC file. +-- +-- The possible toplevel declarations are: +-- +-- [@binding name { ... }@] Declares a binding set. +-- +-- [@class pattern [ style | binding \][ : priority \] name@] +-- Specifies a style or binding set for a particular branch of the inheritance +-- hierarchy. +-- +-- [@include filename@] Parses another file at this point. If filename is +-- not an absolute filename, it is searched in the directories of the currently +-- open RC files. Gtk+ also tries to load a locale-specific variant of the +-- included file. +-- +-- [@module_path path@] Sets a path (a list of directories separated by +-- colons) that will be searched for theme engines referenced in RC files. +-- +-- [@pixmap_path path@] Sets a path (a list of directories separated by +-- colons) that will be searched for pixmaps referenced in RC files. +-- +-- [@im_module_file pathname@] Sets the pathname for the IM modules file. +-- Setting this from RC files is deprecated; you should use the environment +-- variable GTK_IM_MODULE_FILE instead. +-- +-- [@style name [ = parent \] { ... }@] Declares a style. +-- +-- [@widget pattern [ style | binding \][ : priority \] name@] +-- Specifies a style or binding set for a particular group of widgets by +-- matching on the widget pathname. +-- +-- [@widget_class pattern [ style | binding \][ : priority \] name@] +-- Specifies a style or binding set for a particular group of widgets by +-- matching on the class pathname. +-- +-- [setting = value] Specifies a value for a setting. Note that settings in +-- RC files are overwritten by system-wide settings (which are managed by an +-- XSettings manager on X11). + +-- ** Styles +-- +-- | A RC style is specified by a @style@ declaration in a RC file, and then +-- bound to widgets with a @widget@, @widget_class@, or @class@ declaration. +-- All styles applying to a particular widget are composited together with +-- @widget@ declarations overriding @widget_class@ declarations which, in turn, +-- override @class@ declarations. Within each type of declaration, later +-- declarations override earlier ones. +-- +-- Within a @style@ declaration, the possible elements are: +-- +-- [@bg[state\] = color@] Sets the color used for the background of +-- most widgets. +-- +-- [@fg[state\] = color@] Sets the color used for the foreground of +-- most widgets. +-- +-- [@base[state\] = color@] Sets the color used for the background of +-- widgets displaying editable text. This color is used for the background of, +-- among others, {GtkText, FIXME: unknown type\/value}, 'Entry', 'List', and +-- 'CList'. +-- +-- [@text[state\] = color@] Sets the color used for foreground of +-- widgets using @base@ for the background color. +-- +-- [@xthickness = number@] Sets the xthickness, which is used for +-- various horizontal padding values in Gtk+. +-- +-- [@ythickness = number@] Sets the ythickness, which is used for +-- various vertical padding values in Gtk+. +-- +-- [@bg_pixmap[state\] = pixmap@] Sets a background pixmap to be used +-- in place of the @bg@ color (or for {GtkText, FIXME: unknown type\/value}, in +-- place of the @base@ color. The special value @\"\<parent>\"@ may be used to +-- indicate that the widget should use the same background pixmap as its +-- parent. The special value @\"\<none>\"@ may be used to indicate no +-- background pixmap. +-- +-- [@font = font@] Starting with Gtk+ 2.0, the \"font\" and \"fontset\" +-- declarations are ignored; use \"font_name\" declarations instead. +-- +-- [@fontset = font@] Starting with Gtk+ 2.0, the \"font\" and \"fontset\" +-- declarations are ignored; use \"font_name\" declarations instead. +-- +-- [@font_name = font@] Sets the font for a widget. font must be a Pango +-- font name, e.g. @\"Sans Italic 10\"@. For details about Pango font names, +-- see 'fontDescriptionFromString'. +-- +-- [@stock[\"stock-id\"\] = { icon source specifications }@] Defines the +-- icon for a stock item. +-- +-- [@color[\"color-name\"\] = color specification@] Since 2.10, this element +-- can be used to defines symbolic colors. See below for the syntax of color +-- specifications. +-- +-- [@engine \"engine\" { engine-specific settings }@] Defines the engine to +-- be used when drawing with this style. +-- +-- [@class::property = value@] Sets a style property for a widget class. +-- +-- The colors and background pixmaps are specified as a function of the +-- state of the widget. The states are: +-- +-- [@NORMAL@] A color used for a widget in its normal state. +-- +-- [@ACTIVE@] A variant of the @NORMAL@ color used when the widget is in the +-- 'StateActive' state, and also for the trough of a ScrollBar, tabs of a +-- NoteBook other than the current tab and similar areas. Frequently, this +-- should be a darker variant of the @NORMAL@ color. +-- +-- [@PRELIGHT@] A color used for widgets in the 'StatePrelight' state. This +-- state is the used for Buttons and MenuItems that have the mouse cursor over +-- them, and for their children. +-- +-- [@SELECTED@] A color used to highlight data selected by the user. for +-- instance, the selected items in a list widget, and the selection in an +-- editable widget. +-- +-- [@INSENSITIVE@] A color used for the background of widgets that have been +-- set insensitive with 'widgetSetSensitive'. +-- +-- Colors can be specified as a string containing a color name (GTK+ knows +-- all names from the X color database \/usr\/lib\/X11\/rgb.txt), in one of the +-- hexadecimal forms @#rrrrggggbbbb@, @#rrrgggbbb@, @#rrggbb@, or @#rgb@, where +-- @r@, @g@ and @b@ are hex digits, or they can be specified as a triplet @{ r, +-- g, b}@, where @r@, @g@ and @b@ are either integers in the range 0-65535 or +-- floats in the range 0.0-1.0. +-- +-- Since 2.10, colors can also be specified by refering to a symbolic color, +-- as follows: @\@color-name@, or by using expressions to combine colors. The +-- following expressions are currently supported: +-- +-- [mix (factor, color1, color2)] Computes a new color by mixing color1 and +-- color2. The factor determines how close the new color is to color1. A factor +-- of 1.0 gives pure color1, a factor of 0.0 gives pure color2. +-- +-- [shade (factor, color)] Computes a lighter or darker variant of color. A +-- factor of 1.0 leaves the color unchanged, smaller factors yield darker +-- colors, larger factors yield lighter colors. +-- +-- [lighter (color)] This is an abbreviation for @shade (1.3, color)@. +-- +-- [darker (color)] This is an abbreviation for @shade (0.7, color)@. +-- +-- Here are some examples of color expressions: +-- +-- > mix (0.5, "red", "blue") +-- > shade (1.5, mix (0.3, "#0abbc0", { 0.3, 0.5, 0.9 })) +-- > lighter (@foreground) +-- +-- In a @stock@ definition, icon sources are specified as a 4-tuple of image +-- filename or icon name, text direction, widget state, and size, in that +-- order. Each icon source specifies an image filename or icon name to use with +-- a given direction, state, and size. Filenames are specified as a string such +-- as @\"itemltr.png\"@, while icon names (looked up in the current icon +-- theme), are specified with a leading @\@@, such as @\@\"item-ltr\"@. The @*@ +-- character can be used as a wildcard, and if direction\/state\/size are +-- omitted they default to @*@. So for example, the following specifies +-- different icons to use for left-to-right and right-to-left languages: This +-- could be abbreviated as follows: +-- +-- > stock["my-stock-item"] = +-- > { +-- > { "itemltr.png", LTR, *, * }, +-- > { "itemrtl.png", RTL, *, * } +-- > } +-- +-- > stock["my-stock-item"] = +-- > { +-- > { "itemltr.png", LTR }, +-- > { "itemrtl.png", RTL } +-- > } +-- +-- You can specify custom icons for specific sizes, as follows: The sizes +-- that come with Gtk+ itself are @\"gtk-menu\"@, @\"gtk-small-toolbar\"@, +-- @\"gtk-large-toolbar\"@, @\"gtk-button\"@, @\"gtk-dialog\"@. Applications +-- can define other sizes. +-- +-- > stock["my-stock-item"] = +-- > { +-- > { "itemmenusize.png", *, *, "gtk-menu" }, +-- > { "itemtoolbarsize.png", *, *, "gtk-large-toolbar" } +-- > { "itemgeneric.png" } /* implicit *, *, * as a fallback */ +-- > } +-- +-- It's also possible to use custom icons for a given state, for example: +-- +-- > stock["my-stock-item"] = +-- > { +-- > { "itemprelight.png", *, PRELIGHT }, +-- > { "iteminsensitive.png", *, INSENSITIVE }, +-- > { "itemgeneric.png" } /* implicit *, *, * as a fallback */ +-- > } +-- +-- When selecting an icon source to use, Gtk+ will consider text direction +-- most important, state second, and size third. It will select the best match +-- based on those criteria. If an attribute matches exactly (e.g. you specified +-- @PRELIGHT@ or specified the size), Gtk+ won't modify the image; if the +-- attribute matches with a wildcard, Gtk+ will scale or modify the image to +-- match the state and size the user requested. + +-- ** Key bindings +-- +-- | Key bindings allow the user to specify actions to be taken on particular +-- key presses. The form of a binding set declaration is: +-- +-- key is a string consisting of a series of modifiers followed by the name +-- of a key. The modifiers can be: +-- +-- * @\<alt>@ +-- +-- * @\<ctl>@ +-- +-- * @\<control>@ +-- +-- * @\<meta>@ +-- +-- * @\<hyper>@ +-- +-- * @\<super>@ +-- +-- * @\<mod1>@ +-- +-- * @\<mod2>@ +-- +-- * @\<mod3>@ +-- +-- * @\<mod4>@ +-- +-- * @\<mod5>@ +-- +-- * @\<release>@ +-- +-- * @\<shft>@ +-- +-- * @\<shift>@ +-- +-- @\<shft>@ is an alias for @\<shift>@, @\<ctl>@ is an alias for +-- @\<control>@, and @\<alt>@ is an alias for @\<mod1>@. +-- +-- The action that is bound to the key is a sequence of signal names +-- (strings) followed by parameters for each signal. The signals must be action +-- signals. (See 'gSignalNew'). Each parameter can be a float, integer, string, +-- or unquoted string representing an enumeration value. The types of the +-- parameters specified must match the types of the parameters of the signal. +-- +-- Binding sets are connected to widgets in the same manner as styles, with +-- one difference: Binding sets override other binding sets first by pattern +-- type, then by priority and then by order of specification. The priorities +-- that can be specified and their default values are the same as for styles. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----RcStyle +-- @ + +-- * Types + RcStyle, + RcStyleClass, + castToRcStyle, + toRcStyle, + +-- * Constructors + rcStyleNew, + +-- * Methods + rcStyleCopy, + rcAddDefaultFile, + rcGetDefaultFiles, + rcGetImModuleFile, + rcGetModuleDir, + rcGetStyle, + rcGetStyleByPaths, + rcGetThemeDir, + rcParse, + rcParseString, + rcReparseAll, + rcReparseAllForSettings, + rcResetStyles, + rcSetDefaultFiles, + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.GType (GType) +import System.Glib.GTypeConstants (none) +{#import Graphics.UI.Gtk.Types#} + + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Constructors + +-- | Creates a new 'RcStyle' with no fields set. The 'RcStyle' structure is +-- used to represent a set of information about the appearance of a widget. +-- This can later be composited together with other 'RcStyle' structures to +-- form a 'Style'. +-- +rcStyleNew :: IO RcStyle +rcStyleNew = + constructNewGObject mkRcStyle $ + {# call gtk_rc_style_new #} + +-------------------- +-- Methods + +-- | Makes a copy of the specified 'RcStyle'. This function will correctly +-- copy an RC style that is a member of a class derived from 'RcStyle'. +-- +rcStyleCopy :: RcStyleClass self => self + -> IO RcStyle -- ^ returns the resulting 'RcStyle' +rcStyleCopy self = + constructNewGObject mkRcStyle $ + {# call gtk_rc_style_copy #} + (toRcStyle self) + +-- | Adds a file to the list of files to be parsed at the end of 'initGUI'. +-- +rcAddDefaultFile :: String -> IO () +rcAddDefaultFile filename = + withUTFString filename $ \filenamePtr -> + {# call gtk_rc_add_default_file #} + filenamePtr + +-- | etrieves the current list of RC files that will be parsed at the end of +-- 'initGUI'. +-- +rcGetDefaultFiles :: IO [String] +rcGetDefaultFiles = do + aPtr <- {# call gtk_rc_get_default_files #} + sPtrs <- peekArray0 nullPtr (castPtr aPtr) + mapM peekUTFString sPtrs + +-- | Obtains the path to the IM modules file. See the documentation of the +-- @GTK_IM_MODULE_FILE@ environment variable for more details. +-- +rcGetImModuleFile :: IO String +rcGetImModuleFile = + {# call gtk_rc_get_im_module_file #} + >>= readUTFString + +-- | Returns a directory in which GTK+ looks for theme engines. +-- +rcGetModuleDir :: IO String +rcGetModuleDir = + {# call gtk_rc_get_module_dir #} + >>= readUTFString + +-- | Finds all matching RC styles for a given widget, composites them +-- together, and then creates a GtkStyle representing the composite +-- appearance. (GTK+ actually keeps a cache of previously created styles, so a +-- new style may not be created.) +-- +rcGetStyle :: WidgetClass widget => widget -> IO Style +rcGetStyle widget = + makeNewGObject mkStyle $ + {# call gtk_rc_get_style #} + (toWidget widget) + +-- | Creates up a 'Style' from styles defined in a RC file by providing the +-- raw components used in matching. This function may be useful when creating +-- pseudo-widgets that should be themed like widgets but don't actually have +-- corresponding GTK+ widgets. +-- +rcGetStyleByPaths :: Settings + -> Maybe String + -- ^ @widgetPath@ : the widget path to use when looking up the style, or + -- @Nothing@ if no matching against the widget path should be done + -> Maybe String + -- ^ @classPath@ : the class path to use when looking up the style, or + -- @Nothing@ if no matching against the class path should be done. + -> GType + -- ^ @type@ : a type that will be used along with parent types of this type when + -- matching against class styles, or 'none' + -> IO Style +rcGetStyleByPaths settings mWidgetPath mClassPath type_ = + makeNewGObject mkStyle $ + (case mClassPath of + Just classPath -> withUTFString classPath + Nothing -> (\act -> act nullPtr)) $ \classPathPtr -> + (case mWidgetPath of + Just widgetPath -> withUTFString widgetPath + Nothing -> (\act -> act nullPtr)) $ \widgetPathPtr -> + {# call gtk_rc_get_style_by_paths #} + settings + widgetPathPtr + classPathPtr + type_ + +-- | Returns the standard directory in which themes should be installed. (GTK+ +-- does not actually use this directory itself.) +-- +rcGetThemeDir :: IO String +rcGetThemeDir = + {# call gtk_rc_get_theme_dir #} + >>= readUTFString + +-- | Parses a given resource file. +-- +rcParse :: String + -- ^ @filename@ : the @filename@ of a file to parse. If @filename@ is not + -- absolute, it is searched in the current directory. + -> IO () +rcParse filename = + withUTFString filename $ \filenamePtr -> + {# call gtk_rc_parse #} + filenamePtr + +-- | Parses resource information directly from a string. +-- +rcParseString :: String -> IO () +rcParseString rcString = + withUTFString rcString $ \rcStringPtr -> + {# call gtk_rc_parse_string #} + rcStringPtr + +-- | If the modification time on any previously read file for the default +-- 'Settings' has changed, discard all style information and then reread all +-- previously read RC files. +-- +rcReparseAll :: IO Bool -- ^ @True@ if the files were reread. +rcReparseAll = + liftM toBool $ + {# call gtk_rc_reparse_all #} + +-- | f the modification time on any previously read file for the given +-- 'Settings' has changed, discard all style information and then reread all +-- previously read RC files. +-- +rcReparseAllForSettings :: Settings + -> Bool -- ^ @forceLoad@ : load whether or not anything changed + -> IO Bool -- ^ @True@ if the files were reread. +rcReparseAllForSettings settings forceLoad = + liftM toBool $ + {# call gtk_rc_reparse_all_for_settings #} + (toSettings settings) + (fromBool forceLoad) + +-- | This function recomputes the styles for all widgets that use a particular +-- 'Settings' object. (There is one 'Settings' object per 'Screen', see +-- 'settingsGetForScreen'.) It is useful when some global parameter has +-- changed that affects the appearance of all widgets, because when a widget +-- gets a new style, it will both redraw and recompute any cached information +-- about its appearance. As an example, it is used when the default font size +-- set by the operating system changes. Note that this function doesn't affect +-- widgets that have a style set explicitely on them with 'widgetSetStyle'. +-- +rcResetStyles :: Settings -> IO () +rcResetStyles settings = + {# call gtk_rc_reset_styles #} + (toSettings settings) + +-- | Sets the list of files that GTK+ will read at the end of 'initGUI'. +-- +rcSetDefaultFiles :: [String] -> IO () +rcSetDefaultFiles files = + withUTFStringArray0 files $ \ssPtr -> + {# call gtk_rc_set_default_files #} ssPtr hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 164 - changeCurrentPage, - moveFocusOut, + switchPage, hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 168 - reorderTab, - selectPage, hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 1058 --- | \'currentPage\' property. See 'notebookGetCurrentPage' and --- 'notebookSetCurrentPage' +-- | Switches to the page number @pageNum@. +-- +-- Note that due to historical reasons, 'Notebook' refuses to switch to a +-- page unless the child widget is visible. Therefore, it is recommended to +-- show child widgets before adding them to a notebook. +-- +-- Returns the page number of the current page. hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 1150 --- | The 'notebookStyleArrowSpacing" property defines the spacing between the scroll arrows and the tabs. +-- | The 'notebookStyleArrowSpacing' property defines the spacing between the scroll arrows and the tabs. hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 1220 --- | [_$_] +-- | Emitted when the user or a function changes the current page. hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 1222 -changeCurrentPage :: NotebookClass self => Signal self (Int -> IO Bool) -changeCurrentPage = Signal (connect_INT__BOOL "change_current_page") +switchPage :: NotebookClass self => Signal self (Int -> IO ()) +switchPage = Signal (\after obj act -> + connect_PTR_WORD__NONE "switch-page" after obj + (\_ page -> act (fromIntegral page))) hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 1227 --- | +#if GTK_CHECK_VERSION(2,10,0) +-- | The 'pageReordered' signal is emitted in the notebook right after a page has been reordered. hunk ./gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp 1230 -moveFocusOut :: NotebookClass self => Signal self (DirectionType -> IO ()) -moveFocusOut = Signal (connect_ENUM__NONE "move_focus_out") - --- | The 'pageAdded' signal is emitted in the notebook right after a page is added to the notebook. +-- * Available since Gtk+ version 2.10 |
From: Axel S. <si...@co...> - 2009-10-30 17:02:25
|
Mon Oct 26 12:41:54 EDT 2009 Axe...@en... * Import GObject into the File module. hunk ./gio/System/GIO/File.chs.pp 108 +import System.Glib.GObject |
From: Axel S. <si...@co...> - 2009-10-30 17:02:25
|
Mon Oct 26 13:48:25 EDT 2009 Axe...@en... * Fix more modules to use the new mk... functions. hunk ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceBuffer.chs 86 - (fromMaybe (mkTextTagTable nullForeignPtr) tt) + (fromMaybe (TextTagTable nullForeignPtr) tt) hunk ./gtksourceview2/Graphics/UI/Gtk/SourceView/SourceStyle/Internal.chs 37 -{#import System.Glib.GObject#} (constructNewGObject) +{#import System.Glib.GObject#} (objectNew, constructNewGObject) hunk ./sourceview/Graphics/UI/Gtk/SourceView/SourceBuffer.chs 87 - (fromMaybe (mkSourceTagTable nullForeignPtr) tt) + (fromMaybe (SourceTagTable nullForeignPtr) tt) |
From: Axel S. <si...@co...> - 2009-10-30 17:02:24
|
Mon Oct 26 14:41:45 EDT 2009 Axe...@en... * More fixed to get the new mk... functions to work. hunk ./Makefile.am 13 +htmldoc_HSFILES_HIDDEN = +htmldoc_HSFILES_EXCLUDE = + hunk ./Makefile.am 306 -htmldoc_HSFILES_HIDDEN = \ +htmldoc_HSFILES_HIDDEN += \ hunk ./Makefile.am 1135 -libHSvte_a_SOURCES = \ +libHSvte_a_SOURCES = \ hunk ./Makefile.am 1140 -libHSvte_a_LIBADD = \ +libHSvte_a_LIBADD = \ hunk ./Makefile.am 1145 +htmldoc_HSFILES_EXCLUDE += \ + vte/Graphics/UI/Gtk/Vte/Structs.hs +[_^I_][_^I_][_^I_][_$_] + hunk ./Makefile.am 1159 - --parentname=Graphics.UI.Gtk.Types) + --forward=*System.Glib.GObject \ + --forward=*Graphics.UI.Gtk.Types) + hunk ./Makefile.am 1849 - cairo/Graphics/Rendering/Cairo/Types.hs -htmldoc_HSFILES_EXCLUDE = \ hunk ./Makefile.am 1850 + cairo/Graphics/Rendering/Cairo/Types.hs + +htmldoc_HSFILES_EXCLUDE += \ hunk ./Makefile.am 2507 + gstreamer/Media/Streaming/GStreamer/Core/HierarchyBase.hs \ hunk ./Makefile.am 2565 + gstreamer/Media/Streaming/GStreamer/Core/MiniHierarchyBase.hs \ hunk ./Makefile.am 2573 + hunk ./gtk/Graphics/UI/Gtk/Abstract/IMContext.chs.pp 99 - (fromMaybe (mkDrawWindow nullForeignPtr) window) + (fromMaybe (DrawWindow nullForeignPtr) window) hunk ./gtk/Graphics/UI/Gtk/Windows/Dialog.chs.pp 320 - {# call alternative_dialog_button_order #} (mkScreen nullForeignPtr) + {# call alternative_dialog_button_order #} (Screen nullForeignPtr) hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 1323 - {# call window_set_default_icon #} (mkPixbuf nullForeignPtr) + {# call window_set_default_icon #} (Pixbuf nullForeignPtr) hunk ./vte/Graphics/UI/Gtk/Vte/Structs.hsc 1 -{-# OPTIONS_HADDOCK hide #-} hunk ./vte/Graphics/UI/Gtk/Vte/Structs.hsc 21 --- #hide - hunk ./vte/Graphics/UI/Gtk/Vte/Vte.chs.pp 653 - {#call terminal_set_background_image#} (toTerminal terminal) (mkPixbuf nullForeignPtr) + {#call terminal_set_background_image#} (toTerminal terminal) (Pixbuf nullForeignPtr) |
From: Axel S. <si...@co...> - 2009-10-30 17:02:23
|
Mon Oct 26 12:28:10 EDT 2009 Axe...@en... * Fix construction of SVG objects to use new typles of constructor and destructor. hunk ./svgcairo/Graphics/Rendering/Cairo/SVG.chs.pp 85 -import System.Glib.GObject (GObjectClass(..), constructNewGObject, unGObject, mkGObject) +import System.Glib.GObject (GObject(..), GObjectClass(..), constructNewGObject, + unGObject, objectUnref) hunk ./svgcairo/Graphics/Rendering/Cairo/SVG.chs.pp 99 -mkSVG = SVG -unSVG (SVG o) = o +mkSVG = (SVG, objectUnref) +unSVG (SVG obj) = obj hunk ./svgcairo/Graphics/Rendering/Cairo/SVG.chs.pp 103 - toGObject = mkGObject . castForeignPtr . unSVG - unsafeCastGObject = mkSVG . castForeignPtr . unGObject + toGObject = GObject . castForeignPtr . unSVG + unsafeCastGObject = SVG . castForeignPtr . unGObject hunk ./svgcairo/Graphics/Rendering/Cairo/SVG.chs.pp 163 - constructNewGObject SVG {# call unsafe new #} + constructNewGObject mkSVG {# call unsafe new #} |
From: Axel S. <si...@co...> - 2009-10-30 17:02:20
|
Sun May 10 03:59:21 EDT 2009 Axe...@en... * Extend the type hierarchy generator to allow for re-exporting of modules and to emit mk... functions that contain Haskell constructor and a C destructor function. hunk ./tools/hierarchyGen/Hierarchy.chs.template 29 +-- Note: the mk... functions were originally meant to simply be an alias +-- for the constructor. However, in order to communicate the destructor +-- of an object to objectNew, the mk... functions are now a tuple containing +-- Haskell constructor and the destructor function pointer. This hack avoids +-- changing all modules that simply pass mk... to objectNew. +-- hunk ./tools/hierarchyGen/Hierarchy.chs.template 36 -@MODULE_EXPORTS@ +@MODULE_EXPORTS@@FORWARD_EXPORTS@ hunk ./tools/hierarchyGen/Hierarchy.chs.template 43 - +@DESTR_IMPORT@ +@FORWARD_IMPORTS@ hunk ./tools/hierarchyGen/TypeGen.hs 129 - + let forwardNames = map (drop 10) (filter ("--forward=" `isPrefixOf`) rem) + let destrFun = case map (drop 13) (filter ("--destructor=" `isPrefixOf`) rem) of + [] -> "objectUnref" + (destrFun:_) -> destrFun hunk ./tools/hierarchyGen/TypeGen.hs 155 - "MODULE_EXPORTS" -> generateExports parentName objs + "MODULE_EXPORTS" -> generateExports parentName forwardNames objs hunk ./tools/hierarchyGen/TypeGen.hs 157 - then ss "" + then id hunk ./tools/hierarchyGen/TypeGen.hs 159 + "FORWARD_IMPORTS"-> + foldl (.) id [ ss "import " . ss m . indent 0 | m <- forwardNames ] + "DESTR_IMPORT" -> if destrFun/="objectUnref" then id else + indent 0.ss "import System.Glib.GObject(objectUnref)" hunk ./tools/hierarchyGen/TypeGen.hs 165 - "DECLERATIONS" -> generateDeclerations prefix objs specialQueries + "DECLERATIONS" -> generateDeclerations destrFun prefix objs specialQueries hunk ./tools/hierarchyGen/TypeGen.hs 175 + \ {--forward=<fwdName>} {--destructor=<destrName>}\n\ hunk ./tools/hierarchyGen/TypeGen.hs 190 - \ parent classes eg Hierarchy (default is none)\n" + \ parent classes eg Hierarchy (default is none)\n\ + \ <fwdName> specify a number of modules that are imported\n\ + \ as well as exported from the generated module\n\ + \ <destrName> specify a non-standard C function pointer that\n\ + \ is called to destroy the objects\n" hunk ./tools/hierarchyGen/TypeGen.hs 203 -generateExports :: String -> [[String]] -> ShowS -generateExports parent objs = +generateExports :: String -> [String] -> [[String]] -> ShowS +generateExports parent forwardNames objs = hunk ./tools/hierarchyGen/TypeGen.hs 208 - drop 2. - foldl (\s1 s2 -> s1.ss ", ".s2) id + drop 1. + foldl (\s1 s2 -> s1.ss ",".indent 1.ss "module ".s2) id + (map ss forwardNames). + foldl (\s1 s2 -> s1.ss ",".s2) id hunk ./tools/hierarchyGen/TypeGen.hs 219 -generateDeclerations :: String -> [[String]] -> TypeTable -> ShowS -generateDeclerations prefix objs typeTable = +generateDeclerations :: String -> String -> [[String]] -> TypeTable -> ShowS +generateDeclerations destr prefix objs typeTable = hunk ./tools/hierarchyGen/TypeGen.hs 222 - [ makeClass prefix typeTable obj + [ makeClass destr prefix typeTable obj hunk ./tools/hierarchyGen/TypeGen.hs 268 -makeClass :: String -> TypeTable -> [String] -> ShowS -makeClass prefix table (name:[]) = id -makeClass prefix table (name:parents) = +makeClass :: String -> String -> TypeTable -> [String] -> ShowS +makeClass destr prefix table (name:[]) = id +makeClass destr prefix table (name:parents) = hunk ./tools/hierarchyGen/TypeGen.hs 289 - indent 0.ss "mk".ss name.ss " = ".ss name. + indent 0.ss "mk".ss name.ss " = (".ss name.ss ", ".ss destr.ss ")". hunk ./tools/hierarchyGen/TypeGen.hs 309 - indent 1.ss "toGObject = mkGObject . castForeignPtr . un".ss name. - indent 1.ss "unsafeCastGObject = mk".ss name.ss" . castForeignPtr . unGObject" + indent 1.ss "toGObject = GObject . castForeignPtr . un".ss name. + indent 1.ss "unsafeCastGObject = ".ss name.ss" . castForeignPtr . unGObject" |