module Graphics.UI.Gtk.Entry.EntryCompletion (
EntryCompletion,
EntryCompletionClass,
castToEntryCompletion, gTypeEntryCompletion,
toEntryCompletion,
entryCompletionNew,
entryCompletionGetEntry,
entryCompletionSetModel,
entryCompletionGetModel,
entryCompletionSetTextModel,
entryCompletionSetMatchFunc,
entryCompletionSetMinimumKeyLength,
entryCompletionGetMinimumKeyLength,
entryCompletionComplete,
entryCompletionInsertActionText,
entryCompletionInsertActionMarkup,
entryCompletionDeleteAction,
entryCompletionSetTextColumn,
entryCompletionInsertPrefix,
entryCompletionGetTextColumn,
entryCompletionSetInlineCompletion,
entryCompletionGetInlineCompletion,
entryCompletionSetPopupCompletion,
entryCompletionGetPopupCompletion,
entryCompletionSetPopupSetWidth,
entryCompletionGetPopupSetWidth,
entryCompletionSetPopupSingleMatch,
entryCompletionGetPopupSingleMatch,
entryCompletionModel,
entryCompletionMinimumKeyLength,
entryCompletionTextColumn,
entryCompletionInlineCompletion,
entryCompletionPopupCompletion,
entryCompletionPopupSetWidth,
entryCompletionPopupSingleMatch,
insertPrefix,
completionActionActivated,
matchSelected,
onInsertPrefix,
afterInsertPrefix,
onActionActivated,
afterActionActivated,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Attributes
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Types
import Graphics.UI.Gtk.Signals
import Graphics.UI.Gtk.ModelView.Types (TreeIter, peekTreeIter,
TypedTreeModelClass)
import Graphics.UI.Gtk.ModelView.CustomStore (customStoreSetColumn)
import Graphics.UI.Gtk.ModelView.TreeModel (ColumnId(..),
makeColumnIdString,
columnIdToNumber)
entryCompletionNew :: IO EntryCompletion
entryCompletionNew =
wrapNewGObject mkEntryCompletion $
gtk_entry_completion_new
entryCompletionGetEntry :: EntryCompletion
-> IO (Maybe Entry)
entryCompletionGetEntry self =
maybeNull (makeNewObject mkEntry) $
liftM (castPtr :: Ptr Widget -> Ptr Entry) $
(\(EntryCompletion arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_get_entry argPtr1)
self
entryCompletionSetModel :: TreeModelClass model => EntryCompletion
-> Maybe model
-> IO ()
entryCompletionSetModel self model =
(\(EntryCompletion arg1) (TreeModel arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_entry_completion_set_model argPtr1 argPtr2)
self
(maybe (TreeModel nullForeignPtr) toTreeModel model)
entryCompletionGetModel :: EntryCompletion
-> IO (Maybe TreeModel)
entryCompletionGetModel self =
maybeNull (makeNewGObject mkTreeModel) $
(\(EntryCompletion arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_get_model argPtr1)
self
entryCompletionSetTextModel :: (TreeModelClass (model string),
TypedTreeModelClass model, GlibString string)
=> EntryCompletion
-> model string
-> IO ()
entryCompletionSetTextModel self model = do
let strCol = makeColumnIdString 0
customStoreSetColumn model strCol id
set self [entryCompletionTextColumn := strCol]
entryCompletionSetMatchFunc :: GlibString string
=> EntryCompletion -> (string -> TreeIter -> IO Bool) -> IO ()
entryCompletionSetMatchFunc ec handler = do
hPtr <- mkHandler_GtkEntryCompletionMatchFunc
(\_ keyPtr iterPtr _ -> do key <- peekUTFString keyPtr
iter <- peek iterPtr
liftM fromBool $ handler key iter)
(\(EntryCompletion arg1) arg2 arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_set_match_func argPtr1 arg2 arg3 arg4) ec
(castFunPtr hPtr) (castFunPtrToPtr hPtr) destroyFunPtr
type GtkEntryCompletionMatchFunc =
Ptr EntryCompletion ->
Ptr CChar ->
Ptr TreeIter ->
Ptr () ->
IO (CInt)
foreign import ccall "wrapper" mkHandler_GtkEntryCompletionMatchFunc ::
GtkEntryCompletionMatchFunc ->
IO (FunPtr GtkEntryCompletionMatchFunc)
entryCompletionSetMinimumKeyLength :: EntryCompletion
-> Int
-> IO ()
entryCompletionSetMinimumKeyLength self length =
(\(EntryCompletion arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_set_minimum_key_length argPtr1 arg2)
self
(fromIntegral length)
entryCompletionGetMinimumKeyLength :: EntryCompletion
-> IO Int
entryCompletionGetMinimumKeyLength self =
liftM fromIntegral $
(\(EntryCompletion arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_get_minimum_key_length argPtr1)
self
entryCompletionComplete :: EntryCompletion -> IO ()
entryCompletionComplete self =
(\(EntryCompletion arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_complete argPtr1)
self
entryCompletionInsertActionText :: GlibString string => EntryCompletion
-> Int
-> string
-> IO ()
entryCompletionInsertActionText self index text =
withUTFString text $ \textPtr ->
(\(EntryCompletion arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_insert_action_text argPtr1 arg2 arg3)
self
(fromIntegral index)
textPtr
entryCompletionInsertActionMarkup :: GlibString string => EntryCompletion
-> Int
-> string
-> IO ()
entryCompletionInsertActionMarkup self index markup =
withUTFString markup $ \markupPtr ->
(\(EntryCompletion arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_insert_action_markup argPtr1 arg2 arg3)
self
(fromIntegral index)
markupPtr
entryCompletionDeleteAction :: EntryCompletion
-> Int
-> IO ()
entryCompletionDeleteAction self index =
(\(EntryCompletion arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_delete_action argPtr1 arg2)
self
(fromIntegral index)
entryCompletionSetTextColumn :: GlibString string => EntryCompletion
-> ColumnId row string
-> IO ()
entryCompletionSetTextColumn self column =
(\(EntryCompletion arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_set_text_column argPtr1 arg2)
self
((fromIntegral . columnIdToNumber) column)
entryCompletionInsertPrefix :: EntryCompletion -> IO ()
entryCompletionInsertPrefix self =
(\(EntryCompletion arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_insert_prefix argPtr1)
self
entryCompletionGetTextColumn :: GlibString string => EntryCompletion
-> IO (ColumnId row string)
entryCompletionGetTextColumn self =
liftM (makeColumnIdString . fromIntegral) $
(\(EntryCompletion arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_get_text_column argPtr1)
self
entryCompletionSetInlineCompletion :: EntryCompletion
-> Bool
-> IO ()
entryCompletionSetInlineCompletion self inlineCompletion =
(\(EntryCompletion arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_set_inline_completion argPtr1 arg2)
self
(fromBool inlineCompletion)
entryCompletionGetInlineCompletion :: EntryCompletion
-> IO Bool
entryCompletionGetInlineCompletion self =
liftM toBool $
(\(EntryCompletion arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_get_inline_completion argPtr1)
self
entryCompletionSetPopupCompletion :: EntryCompletion
-> Bool
-> IO ()
entryCompletionSetPopupCompletion self popupCompletion =
(\(EntryCompletion arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_set_popup_completion argPtr1 arg2)
self
(fromBool popupCompletion)
entryCompletionGetPopupCompletion :: EntryCompletion
-> IO Bool
entryCompletionGetPopupCompletion self =
liftM toBool $
(\(EntryCompletion arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_get_popup_completion argPtr1)
self
entryCompletionSetPopupSetWidth :: EntryCompletion
-> Bool
-> IO ()
entryCompletionSetPopupSetWidth self popupSetWidth =
(\(EntryCompletion arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_set_popup_set_width argPtr1 arg2)
self
(fromBool popupSetWidth)
entryCompletionGetPopupSetWidth :: EntryCompletion
-> IO Bool
entryCompletionGetPopupSetWidth self =
liftM toBool $
(\(EntryCompletion arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_get_popup_set_width argPtr1)
self
entryCompletionSetPopupSingleMatch :: EntryCompletion
-> Bool
-> IO ()
entryCompletionSetPopupSingleMatch self popupSingleMatch =
(\(EntryCompletion arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_set_popup_single_match argPtr1 arg2)
self
(fromBool popupSingleMatch)
entryCompletionGetPopupSingleMatch :: EntryCompletion
-> IO Bool
entryCompletionGetPopupSingleMatch self =
liftM toBool $
(\(EntryCompletion arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_entry_completion_get_popup_single_match argPtr1)
self
entryCompletionModel :: TreeModelClass model => ReadWriteAttr EntryCompletion (Maybe TreeModel) (Maybe model)
entryCompletionModel = newAttr
entryCompletionGetModel
entryCompletionSetModel
entryCompletionMinimumKeyLength :: Attr EntryCompletion Int
entryCompletionMinimumKeyLength = newAttr
entryCompletionGetMinimumKeyLength
entryCompletionSetMinimumKeyLength
entryCompletionTextColumn :: GlibString string => Attr EntryCompletion (ColumnId row string)
entryCompletionTextColumn = newAttr
entryCompletionGetTextColumn
entryCompletionSetTextColumn
entryCompletionInlineCompletion :: Attr EntryCompletion Bool
entryCompletionInlineCompletion = newAttr
entryCompletionGetInlineCompletion
entryCompletionSetInlineCompletion
entryCompletionPopupCompletion :: Attr EntryCompletion Bool
entryCompletionPopupCompletion = newAttr
entryCompletionGetPopupCompletion
entryCompletionSetPopupCompletion
entryCompletionPopupSetWidth :: Attr EntryCompletion Bool
entryCompletionPopupSetWidth = newAttr
entryCompletionGetPopupSetWidth
entryCompletionSetPopupSetWidth
entryCompletionPopupSingleMatch :: Attr EntryCompletion Bool
entryCompletionPopupSingleMatch = newAttr
entryCompletionGetPopupSingleMatch
entryCompletionSetPopupSingleMatch
insertPrefix :: (EntryCompletionClass self, GlibString string) => Signal self (string -> IO Bool)
insertPrefix = Signal (connect_GLIBSTRING__BOOL "insert-prefix")
matchSelected :: EntryCompletionClass self => Signal self (TreeModel -> TreeIter -> IO Bool)
matchSelected = Signal (connect_OBJECT_BOXED__BOOL "match-selected" peekTreeIter)
completionActionActivated :: EntryCompletionClass self => Signal self (Int -> IO ())
completionActionActivated = Signal (connect_INT__NONE "action-activated")
onInsertPrefix, afterInsertPrefix :: (EntryCompletionClass self, GlibString string) => self
-> (string -> IO Bool)
-> IO (ConnectId self)
onInsertPrefix = connect_GLIBSTRING__BOOL "insert_prefix" False
afterInsertPrefix = connect_GLIBSTRING__BOOL "insert_prefix" True
onActionActivated, afterActionActivated :: EntryCompletionClass self => self
-> (Int -> IO ())
-> IO (ConnectId self)
onActionActivated = connect_INT__NONE "action_activated" False
afterActionActivated = connect_INT__NONE "action_activated" True
foreign import ccall safe "gtk_entry_completion_new"
gtk_entry_completion_new :: (IO (Ptr EntryCompletion))
foreign import ccall safe "gtk_entry_completion_get_entry"
gtk_entry_completion_get_entry :: ((Ptr EntryCompletion) -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_entry_completion_set_model"
gtk_entry_completion_set_model :: ((Ptr EntryCompletion) -> ((Ptr TreeModel) -> (IO ())))
foreign import ccall safe "gtk_entry_completion_get_model"
gtk_entry_completion_get_model :: ((Ptr EntryCompletion) -> (IO (Ptr TreeModel)))
foreign import ccall safe "gtk_entry_completion_set_match_func"
gtk_entry_completion_set_match_func :: ((Ptr EntryCompletion) -> ((FunPtr ((Ptr EntryCompletion) -> ((Ptr CChar) -> ((Ptr TreeIter) -> ((Ptr ()) -> (IO CInt)))))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO ())))))
foreign import ccall safe "gtk_entry_completion_set_minimum_key_length"
gtk_entry_completion_set_minimum_key_length :: ((Ptr EntryCompletion) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_entry_completion_get_minimum_key_length"
gtk_entry_completion_get_minimum_key_length :: ((Ptr EntryCompletion) -> (IO CInt))
foreign import ccall safe "gtk_entry_completion_complete"
gtk_entry_completion_complete :: ((Ptr EntryCompletion) -> (IO ()))
foreign import ccall safe "gtk_entry_completion_insert_action_text"
gtk_entry_completion_insert_action_text :: ((Ptr EntryCompletion) -> (CInt -> ((Ptr CChar) -> (IO ()))))
foreign import ccall safe "gtk_entry_completion_insert_action_markup"
gtk_entry_completion_insert_action_markup :: ((Ptr EntryCompletion) -> (CInt -> ((Ptr CChar) -> (IO ()))))
foreign import ccall safe "gtk_entry_completion_delete_action"
gtk_entry_completion_delete_action :: ((Ptr EntryCompletion) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_entry_completion_set_text_column"
gtk_entry_completion_set_text_column :: ((Ptr EntryCompletion) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_entry_completion_insert_prefix"
gtk_entry_completion_insert_prefix :: ((Ptr EntryCompletion) -> (IO ()))
foreign import ccall safe "gtk_entry_completion_get_text_column"
gtk_entry_completion_get_text_column :: ((Ptr EntryCompletion) -> (IO CInt))
foreign import ccall safe "gtk_entry_completion_set_inline_completion"
gtk_entry_completion_set_inline_completion :: ((Ptr EntryCompletion) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_entry_completion_get_inline_completion"
gtk_entry_completion_get_inline_completion :: ((Ptr EntryCompletion) -> (IO CInt))
foreign import ccall safe "gtk_entry_completion_set_popup_completion"
gtk_entry_completion_set_popup_completion :: ((Ptr EntryCompletion) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_entry_completion_get_popup_completion"
gtk_entry_completion_get_popup_completion :: ((Ptr EntryCompletion) -> (IO CInt))
foreign import ccall safe "gtk_entry_completion_set_popup_set_width"
gtk_entry_completion_set_popup_set_width :: ((Ptr EntryCompletion) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_entry_completion_get_popup_set_width"
gtk_entry_completion_get_popup_set_width :: ((Ptr EntryCompletion) -> (IO CInt))
foreign import ccall safe "gtk_entry_completion_set_popup_single_match"
gtk_entry_completion_set_popup_single_match :: ((Ptr EntryCompletion) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_entry_completion_get_popup_single_match"
gtk_entry_completion_get_popup_single_match :: ((Ptr EntryCompletion) -> (IO CInt))