From: Andy S. <And...@co...> - 2010-03-22 07:25:46
|
Mon Mar 22 03:23:41 EDT 2010 Andy Stewart <laz...@gm...> * Update all `Entry` and `Embedding` modules to Gtk+ 2.18.3 Ignore-this: 89eaf339c3f05182a23360cca1161bcb hunk ./ApiUpdateTodoList.txt 51 -*** TODO EntryBuffer.chs +*** DONE EntryBuffer.chs hunk ./ApiUpdateTodoList.txt 215 -** TODO Directory: gtk-modules/Graphics/UI/Gtk/Embedding -*** TODO Plug.chs.pp -*** TODO Socket.chs.pp +** DONE Directory: gtk-modules/Graphics/UI/Gtk/Embedding +*** DONE Plug.chs.pp +*** DONE Socket.chs.pp hunk ./ApiUpdateTodoList.txt 220 -*** TODO Editable.chs.pp +*** DONE Editable.chs.pp hunk ./ApiUpdateTodoList.txt 222 -*** TODO EntryCompletion.chs.pp -*** TODO HScale.chs +*** DONE EntryCompletion.chs.pp +*** DONE HScale.chs hunk ./ApiUpdateTodoList.txt 225 -*** TODO VScale.chs +*** DONE VScale.chs hunk ./Makefile.am 638 + gtk/Graphics/UI/Gtk/Entry/EntryBuffer.chs.pp \ hunk ./gtk/Graphics/UI/Gtk.hs.pp 92 + module Graphics.UI.Gtk.Entry.EntryBuffer, hunk ./gtk/Graphics/UI/Gtk.hs.pp 285 -import Graphics.UI.Gtk.Entry.Editable -import Graphics.UI.Gtk.Entry.Entry -import Graphics.UI.Gtk.Entry.EntryCompletion +import Graphics.UI.Gtk.Entry.Editable hiding (editableChanged) +import Graphics.UI.Gtk.Entry.Entry hiding (backspace, copyClipboard, cutClipboard, deleteFromCursor, + insertAtCursor, moveCursor, pasteClipboard, populatePopup, toggleOverwrite) +import Graphics.UI.Gtk.Entry.EntryBuffer +import Graphics.UI.Gtk.Entry.EntryCompletion hiding (actionActivated) hunk ./gtk/Graphics/UI/Gtk.hs.pp 292 -import Graphics.UI.Gtk.Entry.SpinButton +import Graphics.UI.Gtk.Entry.SpinButton hiding (changeValue, valueChanged) hunk ./gtk/Graphics/UI/Gtk.hs.pp 418 - objectDestroy ) + destory ) hunk ./gtk/Graphics/UI/Gtk/Abstract/IMContext.chs.pp 59 - imContextPreeditStart, - imContextPreeditEnd, - imContextPreeditChanged, - imContextCommit, - imContextRetrieveSurrounding, - imContextDeleteSurrounding', + preeditStart, + preeditEnd, + preeditChanged, + commit, + retrieveSurrounding, + deleteSurrounding, hunk ./gtk/Graphics/UI/Gtk/Abstract/IMContext.chs.pp 217 --- 'imContextRetrieveSurrounding' signal on the input method; in response to +-- 'retrieveSurrounding' signal on the input method; in response to hunk ./gtk/Graphics/UI/Gtk/Abstract/IMContext.chs.pp 220 --- is no obligation for a widget to respond to the 'imContextRetrieveSurrounding' +-- is no obligation for a widget to respond to the 'retrieveSurrounding' hunk ./gtk/Graphics/UI/Gtk/Abstract/IMContext.chs.pp 246 --- 'imContextDeleteSurrounding' signal. +-- 'deleteSurrounding signal. hunk ./gtk/Graphics/UI/Gtk/Abstract/IMContext.chs.pp 276 -imContextPreeditStart :: IMContextClass self => Signal self (IO ()) -imContextPreeditStart = Signal (connect_NONE__NONE "preedit_start") +preeditStart :: IMContextClass self => Signal self (IO ()) +preeditStart = Signal (connect_NONE__NONE "preedit_start") hunk ./gtk/Graphics/UI/Gtk/Abstract/IMContext.chs.pp 282 -imContextPreeditEnd :: IMContextClass self => Signal self (IO ()) -imContextPreeditEnd = Signal (connect_NONE__NONE "preedit_end") +preeditEnd :: IMContextClass self => Signal self (IO ()) +preeditEnd = Signal (connect_NONE__NONE "preedit_end") hunk ./gtk/Graphics/UI/Gtk/Abstract/IMContext.chs.pp 289 -imContextPreeditChanged :: IMContextClass self => Signal self (IO ()) -imContextPreeditChanged = Signal (connect_NONE__NONE "preedit_changed") +preeditChanged :: IMContextClass self => Signal self (IO ()) +preeditChanged = Signal (connect_NONE__NONE "preedit_changed") hunk ./gtk/Graphics/UI/Gtk/Abstract/IMContext.chs.pp 297 -imContextCommit :: IMContextClass self => Signal self (String -> IO ()) -imContextCommit = Signal (connect_STRING__NONE "commit") +commit :: IMContextClass self => Signal self (String -> IO ()) +commit = Signal (connect_STRING__NONE "commit") hunk ./gtk/Graphics/UI/Gtk/Abstract/IMContext.chs.pp 305 -imContextRetrieveSurrounding :: IMContextClass self => Signal self (IO Bool) -imContextRetrieveSurrounding = Signal (connect_NONE__BOOL "retrieve_surrounding") +retrieveSurrounding :: IMContextClass self => Signal self (IO Bool) +retrieveSurrounding = Signal (connect_NONE__BOOL "retrieve_surrounding") hunk ./gtk/Graphics/UI/Gtk/Abstract/IMContext.chs.pp 317 -imContextDeleteSurrounding' :: IMContextClass self => Signal self (Int -> Int -> IO Bool) -imContextDeleteSurrounding' = Signal (connect_INT_INT__BOOL "delete_surrounding") +deleteSurrounding :: IMContextClass self => Signal self (Int -> Int -> IO Bool) +deleteSurrounding = Signal (connect_INT_INT__BOOL "delete_surrounding") hunk ./gtk/Graphics/UI/Gtk/Abstract/Object.chs.pp 72 - objectDestroy + destory, hunk ./gtk/Graphics/UI/Gtk/Abstract/Object.chs.pp 159 -objectDestroy :: ObjectClass self => Signal self (IO ()) -objectDestroy = Signal (connect_NONE__NONE "destroy") +destory :: ObjectClass self => Signal self (IO ()) +destory = Signal (connect_NONE__NONE "destroy") hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 298 - popupMenuSignal, + popupMenu, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 2797 -popupMenuSignal :: WidgetClass self => Signal self (IO Bool) -popupMenuSignal = Signal (connect_NONE__BOOL "popup_menu") +popupMenu :: WidgetClass self => Signal self (IO Bool) +popupMenu = Signal (connect_NONE__BOOL "popup_menu") hunk ./gtk/Graphics/UI/Gtk/Entry/Editable.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon, Duncan Coutts +-- Copyright (C) 1999-2009 Axel Simon, Duncan Coutts hunk ./gtk/Graphics/UI/Gtk/Entry/Editable.chs.pp 28 + hunk ./gtk/Graphics/UI/Gtk/Entry/Editable.chs.pp 40 +-- hunk ./gtk/Graphics/UI/Gtk/Entry/Editable.chs.pp 73 + insertText, + deleteText, + editableChanged, + stopDeleteText, + stopInsertText, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Entry/Editable.chs.pp 85 - stopDeleteText, hunk ./gtk/Graphics/UI/Gtk/Entry/Editable.chs.pp 87 - stopInsertText +#endif hunk ./gtk/Graphics/UI/Gtk/Entry/Editable.chs.pp 287 +-- | This signal is emitted when text is inserted into the widget by the user. +-- The default handler for this signal will normally be responsible for +-- inserting the text, so by connecting to this signal and then stopping the +-- signal with 'gSignalStopEmission', it is possible to modify the inserted +-- text, or prevent it from being inserted entirely. +-- +insertText :: EditableClass self => Signal self (String -> Int -> Int -> IO ()) +insertText = Signal (connect_STRING_INT_INT__NONE "insert-text") + +-- | This signal is emitted when text is deleted from the widget by the user. +-- The default handler for this signal will normally be responsible for +-- deleting the text, so by connecting to this signal and then stopping the +-- signal with 'gSignalStopEmission', it is possible to modify the range of +-- deleted text, or prevent it from being deleted entirely. The @startPos@ and +-- @endPos@ parameters are interpreted as for 'editableDeleteText'. +-- +deleteText :: EditableClass self => Signal self (Int -> Int -> IO ()) +deleteText = Signal (connect_INT_INT__NONE "delete-text") + +-- | The ::changed signal is emitted at the end of a single user-visible +-- operation on the contents of the 'Editable'. +-- +-- E.g., a paste operation that replaces the contents of the selection will +-- cause only one signal emission (even though it is implemented by first +-- deleting the selection, then inserting the new content, and may cause +-- multiple ::notify::text signals to be emitted). +-- +editableChanged :: EditableClass self => Signal self (IO ()) +editableChanged = Signal (connect_NONE__NONE "changed") + +-- | Stop the current signal that deletes text. +stopDeleteText :: EditableClass self => ConnectId self -> IO () +stopDeleteText (ConnectId _ obj) = + signalStopEmission obj "delete_text" hunk ./gtk/Graphics/UI/Gtk/Entry/Editable.chs.pp 322 +-- | Stop the current signal that inserts text. +stopInsertText :: EditableClass self => ConnectId self -> IO () +stopInsertText (ConnectId _ obj) = + signalStopEmission obj "insert_text" + +-------------------- +-- Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Entry/Editable.chs.pp 347 --- | Stop the current signal that deletes text. -stopDeleteText :: EditableClass self => ConnectId self -> IO () -stopDeleteText (ConnectId _ obj) = - signalStopEmission obj "delete_text" - hunk ./gtk/Graphics/UI/Gtk/Entry/Editable.chs.pp 398 - --- | Stop the current signal that inserts text. -stopInsertText :: EditableClass self => ConnectId self -> IO () -stopInsertText (ConnectId _ obj) = - signalStopEmission obj "insert_text" +#endif hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 8 --- Copyright (C) 1999-2005 Axel Simon +-- Copyright (C) 1999-2009 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 33 +-- [_$_] +-- Note: [_$_] +-- Below function can use attributes instead, so don't bind it for simple: +-- gtk_entry_get_inner_border +-- gtk_entry_set_inner_border +-- gtk_entry_get_overwrite_mode +-- gtk_entry_set_overwrite_mode +-- gtk_entry_get_progress_fraction +-- gtk_entry_set_progress_fraction +-- gtk_entry_get_progress_pulse_step +-- gtk_entry_set_progress_pulse_step +-- gtk_entry_get_buffer +-- gtk_entry_set_buffer hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 48 + hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 57 +-- hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 73 +-- * Enums. + IconPosition(..), + hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 78 +#if GTK_CHECK_VERSION(2,18,0) + entryNewWithBuffer, +#endif hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 95 +#if GTK_CHECK_VERSION(2,12,0) + entrySetCursorHAdjustment, + entryGetCursorHAdjustment, +#endif hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 111 +#if GTK_CHECK_VERSION(2,14,0) + entryGetTextLength, +#endif + entryGetLayout, + entryGetLayoutOffsets, + entryLayoutIndexToTextIndex, + entryTextIndexToLayoutIndex, +#if GTK_CHECK_VERSION(2,16,0) + entryProgressPulse, + entrySetIconFromPixbuf, + entrySetIconFromStock, + entrySetIconFromIconName, + -- entrySetIconFromGicon, + entryGetIconStorageType, + entryGetIconPixbuf, + entryGetIconStock, + entryGetIconName, + -- entryGetIconGicon, + entrySetIconActivatable, + entryGetIconActivatable, + entrySetIconSensitive, + entryGetIconSensitive, + entryGetIconAtPos, + entrySetIconTooltipText, + entryGetIconTooltipText, + entrySetIconTooltipMarkup, + entryGetIconTooltipMarkup, + entrySetIconDragSource, + entryGetCurrentIconDragSource, +#endif hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 145 + entryCapsLockWarning, + entryImModule, hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 151 + -- entryInnerBorder, + entryOverwriteMode, + entryTextLength, + entryTruncateMultiline, + entryProgressFraction, + entryProgressPulseStep, + entryPrimaryIconPixbuf, + entrySecondaryIconPixbuf, + entryPrimaryIconStock, + entrySecondaryIconStock, + entryPrimaryIconName, + entrySecondaryIconName, + -- entryPrimaryIconGicon, + -- entrySecondaryIconGicon, + entryPrimaryIconStorageType, + entrySecondaryIconStorageType, + entryPrimaryIconActivatable, + entrySecondaryIconActivatable, + entryPrimaryIconSensitive, + entrySecondaryIconSensitive, + entryPrimaryIconTooltipText, + entrySecondaryIconTooltipText, + entryPrimaryIconTooltipMarkup, + entrySecondaryIconTooltipMarkup, hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 176 + entryInvisibleCharSet, hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 186 +#if GTK_CHECK_VERSION(2,18,0) + entryBuffer, +#endif hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 191 + activate, + backspace, + copyClipboard, + cutClipboard, + deleteFromCursor, + iconPress, + -- iconRelease, + insertAtCursor, + moveCursor, + pasteClipboard, + populatePopup, + toggleOverwrite, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 216 +#endif hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 221 +import Data.IORef (newIORef) hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 229 +import Graphics.UI.Gtk.Gdk.Enums (DragAction(..)) +import Graphics.UI.Gtk.General.Enums (DeleteType(..), MovementStep(..)) hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 232 +{#import Graphics.UI.Gtk.General.DNDTypes#} (TargetList(..)) hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 234 +{#import Graphics.UI.Gtk.Pango.Types#} +{#import Graphics.UI.Gtk.Display.Image#} (ImageType) +import Graphics.UI.Gtk.Gdk.Events (Event, marshalEvent) +import System.Glib.Flags hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 241 +-------------------- +-- Enums +{#enum EntryIconPosition as IconPosition {underscoreToCase}#} + hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 261 +#if GTK_CHECK_VERSION(2,18,0) +-- | Creates a new entry with the specified text buffer. +-- +-- * Available since Gtk+ version 2.18 +-- +entryNewWithBuffer :: EntryBufferClass buffer => + buffer -- ^ @buffer@ - The buffer to use for the new 'Entry'. + -> IO Entry +entryNewWithBuffer buffer = + makeNewObject mkEntry $ + liftM (castPtr :: Ptr Widget -> Ptr Entry) $ + {# call gtk_entry_new_with_buffer #} + (toEntryBuffer buffer) +#endif + hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 400 +#if GTK_CHECK_VERSION(2,12,0) +entrySetCursorHAdjustment :: EntryClass self => self + -> Adjustment -- ^ @adjustment@ - an adjustment which should be adjusted when + -- the cursor is moved, or {@NULL@, FIXME: this should probably + -- be converted to a Maybe data type} + -> IO () +entrySetCursorHAdjustment self adjustment = + {# call entry_set_cursor_hadjustment #} + (toEntry self) + adjustment + +entryGetCursorHAdjustment :: EntryClass self => self + -> IO Adjustment -- ^ returns the horizontal cursor adjustment, or {@NULL@, + -- FIXME: this should probably be converted to a Maybe data + -- type} if none has been set. +entryGetCursorHAdjustment self = + makeNewObject mkAdjustment $ + {# call entry_get_cursor_hadjustment #} + (toEntry self) +#endif + hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 531 - {# call gtk_entry_set_completion #} + {# call entry_set_completion #} hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 544 - {# call gtk_entry_get_completion #} + {# call entry_get_completion #} + (toEntry self) +#endif + +#if GTK_CHECK_VERSION(2,14,0) +-- | Retrieves the current length of the text in @entry@. +-- +-- This is equivalent to: +-- +-- * Available since Gtk+ version 2.14 +-- +entryGetTextLength :: EntryClass self => self + -> IO Word16 -- ^ returns the current number of characters in 'Entry', or 0 + -- if there are none. +entryGetTextLength self = + liftM fromIntegral $ + {# call entry_get_text_length #} + (toEntry self) +#endif + +-- | Gets the 'PangoLayout' used to display the entry. The layout is useful to +-- e.g. convert text positions to pixel positions, in combination with +-- 'entryGetLayoutOffsets'. The returned layout is owned by the entry and must +-- not be modified or freed by the caller. +-- +-- Keep in mind that the layout text may contain a preedit string, so +-- 'entryLayoutIndexToTextIndex' and 'entryTextIndexToLayoutIndex' are needed +-- to convert byte indices in the layout to byte indices in the entry contents. +-- +entryGetLayout :: EntryClass self => self + -> IO PangoLayout -- ^ returns the 'PangoLayout' for this entry +entryGetLayout self = do + pl <- constructNewGObject mkPangoLayoutRaw $ + {# call entry_get_layout #} + (toEntry self) + ps <- makeNewPangoString "" + psRef <- newIORef ps + return (PangoLayout psRef pl) + +-- | Obtains the position of the 'PangoLayout' used to render text in the +-- entry, in widget coordinates. Useful if you want to line up the text in an +-- entry with some other text, e.g. when using the entry to implement editable +-- cells in a sheet widget. +-- +-- Also useful to convert mouse events into coordinates inside the +-- 'PangoLayout', e.g. to take some action if some part of the entry text is +-- clicked. +-- +-- Note that as the user scrolls around in the entry the offsets will +-- change; you'll need to connect to the \"notify::scroll-offset\" signal to +-- track this. Remember when using the 'PangoLayout' functions you need to +-- convert to and from pixels using 'pangopixels' or 'PangoScale' +-- +-- Keep in mind that the layout text may contain a preedit string, so +-- 'entryLayoutIndexToTextIndex' and 'entryTextIndexToLayoutIndex' are needed +-- to convert byte indices in the layout to byte indices in the entry contents. +-- +entryGetLayoutOffsets :: EntryClass self => self + -> IO (Int, Int) -- ^ @(x, y)@ [_$_] + -- @x@ - location to store X offset of layout + -- @y@ - location to store Y offset of layout +entryGetLayoutOffsets self = + alloca $ \xPtr -> + alloca $ \yPtr -> + {# call entry_get_layout_offsets #} + (toEntry self) + xPtr + yPtr + >> + peek xPtr >>= \x -> + peek yPtr >>= \y -> + return (fromIntegral x, fromIntegral y) + +-- | Converts from a position in the entry contents (returned by +-- 'entryGetText') to a position in the entry's 'PangoLayout' (returned by +-- 'entryGetLayout', with text retrieved via 'layoutGetText'). +-- +entryLayoutIndexToTextIndex :: EntryClass self => self + -> Int -- ^ @layoutIndex@ - byte index into the entry layout text + -> IO Int -- ^ returns byte index into the entry contents +entryLayoutIndexToTextIndex self layoutIndex = + liftM fromIntegral $ + {# call entry_layout_index_to_text_index #} + (toEntry self) + (fromIntegral layoutIndex) + +-- | Converts from a position in the entry's 'PangoLayout' (returned by +-- 'entryGetLayout') to a position in the entry contents (returned by +-- 'entryGetText'). +-- +entryTextIndexToLayoutIndex :: EntryClass self => self + -> Int -- ^ @textIndex@ - byte index into the entry contents + -> IO Int -- ^ returns byte index into the entry layout text +entryTextIndexToLayoutIndex self textIndex = + liftM fromIntegral $ + {# call entry_text_index_to_layout_index #} + (toEntry self) + (fromIntegral textIndex) + +#if GTK_CHECK_VERSION(2,16,0) +-- | Indicates that some progress is made, but you don't know how much. Causes +-- the entry's progress indicator to enter \"activity mode,\" where a block +-- bounces back and forth. Each call to 'entryProgressPulse' causes the block +-- to move by a little bit (the amount of movement per pulse is determined by +-- 'entrySetProgressPulseStep'). +-- +-- * Available since Gtk+ version 2.16 +-- +entryProgressPulse :: EntryClass self => self -> IO () +entryProgressPulse self = + {# call entry_progress_pulse #} + (toEntry self) + +-- | Sets the icon shown in the specified position using a pixbuf. +-- +-- If @pixbuf@ is {@NULL@, FIXME: this should probably be converted to a +-- Maybe data type}, no icon will be shown in the specified position. +-- +-- * Available since Gtk+ version 2.16 +-- +entrySetIconFromPixbuf :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - Icon position + -> Pixbuf -- ^ @pixbuf@ - A 'Pixbuf', or {@NULL@, FIXME: this + -- should probably be converted to a Maybe data type} + -> IO () +entrySetIconFromPixbuf self iconPos pixbuf = + {# call entry_set_icon_from_pixbuf #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + pixbuf + +-- | Sets the icon shown in the entry at the specified position from a stock +-- image. +-- +-- If @stockId@ is {@NULL@, FIXME: this should probably be converted to a +-- Maybe data type}, no icon will be shown in the specified position. +-- +-- * Available since Gtk+ version 2.16 +-- +entrySetIconFromStock :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - Icon position + -> String -- ^ @stockId@ - The name of the stock item, or {@NULL@, + -- FIXME: this should probably be converted to a Maybe + -- data type} + -> IO () +entrySetIconFromStock self iconPos stockId = + withUTFString stockId $ \stockIdPtr -> + {# call entry_set_icon_from_stock #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + stockIdPtr + +-- | Sets the icon shown in the entry at the specified position from the +-- current icon theme. +-- +-- If the icon name isn't known, a \"broken image\" icon will be displayed +-- instead. +-- +-- If @iconName@ is {@NULL@, FIXME: this should probably be converted to a +-- Maybe data type}, no icon will be shown in the specified position. +-- +-- * Available since Gtk+ version 2.16 +-- +entrySetIconFromIconName :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - The position at which to set the icon + -> String -- ^ @iconName@ - An icon name, or {@NULL@, FIXME: this + -- should probably be converted to a Maybe data type} + -> IO () +entrySetIconFromIconName self iconPos iconName = + withUTFString iconName $ \iconNamePtr -> + {# call entry_set_icon_from_icon_name #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + iconNamePtr + +-- | Sets the icon shown in the entry at the specified position from the +-- current icon theme. If the icon isn't known, a \"broken image\" icon will be +-- displayed instead. +-- +-- If @icon@ is {@NULL@, FIXME: this should probably be converted to a Maybe +-- data type}, no icon will be shown in the specified position. +-- +-- * Available since Gtk+ version 2.16 +-- +-- entrySetIconFromGicon :: EntryClass self => self +-- -> IconPosition -- ^ @iconPos@ - The position at which to set the icon +-- -> GIcon -- ^ @icon@ - The icon to set, or {@NULL@, FIXME: this +-- -- should probably be converted to a Maybe data type} +-- -> IO () +-- entrySetIconFromGicon self iconPos icon = +-- {# call entry_set_icon_from_gicon #} +-- (toEntry self) +-- ((fromIntegral . fromEnum) iconPos) +-- icon + +-- | Gets the type of representation being used by the icon to store image +-- data. If the icon has no image data, the return value will be 'ImageEmpty'. +-- +-- * Available since Gtk+ version 2.16 +-- +entryGetIconStorageType :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - Icon position + -> IO ImageType -- ^ returns image representation being used +entryGetIconStorageType self iconPos = + liftM (toEnum . fromIntegral) $ + {# call entry_get_icon_storage_type #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + +-- | Retrieves the image used for the icon. +-- +-- Unlike the other methods of setting and getting icon data, this method +-- will work regardless of whether the icon was set using a 'Pixbuf', a {GIcon, +-- FIXME: unknown type\/value}, a stock item, or an icon name. +-- +-- * Available since Gtk+ version 2.16 +-- +entryGetIconPixbuf :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - Icon position + -> IO Pixbuf -- ^ returns A 'Pixbuf', or {@NULL@, FIXME: this should + -- probably be converted to a Maybe data type} if no icon + -- is set for this position. +entryGetIconPixbuf self iconPos = + makeNewGObject mkPixbuf $ + {# call entry_get_icon_pixbuf #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + +-- | Retrieves the stock id used for the icon, or {@NULL@, FIXME: this should +-- probably be converted to a Maybe data type} if there is no icon or if the +-- icon was set by some other method (e.g., by pixbuf, icon name or gicon). +-- +-- * Available since Gtk+ version 2.16 +-- +entryGetIconStock :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - Icon position + -> IO String -- ^ returns A stock id, or {@NULL@, FIXME: this should + -- probably be converted to a Maybe data type} if no icon + -- is set or if the icon wasn't set from a stock id +entryGetIconStock self iconPos = + {# call entry_get_icon_stock #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + >>= peekUTFString + +-- | Retrieves the icon name used for the icon, or {@NULL@, FIXME: this should +-- probably be converted to a Maybe data type} if there is no icon or if the +-- icon was set by some other method (e.g., by pixbuf, stock or gicon). +-- +-- * Available since Gtk+ version 2.16 +-- +entryGetIconName :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - Icon position + -> IO String -- ^ returns An icon name, or {@NULL@, FIXME: this + -- should probably be converted to a Maybe data type} if + -- no icon is set or if the icon wasn't set from an icon + -- name +entryGetIconName self iconPos = + {# call entry_get_icon_name #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + >>= peekUTFString + +-- | Retrieves the {GIcon, FIXME: unknown type\/value} used for the icon, or +-- {@NULL@, FIXME: this should probably be converted to a Maybe data type} if +-- there is no icon or if the icon was set by some other method (e.g., by +-- stock, pixbuf, or icon name). +-- +-- * Available since Gtk+ version 2.16 +-- +-- entryGetIconGicon :: EntryClass self => self +-- -> IconPosition -- ^ @iconPos@ - Icon position +-- -> IO GIcon -- ^ returns A {GIcon, FIXME: unknown type\/value}, or +-- -- {@NULL@, FIXME: this should probably be converted to a +-- -- Maybe data type} if no icon is set or if the icon is +-- -- not a {GIcon, FIXME: unknown type\/value} +-- entryGetIconGicon self iconPos = +-- {# call entry_get_icon_gicon #} +-- (toEntry self) +-- ((fromIntegral . fromEnum) iconPos) + +-- | Sets whether the icon is activatable. +-- +-- * Available since Gtk+ version 2.16 +-- +entrySetIconActivatable :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - Icon position + -> Bool -- ^ @activatable@ - @True@ if the icon should be + -- activatable + -> IO () +entrySetIconActivatable self iconPos activatable = + {# call entry_set_icon_activatable #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + (fromBool activatable) + +-- | Returns whether the icon is activatable. +-- +-- * Available since Gtk+ version 2.16 +-- +entryGetIconActivatable :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - Icon position + -> IO Bool -- ^ returns @True@ if the icon is activatable. +entryGetIconActivatable self iconPos = + liftM toBool $ + {# call entry_get_icon_activatable #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + +-- | Sets the sensitivity for the specified icon. +-- +-- * Available since Gtk+ version 2.16 +-- +entrySetIconSensitive :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - Icon position + -> Bool -- ^ @sensitive@ - Specifies whether the icon should + -- appear sensitive or insensitive + -> IO () +entrySetIconSensitive self iconPos sensitive = + {# call entry_set_icon_sensitive #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + (fromBool sensitive) + +-- | Returns whether the icon appears sensitive or insensitive. +-- +-- * Available since Gtk+ version 2.16 +-- +entryGetIconSensitive :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - Icon position + -> IO Bool -- ^ returns @True@ if the icon is sensitive. +entryGetIconSensitive self iconPos = + liftM toBool $ + {# call entry_get_icon_sensitive #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + +-- | Finds the icon at the given position and return its index. If @x@, @y@ +-- doesn't lie inside an icon, -1 is returned. This function is intended for +-- use in a {\"query-tooltip\", FIXME: unknown type\/value} signal handler. +-- +-- * Available since Gtk+ version 2.16 +-- +entryGetIconAtPos :: EntryClass self => self + -> Int -- ^ @x@ - the x coordinate of the position to find + -> Int -- ^ @y@ - the y coordinate of the position to find + -> IO Int -- ^ returns the index of the icon at the given position, or -1 +entryGetIconAtPos self x y = + liftM fromIntegral $ + {# call entry_get_icon_at_pos #} + (toEntry self) + (fromIntegral x) + (fromIntegral y) + +-- | Sets @tooltip@ as the contents of the tooltip for the icon at the +-- specified position. +-- +-- Use {@NULL@, FIXME: this should probably be converted to a Maybe data +-- type} for @tooltip@ to remove an existing tooltip. +-- +-- See also 'widgetSetTooltipText' and 'entrySetIconTooltipMarkup'. +-- +-- * Available since Gtk+ version 2.16 +-- +entrySetIconTooltipText :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - the icon position + -> String -- ^ @tooltip@ - the contents of the tooltip for the + -- icon, or {@NULL@, FIXME: this should probably be + -- converted to a Maybe data type} + -> IO () +entrySetIconTooltipText self iconPos tooltip = + withUTFString tooltip $ \tooltipPtr -> + {# call entry_set_icon_tooltip_text #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + tooltipPtr + +-- | Gets the contents of the tooltip on the icon at the specified position in +-- @entry@. +-- +-- * Available since Gtk+ version 2.16 +-- +entryGetIconTooltipText :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - the icon position + -> IO String -- ^ returns the tooltip text, or {@NULL@, FIXME: this + -- should probably be converted to a Maybe data type}. + -- Free the returned string with 'gFree' when done. +entryGetIconTooltipText self iconPos = + {# call entry_get_icon_tooltip_text #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + >>= readUTFString + +-- | Sets @tooltip@ as the contents of the tooltip for the icon at the +-- specified position. @tooltip@ is assumed to be marked up with the Pango text +-- markup language. +-- +-- Use {@NULL@, FIXME: this should probably be converted to a Maybe data +-- type} for @tooltip@ to remove an existing tooltip. +-- +-- See also 'widgetSetTooltipMarkup' and 'entySetIconTooltipText'. +-- +-- * Available since Gtk+ version 2.16 +-- +entrySetIconTooltipMarkup :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - the icon position + -> String -- ^ @tooltip@ - the contents of the tooltip for the + -- icon, or {@NULL@, FIXME: this should probably be + -- converted to a Maybe data type} + -> IO () +entrySetIconTooltipMarkup self iconPos tooltip = + withUTFString tooltip $ \tooltipPtr -> + {# call entry_set_icon_tooltip_markup #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + tooltipPtr + +-- | Gets the contents of the tooltip on the icon at the specified position in +-- @entry@. +-- +-- * Available since Gtk+ version 2.16 +-- +entryGetIconTooltipMarkup :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - the icon position + -> IO String -- ^ returns the tooltip text, or {@NULL@, FIXME: this + -- should probably be converted to a Maybe data type}. + -- Free the returned string with 'gFree' when done. +entryGetIconTooltipMarkup self iconPos = + {# call entry_get_icon_tooltip_markup #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + >>= readUTFString + +-- | Sets up the icon at the given position so that Gtk+ will start a drag +-- operation when the user clicks and drags the icon. +-- +-- To handle the drag operation, you need to connect to the usual +-- {\"drag-data-get\", FIXME: unknown type\/value} (or possibly +-- {\"drag-data-delete\", FIXME: unknown type\/value}) signal, and use +-- 'entryGetCurrentIconDragSource' in your signal handler to find out if the +-- drag was started from an icon. +-- +-- By default, Gtk+ uses the icon as the drag icon. You can use the +-- {\"drag-begin\", FIXME: unknown type\/value} signal to set a different icon. +-- Note that you have to use 'gSignalConnectAfter' to ensure that your signal +-- handler gets executed after the default handler. +-- +-- * Available since Gtk+ version 2.16 +-- +entrySetIconDragSource :: EntryClass self => self + -> IconPosition -- ^ @iconPos@ - icon position + -> TargetList -- ^ @targets@ - the targets (data formats) in which + -- the data can be provided + -> [DragAction] -- ^ @actions@ - a bitmask of the allowed drag actions + -> IO () +entrySetIconDragSource self iconPos targetList actions = + {# call gtk_entry_set_icon_drag_source #} + (toEntry self) + ((fromIntegral . fromEnum) iconPos) + targetList + ((fromIntegral . fromFlags) actions) +-- entrySetIconDragSource self iconPos targets actions = +-- alloca $ \nTargetsPtr -> do +-- tlPtr <- {#call unsafe gtk_target_table_new_from_list#} targets nTargetsPtr +-- nTargets <- peek nTargetsPtr +-- {# call entry_set_icon_drag_source #} +-- (toEntry self) +-- ((fromIntegral . fromEnum) iconPos) +-- tlPtr +-- nTargets +-- ((fromIntegral . fromFlags) actions) +-- {#call unsafe gtk_target_table_free#} tlPtr nTargets + +-- | Returns the index of the icon which is the source of the current DND +-- operation, or -1. +-- +-- This function is meant to be used in a {\"drag-data-get\", FIXME: unknown +-- type\/value} callback. +-- +-- * Available since Gtk+ version 2.16 +-- +entryGetCurrentIconDragSource :: EntryClass self => self + -> IO Int -- ^ returns index of the icon which is the source of the current + -- DND operation, or -1. +entryGetCurrentIconDragSource self = + liftM fromIntegral $ + {# call entry_get_current_icon_drag_source #} hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 1056 +-- | Whether password entries will show a warning when Caps Lock is on. +-- [_$_] +-- Note that the warning is shown using a secondary icon, and thus does not work if you are using the +-- secondary icon position for some other purpose. +-- [_$_] +-- Default value: 'True' +-- [_$_] +-- Since 2.16 +entryCapsLockWarning :: EntryClass self => Attr self Bool +entryCapsLockWarning = newAttrFromBoolProperty "caps-lock-warning" [_$_] + +-- | Which IM (input method) module should be used for this entry. See 'IMContext'. +-- [_$_] +-- Setting this to a non-'Nothing' value overrides the system-wide IM module setting. See the 'Settings' +-- 'gtkImModule' property. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.16 +entryImModule :: EntryClass self => Attr self (Maybe String) +entryImModule = newAttrFromMaybeStringProperty "im-module" [_$_] + hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 1115 +-- entryInnerBorder :: EntryClass self => Attr self {-GtkBorder-} +-- entryInnerBorder = newAttrFrom{-GtkBorder-}Property "inner-border" + +-- | If text is overwritten when typing in the 'Entry'. +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- Since 2.14 +entryOverwriteMode :: EntryClass self => Attr self Bool +entryOverwriteMode = newAttrFromBoolProperty "overwrite-mode" + +-- | The length of the text in the 'Entry'. +-- [_$_] +-- Allowed values: <= 65535 +-- [_$_] +-- Default value: 0 +-- [_$_] +-- Since 2.14 +entryTextLength :: EntryClass self => ReadAttr self Int +entryTextLength = readAttrFromIntProperty "text-length" + +-- | When 'True', pasted multi-line text is truncated to the first line. +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- Since 2.10 +entryTruncateMultiline :: EntryClass self => Attr self Bool +entryTruncateMultiline = newAttrFromBoolProperty "truncate-multiline" + +-- | The current fraction of the task that's been completed. +-- [_$_] +-- Allowed values: [0,1] +-- [_$_] +-- Default value: 0 +-- [_$_] +-- Since 2.16 +entryProgressFraction :: EntryClass self => Attr self Double +entryProgressFraction = newAttrFromDoubleProperty "progress-fraction" + +-- | The fraction of total entry width to move the progress bouncing block for each call to +-- 'entryProgressPulse'. +-- [_$_] +-- Allowed values: [0,1] +-- [_$_] +-- Default value: 0.1 +-- [_$_] +-- Since 2.16 +entryProgressPulseStep :: EntryClass self => Attr self Double +entryProgressPulseStep = newAttrFromDoubleProperty "progress-pulse-step" + +-- | A pixbuf to use as the primary icon for the entry. +-- [_$_] +-- Since 2.16 +entryPrimaryIconPixbuf :: EntryClass self => Attr self Pixbuf +entryPrimaryIconPixbuf = newAttrFromObjectProperty "primary-icon-pixbuf" + {# call pure unsafe gdk_pixbuf_get_type #} +-- | An pixbuf to use as the secondary icon for the entry. +-- [_$_] +-- Since 2.16 +entrySecondaryIconPixbuf :: EntryClass self => Attr self Pixbuf +entrySecondaryIconPixbuf = newAttrFromObjectProperty "secondary-icon-pixbuf" + {# call pure unsafe gdk_pixbuf_get_type #} +-- | The stock id to use for the primary icon for the entry. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.16 +entryPrimaryIconStock :: EntryClass self => Attr self String +entryPrimaryIconStock = newAttrFromStringProperty "primary-icon-stock" + +-- | The stock id to use for the secondary icon for the entry. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.16 +entrySecondaryIconStock :: EntryClass self => Attr self String +entrySecondaryIconStock = newAttrFromStringProperty "secondary-icon-stock" + +-- | The icon name to use for the primary icon for the entry. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.16 +entryPrimaryIconName :: EntryClass self => Attr self String +entryPrimaryIconName = newAttrFromStringProperty "primary-icon-name" + +-- | The icon name to use for the secondary icon for the entry. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.16 +entrySecondaryIconName :: EntryClass self => Attr self String +entrySecondaryIconName = newAttrFromStringProperty "secondary-icon-name" + +-- entryPrimaryIconGicon :: EntryClass self => Attr self {-GIcon-} +-- entryPrimaryIconGicon = newAttrFrom{-GIcon-}Property "primary-icon-gicon" + +-- | +-- +-- entrySecondaryIconGicon :: EntryClass self => Attr self {-GIcon-} +-- entrySecondaryIconGicon = newAttrFrom{-GIcon-}Property "secondary-icon-gicon" + +-- | The representation which is used for the primary icon of the entry. +-- [_$_] +-- Default value: ''ImageEmpty'' +-- [_$_] +-- Since 2.16 +entryPrimaryIconStorageType :: EntryClass self => ReadAttr self ImageType +entryPrimaryIconStorageType = readAttrFromEnumProperty "primary-icon-storage-type" + {# call pure unsafe gtk_image_type_get_type #} + +-- | The representation which is used for the secondary icon of the entry. +-- [_$_] +-- Default value: ''ImageEmpty'' +-- [_$_] +-- Since 2.16 +entrySecondaryIconStorageType :: EntryClass self => ReadAttr self ImageType +entrySecondaryIconStorageType = readAttrFromEnumProperty "secondary-icon-storage-type" + {# call pure unsafe gtk_image_type_get_type #} + +-- | Whether the primary icon is activatable. +-- [_$_] +-- GTK+ emits the 'iconPress' and 'iconRelease' signals only on sensitive, activatable icons. +-- [_$_] +-- Sensitive, but non-activatable icons can be used for purely informational purposes. +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- Since 2.16 +entryPrimaryIconActivatable :: EntryClass self => Attr self Bool +entryPrimaryIconActivatable = newAttrFromBoolProperty "primary-icon-activatable" + +-- | Whether the secondary icon is activatable. +-- [_$_] +-- GTK+ emits the 'iconPress' and 'iconRelease' signals only on sensitive, activatable icons. +-- [_$_] +-- Sensitive, but non-activatable icons can be used for purely informational purposes. +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- Since 2.16 +entrySecondaryIconActivatable :: EntryClass self => Attr self Bool +entrySecondaryIconActivatable = newAttrFromBoolProperty "secondary-icon-activatable" + +-- | Whether the primary icon is sensitive. +-- [_$_] +-- An insensitive icon appears grayed out. GTK+ does not emit the 'iconPress' and 'iconRelease' +-- signals and does not allow DND from insensitive icons. +-- [_$_] +-- An icon should be set insensitive if the action that would trigger when clicked is currently not +-- available. +-- [_$_] +-- Default value: 'True' +-- [_$_] +-- Since 2.16 +entryPrimaryIconSensitive :: EntryClass self => Attr self Bool +entryPrimaryIconSensitive = newAttrFromBoolProperty "primary-icon-sensitive" + +-- | Whether the secondary icon is sensitive. +-- [_$_] +-- An insensitive icon appears grayed out. GTK+ does not emit the 'iconPress' and 'iconRelease' +-- signals and does not allow DND from insensitive icons. +-- [_$_] +-- An icon should be set insensitive if the action that would trigger when clicked is currently not +-- available. +-- [_$_] +-- Default value: 'True' +-- [_$_] +-- Since 2.16 +entrySecondaryIconSensitive :: EntryClass self => Attr self Bool +entrySecondaryIconSensitive = newAttrFromBoolProperty "secondary-icon-sensitive" + +-- | The contents of the tooltip on the primary icon. +-- [_$_] +-- Also see 'entrySetIconTooltipText'. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.16 +entryPrimaryIconTooltipText :: EntryClass self => Attr self String +entryPrimaryIconTooltipText = newAttrFromStringProperty "primary-icon-tooltip-text" + +-- | The contents of the tooltip on the secondary icon. +-- [_$_] +-- Also see 'entrySetIconTooltipText'. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.16 +entrySecondaryIconTooltipText :: EntryClass self => Attr self String +entrySecondaryIconTooltipText = newAttrFromStringProperty "secondary-icon-tooltip-text" + +-- | The contents of the tooltip on the primary icon, which is marked up with the Pango text markup +-- language. +-- [_$_] +-- Also see 'entrySetIconTooltipMarkup'. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.16 +entryPrimaryIconTooltipMarkup :: EntryClass self => Attr self String +entryPrimaryIconTooltipMarkup = newAttrFromStringProperty "primary-icon-tooltip-markup" + +-- | The contents of the tooltip on the secondary icon, which is marked up with the Pango text markup +-- language. +-- [_$_] +-- Also see 'entrySetIconTooltipMarkup'. +-- [_$_] +-- Default value: 'Nothing' +-- [_$_] +-- Since 2.16 +entrySecondaryIconTooltipMarkup :: EntryClass self => Attr self String +entrySecondaryIconTooltipMarkup = newAttrFromStringProperty "secondary-icon-tooltip-markup" + hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 1338 +-- | Whether the invisible char has been set for the 'Entry'. +-- [_$_] +-- Default value: 'False' +-- [_$_] +-- Since 2.16 +entryInvisibleCharSet :: EntryClass self => Attr self Bool +entryInvisibleCharSet = newAttrFromBoolProperty "invisible-char-set" + hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 1412 +#if GTK_CHECK_VERSION(2,18,0) +entryBuffer :: (EntryClass self, EntryBufferClass entryBuffer) => ReadWriteAttr self EntryBuffer entryBuffer +entryBuffer = newAttrFromObjectProperty "buffer" + {# call pure unsafe gtk_entry_buffer_get_type #} +#endif + hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 1420 +-- | A keybinding signal which gets emitted when the user activates the entry. +-- [_$_] +-- Applications should not connect to it, but may emit it with 'signalEmitByName' if they need to +-- control activation programmatically. +-- [_$_] +-- The default bindings for this signal are all forms of the Enter key. +activate :: EntryClass self => Signal self (IO ()) +activate = Signal (connect_NONE__NONE "activate") + [_$_] +-- | The 'backspace' signal is a keybinding signal which gets emitted when the user asks for it. +-- [_$_] +-- The default bindings for this signal are Backspace and Shift-Backspace. +backspace :: EntryClass self => Signal self (IO ()) +backspace = Signal (connect_NONE__NONE "backspace") hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 1435 +-- | The 'copyClipboard' signal is a keybinding signal which gets emitted to copy the selection to the +-- clipboard. +-- [_$_] +-- The default bindings for this signal are Ctrl-c and Ctrl-Insert. +copyClipboard :: EntryClass self => Signal self (IO ()) +copyClipboard = Signal (connect_NONE__NONE "copy-clipboard") + [_$_] +-- | The 'cutClipboard' signal is a keybinding signal which gets emitted to cut the selection to the +-- clipboard. +-- [_$_] +-- The default bindings for this signal are Ctrl-x and Shift-Delete. +cutClipboard :: EntryClass self => Signal self (IO ()) +cutClipboard = Signal (connect_NONE__NONE "cut-clipboard") + [_$_] +-- | The 'deleteFromCursor' signal is a keybinding signal which gets emitted when the user initiates a +-- text deletion. +-- [_$_] +-- If the type is ''DeleteChars'', GTK+ deletes the selection if there is one, otherwise it deletes +-- the requested number of characters. +-- [_$_] +-- The default bindings for this signal are Delete for deleting a character and Ctrl-Delete for +-- deleting a word. +deleteFromCursor :: EntryClass self => Signal self (DeleteType -> Int -> IO ()) +deleteFromCursor = Signal (connect_ENUM_INT__NONE "delete-from-cursor") + +-- | The 'insertAtCursor' signal is a keybinding signal which gets emitted when the user initiates the +-- insertion of a fixed string at the cursor. +-- [_$_] +-- This signal has no default bindings. +insertAtCursor :: EntryClass self => Signal self (String -> IO ()) +insertAtCursor = Signal (connect_STRING__NONE "insert-at-cursor") + [_$_] +-- | The 'moveCursor' signal is a keybinding signal which gets emitted when the user initiates a cursor +-- movement. If the cursor is not visible in entry, this signal causes the viewport to be moved +-- instead. +-- [_$_] +-- Applications should not connect to it, but may emit it with 'signalEmitByName' if they need to +-- control the cursor programmatically. +-- [_$_] +-- The default bindings for this signal come in two variants, the variant with the Shift modifier +-- extends the selection, the variant without the Shift modifer does not. There are too many key +-- combinations to list them all here. +-- [_$_] +-- [_\e2_][_\97_][_\8f_] Arrow keys move by individual characters/lines [_$_] +-- [_\e2_][_\97_][_\8f_] Ctrl-arrow key combinations move by words/paragraphs [_$_] +-- [_\e2_][_\97_][_\8f_] Home/End keys move to the ends of the buffer +moveCursor :: EntryClass self => Signal self (MovementStep -> Int -> Bool -> IO ()) +moveCursor = Signal (connect_ENUM_INT_BOOL__NONE "move-cursor") + +-- | The 'pasteClipboard' signal is a keybinding signal which gets emitted to paste the contents of the +-- clipboard into the text view. +-- [_$_] +-- The default bindings for this signal are Ctrl-v and Shift-Insert. +pasteClipboard :: EntryClass self => Signal self (IO ()) +pasteClipboard = Signal (connect_NONE__NONE "paste-clipboard") + [_$_] +-- | The 'populatePopup' signal gets emitted before showing the context menu of the entry. +-- [_$_] +-- If you need to add items to the context menu, connect to this signal and append your menuitems to +-- the menu. +populatePopup :: EntryClass self => Signal self (Menu -> IO ()) +populatePopup = Signal (connect_OBJECT__NONE "populate-popup") + +-- | The 'toggleOverwrite' signal is a keybinding signal which gets emitted to toggle the overwrite mode +-- of the entry. +-- [_$_] +-- The default bindings for this signal is Insert. +toggleOverwrite :: EntryClass self => Signal self (IO ()) +toggleOverwrite = Signal (connect_NONE__NONE "toggle-overwrite") + [_$_] +-- | The 'iconPress' signal is emitted when an activatable icon is clicked. +iconPress :: EntryClass self => Signal self (IconPosition -> Event -> IO ()) +iconPress = Signal (connect_ENUM_BOXED__NONE "icon-press" marshalEvent) + [_$_] +-- * Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp 1566 - +#endif addfile ./gtk/Graphics/UI/Gtk/Entry/EntryBuffer.chs.pp hunk ./gtk/Graphics/UI/Gtk/Entry/EntryBuffer.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget EntryBuffer +-- +-- Author : Andy Stewart +-- +-- Created: 22 Mar 2010 +-- +-- Copyright (C) 2010 Andy Stewart +-- +-- 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) +-- +-- Text buffer for 'Entry' +-- +-- * Module available since Gtk+ version 2.18 +-- +module Graphics.UI.Gtk.Entry.EntryBuffer ( + +-- * Detail +-- +-- | The 'EntryBuffer' class contains the actual text displayed in a 'Entry' +-- widget. +-- +-- A single 'EntryBuffer' object can be shared by multiple 'Entry' widgets +-- which will then share the same text content, but not the cursor position, +-- visibility attributes, icon etc. +-- +-- 'EntryBuffer' may be derived from. Such a derived class might allow text +-- to be stored in an alternate location, such as non-pageable memory, useful +-- in the case of important passwords. Or a derived class could integrate with +-- an application's concept of undo\/redo. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----EntryBuffer +-- @ + +#if GTK_CHECK_VERSION(2,18,0) +-- * Types + EntryBuffer, + EntryBufferClass, + castToEntryBuffer, + toEntryBuffer, + +-- * Constructors + entryBufferNew, + +-- * Methods + entryBufferGetText, + entryBufferSetText, + entryBufferGetBytes, + entryBufferGetLength, + entryBufferInsertText, + entryBufferDeleteText, + entryBufferEmitDeletedText, + entryBufferEmitInsertedText, + entryBufferGetMaxLength, + entryBufferSetMaxLength, + +-- * Attributes + entryBufferText, + entryBufferLength, + entryBufferMaxLength, + +-- * Signals + insertedText, + deletedText, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.Attributes +import System.Glib.Properties +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Signals#} + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,18,0) +-------------------- +-- Constructors + +-- | Create a new 'EntryBuffer' object. +-- +-- Optionally, specify initial text to set in the buffer. +-- +entryBufferNew :: + String -- ^ @initialChars@ - initial buffer text + -> Int -- ^ @nInitialChars@ - number of characters in @initialChars@, or + -- -1 + -> IO EntryBuffer +entryBufferNew initialChars nInitialChars = + constructNewGObject mkEntryBuffer $ + withUTFString initialChars $ \initialCharsPtr -> + {# call gtk_entry_buffer_new #} + initialCharsPtr + (fromIntegral nInitialChars) + +-------------------- +-- Methods + +-- | Retrieves the contents of the buffer. +-- +-- The memory pointer returned by this call will not change unless this +-- object emits a signal, or is finalized. +-- +entryBufferGetText :: EntryBufferClass self => self + -> IO String -- ^ returns a pointer to the contents of the widget as a + -- string. This string points to internally allocated storage in + -- the buffer and must not be freed, modified or stored. +entryBufferGetText self = + {# call gtk_entry_buffer_get_text #} + (toEntryBuffer self) + >>= peekUTFString + +-- | Sets the text in the buffer. +-- +-- This is roughly equivalent to calling 'entryBufferDeleteText' and +-- 'entryBufferInsertText'. +-- +-- Note that @nChars@ is in characters, not in bytes. +-- +entryBufferSetText :: EntryBufferClass self => self + -> String -- ^ @chars@ - the new text + -> Int -- ^ @nChars@ - the number of characters in @text@, or -1 + -> IO () +entryBufferSetText self chars nChars = + withUTFString chars $ \charsPtr -> + {# call gtk_entry_buffer_set_text #} + (toEntryBuffer self) + charsPtr + (fromIntegral nChars) + +-- | Retrieves the length in bytes of the buffer. See 'entryBufferGetLength'. +-- +entryBufferGetBytes :: EntryBufferClass self => self + -> IO Int -- ^ returns The byte length of the buffer. +entryBufferGetBytes self = + liftM fromIntegral $ [_$_] + {# call gtk_entry_buffer_get_bytes #} + (toEntryBuffer self) + +-- | Retrieves the length in characters of the buffer. +-- +entryBufferGetLength :: EntryBufferClass self => self + -> IO Int -- ^ returns The number of characters in the buffer. +entryBufferGetLength self = + liftM fromIntegral $ + {# call gtk_entry_buffer_get_length #} + (toEntryBuffer self) + +-- | Retrieves the maximum allowed length of the text in buffer. See 'entryBufferSetMaxLength'. +entryBufferGetMaxLength :: EntryBufferClass self => self + -> IO Int -- ^ returns the maximum allowed number of characters in + -- 'EntryBuffer', or 0 if there is no maximum. +entryBufferGetMaxLength self = + liftM fromIntegral $ + {# call gtk_entry_buffer_get_max_length #} + (toEntryBuffer self) + +-- | Sets the maximum allowed length of the contents of the buffer. If the current contents are longer +-- than the given length, then they will be truncated to fit. +entryBufferSetMaxLength :: EntryBufferClass self => self + -> Int -- ^ @maxLength@ - the maximum length of the entry buffer, or 0 for no + -- maximum. (other than the maximum length of entries.) The value + -- passed in will be clamped to the range 0-65536. + -> IO () +entryBufferSetMaxLength self maxLength = + {# call gtk_entry_buffer_set_max_length #} + (toEntryBuffer self) + (fromIntegral maxLength) + +-- | Inserts @nChars@ characters of @chars@ into the contents of the buffer, +-- at position @position@. +-- +-- If @nChars@ is negative, then characters from chars will be inserted +-- until a null-terminator is found. If @position@ or @nChars@ are out of +-- bounds, or the maximum buffer text length is exceeded, then they are coerced +-- to sane values. +-- +-- Note that the position and length are in characters, not in bytes. +-- +entryBufferInsertText :: EntryBufferClass self => self + -> Int -- ^ @position@ - the position at which to insert text. + -> String -- ^ @chars@ - the text to insert into the buffer. + -> Int -- ^ @nChars@ - the length of the text in characters, or -1 + -> IO Int -- ^ returns The number of characters actually inserted. +entryBufferInsertText self position chars nChars = + liftM fromIntegral $ + withUTFString chars $ \charsPtr -> + {# call gtk_entry_buffer_insert_text #} + (toEntryBuffer self) + (fromIntegral position) + char... [truncated message content] |