Hello all,
Here is a patch that adds new signal handlers for the "icon-press" and
"icon-release" signals of the GtkEntry object. It was a bit trickier
than I expected, because I needed a new connect_* function, which I
foolishly wrote by hand to begin with :-). Furthermore, this signal
passes along a GdkEventButton * so I had to familiarize myself with the
EventM monad first.
Anyways, I have been using them and can confirm they work fine. Funnily
enough, the GTK+ API docs say those signals are given a plain GdkEvent
*, but they really do send a GdkEventButton *... But I guess we can't
blame them: they're stuck with C :-).
Cheers,
Maxime
diff -rN -u old-gtk2hs/gtk/Graphics/UI/Gtk/Entry/Entry.chs new-gtk2hs/gtk/Graphics/UI/Gtk/Entry/Entry.chs
--- old-gtk2hs/gtk/Graphics/UI/Gtk/Entry/Entry.chs 2010-10-18 21:54:04.000000000 +0200
+++ new-gtk2hs/gtk/Graphics/UI/Gtk/Entry/Entry.chs 2010-10-18 21:54:06.000000000 +0200
@@ -112,6 +112,8 @@
entryCutClipboard,
entryPasteClipboard,
entryDeleteFromCursor,
+ entryIconPress,
+ entryIconRelease,
entryInsertAtCursor,
entryMoveCursor,
entryPopulatePopup,
@@ -134,6 +136,7 @@
) where
import Control.Monad (liftM)
+import Control.Monad.Reader (runReaderT)
import Data.Char (ord, chr)
import System.Glib.FFI
@@ -145,6 +148,7 @@
import Graphics.UI.Gtk.General.Enums (DeleteType (..), MovementStep (..), EntryIconPosition (..))
{#import Graphics.UI.Gtk.Types#}
{#import Graphics.UI.Gtk.Signals#}
+import Graphics.UI.Gtk.Gdk.EventM (EventM, EButton)
{# context lib="gtk" prefix="gtk" #}
@@ -618,6 +622,18 @@
entryDeleteFromCursor :: EntryClass ec => Signal ec (DeleteType -> Int -> IO ())
entryDeleteFromCursor = Signal (connect_ENUM_INT__NONE "delete-from-cursor")
+entryIconPress :: EntryClass ec =>
+ Signal ec (EntryIconPosition -> EventM EButton ())
+entryIconPress = Signal connect
+ where connect after obj f =
+ connect_ENUM_PTR__NONE "icon-press" after obj (runReaderT . f)
+
+entryIconRelease :: EntryClass ec =>
+ Signal ec (EntryIconPosition -> EventM EButton ())
+entryIconRelease = Signal connect
+ where connect after obj f =
+ connect_ENUM_PTR__NONE "icon-press" after obj (runReaderT . f)
+
-- | The 'entryInsertAtCursor' signal is a keybinding signal which gets emitted when the user initiates the
-- insertion of a fixed string at the cursor.
entryInsertAtCursor :: EntryClass ec => Signal ec (String -> IO ())
@@ -722,4 +738,4 @@
IO (ConnectId ec)
onToggleOverwrite = connect_NONE__NONE "toggle_overwrite" False
afterToggleOverwrite = connect_NONE__NONE "toggle_overwrite" True
-#endif
\ No newline at end of file
+#endif
diff -rN -u old-gtk2hs/gtk/marshal.list new-gtk2hs/gtk/marshal.list
--- old-gtk2hs/gtk/marshal.list 2010-10-18 21:54:04.000000000 +0200
+++ new-gtk2hs/gtk/marshal.list 2010-10-18 21:54:06.000000000 +0200
@@ -89,6 +89,7 @@
#VOID:ENUM,FLOAT,BOOLEAN
VOID:ENUM,INT
VOID:ENUM,INT,BOOLEAN
+VOID:ENUM,POINTER
#VOID:INT
#VOID:INT,INT
#VOID:INT,INT,BOXED
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Gtk2hs-devel mailing list
Gtk2hs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel