/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/gui/editorwidgets/qgsrelationreferencewidget.h                   *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 ************************************************************************/





%ModuleHeaderCode
// fix to allow compilation with sip that for some reason
// doesn't add this include to the file where the code from
// ConvertToSubClassCode goes.
#include <qgsrelationreferencewidget.h>
%End

class QgsRelationReferenceWidget : QWidget
{

%TypeHeaderCode
#include "qgsrelationreferencewidget.h"
%End

%ConvertToSubClassCode
    if ( qobject_cast<QgsRelationReferenceWidget *>( sipCpp ) )
      sipType = sipType_QgsRelationReferenceWidget;
    else
      sipType = NULL;
%End
  public:

    enum CanvasExtent
    {
      Fixed,
      Pan,
      Scale
    };

    explicit QgsRelationReferenceWidget( QWidget *parent /TransferThis/ );

    ~QgsRelationReferenceWidget();

    void setRelation( const QgsRelation &relation, bool allowNullValue );

    void setRelationEditable( bool editable );

    void setForeignKey( const QVariant &value );
%Docstring
this sets the related feature using from the foreign key
%End

    QVariant foreignKey() const;
%Docstring
returns the related feature foreign key
 :rtype: QVariant
%End

    void setEditorContext( const QgsAttributeEditorContext &context, QgsMapCanvas *canvas, QgsMessageBar *messageBar );

    bool embedForm();
%Docstring
determines if the form of the related feature will be shown
 :rtype: bool
%End
    void setEmbedForm( bool display );

    bool readOnlySelector();
%Docstring
determines if the foreign key is shown in a combox box or a read-only line edit
 :rtype: bool
%End
    void setReadOnlySelector( bool readOnly );

    bool allowMapIdentification();
%Docstring
determines if the widge offers the possibility to select the related feature on the map (using a dedicated map tool)
 :rtype: bool
%End
    void setAllowMapIdentification( bool allowMapIdentification );

    bool orderByValue();
%Docstring
If the widget will order the combobox entries by value
 :rtype: bool
%End
    void setOrderByValue( bool orderByValue );
%Docstring
Set if the widget will order the combobox entries by value
%End
    void setFilterFields( const QStringList &filterFields );
%Docstring
Set the fields for which filter comboboxes will be created
%End

    bool openFormButtonVisible();
%Docstring
determines the open form button is visible in the widget
 :rtype: bool
%End
    void setOpenFormButtonVisible( bool openFormButtonVisible );

    bool chainFilters() const;
%Docstring
 Determines if the filters are chained

 :return: True if filters are chained
 :rtype: bool
%End

    void setChainFilters( bool chainFilters );
%Docstring
 Set if filters are chained.
 Chained filters restrict the option of subsequent filters based on the selection of a previous filter.

 \param chainFilters If chaining should be enabled
%End

    QgsFeature referencedFeature() const;
%Docstring
if no feature is related, it returns an invalid feature
 :rtype: QgsFeature
%End

    void showIndeterminateState();
%Docstring
 Sets the widget to display in an indeterminate "mixed value" state.
.. versionadded:: 2.16
%End

    bool allowAddFeatures() const;
%Docstring
 Determines if a button for adding new features should be shown.

.. versionadded:: 2.16
 :rtype: bool
%End

    void setAllowAddFeatures( bool allowAddFeatures );
%Docstring
 Determines if a button for adding new features should be shown.

.. versionadded:: 2.16
%End

  public slots:
    void openForm();
%Docstring
open the form of the related feature in a new dialog
%End

    void mapIdentification();
%Docstring
activate the map tool to select a new related feature on the map
%End

    void deleteForeignKey();
%Docstring
unset the currently related feature
%End

  protected:
    virtual void showEvent( QShowEvent *e );

    void init();

  signals:
    void foreignKeyChanged( const QVariant & );

};

/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/gui/editorwidgets/qgsrelationreferencewidget.h                   *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 ************************************************************************/