module Graphics.UI.Gtk.Entry.Entry (
Entry,
EntryClass,
castToEntry, gTypeEntry,
toEntry,
entryNew,
entryNewWithBuffer,
entrySetText,
entryGetText,
entryAppendText,
entryPrependText,
entrySetVisibility,
entryGetVisibility,
entrySetInvisibleChar,
entryGetInvisibleChar,
entrySetMaxLength,
entryGetMaxLength,
entryGetActivatesDefault,
entrySetActivatesDefault,
entryGetHasFrame,
entrySetHasFrame,
entryGetWidthChars,
entrySetWidthChars,
entrySetAlignment,
entryGetAlignment,
entrySetCompletion,
entryGetCompletion,
entryGetBuffer,
entrySetBuffer,
entryGetIconWindow,
entryGetTextWindow,
entryImContextFilterKeypress,
entryResetImContext,
entryCursorPosition,
entrySelectionBound,
entryEditable,
entryMaxLength,
entryVisibility,
entryHasFrame,
entryInvisibleChar,
entryActivatesDefault,
entryWidthChars,
entryScrollOffset,
entryText,
entryXalign,
entryAlignment,
entryCompletion,
entryBuffer,
entryActivated,
entryActivate,
entryBackspace,
entryCopyClipboard,
entryCutClipboard,
entryPasteClipboard,
entryDeleteFromCursor,
entryInsertAtCursor,
entryMoveCursor,
entryPopulatePopup,
entryToggleOverwirte,
entryToggleOverwrite,
entryPreeditChanged,
entryIconPress,
entryIconRelease,
onEntryActivate,
afterEntryActivate,
onCopyClipboard,
afterCopyClipboard,
onCutClipboard,
afterCutClipboard,
onPasteClipboard,
afterPasteClipboard,
onToggleOverwrite,
afterToggleOverwrite,
) where
import Control.Monad (liftM)
import Control.Monad.Reader (runReaderT)
import Data.Char (ord, chr)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Attributes
import System.Glib.Properties
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.General.Enums (DeleteType (..), MovementStep (..)
, EntryIconPosition (..)
)
import Graphics.UI.Gtk.Gdk.EventM (EventM, EButton, EKey)
import Control.Monad.Reader ( ask )
import Control.Monad.Trans ( liftIO )
import Graphics.UI.Gtk.Entry.EntryBuffer
import Graphics.UI.Gtk.Types
import Graphics.UI.Gtk.Signals
instance EditableClass Entry
entryNew :: IO Entry
entryNew =
makeNewObject mkEntry $
liftM (castPtr :: Ptr Widget -> Ptr Entry) $
gtk_entry_new
entryNewWithBuffer :: EntryBufferClass buffer => buffer -> IO Entry
entryNewWithBuffer buffer =
makeNewObject mkEntry $
liftM (castPtr :: Ptr Widget -> Ptr Entry) $
(\(EntryBuffer arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_new_with_buffer argPtr1)
(toEntryBuffer buffer)
entryGetBuffer :: EntryClass self => self
-> IO EntryBuffer
entryGetBuffer self =
makeNewGObject mkEntryBuffer $
(\(Entry arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_get_buffer argPtr1)
(toEntry self)
entrySetBuffer :: (EntryClass self, EntryBufferClass buffer) => self
-> buffer -> IO ()
entrySetBuffer self =
(\(Entry arg1) (EntryBuffer arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_entry_set_buffer argPtr1 argPtr2)
(toEntry self) . toEntryBuffer
entrySetText :: (EntryClass self, GlibString string) => self -> string -> IO ()
entrySetText self text =
withUTFString text $ \textPtr ->
(\(Entry arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_set_text argPtr1 arg2)
(toEntry self)
textPtr
entryGetText :: (EntryClass self, GlibString string) => self -> IO string
entryGetText self =
(\(Entry arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_get_text argPtr1)
(toEntry self)
>>= peekUTFString
entryAppendText :: (EntryClass self, GlibString string) => self -> string -> IO ()
entryAppendText self text =
withUTFString text $ \textPtr ->
(\(Entry arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_append_text argPtr1 arg2)
(toEntry self)
textPtr
entryPrependText :: (EntryClass self, GlibString string) => self -> string -> IO ()
entryPrependText self text =
withUTFString text $ \textPtr ->
(\(Entry arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_prepend_text argPtr1 arg2)
(toEntry self)
textPtr
entrySetVisibility :: EntryClass self => self
-> Bool
-> IO ()
entrySetVisibility self visible =
(\(Entry arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_set_visibility argPtr1 arg2)
(toEntry self)
(fromBool visible)
entryGetVisibility :: EntryClass self => self
-> IO Bool
entryGetVisibility self =
liftM toBool $
(\(Entry arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_get_visibility argPtr1)
(toEntry self)
entrySetInvisibleChar :: EntryClass self => self -> Char -> IO ()
entrySetInvisibleChar self ch =
(\(Entry arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_set_invisible_char argPtr1 arg2)
(toEntry self)
((fromIntegral . ord) ch)
entryGetInvisibleChar :: EntryClass self => self
-> IO Char
entryGetInvisibleChar self =
liftM (chr . fromIntegral) $
(\(Entry arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_get_invisible_char argPtr1)
(toEntry self)
entrySetMaxLength :: EntryClass self => self
-> Int
-> IO ()
entrySetMaxLength self max =
(\(Entry arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_set_max_length argPtr1 arg2)
(toEntry self)
(fromIntegral max)
entryGetMaxLength :: EntryClass self => self
-> IO Int
entryGetMaxLength self =
liftM fromIntegral $
(\(Entry arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_get_max_length argPtr1)
(toEntry self)
entryGetActivatesDefault :: EntryClass self => self
-> IO Bool
entryGetActivatesDefault self =
liftM toBool $
(\(Entry arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_get_activates_default argPtr1)
(toEntry self)
entrySetActivatesDefault :: EntryClass self => self
-> Bool
-> IO ()
entrySetActivatesDefault self setting =
(\(Entry arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_set_activates_default argPtr1 arg2)
(toEntry self)
(fromBool setting)
entryGetHasFrame :: EntryClass self => self
-> IO Bool
entryGetHasFrame self =
liftM toBool $
(\(Entry arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_get_has_frame argPtr1)
(toEntry self)
entrySetHasFrame :: EntryClass self => self -> Bool -> IO ()
entrySetHasFrame self setting =
(\(Entry arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_set_has_frame argPtr1 arg2)
(toEntry self)
(fromBool setting)
entryGetWidthChars :: EntryClass self => self
-> IO Int
entryGetWidthChars self =
liftM fromIntegral $
(\(Entry arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_get_width_chars argPtr1)
(toEntry self)
entrySetWidthChars :: EntryClass self => self
-> Int
-> IO ()
entrySetWidthChars self nChars =
(\(Entry arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_set_width_chars argPtr1 arg2)
(toEntry self)
(fromIntegral nChars)
entrySetAlignment :: EntryClass self => self
-> Float
-> IO ()
entrySetAlignment self xalign =
(\(Entry arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_set_alignment argPtr1 arg2)
(toEntry self)
(realToFrac xalign)
entryGetAlignment :: EntryClass self => self
-> IO Float
entryGetAlignment self =
liftM realToFrac $
(\(Entry arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_get_alignment argPtr1)
(toEntry self)
entrySetCompletion :: EntryClass self => self -> EntryCompletion -> IO ()
entrySetCompletion self completion =
(\(Entry arg1) (EntryCompletion arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_entry_set_completion argPtr1 argPtr2)
(toEntry self)
completion
entryGetCompletion :: EntryClass self => self
-> IO EntryCompletion
entryGetCompletion self =
makeNewGObject mkEntryCompletion $
(\(Entry arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_get_completion argPtr1)
(toEntry self)
entryGetIconWindow :: EntryClass self => self
-> EntryIconPosition
-> IO DrawWindow
entryGetIconWindow entry iconPos =
makeNewGObject mkDrawWindow $
(\(Entry arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_get_icon_window argPtr1 arg2)
(toEntry entry)
((fromIntegral . fromEnum) iconPos)
entryGetTextWindow :: EntryClass self => self
-> IO DrawWindow
entryGetTextWindow entry =
makeNewGObject mkDrawWindow $
(\(Entry arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_get_text_window argPtr1)
(toEntry entry)
entryImContextFilterKeypress :: EntryClass self => self -> EventM EKey Bool
entryImContextFilterKeypress self = do
ptr <- ask
liftIO $ liftM toBool $
(\(Entry arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_im_context_filter_keypress argPtr1 arg2)
(toEntry self)
(castPtr ptr)
entryResetImContext :: EntryClass self => self -> IO ()
entryResetImContext self =
(\(Entry arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_reset_im_context argPtr1) (toEntry self)
entryCursorPosition :: EntryClass self => ReadAttr self Int
entryCursorPosition = readAttrFromIntProperty "cursor-position"
entrySelectionBound :: EntryClass self => ReadAttr self Int
entrySelectionBound = readAttrFromIntProperty "selection-bound"
entryEditable :: EntryClass self => Attr self Bool
entryEditable = newAttrFromBoolProperty "editable"
entryMaxLength :: EntryClass self => Attr self Int
entryMaxLength = newAttr
entryGetMaxLength
entrySetMaxLength
entryVisibility :: EntryClass self => Attr self Bool
entryVisibility = newAttr
entryGetVisibility
entrySetVisibility
entryHasFrame :: EntryClass self => Attr self Bool
entryHasFrame = newAttr
entryGetHasFrame
entrySetHasFrame
entryInvisibleChar :: EntryClass self => Attr self Char
entryInvisibleChar = newAttr
entryGetInvisibleChar
entrySetInvisibleChar
entryActivatesDefault :: EntryClass self => Attr self Bool
entryActivatesDefault = newAttr
entryGetActivatesDefault
entrySetActivatesDefault
entryWidthChars :: EntryClass self => Attr self Int
entryWidthChars = newAttr
entryGetWidthChars
entrySetWidthChars
entryScrollOffset :: EntryClass self => ReadAttr self Int
entryScrollOffset = readAttrFromIntProperty "scroll-offset"
entryText :: (EntryClass self, GlibString string) => Attr self string
entryText = newAttr
entryGetText
entrySetText
entryXalign :: EntryClass self => Attr self Float
entryXalign = newAttrFromFloatProperty "xalign"
entryAlignment :: EntryClass self => Attr self Float
entryAlignment = newAttr
entryGetAlignment
entrySetAlignment
entryCompletion :: EntryClass self => Attr self EntryCompletion
entryCompletion = newAttr
entryGetCompletion
entrySetCompletion
entryBuffer :: (EntryClass self, EntryBufferClass buffer) =>
ReadWriteAttr self EntryBuffer buffer
entryBuffer = newAttr
entryGetBuffer
entrySetBuffer
entryActivated :: EntryClass ec => Signal ec (IO ())
entryActivated = Signal (connect_NONE__NONE "activate")
entryActivate :: EntryClass ec => Signal ec (IO ())
entryActivate = entryActivated
entryBackspace :: EntryClass ec => Signal ec (IO ())
entryBackspace = Signal (connect_NONE__NONE "backspace")
entryCopyClipboard :: EntryClass ec => Signal ec (IO ())
entryCopyClipboard = Signal (connect_NONE__NONE "copy-clipboard")
entryCutClipboard :: EntryClass ec => Signal ec (IO ())
entryCutClipboard = Signal (connect_NONE__NONE "cut-clipboard")
entryDeleteFromCursor :: EntryClass ec => Signal ec (DeleteType -> Int -> IO ())
entryDeleteFromCursor = Signal (connect_ENUM_INT__NONE "delete-from-cursor")
entryInsertAtCursor :: (EntryClass ec, GlibString string) => Signal ec (string -> IO ())
entryInsertAtCursor = Signal (connect_GLIBSTRING__NONE "insert-at-cursor")
entryMoveCursor :: EntryClass ec => Signal ec (MovementStep -> Int -> Bool -> IO ())
entryMoveCursor = Signal (connect_ENUM_INT_BOOL__NONE "move-cursor")
entryPasteClipboard :: EntryClass ec => Signal ec (IO ())
entryPasteClipboard = Signal (connect_NONE__NONE "paste-clipboard")
entryPopulatePopup :: EntryClass ec => Signal ec (Menu -> IO ())
entryPopulatePopup = Signal (connect_OBJECT__NONE "populate-popup")
entryPreeditChanged :: (EntryClass ec, GlibString string) => Signal ec (string -> IO ())
entryPreeditChanged = Signal (connect_GLIBSTRING__NONE "preedit-changed")
entryIconPress :: EntryClass ec =>
Signal ec (EntryIconPosition -> EventM EButton ())
entryIconPress = Signal $ \after obj f ->
connect_ENUM_PTR__NONE "icon-press" after obj (runReaderT . f)
entryIconRelease :: EntryClass ec =>
Signal ec (EntryIconPosition -> EventM EButton ())
entryIconRelease = Signal $ \after obj f ->
connect_ENUM_PTR__NONE "icon-press" after obj (runReaderT . f)
entryToggleOverwirte :: EntryClass ec => Signal ec (IO ())
entryToggleOverwirte = entryToggleOverwrite
entryToggleOverwrite :: EntryClass ec => Signal ec (IO ())
entryToggleOverwrite = Signal (connect_NONE__NONE "toggle-overwrite")
onEntryActivate, afterEntryActivate :: EntryClass ec => ec -> IO () ->
IO (ConnectId ec)
onEntryActivate = connect_NONE__NONE "activate" False
afterEntryActivate = connect_NONE__NONE "activate" True
onCopyClipboard, afterCopyClipboard :: EntryClass ec => ec -> IO () ->
IO (ConnectId ec)
onCopyClipboard = connect_NONE__NONE "copy_clipboard" False
afterCopyClipboard = connect_NONE__NONE "copy_clipboard" True
onCutClipboard, afterCutClipboard :: EntryClass ec => ec -> IO () ->
IO (ConnectId ec)
onCutClipboard = connect_NONE__NONE "cut_clipboard" False
afterCutClipboard = connect_NONE__NONE "cut_clipboard" True
onPasteClipboard, afterPasteClipboard :: EntryClass ec => ec -> IO () ->
IO (ConnectId ec)
onPasteClipboard = connect_NONE__NONE "paste_clipboard" False
afterPasteClipboard = connect_NONE__NONE "paste_clipboard" True
onToggleOverwrite, afterToggleOverwrite :: EntryClass ec => ec -> IO () ->
IO (ConnectId ec)
onToggleOverwrite = connect_NONE__NONE "toggle_overwrite" False
afterToggleOverwrite = connect_NONE__NONE "toggle_overwrite" True
foreign import ccall unsafe "gtk_entry_new"
gtk_entry_new :: (IO (Ptr Widget))
foreign import ccall unsafe "gtk_entry_new_with_buffer"
gtk_entry_new_with_buffer :: ((Ptr EntryBuffer) -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_entry_get_buffer"
gtk_entry_get_buffer :: ((Ptr Entry) -> (IO (Ptr EntryBuffer)))
foreign import ccall safe "gtk_entry_set_buffer"
gtk_entry_set_buffer :: ((Ptr Entry) -> ((Ptr EntryBuffer) -> (IO ())))
foreign import ccall safe "gtk_entry_set_text"
gtk_entry_set_text :: ((Ptr Entry) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_entry_get_text"
gtk_entry_get_text :: ((Ptr Entry) -> (IO (Ptr CChar)))
foreign import ccall safe "gtk_entry_append_text"
gtk_entry_append_text :: ((Ptr Entry) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_entry_prepend_text"
gtk_entry_prepend_text :: ((Ptr Entry) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_entry_set_visibility"
gtk_entry_set_visibility :: ((Ptr Entry) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_entry_get_visibility"
gtk_entry_get_visibility :: ((Ptr Entry) -> (IO CInt))
foreign import ccall unsafe "gtk_entry_set_invisible_char"
gtk_entry_set_invisible_char :: ((Ptr Entry) -> (CUInt -> (IO ())))
foreign import ccall unsafe "gtk_entry_get_invisible_char"
gtk_entry_get_invisible_char :: ((Ptr Entry) -> (IO CUInt))
foreign import ccall safe "gtk_entry_set_max_length"
gtk_entry_set_max_length :: ((Ptr Entry) -> (CInt -> (IO ())))
foreign import ccall unsafe "gtk_entry_get_max_length"
gtk_entry_get_max_length :: ((Ptr Entry) -> (IO CInt))
foreign import ccall unsafe "gtk_entry_get_activates_default"
gtk_entry_get_activates_default :: ((Ptr Entry) -> (IO CInt))
foreign import ccall safe "gtk_entry_set_activates_default"
gtk_entry_set_activates_default :: ((Ptr Entry) -> (CInt -> (IO ())))
foreign import ccall unsafe "gtk_entry_get_has_frame"
gtk_entry_get_has_frame :: ((Ptr Entry) -> (IO CInt))
foreign import ccall safe "gtk_entry_set_has_frame"
gtk_entry_set_has_frame :: ((Ptr Entry) -> (CInt -> (IO ())))
foreign import ccall unsafe "gtk_entry_get_width_chars"
gtk_entry_get_width_chars :: ((Ptr Entry) -> (IO CInt))
foreign import ccall safe "gtk_entry_set_width_chars"
gtk_entry_set_width_chars :: ((Ptr Entry) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_entry_set_alignment"
gtk_entry_set_alignment :: ((Ptr Entry) -> (CFloat -> (IO ())))
foreign import ccall unsafe "gtk_entry_get_alignment"
gtk_entry_get_alignment :: ((Ptr Entry) -> (IO CFloat))
foreign import ccall safe "gtk_entry_set_completion"
gtk_entry_set_completion :: ((Ptr Entry) -> ((Ptr EntryCompletion) -> (IO ())))
foreign import ccall safe "gtk_entry_get_completion"
gtk_entry_get_completion :: ((Ptr Entry) -> (IO (Ptr EntryCompletion)))
foreign import ccall safe "gtk_entry_get_icon_window"
gtk_entry_get_icon_window :: ((Ptr Entry) -> (CInt -> (IO (Ptr DrawWindow))))
foreign import ccall safe "gtk_entry_get_text_window"
gtk_entry_get_text_window :: ((Ptr Entry) -> (IO (Ptr DrawWindow)))
foreign import ccall safe "gtk_entry_im_context_filter_keypress"
gtk_entry_im_context_filter_keypress :: ((Ptr Entry) -> ((Ptr ()) -> (IO CInt)))
foreign import ccall safe "gtk_entry_reset_im_context"
gtk_entry_reset_im_context :: ((Ptr Entry) -> (IO ()))