gi-gtk-hs-0.3.8.0: A wrapper for gi-gtk, adding a few more idiomatic API parts on top
Stabilityprovisional
Portabilityportable (depends on GHC)
Safe HaskellNone
LanguageHaskell2010

Data.GI.Gtk.ModelView.TreeModel

Description

The tree interface used by TreeView.

Synopsis

Detail

The TreeModel interface defines a generic storage object for use by the TreeView and similar widgets. Specifically, the functions in defined here are used by Gtk's widgets to access the stored data. Thus, rather than calling these functions, an application programmer has to implement them. While the module Data.GI.Gtk.ModelView.CustomStore provides the necessary functions to implement the TreeMode interface, it is often sufficient to use the wo implementations that come with gi-gtk-hs, namely are ListStore and TreeStore.

The model is represented as a hierarchical tree of values. It is important to note that this interface only provides a way of examining a model and observing changes. The implementation of each individual model decides how and if changes are made.

Two generic models are provided that implement the TreeModel interface: the TreeStore and the ListStore. To use these, the developer simply inserts data into these models as necessary. These models provide the data structure as well as the TreeModel interface. In fact, they implement other interfaces, making drag and drop and storing data trivial.

A TreeModel stores records of the same type. Each record is referred to as row, just like in a relational database. Defining how the information of a row is displayed can be done in two ways: If the widget displays data using CellRenderer or one of its derivatives, it is possible to state how a row is mapped to the attributes of a renderer using the cellLayoutSetAttributes function. Some widgets do not use CellRenderers to display their data. In this case an extraction function can be defined that maps a row to one of a few basic types (like Strings or Ints). This extraction function is associated with a ColumnId using treeModelSetColumn. The latter can be set in the widget for the property that should be set. The widget then uses the function treeModelGetValue and the ColumnId to extract the value from the model. As the name suggests, using ColumnIds creates a view of the data as if each row were divided into a well-defined set of columns, again, like a relational database.

Models are accessed on a node level of granularity. There are two index types used to reference a particular node in a model. They are the TreePath and the TreeIter. Most of the interface consists of operations on a TreeIter.

A path is essentially a potential node. It is a location on a model that may or may not actually correspond to a node on a specific model. A TreePath is in fact a synonym for a list of Ints and hence are easy to manipulate. Each number refers to the offset at that level. Thus, the path [0] refers to the root node and the path [2,4] refers to the fifth child of the third node.

By contrast, a TreeIter is a reference to a specific node on a specific model. It is an abstract data type filled in by the model. One can convert a path to an iterator by calling treeModelGetIter. These iterators are the primary way of accessing a model and are similar to the iterators used by TextBuffer. The model interface defines a set of operations using them for navigating the model. Iterators are expected to always be valid for as long as the model is unchanged (and doesn't emit a signal).

Class Hierarchy

|  GInterface
|   +----TreeModel
|   +--------TypedTreeModel

class (GObject o, IsDescendantOf TreeModel o) => IsTreeModel o #

Instances

Instances details
(GObject o, IsDescendantOf TreeModel o) => IsTreeModel o 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

type family ResolveTreeModelMethod (t :: Symbol) o where ... #

Equations

ResolveTreeModelMethod "bindProperty" o = ObjectBindPropertyMethodInfo 
ResolveTreeModelMethod "bindPropertyFull" o = ObjectBindPropertyFullMethodInfo 
ResolveTreeModelMethod "filterNew" o = TreeModelFilterNewMethodInfo 
ResolveTreeModelMethod "forceFloating" o = ObjectForceFloatingMethodInfo 
ResolveTreeModelMethod "foreach" o = TreeModelForeachMethodInfo 
ResolveTreeModelMethod "freezeNotify" o = ObjectFreezeNotifyMethodInfo 
ResolveTreeModelMethod "getv" o = ObjectGetvMethodInfo 
ResolveTreeModelMethod "isFloating" o = ObjectIsFloatingMethodInfo 
ResolveTreeModelMethod "iterChildren" o = TreeModelIterChildrenMethodInfo 
ResolveTreeModelMethod "iterHasChild" o = TreeModelIterHasChildMethodInfo 
ResolveTreeModelMethod "iterNChildren" o = TreeModelIterNChildrenMethodInfo 
ResolveTreeModelMethod "iterNext" o = TreeModelIterNextMethodInfo 
ResolveTreeModelMethod "iterNthChild" o = TreeModelIterNthChildMethodInfo 
ResolveTreeModelMethod "iterParent" o = TreeModelIterParentMethodInfo 
ResolveTreeModelMethod "iterPrevious" o = TreeModelIterPreviousMethodInfo 
ResolveTreeModelMethod "notify" o = ObjectNotifyMethodInfo 
ResolveTreeModelMethod "notifyByPspec" o = ObjectNotifyByPspecMethodInfo 
ResolveTreeModelMethod "ref" o = ObjectRefMethodInfo 
ResolveTreeModelMethod "refNode" o = TreeModelRefNodeMethodInfo 
ResolveTreeModelMethod "refSink" o = ObjectRefSinkMethodInfo 
ResolveTreeModelMethod "rowChanged" o = TreeModelRowChangedMethodInfo 
ResolveTreeModelMethod "rowDeleted" o = TreeModelRowDeletedMethodInfo 
ResolveTreeModelMethod "rowHasChildToggled" o = TreeModelRowHasChildToggledMethodInfo 
ResolveTreeModelMethod "rowInserted" o = TreeModelRowInsertedMethodInfo 
ResolveTreeModelMethod "rowsReordered" o = TreeModelRowsReorderedMethodInfo 
ResolveTreeModelMethod "runDispose" o = ObjectRunDisposeMethodInfo 
ResolveTreeModelMethod "sortNewWithModel" o = TreeModelSortNewWithModelMethodInfo 
ResolveTreeModelMethod "stealData" o = ObjectStealDataMethodInfo 
ResolveTreeModelMethod "stealQdata" o = ObjectStealQdataMethodInfo 
ResolveTreeModelMethod "thawNotify" o = ObjectThawNotifyMethodInfo 
ResolveTreeModelMethod "unref" o = ObjectUnrefMethodInfo 
ResolveTreeModelMethod "unrefNode" o = TreeModelUnrefNodeMethodInfo 
ResolveTreeModelMethod "watchClosure" o = ObjectWatchClosureMethodInfo 
ResolveTreeModelMethod "getColumnType" o = TreeModelGetColumnTypeMethodInfo 
ResolveTreeModelMethod "getData" o = ObjectGetDataMethodInfo 
ResolveTreeModelMethod "getFlags" o = TreeModelGetFlagsMethodInfo 
ResolveTreeModelMethod "getIter" o = TreeModelGetIterMethodInfo 
ResolveTreeModelMethod "getIterFirst" o = TreeModelGetIterFirstMethodInfo 
ResolveTreeModelMethod "getIterFromString" o = TreeModelGetIterFromStringMethodInfo 
ResolveTreeModelMethod "getNColumns" o = TreeModelGetNColumnsMethodInfo 
ResolveTreeModelMethod "getPath" o = TreeModelGetPathMethodInfo 
ResolveTreeModelMethod "getProperty" o = ObjectGetPropertyMethodInfo 
ResolveTreeModelMethod "getQdata" o = ObjectGetQdataMethodInfo 
ResolveTreeModelMethod "getStringFromIter" o = TreeModelGetStringFromIterMethodInfo 
ResolveTreeModelMethod "getValue" o = TreeModelGetValueMethodInfo 
ResolveTreeModelMethod "setData" o = ObjectSetDataMethodInfo 
ResolveTreeModelMethod "setDataFull" o = ObjectSetDataFullMethodInfo 
ResolveTreeModelMethod "setProperty" o = ObjectSetPropertyMethodInfo 
ResolveTreeModelMethod l o = MethodResolutionFailed l o :: Type 

newtype TreeModel #

Instances

Instances details
Eq TreeModel 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

IsGValue TreeModel 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

GObject TreeModel 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

gobjectType :: IO GType #

HasParentTypes TreeModel 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

(info ~ ResolveTreeModelMethod t TreeModel, MethodInfo info TreeModel p) => IsLabel t (TreeModel -> p) 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

fromLabel :: TreeModel -> p #

HasAttributeList TreeModel 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

type ParentTypes TreeModel 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

type AttributeList TreeModel 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

type AttributeList TreeModel = TreeModelAttributeList
type SignalList TreeModel 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

type SignalList TreeModel = TreeModelSignalList

data TreeModelFilterNewMethodInfo #

Instances

Instances details
(signature ~ (Maybe TreePath -> m TreeModel), MonadIO m, IsTreeModel a) => MethodInfo TreeModelFilterNewMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelForeachMethodInfo #

Instances

Instances details
(signature ~ (TreeModelForeachFunc -> m ()), MonadIO m, IsTreeModel a) => MethodInfo TreeModelForeachMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelGetColumnTypeMethodInfo #

Instances

Instances details
(signature ~ (Int32 -> m GType), MonadIO m, IsTreeModel a) => MethodInfo TreeModelGetColumnTypeMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelGetFlagsMethodInfo #

Instances

Instances details
(signature ~ m [TreeModelFlags], MonadIO m, IsTreeModel a) => MethodInfo TreeModelGetFlagsMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelGetIterFirstMethodInfo #

Instances

Instances details
(signature ~ m (Bool, TreeIter), MonadIO m, IsTreeModel a) => MethodInfo TreeModelGetIterFirstMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelGetIterFromStringMethodInfo #

Instances

Instances details
(signature ~ (Text -> m (Bool, TreeIter)), MonadIO m, IsTreeModel a) => MethodInfo TreeModelGetIterFromStringMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelGetIterMethodInfo #

Instances

Instances details
(signature ~ (TreePath -> m (Bool, TreeIter)), MonadIO m, IsTreeModel a) => MethodInfo TreeModelGetIterMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelGetNColumnsMethodInfo #

Instances

Instances details
(signature ~ m Int32, MonadIO m, IsTreeModel a) => MethodInfo TreeModelGetNColumnsMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelGetPathMethodInfo #

Instances

Instances details
(signature ~ (TreeIter -> m TreePath), MonadIO m, IsTreeModel a) => MethodInfo TreeModelGetPathMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelGetStringFromIterMethodInfo #

Instances

Instances details
(signature ~ (TreeIter -> m Text), MonadIO m, IsTreeModel a) => MethodInfo TreeModelGetStringFromIterMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelGetValueMethodInfo #

Instances

Instances details
(signature ~ (TreeIter -> Int32 -> m GValue), MonadIO m, IsTreeModel a) => MethodInfo TreeModelGetValueMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelIterChildrenMethodInfo #

Instances

Instances details
(signature ~ (Maybe TreeIter -> m (Bool, TreeIter)), MonadIO m, IsTreeModel a) => MethodInfo TreeModelIterChildrenMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelIterHasChildMethodInfo #

Instances

Instances details
(signature ~ (TreeIter -> m Bool), MonadIO m, IsTreeModel a) => MethodInfo TreeModelIterHasChildMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelIterNChildrenMethodInfo #

Instances

Instances details
(signature ~ (Maybe TreeIter -> m Int32), MonadIO m, IsTreeModel a) => MethodInfo TreeModelIterNChildrenMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelIterNextMethodInfo #

Instances

Instances details
(signature ~ (TreeIter -> m Bool), MonadIO m, IsTreeModel a) => MethodInfo TreeModelIterNextMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelIterNthChildMethodInfo #

Instances

Instances details
(signature ~ (Maybe TreeIter -> Int32 -> m (Bool, TreeIter)), MonadIO m, IsTreeModel a) => MethodInfo TreeModelIterNthChildMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelIterParentMethodInfo #

Instances

Instances details
(signature ~ (TreeIter -> m (Bool, TreeIter)), MonadIO m, IsTreeModel a) => MethodInfo TreeModelIterParentMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelIterPreviousMethodInfo #

Instances

Instances details
(signature ~ (TreeIter -> m Bool), MonadIO m, IsTreeModel a) => MethodInfo TreeModelIterPreviousMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelRefNodeMethodInfo #

Instances

Instances details
(signature ~ (TreeIter -> m ()), MonadIO m, IsTreeModel a) => MethodInfo TreeModelRefNodeMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelRowChangedMethodInfo #

Instances

Instances details
(signature ~ (TreePath -> TreeIter -> m ()), MonadIO m, IsTreeModel a) => MethodInfo TreeModelRowChangedMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelRowDeletedMethodInfo #

Instances

Instances details
(signature ~ (TreePath -> m ()), MonadIO m, IsTreeModel a) => MethodInfo TreeModelRowDeletedMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelRowHasChildToggledMethodInfo #

Instances

Instances details
(signature ~ (TreePath -> TreeIter -> m ()), MonadIO m, IsTreeModel a) => MethodInfo TreeModelRowHasChildToggledMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelRowInsertedMethodInfo #

Instances

Instances details
(signature ~ (TreePath -> TreeIter -> m ()), MonadIO m, IsTreeModel a) => MethodInfo TreeModelRowInsertedMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelRowsReorderedMethodInfo #

Instances

Instances details
(signature ~ (TreePath -> Maybe TreeIter -> [Int32] -> m ()), MonadIO m, IsTreeModel a) => MethodInfo TreeModelRowsReorderedMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelSortNewWithModelMethodInfo #

Instances

Instances details
(signature ~ m TreeModel, MonadIO m, IsTreeModel a) => MethodInfo TreeModelSortNewWithModelMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data TreeModelUnrefNodeMethodInfo #

Instances

Instances details
(signature ~ (TreeIter -> m ()), MonadIO m, IsTreeModel a) => MethodInfo TreeModelUnrefNodeMethodInfo a signature 
Instance details

Defined in GI.Gtk.Interfaces.TreeModel

Methods

overloadedMethod :: a -> signature #

data ColumnId row ty Source #

The type of a tree column.

Instances

Instances details
Eq (ColumnId row ty) Source # 
Instance details

Defined in Data.GI.Gtk.ModelView.TreeModel

Methods

(==) :: ColumnId row ty -> ColumnId row ty -> Bool #

(/=) :: ColumnId row ty -> ColumnId row ty -> Bool #

Show (ColumnId row ty) Source # 
Instance details

Defined in Data.GI.Gtk.ModelView.TreeModel

Methods

showsPrec :: Int -> ColumnId row ty -> ShowS #

show :: ColumnId row ty -> String #

showList :: [ColumnId row ty] -> ShowS #

Constructors

makeColumnIdInt :: Int32 -> ColumnId row Int32 Source #

Create a ColumnId to extract an integer.

makeColumnIdBool :: Int32 -> ColumnId row Bool Source #

Create a ColumnId to extract an Boolean.

makeColumnIdString :: Int32 -> ColumnId row Text Source #

Create a ColumnId to extract an string.

makeColumnIdPixbuf :: Int32 -> ColumnId row Pixbuf Source #

Create a ColumnId to extract an Pixbuf.

invalidColumnId :: ColumnId row ty Source #

The invalid ColumnId. Widgets use this value if no column id has been set.

Methods

columnIdToNumber :: ColumnId row ty -> Int32 Source #

Convert a ColumnId to a bare number.

stringToTreePath :: Text -> [Int32] Source #

Convert a comma or colon separated string into a TreePath. Any non-digit characters are assumed to separate indices, thus, the function always is always successful.

treeModelGetValue Source #

Arguments

:: IsTreeModel self 
=> self 
-> TreeIter 
-> ColumnId row ty

column - The column to lookup the value at.

-> IO ty 

Read the value of at a specific column and TreeIter.

treeModelGetIter :: (MonadIO m, IsTreeModel model) => model -> TreePath -> m (Maybe TreeIter) Source #

Gets the a TreeIter or Nothing if the path is invalid or empty

Orphan instances

Eq (ColumnId row ty) Source # 
Instance details

Methods

(==) :: ColumnId row ty -> ColumnId row ty -> Bool #

(/=) :: ColumnId row ty -> ColumnId row ty -> Bool #

Show (ColumnId row ty) Source # 
Instance details

Methods

showsPrec :: Int -> ColumnId row ty -> ShowS #

show :: ColumnId row ty -> String #

showList :: [ColumnId row ty] -> ShowS #