<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
<!ENTITY pi "&#960;">
<!ENTITY solidus "&#8260;">
]>
<refentry id="GtkSliceListModel">
<refmeta>
<refentrytitle role="top_of_page" id="GtkSliceListModel.top_of_page">GtkSliceListModel</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GtkSliceListModel</refname>
<refpurpose>A list model that presents a slice out of a larger list</refpurpose>
</refnamediv>

<refsect1 id="GtkSliceListModel.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="GtkSliceListModel"><returnvalue>GtkSliceListModel</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-slice-list-model-new">gtk_slice_list_model_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GtkSliceListModel"><returnvalue>GtkSliceListModel</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-slice-list-model-new-for-type">gtk_slice_list_model_new_for_type</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-slice-list-model-set-model">gtk_slice_list_model_set_model</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GListModel"><returnvalue>GListModel</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-slice-list-model-get-model">gtk_slice_list_model_get_model</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-slice-list-model-set-offset">gtk_slice_list_model_set_offset</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-slice-list-model-get-offset">gtk_slice_list_model_get_offset</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-slice-list-model-set-size">gtk_slice_list_model_set_size</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-slice-list-model-get-size">gtk_slice_list_model_get_size</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkSliceListModel.properties" role="properties">
<title role="properties.title">Properties</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="properties_type" colwidth="150px"/>
<colspec colname="properties_name" colwidth="300px"/>
<colspec colname="properties_flags" colwidth="200px"/>
<tbody>
<row><entry role="property_type"><link linkend="GType"><type>GType</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkSliceListModel--item-type">item-type</link></entry><entry role="property_flags">Read / Write / Construct&#160;Only</entry></row>
<row><entry role="property_type"><link linkend="GListModel"><type>GListModel</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkSliceListModel--model">model</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="guint"><type>guint</type></link></entry><entry role="property_name"><link linkend="GtkSliceListModel--offset">offset</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="guint"><type>guint</type></link></entry><entry role="property_name"><link linkend="GtkSliceListModel--size">size</link></entry><entry role="property_flags">Read / Write</entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkSliceListModel.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GtkSliceListModel-struct">GtkSliceListModel</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkSliceListModel.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<screen>    <link linkend="GObject">GObject</link>
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GtkSliceListModel
</screen>
</refsect1>
<refsect1 id="GtkSliceListModel.implemented-interfaces" role="impl_interfaces">
<title role="impl_interfaces.title">Implemented Interfaces</title>
<para>
GtkSliceListModel implements
 <link linkend="GListModel">GListModel</link>.</para>

</refsect1>

<refsect1 id="GtkSliceListModel.includes"><title>Includes</title><synopsis>#include &lt;gtk/gtk.h&gt;
</synopsis></refsect1>

<refsect1 id="GtkSliceListModel.description" role="desc">
<title role="desc.title">Description</title>
<para><link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link> is a list model that takes a list model and presents a slice of
that model.</para>
<para>This is useful when implementing paging by setting the size to the number of elements
per page and updating the offset whenever a different page is opened.</para>

</refsect1>
<refsect1 id="GtkSliceListModel.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gtk-slice-list-model-new" role="function">
<title>gtk_slice_list_model_new&#160;()</title>
<indexterm zone="gtk-slice-list-model-new"><primary>gtk_slice_list_model_new</primary></indexterm>
<programlisting language="C"><link linkend="GtkSliceListModel"><returnvalue>GtkSliceListModel</returnvalue></link>&#160;*
gtk_slice_list_model_new (<parameter><link linkend="GListModel"><type>GListModel</type></link> *model</parameter>,
                          <parameter><link linkend="guint"><type>guint</type></link> offset</parameter>,
                          <parameter><link linkend="guint"><type>guint</type></link> size</parameter>);</programlisting>
<para>Creates a new slice model that presents the slice from <parameter>offset</parameter>
 to
<parameter>offset</parameter>
 + <parameter>size</parameter>
 our of the given <parameter>model</parameter>
.</para>
<refsect3 id="gtk-slice-list-model-new.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>model</para></entry>
<entry role="parameter_description"><para>The model to use. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>offset</para></entry>
<entry role="parameter_description"><para>the offset of the slice</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>size</para></entry>
<entry role="parameter_description"><para>maximum size of the slice</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-slice-list-model-new.returns" role="returns">
<title>Returns</title>
<para> A new <link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link></para>
</refsect3></refsect2>
<refsect2 id="gtk-slice-list-model-new-for-type" role="function">
<title>gtk_slice_list_model_new_for_type&#160;()</title>
<indexterm zone="gtk-slice-list-model-new-for-type"><primary>gtk_slice_list_model_new_for_type</primary></indexterm>
<programlisting language="C"><link linkend="GtkSliceListModel"><returnvalue>GtkSliceListModel</returnvalue></link>&#160;*
gtk_slice_list_model_new_for_type (<parameter><link linkend="GType"><type>GType</type></link> item_type</parameter>);</programlisting>
<para>Creates a new empty <link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link> for the given <parameter>item_type</parameter>
 that
can be set up later.</para>
<refsect3 id="gtk-slice-list-model-new-for-type.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>item_type</para></entry>
<entry role="parameter_description"><para>the type of items</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-slice-list-model-new-for-type.returns" role="returns">
<title>Returns</title>
<para> a new empty <link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link></para>
</refsect3></refsect2>
<refsect2 id="gtk-slice-list-model-set-model" role="function">
<title>gtk_slice_list_model_set_model&#160;()</title>
<indexterm zone="gtk-slice-list-model-set-model"><primary>gtk_slice_list_model_set_model</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_slice_list_model_set_model (<parameter><link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link> *self</parameter>,
                                <parameter><link linkend="GListModel"><type>GListModel</type></link> *model</parameter>);</programlisting>
<para>Sets the model to show a slice of. The model's item type must conform
to <parameter>self</parameter>
's item type.</para>
<refsect3 id="gtk-slice-list-model-set-model.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>self</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>model</para></entry>
<entry role="parameter_description"><para>The model to be sliced. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-slice-list-model-get-model" role="function">
<title>gtk_slice_list_model_get_model&#160;()</title>
<indexterm zone="gtk-slice-list-model-get-model"><primary>gtk_slice_list_model_get_model</primary></indexterm>
<programlisting language="C"><link linkend="GListModel"><returnvalue>GListModel</returnvalue></link>&#160;*
gtk_slice_list_model_get_model (<parameter><link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link> *self</parameter>);</programlisting>
<para>Gets the model that is curently being used or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if none.</para>
<refsect3 id="gtk-slice-list-model-get-model.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>self</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-slice-list-model-get-model.returns" role="returns">
<title>Returns</title>
<para>The model in use. </para>
<para><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="gtk-slice-list-model-set-offset" role="function">
<title>gtk_slice_list_model_set_offset&#160;()</title>
<indexterm zone="gtk-slice-list-model-set-offset"><primary>gtk_slice_list_model_set_offset</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_slice_list_model_set_offset (<parameter><link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link> *self</parameter>,
                                 <parameter><link linkend="guint"><type>guint</type></link> offset</parameter>);</programlisting>
<para>Sets the offset into the original model for this slice.</para>
<para>If the offset is too large for the sliced model,
<parameter>self</parameter>
 will end up empty.</para>
<refsect3 id="gtk-slice-list-model-set-offset.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>self</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>offset</para></entry>
<entry role="parameter_description"><para>the new offset to use</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-slice-list-model-get-offset" role="function">
<title>gtk_slice_list_model_get_offset&#160;()</title>
<indexterm zone="gtk-slice-list-model-get-offset"><primary>gtk_slice_list_model_get_offset</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gtk_slice_list_model_get_offset (<parameter><link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link> *self</parameter>);</programlisting>
<para>Gets the offset set via <link linkend="gtk-slice-list-model-set-offset"><function>gtk_slice_list_model_set_offset()</function></link></para>
<refsect3 id="gtk-slice-list-model-get-offset.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>self</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-slice-list-model-get-offset.returns" role="returns">
<title>Returns</title>
<para> The offset</para>
</refsect3></refsect2>
<refsect2 id="gtk-slice-list-model-set-size" role="function">
<title>gtk_slice_list_model_set_size&#160;()</title>
<indexterm zone="gtk-slice-list-model-set-size"><primary>gtk_slice_list_model_set_size</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_slice_list_model_set_size (<parameter><link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link> *self</parameter>,
                               <parameter><link linkend="guint"><type>guint</type></link> size</parameter>);</programlisting>
<para>Sets the maximum size. <parameter>self</parameter>
 will never have more items
than <parameter>size</parameter>
.</para>
<para>It can however have fewer items if the offset is too large or
the model sliced from doesn't have enough items.</para>
<refsect3 id="gtk-slice-list-model-set-size.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>self</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>size</para></entry>
<entry role="parameter_description"><para>the maximum size</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-slice-list-model-get-size" role="function">
<title>gtk_slice_list_model_get_size&#160;()</title>
<indexterm zone="gtk-slice-list-model-get-size"><primary>gtk_slice_list_model_get_size</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gtk_slice_list_model_get_size (<parameter><link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link> *self</parameter>);</programlisting>
<para>Gets the size set via <link linkend="gtk-slice-list-model-set-size"><function>gtk_slice_list_model_set_size()</function></link>.</para>
<refsect3 id="gtk-slice-list-model-get-size.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>self</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkSliceListModel"><type>GtkSliceListModel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-slice-list-model-get-size.returns" role="returns">
<title>Returns</title>
<para> The size</para>
</refsect3></refsect2>

</refsect1>
<refsect1 id="GtkSliceListModel.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GtkSliceListModel-struct" role="struct">
<title>GtkSliceListModel</title>
<indexterm zone="GtkSliceListModel-struct"><primary>GtkSliceListModel</primary></indexterm>
<programlisting language="C">typedef struct _GtkSliceListModel GtkSliceListModel;</programlisting>
</refsect2>

</refsect1>
<refsect1 id="GtkSliceListModel.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GtkSliceListModel--item-type" role="property"><title>The <literal>“item-type”</literal> property</title>
<indexterm zone="GtkSliceListModel--item-type"><primary>GtkSliceListModel:item-type</primary></indexterm>
<programlisting>  “item-type”                <link linkend="GType"><type>GType</type></link>&#160;*</programlisting>
<para>The <link linkend="GType"><type>GType</type></link> for elements of this object</para>
<para>Owner: GtkSliceListModel</para>
<para>Flags: Read / Write / Construct&#160;Only</para>
<para>Allowed values: GObject</para>
</refsect2>
<refsect2 id="GtkSliceListModel--model" role="property"><title>The <literal>“model”</literal> property</title>
<indexterm zone="GtkSliceListModel--model"><primary>GtkSliceListModel:model</primary></indexterm>
<programlisting>  “model”                    <link linkend="GListModel"><type>GListModel</type></link>&#160;*</programlisting>
<para>Child model to take slice from</para>
<para>Owner: GtkSliceListModel</para>
<para>Flags: Read / Write</para>
</refsect2>
<refsect2 id="GtkSliceListModel--offset" role="property"><title>The <literal>“offset”</literal> property</title>
<indexterm zone="GtkSliceListModel--offset"><primary>GtkSliceListModel:offset</primary></indexterm>
<programlisting>  “offset”                   <link linkend="guint"><type>guint</type></link></programlisting>
<para>Offset of slice</para>
<para>Owner: GtkSliceListModel</para>
<para>Flags: Read / Write</para>
<para>Default value: 0</para>
</refsect2>
<refsect2 id="GtkSliceListModel--size" role="property"><title>The <literal>“size”</literal> property</title>
<indexterm zone="GtkSliceListModel--size"><primary>GtkSliceListModel:size</primary></indexterm>
<programlisting>  “size”                     <link linkend="guint"><type>guint</type></link></programlisting>
<para>Maximum size of slice</para>
<para>Owner: GtkSliceListModel</para>
<para>Flags: Read / Write</para>
<para>Default value: 10</para>
</refsect2>

</refsect1>
<refsect1 id="GtkSliceListModel.see-also">
<title>See Also</title>
<para><link linkend="GListModel"><type>GListModel</type></link></para>

</refsect1>

</refentry>
