{-# LINE 2 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
-- -*-haskell-*-
-- GIMP Toolkit (GTK) Widget EntryCompletion
--
-- Author : Duncan Coutts
--
-- Created: 24 April 2004
--
-- Copyright (C) 2004-2005 Duncan Coutts
--
-- 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 : gtk2hs-users@lists.sourceforge.net
-- Stability : provisional
-- Portability : portable (depends on GHC)
--
-- Completion functionality for 'Entry'
--
-- * Module available since Gtk+ version 2.4
--
module Graphics.UI.Gtk.Entry.EntryCompletion (
-- * Detail
--
-- | 'EntryCompletion' is an auxiliary object to be used in conjunction with
-- 'Entry' to provide the completion functionality. It implements the
-- 'CellLayout' interface, to allow the user to add extra cells to the
-- 'TreeView' with completion matches.
--
-- \"Completion functionality\" means that when the user modifies the
-- text in the entry, 'EntryCompletion' checks which rows in the model
-- match the current content of the entry, and displays a list of
-- matches. By default, the matching is done by comparing the entry
-- text case-insensitively against the text in a model (see
-- 'Graphics.UI.Gtk.Entry.entryCompletionSetTextModel'), but this can
-- be overridden with a custom match function (see
-- 'entryCompletionSetMatchFunc').
--
-- When the user selects a completion, the content of the entry is updated.
-- By default, the content of the entry is replaced by the text column of the
-- model, but this can be overridden by connecting to the 'matchSelected'
-- signal and updating the entry in the signal handler. Note that you should
-- return @True@ from the signal handler to suppress the default behaviour.
--
-- To add completion functionality to an entry, use
-- 'Graphics.UI.Gtk.Entry.Entry.entrySetCompletion'.
--
-- In addition to regular completion matches, which will be inserted into
-- the entry when they are selected, 'EntryCompletion' also allows to display
-- \"actions\" in the popup window. Their appearance is similar to menu items,
-- to differentiate them clearly from completion strings. When an action is
-- selected, the 'completionActionActivated' signal is emitted.

-- * Class Hierarchy
-- |
-- @
-- | 'GObject'
-- | +----EntryCompletion
-- @


-- * Types
  EntryCompletion,
  EntryCompletionClass,
  castToEntryCompletion, gTypeEntryCompletion,
  toEntryCompletion,

-- * Constructors
  entryCompletionNew,

-- * Methods
  entryCompletionGetEntry,
  entryCompletionSetModel,
  entryCompletionGetModel,
  entryCompletionSetTextModel,
  entryCompletionSetMatchFunc,
  entryCompletionSetMinimumKeyLength,
  entryCompletionGetMinimumKeyLength,
  entryCompletionComplete,
  entryCompletionInsertActionText,
  entryCompletionInsertActionMarkup,
  entryCompletionDeleteAction,
  entryCompletionSetTextColumn,

  entryCompletionInsertPrefix,
  entryCompletionGetTextColumn,
  entryCompletionSetInlineCompletion,
  entryCompletionGetInlineCompletion,
  entryCompletionSetPopupCompletion,
  entryCompletionGetPopupCompletion,


  entryCompletionSetPopupSetWidth,
  entryCompletionGetPopupSetWidth,
  entryCompletionSetPopupSingleMatch,
  entryCompletionGetPopupSingleMatch,


-- * Attributes
  entryCompletionModel,
  entryCompletionMinimumKeyLength,

  entryCompletionTextColumn,
  entryCompletionInlineCompletion,
  entryCompletionPopupCompletion,


  entryCompletionPopupSetWidth,
  entryCompletionPopupSingleMatch,


-- * Signals

  insertPrefix,

  completionActionActivated,
  matchSelected,

-- * Deprecated
{-# LINE 137 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
  ) 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
{-# LINE 146 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
import Graphics.UI.Gtk.Signals
{-# LINE 147 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
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)


{-# LINE 155 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}


--------------------
-- Constructors

-- | Creates a new 'EntryCompletion' object.
--
entryCompletionNew :: IO EntryCompletion
entryCompletionNew :: IO EntryCompletion
entryCompletionNew =
  (ForeignPtr EntryCompletion -> EntryCompletion,
 FinalizerPtr EntryCompletion)
-> IO (Ptr EntryCompletion) -> IO EntryCompletion
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr EntryCompletion -> EntryCompletion,
 FinalizerPtr EntryCompletion)
forall {a}.
(ForeignPtr EntryCompletion -> EntryCompletion, FinalizerPtr a)
mkEntryCompletion (IO (Ptr EntryCompletion) -> IO EntryCompletion)
-> IO (Ptr EntryCompletion) -> IO EntryCompletion
forall a b. (a -> b) -> a -> b
$
  IO (Ptr EntryCompletion)
gtk_entry_completion_new
{-# LINE 166 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}

--------------------
-- Methods

-- | Gets the entry @completion@ has been attached to.
--
entryCompletionGetEntry :: EntryCompletion
 -> IO (Maybe Entry) -- ^ returns the entry @completion@ has been attached to.
entryCompletionGetEntry :: EntryCompletion -> IO (Maybe Entry)
entryCompletionGetEntry EntryCompletion
self =
  (IO (Ptr Entry) -> IO Entry) -> IO (Ptr Entry) -> IO (Maybe Entry)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((ForeignPtr Entry -> Entry, FinalizerPtr Entry)
-> IO (Ptr Entry) -> IO Entry
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr Entry -> Entry, FinalizerPtr Entry)
forall {a}. (ForeignPtr Entry -> Entry, FinalizerPtr a)
mkEntry) (IO (Ptr Entry) -> IO (Maybe Entry))
-> IO (Ptr Entry) -> IO (Maybe Entry)
forall a b. (a -> b) -> a -> b
$
  (Ptr Widget -> Ptr Entry) -> IO (Ptr Widget) -> IO (Ptr Entry)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr Entry
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr Entry) (IO (Ptr Widget) -> IO (Ptr Entry))
-> IO (Ptr Widget) -> IO (Ptr Entry)
forall a b. (a -> b) -> a -> b
$
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO (Ptr Widget)) -> IO (Ptr Widget))
-> (Ptr EntryCompletion -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> IO (Ptr Widget)
gtk_entry_completion_get_entry Ptr EntryCompletion
argPtr1)
{-# LINE 178 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self

-- | Sets the model for a 'EntryCompletion'. If @completion@ already has a
-- model set, it will remove it before setting the new model. If model is
-- @Nothing@, then it will unset the model.
--
entryCompletionSetModel :: TreeModelClass model => EntryCompletion
 -> Maybe model -- ^ @model@ - The 'TreeModel'.
 -> IO ()
entryCompletionSetModel :: forall model.
TreeModelClass model =>
EntryCompletion -> Maybe model -> IO ()
entryCompletionSetModel EntryCompletion
self Maybe model
model =
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) (TreeModel ForeignPtr TreeModel
arg2) -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO ()) -> IO ())
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->ForeignPtr TreeModel -> (Ptr TreeModel -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TreeModel
arg2 ((Ptr TreeModel -> IO ()) -> IO ())
-> (Ptr TreeModel -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr TreeModel
argPtr2 ->Ptr EntryCompletion -> Ptr TreeModel -> IO ()
gtk_entry_completion_set_model Ptr EntryCompletion
argPtr1 Ptr TreeModel
argPtr2)
{-# LINE 189 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self
    (TreeModel -> (model -> TreeModel) -> Maybe model -> TreeModel
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (ForeignPtr TreeModel -> TreeModel
TreeModel ForeignPtr TreeModel
forall a. ForeignPtr a
nullForeignPtr) model -> TreeModel
forall o. TreeModelClass o => o -> TreeModel
toTreeModel Maybe model
model)

-- | Returns the model the 'EntryCompletion' is using as data source. Returns
-- @Nothing@ if the model is unset.
--
entryCompletionGetModel :: EntryCompletion
 -> IO (Maybe TreeModel) -- ^ returns A 'TreeModel', or @Nothing@ if none is
                         -- currently being used.
entryCompletionGetModel :: EntryCompletion -> IO (Maybe TreeModel)
entryCompletionGetModel EntryCompletion
self =
  (IO (Ptr TreeModel) -> IO TreeModel)
-> IO (Ptr TreeModel) -> IO (Maybe TreeModel)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((ForeignPtr TreeModel -> TreeModel, FinalizerPtr TreeModel)
-> IO (Ptr TreeModel) -> IO TreeModel
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr TreeModel -> TreeModel, FinalizerPtr TreeModel)
forall {a}. (ForeignPtr TreeModel -> TreeModel, FinalizerPtr a)
mkTreeModel) (IO (Ptr TreeModel) -> IO (Maybe TreeModel))
-> IO (Ptr TreeModel) -> IO (Maybe TreeModel)
forall a b. (a -> b) -> a -> b
$
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO (Ptr TreeModel))
-> IO (Ptr TreeModel)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO (Ptr TreeModel)) -> IO (Ptr TreeModel))
-> (Ptr EntryCompletion -> IO (Ptr TreeModel))
-> IO (Ptr TreeModel)
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> IO (Ptr TreeModel)
gtk_entry_completion_get_model Ptr EntryCompletion
argPtr1)
{-# LINE 201 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self

-- | Convenience function for setting up the most used case of this code: a
-- completion list with just strings. This function will set up @completion@ to
-- have a list displaying all (and just) strings in the completion list, and to
-- get those strings from @model@. This functions creates and adds a
-- 'CellRendererText' which retrieves its content from the given model.
--
entryCompletionSetTextModel :: (TreeModelClass (model string),
                                TypedTreeModelClass model, GlibString string)
 => EntryCompletion -- ^ @completion@
 -> model string -- ^ the model containing 'string's
 -> IO ()
entryCompletionSetTextModel :: forall (model :: * -> *) string.
(TreeModelClass (model string), TypedTreeModelClass model,
 GlibString string) =>
EntryCompletion -> model string -> IO ()
entryCompletionSetTextModel EntryCompletion
self model string
model = do
  let strCol :: ColumnId row string
strCol = Int -> ColumnId row string
forall string row. GlibString string => Int -> ColumnId row string
makeColumnIdString Int
0
  model string
-> ColumnId string string -> (string -> string) -> IO ()
forall (model :: * -> *) row ty.
TypedTreeModelClass model =>
model row -> ColumnId row ty -> (row -> ty) -> IO ()
customStoreSetColumn model string
model ColumnId string string
forall {row}. ColumnId row string
strCol string -> string
forall a. a -> a
id
  EntryCompletion -> [AttrOp EntryCompletion] -> IO ()
forall o. o -> [AttrOp o] -> IO ()
set EntryCompletion
self [Attr EntryCompletion (ColumnId Any string)
forall string row.
GlibString string =>
Attr EntryCompletion (ColumnId row string)
entryCompletionTextColumn Attr EntryCompletion (ColumnId Any string)
-> ColumnId Any string -> AttrOp EntryCompletion
forall o a b. ReadWriteAttr o a b -> b -> AttrOp o
:= ColumnId Any string
forall {row}. ColumnId row string
strCol]

-- | Sets the match function for @completion@ to be @func@. The match function
-- is used to determine if a row should or should not be in the completion
-- list.
--
-- * The passed-in function decides whether the row indicated by the
-- 'TreeIter' matches a given key, and should be displayed as a possible
-- completion for key. Note that the key is normalized and case-folded.
-- Normalization will standardizing such issues as whether a character
-- with an accent is represented as a base character and combining accent
-- or as a single precomposed character. If this is not appropriate you
-- can extract the original text from the entry.
--
entryCompletionSetMatchFunc :: GlibString string
 => EntryCompletion -> (string -> TreeIter -> IO Bool) -> IO ()
entryCompletionSetMatchFunc :: forall string.
GlibString string =>
EntryCompletion -> (string -> TreeIter -> IO Bool) -> IO ()
entryCompletionSetMatchFunc EntryCompletion
ec string -> TreeIter -> IO Bool
handler = do
  FunPtr GtkEntryCompletionMatchFunc
hPtr <- GtkEntryCompletionMatchFunc
-> IO (FunPtr GtkEntryCompletionMatchFunc)
mkHandler_GtkEntryCompletionMatchFunc
    (\Ptr EntryCompletion
_ Ptr CChar
keyPtr Ptr TreeIter
iterPtr Ptr ()
_ -> do string
key <- Ptr CChar -> IO string
forall s. GlibString s => Ptr CChar -> IO s
peekUTFString Ptr CChar
keyPtr
                               TreeIter
iter <- Ptr TreeIter -> IO TreeIter
forall a. Storable a => Ptr a -> IO a
peek Ptr TreeIter
iterPtr
                               (Bool -> CInt) -> IO Bool -> IO CInt
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Bool -> CInt
forall a. Num a => Bool -> a
fromBool (IO Bool -> IO CInt) -> IO Bool -> IO CInt
forall a b. (a -> b) -> a -> b
$ string -> TreeIter -> IO Bool
handler string
key TreeIter
iter)
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) FunPtr GtkEntryCompletionMatchFunc
arg2 Ptr ()
arg3 FunPtr (Ptr () -> IO ())
arg4 -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO ()) -> IO ())
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion
-> FunPtr GtkEntryCompletionMatchFunc
-> Ptr ()
-> FunPtr (Ptr () -> IO ())
-> IO ()
gtk_entry_completion_set_match_func Ptr EntryCompletion
argPtr1 FunPtr GtkEntryCompletionMatchFunc
arg2 Ptr ()
arg3 FunPtr (Ptr () -> IO ())
arg4) EntryCompletion
ec
    (FunPtr GtkEntryCompletionMatchFunc
-> FunPtr GtkEntryCompletionMatchFunc
forall a b. FunPtr a -> FunPtr b
castFunPtr FunPtr GtkEntryCompletionMatchFunc
hPtr) (FunPtr GtkEntryCompletionMatchFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr GtkEntryCompletionMatchFunc
hPtr) FunPtr (Ptr () -> IO ())
destroyFunPtr

-------------------------------------------------
-- Callback stuff for entryCompletionSetMatchFunc
--

type GtkEntryCompletionMatchFunc =
  Ptr EntryCompletion -> --GtkEntryCompletion *completion
  Ptr CChar -> --const gchar *key
  Ptr TreeIter -> --GtkTreeIter *iter
  Ptr () -> --gpointer user_data
  IO (CInt)
{-# LINE 251 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}

foreign import ccall "wrapper" mkHandler_GtkEntryCompletionMatchFunc ::
  GtkEntryCompletionMatchFunc ->
  IO (FunPtr GtkEntryCompletionMatchFunc)

-- | Requires the length of the search key for @completion@ to be at least
-- @length@. This is useful for long lists, where completing using a small key
-- takes a lot of time and will come up with meaningless results anyway (ie, a
-- too large dataset).
--
entryCompletionSetMinimumKeyLength :: EntryCompletion
 -> Int -- ^ @length@ - The minimum length of the key in order to
                    -- start completing.
 -> IO ()
entryCompletionSetMinimumKeyLength :: EntryCompletion -> Int -> IO ()
entryCompletionSetMinimumKeyLength EntryCompletion
self Int
length =
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) CInt
arg2 -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO ()) -> IO ())
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> CInt -> IO ()
gtk_entry_completion_set_minimum_key_length Ptr EntryCompletion
argPtr1 CInt
arg2)
{-# LINE 267 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
length)

-- | Returns the minimum key length as set for @completion@.
--
entryCompletionGetMinimumKeyLength :: EntryCompletion
 -> IO Int -- ^ returns The currently used minimum key length.
entryCompletionGetMinimumKeyLength :: EntryCompletion -> IO Int
entryCompletionGetMinimumKeyLength EntryCompletion
self =
  (CInt -> Int) -> IO CInt -> IO Int
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (IO CInt -> IO Int) -> IO CInt -> IO Int
forall a b. (a -> b) -> a -> b
$
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO CInt) -> IO CInt)
-> (Ptr EntryCompletion -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> IO CInt
gtk_entry_completion_get_minimum_key_length Ptr EntryCompletion
argPtr1)
{-# LINE 277 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self

-- | Requests a completion operation, or in other words a refiltering of the
-- current list with completions, using the current key. The completion list
-- view will be updated accordingly.
--
entryCompletionComplete :: EntryCompletion -> IO ()
entryCompletionComplete :: EntryCompletion -> IO ()
entryCompletionComplete EntryCompletion
self =
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO ()) -> IO ())
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> IO ()
gtk_entry_completion_complete Ptr EntryCompletion
argPtr1)
{-# LINE 286 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self

-- | Inserts an action in @completion@'s action item list at position @index@
-- with text @text@. If you want the action item to have markup, use
-- 'entryCompletionInsertActionMarkup'.
--
entryCompletionInsertActionText :: GlibString string => EntryCompletion
 -> Int -- ^ @index@ - The index of the item to insert.
 -> string -- ^ @text@ - Text of the item to insert.
 -> IO ()
entryCompletionInsertActionText :: forall string.
GlibString string =>
EntryCompletion -> Int -> string -> IO ()
entryCompletionInsertActionText EntryCompletion
self Int
index string
text =
  string -> (Ptr CChar -> IO ()) -> IO ()
forall a. string -> (Ptr CChar -> IO a) -> IO a
forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
withUTFString string
text ((Ptr CChar -> IO ()) -> IO ()) -> (Ptr CChar -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
textPtr ->
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) CInt
arg2 Ptr CChar
arg3 -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO ()) -> IO ())
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> CInt -> Ptr CChar -> IO ()
gtk_entry_completion_insert_action_text Ptr EntryCompletion
argPtr1 CInt
arg2 Ptr CChar
arg3)
{-# LINE 299 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
index)
    Ptr CChar
textPtr

-- | Inserts an action in @completion@'s action item list at position @index@
-- with markup @markup@.
--
entryCompletionInsertActionMarkup :: GlibString string => EntryCompletion
 -> Int -- ^ @index@ - The index of the item to insert.
 -> string -- ^ @markup@ - Markup of the item to insert.
 -> IO ()
entryCompletionInsertActionMarkup :: forall string.
GlibString string =>
EntryCompletion -> Int -> string -> IO ()
entryCompletionInsertActionMarkup EntryCompletion
self Int
index string
markup =
  string -> (Ptr CChar -> IO ()) -> IO ()
forall a. string -> (Ptr CChar -> IO a) -> IO a
forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
withUTFString string
markup ((Ptr CChar -> IO ()) -> IO ()) -> (Ptr CChar -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
markupPtr ->
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) CInt
arg2 Ptr CChar
arg3 -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO ()) -> IO ())
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> CInt -> Ptr CChar -> IO ()
gtk_entry_completion_insert_action_markup Ptr EntryCompletion
argPtr1 CInt
arg2 Ptr CChar
arg3)
{-# LINE 313 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
index)
    Ptr CChar
markupPtr

-- | Deletes the action at @index@ from @completion@'s action list.
--
entryCompletionDeleteAction :: EntryCompletion
 -> Int -- ^ @index@ - The index of the item to Delete.
 -> IO ()
entryCompletionDeleteAction :: EntryCompletion -> Int -> IO ()
entryCompletionDeleteAction EntryCompletion
self Int
index =
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) CInt
arg2 -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO ()) -> IO ())
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> CInt -> IO ()
gtk_entry_completion_delete_action Ptr EntryCompletion
argPtr1 CInt
arg2)
{-# LINE 324 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
index)

-- | Convenience function for setting up the most used case of this code: a
-- completion list with just strings. This function will set up @completion@ to
-- have a list displaying all (and just) strings in the completion list, and to
-- get those strings from @column@ in the model of @completion@.
--
-- This functions creates and adds a 'CellRendererText' for the selected
-- column.
--
entryCompletionSetTextColumn :: GlibString string => EntryCompletion
 -> ColumnId row string -- ^ @column@ - The column in the model of @completion@ to
                        -- get strings from.
 -> IO ()
entryCompletionSetTextColumn :: forall string row.
GlibString string =>
EntryCompletion -> ColumnId row string -> IO ()
entryCompletionSetTextColumn EntryCompletion
self ColumnId row string
column =
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) CInt
arg2 -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO ()) -> IO ())
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> CInt -> IO ()
gtk_entry_completion_set_text_column Ptr EntryCompletion
argPtr1 CInt
arg2)
{-# LINE 341 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self
    ((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> (ColumnId row string -> Int) -> ColumnId row string -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ColumnId row string -> Int
forall row ty. ColumnId row ty -> Int
columnIdToNumber) ColumnId row string
column)


-- | Requests a prefix insertion.
--
-- * Available since Gtk+ version 2.6
--
entryCompletionInsertPrefix :: EntryCompletion -> IO ()
entryCompletionInsertPrefix :: EntryCompletion -> IO ()
entryCompletionInsertPrefix EntryCompletion
self =
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO ()) -> IO ())
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> IO ()
gtk_entry_completion_insert_prefix Ptr EntryCompletion
argPtr1)
{-# LINE 352 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self

-- | Returns the column in the model of the completion to get strings from.
--
-- * Available since Gtk+ version 2.6
--
entryCompletionGetTextColumn :: GlibString string => EntryCompletion
 -> IO (ColumnId row string) -- ^ returns the column containing the strings
entryCompletionGetTextColumn :: forall string row.
GlibString string =>
EntryCompletion -> IO (ColumnId row string)
entryCompletionGetTextColumn EntryCompletion
self =
  (CInt -> ColumnId row string)
-> IO CInt -> IO (ColumnId row string)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Int -> ColumnId row string
forall string row. GlibString string => Int -> ColumnId row string
makeColumnIdString (Int -> ColumnId row string)
-> (CInt -> Int) -> CInt -> ColumnId row string
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) (IO CInt -> IO (ColumnId row string))
-> IO CInt -> IO (ColumnId row string)
forall a b. (a -> b) -> a -> b
$
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO CInt) -> IO CInt)
-> (Ptr EntryCompletion -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> IO CInt
gtk_entry_completion_get_text_column Ptr EntryCompletion
argPtr1)
{-# LINE 363 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self

-- | Sets whether the common prefix of the possible completions should be
-- automatically inserted in the entry.
--
-- * Available since Gtk+ version 2.6
--
entryCompletionSetInlineCompletion :: EntryCompletion
 -> Bool -- ^ @inlineCompletion@ - @True@ to do inline completion
 -> IO ()
entryCompletionSetInlineCompletion :: EntryCompletion -> Bool -> IO ()
entryCompletionSetInlineCompletion EntryCompletion
self Bool
inlineCompletion =
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) CInt
arg2 -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO ()) -> IO ())
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> CInt -> IO ()
gtk_entry_completion_set_inline_completion Ptr EntryCompletion
argPtr1 CInt
arg2)
{-# LINE 375 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self
    (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
inlineCompletion)

-- | Returns whether the common prefix of the possible completions should be
-- automatically inserted in the entry.
--
-- * Available since Gtk+ version 2.6
--
entryCompletionGetInlineCompletion :: EntryCompletion
 -> IO Bool -- ^ returns @True@ if inline completion is turned on
entryCompletionGetInlineCompletion :: EntryCompletion -> IO Bool
entryCompletionGetInlineCompletion EntryCompletion
self =
  (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO CInt) -> IO CInt)
-> (Ptr EntryCompletion -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> IO CInt
gtk_entry_completion_get_inline_completion Ptr EntryCompletion
argPtr1)
{-# LINE 388 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self

-- | Sets whether the completions should be presented in a popup window.
--
-- * Available since Gtk+ version 2.6
--
entryCompletionSetPopupCompletion :: EntryCompletion
 -> Bool -- ^ @popupCompletion@ - @True@ to do popup completion
 -> IO ()
entryCompletionSetPopupCompletion :: EntryCompletion -> Bool -> IO ()
entryCompletionSetPopupCompletion EntryCompletion
self Bool
popupCompletion =
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) CInt
arg2 -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO ()) -> IO ())
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> CInt -> IO ()
gtk_entry_completion_set_popup_completion Ptr EntryCompletion
argPtr1 CInt
arg2)
{-# LINE 399 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self
    (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
popupCompletion)

-- | Returns whether the completions should be presented in a popup window.
--
-- * Available since Gtk+ version 2.6
--
entryCompletionGetPopupCompletion :: EntryCompletion
 -> IO Bool -- ^ returns @True@ if popup completion is turned on
entryCompletionGetPopupCompletion :: EntryCompletion -> IO Bool
entryCompletionGetPopupCompletion EntryCompletion
self =
  (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO CInt) -> IO CInt)
-> (Ptr EntryCompletion -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> IO CInt
gtk_entry_completion_get_popup_completion Ptr EntryCompletion
argPtr1)
{-# LINE 411 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self



-- | Sets whether the completion popup window will be resized to be the same
-- width as the entry.
--
-- * Available since Gtk+ version 2.8
--
entryCompletionSetPopupSetWidth :: EntryCompletion
 -> Bool -- ^ @popupSetWidth@ - @True@ to make the width of the
                    -- popup the same as the entry
 -> IO ()
entryCompletionSetPopupSetWidth :: EntryCompletion -> Bool -> IO ()
entryCompletionSetPopupSetWidth EntryCompletion
self Bool
popupSetWidth =
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) CInt
arg2 -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO ()) -> IO ())
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> CInt -> IO ()
gtk_entry_completion_set_popup_set_width Ptr EntryCompletion
argPtr1 CInt
arg2)
{-# LINE 426 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self
    (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
popupSetWidth)

-- | Returns whether the completion popup window will be resized to the width
-- of the entry.
--
-- * Available since Gtk+ version 2.8
--
entryCompletionGetPopupSetWidth :: EntryCompletion
 -> IO Bool -- ^ returns @True@ if the popup window will be resized to
                    -- the width of the entry
entryCompletionGetPopupSetWidth :: EntryCompletion -> IO Bool
entryCompletionGetPopupSetWidth EntryCompletion
self =
  (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO CInt) -> IO CInt)
-> (Ptr EntryCompletion -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> IO CInt
gtk_entry_completion_get_popup_set_width Ptr EntryCompletion
argPtr1)
{-# LINE 440 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self

-- | Sets whether the completion popup window will appear even if there is
-- only a single match. You may want to set this to @False@ if you are using
-- inline completion.
--
-- * Available since Gtk+ version 2.8
--
entryCompletionSetPopupSingleMatch :: EntryCompletion
 -> Bool -- ^ @popupSingleMatch@ - @True@ if the popup should
                    -- appear even for a single match
 -> IO ()
entryCompletionSetPopupSingleMatch :: EntryCompletion -> Bool -> IO ()
entryCompletionSetPopupSingleMatch EntryCompletion
self Bool
popupSingleMatch =
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) CInt
arg2 -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO ()) -> IO ())
-> (Ptr EntryCompletion -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> CInt -> IO ()
gtk_entry_completion_set_popup_single_match Ptr EntryCompletion
argPtr1 CInt
arg2)
{-# LINE 454 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self
    (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
popupSingleMatch)

-- | Returns whether the completion popup window will appear even if there is
-- only a single match.
--
-- * Available since Gtk+ version 2.8
--
entryCompletionGetPopupSingleMatch :: EntryCompletion
 -> IO Bool -- ^ returns @True@ if the popup window will appear
                    -- regardless of the number of matches.
entryCompletionGetPopupSingleMatch :: EntryCompletion -> IO Bool
entryCompletionGetPopupSingleMatch EntryCompletion
self =
  (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
  (\(EntryCompletion ForeignPtr EntryCompletion
arg1) -> ForeignPtr EntryCompletion
-> (Ptr EntryCompletion -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr EntryCompletion
arg1 ((Ptr EntryCompletion -> IO CInt) -> IO CInt)
-> (Ptr EntryCompletion -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr EntryCompletion
argPtr1 ->Ptr EntryCompletion -> IO CInt
gtk_entry_completion_get_popup_single_match Ptr EntryCompletion
argPtr1)
{-# LINE 468 "./Graphics/UI/Gtk/Entry/EntryCompletion.chs" #-}
    self


--------------------
-- Attributes

-- | The model to find matches in.
--
entryCompletionModel :: TreeModelClass model => ReadWriteAttr EntryCompletion (Maybe TreeModel) (Maybe model)
entryCompletionModel :: forall model.
TreeModelClass model =>
ReadWriteAttr EntryCompletion (Maybe TreeModel) (Maybe model)
entryCompletionModel = (EntryCompletion -> IO (Maybe TreeModel))
-> (EntryCompletion -> Maybe model -> IO ())
-> ReadWriteAttr EntryCompletion (Maybe TreeModel) (Maybe model)
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
  EntryCompletion -> IO (Maybe TreeModel)
entryCompletionGetModel
  EntryCompletion -> Maybe model -> IO ()
forall model.
TreeModelClass model =>
EntryCompletion -> Maybe model -> IO ()
entryCompletionSetModel

-- | Minimum length of the search key in order to look up matches.
--
-- Allowed values: >= 0
--
-- Default value: 1
--
entryCompletionMinimumKeyLength :: Attr EntryCompletion Int
entryCompletionMinimumKeyLength :: Attr EntryCompletion Int
entryCompletionMinimumKeyLength = (EntryCompletion -> IO Int)
-> (EntryCompletion -> Int -> IO ()) -> Attr EntryCompletion Int
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
  EntryCompletion -> IO Int
entryCompletionGetMinimumKeyLength
  EntryCompletion -> Int -> IO ()
entryCompletionSetMinimumKeyLength


-- | The column of the model containing the strings.
--
-- Default value: 'Graphics.UI.Gtk.ModelView.CustomStore.invalidColumnId'
--
entryCompletionTextColumn :: GlibString string => Attr EntryCompletion (ColumnId row string)
entryCompletionTextColumn :: forall string row.
GlibString string =>
Attr EntryCompletion (ColumnId row string)
entryCompletionTextColumn = (EntryCompletion -> IO (ColumnId row string))
-> (EntryCompletion -> ColumnId row string -> IO ())
-> ReadWriteAttr
     EntryCompletion (ColumnId row string) (ColumnId row string)
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
  EntryCompletion -> IO (ColumnId row string)
forall string row.
GlibString string =>
EntryCompletion -> IO (ColumnId row string)
entryCompletionGetTextColumn
  EntryCompletion -> ColumnId row string -> IO ()
forall string row.
GlibString string =>
EntryCompletion -> ColumnId row string -> IO ()
entryCompletionSetTextColumn

-- | Determines whether the common prefix of the possible completions should
-- be inserted automatically in the entry. Note that this requires text-column
-- to be set, even if you are using a custom match function.
--
-- Default value: @False@
--
entryCompletionInlineCompletion :: Attr EntryCompletion Bool
entryCompletionInlineCompletion :: Attr EntryCompletion Bool
entryCompletionInlineCompletion = (EntryCompletion -> IO Bool)
-> (EntryCompletion -> Bool -> IO ()) -> Attr EntryCompletion Bool
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
  EntryCompletion -> IO Bool
entryCompletionGetInlineCompletion
  EntryCompletion -> Bool -> IO ()
entryCompletionSetInlineCompletion

-- | Determines whether the possible completions should be shown in a popup
-- window.
--
-- Default value: @True@
--
entryCompletionPopupCompletion :: Attr EntryCompletion Bool
entryCompletionPopupCompletion :: Attr EntryCompletion Bool
entryCompletionPopupCompletion = (EntryCompletion -> IO Bool)
-> (EntryCompletion -> Bool -> IO ()) -> Attr EntryCompletion Bool
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
  EntryCompletion -> IO Bool
entryCompletionGetPopupCompletion
  EntryCompletion -> Bool -> IO ()
entryCompletionSetPopupCompletion



-- | Determines whether the completions popup window will be resized to the
-- width of the entry.
--
-- Default value: @True@
--
entryCompletionPopupSetWidth :: Attr EntryCompletion Bool
entryCompletionPopupSetWidth :: Attr EntryCompletion Bool
entryCompletionPopupSetWidth = (EntryCompletion -> IO Bool)
-> (EntryCompletion -> Bool -> IO ()) -> Attr EntryCompletion Bool
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
  EntryCompletion -> IO Bool
entryCompletionGetPopupSetWidth
  EntryCompletion -> Bool -> IO ()
entryCompletionSetPopupSetWidth

-- | Determines whether the completions popup window will shown for a single
-- possible completion. You probably want to set this to @False@ if you are
-- using inline completion.
--
-- Default value: @True@
--
entryCompletionPopupSingleMatch :: Attr EntryCompletion Bool
entryCompletionPopupSingleMatch :: Attr EntryCompletion Bool
entryCompletionPopupSingleMatch = (EntryCompletion -> IO Bool)
-> (EntryCompletion -> Bool -> IO ()) -> Attr EntryCompletion Bool
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
  EntryCompletion -> IO Bool
entryCompletionGetPopupSingleMatch
  EntryCompletion -> Bool -> IO ()
entryCompletionSetPopupSingleMatch


--------------------
-- Signals

-- %hash c:f4eb d:9ccf
-- | Gets emitted when the inline autocompletion is triggered. The default
-- behaviour is to make the entry display the whole prefix and select the newly
-- inserted part.
--
-- Applications may connect to this signal in order to insert only a smaller
-- part of the @prefix@ into the entry - e.g. the entry used in the
-- 'FileChooser' inserts only the part of the prefix up to the next \'\/\'.
--
-- * Available since Gtk+ version 2.6
--
insertPrefix :: (EntryCompletionClass self, GlibString string) => Signal self (string -> IO Bool)
insertPrefix :: forall self string.
(EntryCompletionClass self, GlibString string) =>
Signal self (string -> IO Bool)
insertPrefix = (Bool -> self -> (string -> IO Bool) -> IO (ConnectId self))
-> Signal self (string -> IO Bool)
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName
-> Bool -> self -> (string -> IO Bool) -> IO (ConnectId self)
forall a' obj.
(GlibString a', GObjectClass obj) =>
SignalName -> Bool -> obj -> (a' -> IO Bool) -> IO (ConnectId obj)
connect_GLIBSTRING__BOOL SignalName
"insert-prefix")


-- %hash c:d50e d:ad7e
-- | Gets emitted when a match from the list is selected. The default
-- behaviour is to replace the contents of the entry with the contents of the
-- text column in the row pointed to by @iter@.
--
matchSelected :: EntryCompletionClass self => Signal self (TreeModel -> TreeIter -> IO Bool)
matchSelected :: forall self.
EntryCompletionClass self =>
Signal self (TreeModel -> TreeIter -> IO Bool)
matchSelected = (Bool
 -> self
 -> (TreeModel -> TreeIter -> IO Bool)
 -> IO (ConnectId self))
-> Signal self (TreeModel -> TreeIter -> IO Bool)
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName
-> (Ptr TreeIter -> IO TreeIter)
-> Bool
-> self
-> (TreeModel -> TreeIter -> IO Bool)
-> IO (ConnectId self)
forall a' obj b' b.
(GObjectClass a', GObjectClass obj) =>
SignalName
-> (Ptr b' -> IO b)
-> Bool
-> obj
-> (a' -> b -> IO Bool)
-> IO (ConnectId obj)
connect_OBJECT_BOXED__BOOL SignalName
"match-selected" Ptr TreeIter -> IO TreeIter
peekTreeIter)

-- %hash c:21ac d:2cbc
-- | Gets emitted when an action is activated.
--
completionActionActivated :: EntryCompletionClass self => Signal self (Int -> IO ())
completionActionActivated :: forall self.
EntryCompletionClass self =>
Signal self (Int -> IO ())
completionActionActivated = (Bool -> self -> (Int -> IO ()) -> IO (ConnectId self))
-> Signal self (Int -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName -> Bool -> self -> (Int -> IO ()) -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
SignalName -> Bool -> obj -> (Int -> IO ()) -> IO (ConnectId obj)
connect_INT__NONE SignalName
"action-activated")

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))