/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsattributetableconfig.h                                   *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/





class QgsAttributeTableConfig
{
%Docstring(signature="appended")
This is a container for configuration of the attribute table. The
configuration is specific for one vector layer.
%End

%TypeHeaderCode
#include "qgsattributetableconfig.h"
%End
  public:

    enum Type /BaseType=IntEnum/
    {
      Field,
      Action
    };

    struct ColumnConfig
    {
      ColumnConfig();


      QgsAttributeTableConfig::Type type;

      QString name;

      bool hidden;

      int width;
    };

    enum ActionWidgetStyle /BaseType=IntEnum/
    {
      ButtonList,
      DropDown
    };

    QgsAttributeTableConfig();

    QVector<QgsAttributeTableConfig::ColumnConfig> columns() const;
%Docstring
Gets the list with all columns and their configuration. The list order
defines the order of appearance.
%End

    bool isEmpty() const;
%Docstring
Returns ``True`` if the configuration is empty, ie it contains no
columns.

.. seealso:: :py:func:`size`
%End

    int size() const;
%Docstring
Returns the number of columns in the configuration.

.. versionadded:: 3.22
%End

    Py_ssize_t __len__() const;
%MethodCode
    sipRes = sipCpp->size();
%End

    int mapVisibleColumnToIndex( int visibleColumn ) const;
%Docstring
Maps a visible column index to its original column index.

:param visibleColumn: index of visible column

:return: corresponding index when hidden columns are considered
%End

    void setColumns( const QVector<QgsAttributeTableConfig::ColumnConfig> &columns );
%Docstring
Set the list of columns visible in the attribute table. The list order
defines the order of appearance.
%End

    void update( const QgsFields &fields );
%Docstring
Update the configuration with the given fields. Any field which is
present in the configuration but not present in the parameter fields
will be removed. Any field which is in the parameter fields but not in
the configuration will be appended.
%End

    bool actionWidgetVisible() const;
%Docstring
Returns ``True`` if the action widget is visible
%End

    void setActionWidgetVisible( bool visible );
%Docstring
Set if the action widget is visible
%End

    ActionWidgetStyle actionWidgetStyle() const;
%Docstring
Gets the style of the action widget
%End

    void setActionWidgetStyle( ActionWidgetStyle actionWidgetStyle );
%Docstring
Set the style of the action widget
%End

    void writeXml( QDomNode &node ) const;
%Docstring
Serialize to XML on layer save
%End

    void readXml( const QDomNode &node );
%Docstring
Deserialize to XML on layer load
%End

    QString sortExpression() const;
%Docstring
Gets the expression used for sorting.
%End

    void setSortExpression( const QString &sortExpression );
%Docstring
Set the sort expression used for sorting.
%End


    int columnWidth( int column ) const;
%Docstring
Returns the width of a column, or -1 if column should use default width.

:param column: column index

:raises IndexError: if the column is not found

.. seealso:: :py:func:`setColumnWidth`
%End
%MethodCode
    {
      if ( a0 < 0 || a0 >= sipCpp->size() )
      {
        PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
        sipIsErr = 1;
      }
      else
      {
        return PyLong_FromLong( sipCpp->columnWidth( a0 ) );
      }
    }
%End


    void setColumnWidth( int column, int width );
%Docstring
Sets the width of a column.

:param column: column index
:param width: column width in pixels, or -1 if column should use default
              width

:raises IndexError: if the column is not found

.. seealso:: :py:func:`columnWidth`
%End
%MethodCode
    if ( a0 < 0 || a0 >= sipCpp->size() )
    {
      PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
      sipIsErr = 1;
    }
    else
    {
      sipCpp->setColumnWidth( a0, a1 );
    }
%End


    bool columnHidden( int column ) const;
%Docstring
Returns ``True`` if the specified column is hidden.

:param column: column index

:raises IndexError: if the column is not found

.. seealso:: :py:func:`setColumnHidden`
%End
%MethodCode
    {
      if ( a0 < 0 || a0 >= sipCpp->size() )
      {
        PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
        sipIsErr = 1;
      }
      else
      {
        return PyBool_FromLong( sipCpp->columnHidden( a0 ) );
      }
    }
%End


    void setColumnHidden( int column, bool hidden );
%Docstring
Sets whether the specified column should be hidden.

:param column: column index
:param hidden: set to ``True`` to hide column

:raises IndexError: if the column is not found

.. seealso:: :py:func:`columnHidden`
%End
%MethodCode
    if ( a0 < 0 || a0 >= sipCpp->size() )
    {
      PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
      sipIsErr = 1;
    }
    else
    {
      sipCpp->setColumnHidden( a0, a1 );
    }
%End

    Qt::SortOrder sortOrder() const;
%Docstring
Gets the sort order
%End

    void setSortOrder( Qt::SortOrder sortOrder );
%Docstring
Set the sort order
%End

    bool hasSameColumns( const QgsAttributeTableConfig &other ) const;
%Docstring
Compare this configuration's columns name, type, and order to ``other``.
The column's width is not considered.
%End

    bool operator!= ( const QgsAttributeTableConfig &other ) const;

};


/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsattributetableconfig.h                                   *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/
