| Copyright | Will Thompson and Iñaki García Etxebarria | 
|---|---|
| License | LGPL-2.1 | 
| Maintainer | Iñaki García Etxebarria | 
| Safe Haskell | None | 
| Language | Haskell2010 | 
GI.Gtk.Objects.StringList
Description
GtkStringList is a list model that wraps an array of strings.
The objects in the model are of type StringObject and have
 a "string" property that can be used inside expressions.
GtkStringList is well-suited for any place where you would
 typically use a char*[], but need a list model.
GtkStringList as GtkBuildable
The GtkStringList implementation of the GtkBuildable interface
 supports adding items directly using the <items> element and
 specifying <item> elements for each item. Each <item> element
 supports the regular translation attributes “translatable”,
 “context” and “comments”.
Here is a UI definition fragment specifying a GtkStringList
xml code
<object class="GtkStringList">
  <items>
    <item translatable="yes">Factory</item>
    <item translatable="yes">Home</item>
    <item translatable="yes">Subway</item>
  </items>
</object>Synopsis
- newtype StringList = StringList (ManagedPtr StringList)
 - class (GObject o, IsDescendantOf StringList o) => IsStringList o
 - toStringList :: (MonadIO m, IsStringList o) => o -> m StringList
 - stringListAppend :: (HasCallStack, MonadIO m, IsStringList a) => a -> Text -> m ()
 - stringListGetString :: (HasCallStack, MonadIO m, IsStringList a) => a -> Word32 -> m (Maybe Text)
 - stringListNew :: (HasCallStack, MonadIO m) => Maybe [Text] -> m StringList
 - stringListRemove :: (HasCallStack, MonadIO m, IsStringList a) => a -> Word32 -> m ()
 - stringListSplice :: (HasCallStack, MonadIO m, IsStringList a) => a -> Word32 -> Word32 -> Maybe [Text] -> m ()
 - stringListTake :: (HasCallStack, MonadIO m, IsStringList a) => a -> Text -> m ()
 - getStringListItemType :: (MonadIO m, IsStringList o) => o -> m GType
 - getStringListNItems :: (MonadIO m, IsStringList o) => o -> m Word32
 - constructStringListStrings :: (IsStringList o, MonadIO m) => [Text] -> m (GValueConstruct o)
 
Exported types
newtype StringList Source #
Memory-managed wrapper type.
Constructors
| StringList (ManagedPtr StringList) | 
Instances
| Eq StringList Source # | |
Defined in GI.Gtk.Objects.StringList  | |
| GObject StringList Source # | |
Defined in GI.Gtk.Objects.StringList  | |
| ManagedPtrNewtype StringList Source # | |
Defined in GI.Gtk.Objects.StringList Methods  | |
| TypedObject StringList Source # | |
Defined in GI.Gtk.Objects.StringList  | |
| HasParentTypes StringList Source # | |
Defined in GI.Gtk.Objects.StringList  | |
| IsGValue (Maybe StringList) Source # | Convert   | 
Defined in GI.Gtk.Objects.StringList Methods gvalueGType_ :: IO GType # gvalueSet_ :: Ptr GValue -> Maybe StringList -> IO () # gvalueGet_ :: Ptr GValue -> IO (Maybe StringList) #  | |
| type ParentTypes StringList Source # | |
Defined in GI.Gtk.Objects.StringList  | |
class (GObject o, IsDescendantOf StringList o) => IsStringList o Source #
Type class for types which can be safely cast to StringList, for instance with toStringList.
Instances
| (GObject o, IsDescendantOf StringList o) => IsStringList o Source # | |
Defined in GI.Gtk.Objects.StringList  | |
toStringList :: (MonadIO m, IsStringList o) => o -> m StringList Source #
Cast to StringList, for types for which this is known to be safe. For general casts, use castTo.
Methods
Click to display all available methods, including inherited ones
Methods
append, bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, itemsChanged, notify, notifyByPspec, ref, refSink, remove, runDispose, splice, stealData, stealQdata, take, thawNotify, unref, watchClosure.
Getters
getBuildableId, getData, getItem, getItemType, getNItems, getProperty, getQdata, getString.
Setters
append
Arguments
| :: (HasCallStack, MonadIO m, IsStringList a) | |
| => a | 
  | 
| -> Text | 
  | 
| -> m () | 
Appends string to self.
The string will be copied. See
 stringListTake for a way to avoid that.
getString
Arguments
| :: (HasCallStack, MonadIO m, IsStringList a) | |
| => a | 
  | 
| -> Word32 | 
  | 
| -> m (Maybe Text) | Returns: the string at the given position  | 
Gets the string that is at position in self.
If self does not contain position items, Nothing is returned.
This function returns the const char *. To get the
 object wrapping it, use g_list_model_get_item().
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Maybe [Text] | 
  | 
| -> m StringList | Returns: a new   | 
Creates a new GtkStringList with the given strings.
remove
Arguments
| :: (HasCallStack, MonadIO m, IsStringList a) | |
| => a | 
  | 
| -> Word32 | 
  | 
| -> m () | 
Removes the string at position from self.
position must be smaller than the current
 length of the list.
splice
Arguments
| :: (HasCallStack, MonadIO m, IsStringList a) | |
| => a | 
  | 
| -> Word32 | 
  | 
| -> Word32 | 
  | 
| -> Maybe [Text] | 
  | 
| -> m () | 
Changes self by removing nRemovals strings and adding additions
 to it.
This function is more efficient than stringListAppend
 and stringListRemove, because it only emits the
 itemsChanged signal once for the change.
This function copies the strings in additions.
The parameters position and nRemovals must be correct (ie:
 position + nRemovals must be less than or equal to the length
 of the list at the time this function is called).
take
Arguments
| :: (HasCallStack, MonadIO m, IsStringList a) | |
| => a | 
  | 
| -> Text | 
  | 
| -> m () | 
Adds string to self at the end, and takes
 ownership of it.
This variant of stringListAppend
 is convenient for formatting strings:
c code
gtk_string_list_take (self, g_strdup_print ("%d dollars", lots));Properties
itemType
The type of items. See listModelGetItemType.
Since: 4.14
getStringListItemType :: (MonadIO m, IsStringList o) => o -> m GType Source #
Get the value of the “item-type” property.
 When overloading is enabled, this is equivalent to
get stringList #itemType
nItems
The number of items. See listModelGetNItems.
Since: 4.14
getStringListNItems :: (MonadIO m, IsStringList o) => o -> m Word32 Source #
Get the value of the “n-items” property.
 When overloading is enabled, this is equivalent to
get stringList #nItems
strings
The strings in the model.
Since: 4.10
constructStringListStrings :: (IsStringList o, MonadIO m) => [Text] -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “strings” property. This is rarely needed directly, but it is used by new.