Package ch.bailu.gtk.gtk
Klasse MapListModel
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.type.PropertyHolder
ch.bailu.gtk.gtk.MapListModel
- Alle implementierten Schnittstellen:
PointerInterface
A list model that maps the items in another model to different items.
`GtkMapListModel` uses a [callback@Gtk.MapListModelMapFunc].
Example: Create a list of `GtkEventControllers`
```c
static gpointer
map_to_controllers (gpointer widget,
gpointer data)
{
gpointer result = gtk_widget_observe_controllers (widget);
g_object_unref (widget);
return result;
}
widgets = gtk_widget_observe_children (widget);
controllers = gtk_map_list_model_new (widgets,
map_to_controllers,
NULL, NULL);
model = gtk_flatten_list_model_new (GTK_TYPE_EVENT_CONTROLLER,
controllers);
```
`GtkMapListModel` will attempt to discard the mapped objects as soon as
they are no longer needed and recreate them if necessary.
`GtkMapListModel` passes through sections from the underlying model.
`GtkMapListModel` uses a [callback@Gtk.MapListModelMapFunc].
Example: Create a list of `GtkEventControllers`
```c
static gpointer
map_to_controllers (gpointer widget,
gpointer data)
{
gpointer result = gtk_widget_observe_controllers (widget);
g_object_unref (widget);
return result;
}
widgets = gtk_widget_observe_children (widget);
controllers = gtk_map_list_model_new (widgets,
map_to_controllers,
NULL, NULL);
model = gtk_flatten_list_model_new (GTK_TYPE_EVENT_CONTROLLER,
controllers);
```
`GtkMapListModel` will attempt to discard the mapped objects as soon as
they are no longer needed and recreate them if necessary.
`GtkMapListModel` passes through sections from the underlying model.
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic interface
static interface
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
Von Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungMapListModel
(ListModel model, MapListModel.OnMapListModelMapFunc map_func, Pointer user_data, MapListModel.OnDestroyNotify user_destroy) Creates a new `GtkMapListModel` for the given arguments.MapListModel
(PointerContainer pointer) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungImplements interfaceListModel
.Implements interfaceSectionModel
.static ClassHandler
static int
getModel()
Gets the model that is currently being mapped or %NULL if none.static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
boolean
hasMap()
Checks if a map function is currently set on @self.void
setMapFunc
(MapListModel.OnMapListModelMapFunc map_func, Pointer user_data, MapListModel.OnDestroyNotify user_destroy) Sets the function used to map items.void
Sets the model to be mapped.Von Klasse geerbte Methoden ch.bailu.gtk.type.PropertyHolder
getBooleanProperty, getIntProperty, getObjectProperty, getStringProperty, getStrProperty, setBooleanProperty, setIntProperty, setObjectProperty, setStringProperty, setStrProperty
Von Klasse geerbte Methoden ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Konstruktordetails
-
MapListModel
-
MapListModel
public MapListModel(@Nullable ListModel model, MapListModel.OnMapListModelMapFunc map_func, @Nullable Pointer user_data, MapListModel.OnDestroyNotify user_destroy) Creates a new `GtkMapListModel` for the given arguments.- Parameter:
model
- The model to mapmap_func
- map functionuser_data
- user data passed to @map_funcuser_destroy
- destroy notifier for @user_data
-
-
Methodendetails
-
getClassHandler
-
getModel
Gets the model that is currently being mapped or %NULL if none.- Gibt zurück:
- The model that gets mapped
-
hasMap
public boolean hasMap()Checks if a map function is currently set on @self.- Gibt zurück:
- %TRUE if a map function is set
-
setMapFunc
public void setMapFunc(MapListModel.OnMapListModelMapFunc map_func, @Nullable Pointer user_data, MapListModel.OnDestroyNotify user_destroy) Sets the function used to map items.
The function will be called whenever an item needs to be mapped
and must return the item to use for the given input item.
Note that `GtkMapListModel` may call this function multiple times
on the same item, because it may delete items it doesn't need anymore.
GTK makes no effort to ensure that @map_func conforms to the item type
of @self. It assumes that the caller knows what they are doing and the map
function returns items of the appropriate type.- Parameter:
map_func
- map functionuser_data
- user data passed to @map_funcuser_destroy
- destroy notifier for @user_data
-
setModel
Sets the model to be mapped.
GTK makes no effort to ensure that @model conforms to the item type
expected by the map function. It assumes that the caller knows what
they are doing and have set up an appropriate map function.- Parameter:
model
- The model to be mapped
-
asListModel
Implements interfaceListModel
. Call this to get access to interface functions.- Gibt zurück:
ListModel
-
asSectionModel
Implements interfaceSectionModel
. Call this to get access to interface functions.- Gibt zurück:
SectionModel
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-