// qabstractitemview.sip generated by MetaSIP on Sun Nov  9 16:48:00 2014
//
// This file is part of the QtGui Python extension module.
//
// Copyright (c) 2014 Riverbank Computing Limited <info@riverbankcomputing.com>
// 
// This file is part of PyQt.
// 
// This file may be used under the terms of the GNU General Public
// License versions 2.0 or 3.0 as published by the Free Software
// Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
// included in the packaging of this file.  Alternatively you may (at
// your option) use any later version of the GNU General Public
// License if such license has been publicly approved by Riverbank
// Computing Limited (or its successors, if any) and the KDE Free Qt
// Foundation. In addition, as a special exception, Riverbank gives you
// certain additional rights. These rights are described in the Riverbank
// GPL Exception version 1.1, which can be found in the file
// GPL_EXCEPTION.txt in this package.
// 
// If you are unsure which license is appropriate for your use, please
// contact the sales department at sales@riverbankcomputing.com.
// 
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.


%ModuleCode
#include <qabstractitemview.h>
%End

class QAbstractItemView : QAbstractScrollArea
{
%TypeHeaderCode
#include <qabstractitemview.h>
%End

public:
%If (Qt_4_2_0 -)

    enum DragDropMode
    {
        NoDragDrop,
        DragOnly,
        DropOnly,
        DragDrop,
        InternalMove,
    };

%End

    enum EditTrigger
    {
        NoEditTriggers,
        CurrentChanged,
        DoubleClicked,
        SelectedClicked,
        EditKeyPressed,
        AnyKeyPressed,
        AllEditTriggers,
    };

    typedef QFlags<QAbstractItemView::EditTrigger> EditTriggers;

    enum ScrollHint
    {
        EnsureVisible,
        PositionAtTop,
        PositionAtBottom,
%If (Qt_4_2_0 -)
        PositionAtCenter,
%End
    };

%If (Qt_4_2_0 -)

    enum ScrollMode
    {
        ScrollPerItem,
        ScrollPerPixel,
    };

%End

    enum SelectionBehavior
    {
        SelectItems,
        SelectRows,
        SelectColumns,
    };

    enum SelectionMode
    {
        NoSelection,
        SingleSelection,
        MultiSelection,
        ExtendedSelection,
        ContiguousSelection,
    };

    explicit QAbstractItemView(QWidget *parent /TransferThis/ = 0);
    virtual ~QAbstractItemView();
    virtual void setModel(QAbstractItemModel *model /KeepReference/);
    QAbstractItemModel *model() const;
    virtual void setSelectionModel(QItemSelectionModel *selectionModel /KeepReference/);
    QItemSelectionModel *selectionModel() const;
    void setItemDelegate(QAbstractItemDelegate *delegate /KeepReference/);
    QAbstractItemDelegate *itemDelegate() const;
    void setSelectionMode(QAbstractItemView::SelectionMode mode);
    QAbstractItemView::SelectionMode selectionMode() const;
    void setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior);
    QAbstractItemView::SelectionBehavior selectionBehavior() const;
    QModelIndex currentIndex() const;
    QModelIndex rootIndex() const;
    void setEditTriggers(QFlags<QAbstractItemView::EditTrigger> triggers);
    QFlags<QAbstractItemView::EditTrigger> editTriggers() const;
    void setAutoScroll(bool enable);
    bool hasAutoScroll() const;
    void setTabKeyNavigation(bool enable);
    bool tabKeyNavigation() const;
    void setDropIndicatorShown(bool enable);
    bool showDropIndicator() const;
    void setDragEnabled(bool enable);
    bool dragEnabled() const;
    void setAlternatingRowColors(bool enable);
    bool alternatingRowColors() const;
    void setIconSize(const QSize &size);
    QSize iconSize() const;
    void setTextElideMode(Qt::TextElideMode mode);
    Qt::TextElideMode textElideMode() const;
    virtual void keyboardSearch(const QString &search);
    virtual QRect visualRect(const QModelIndex &index) const = 0;
    virtual void scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible) = 0;
    virtual QModelIndex indexAt(const QPoint &p) const = 0;
    QSize sizeHintForIndex(const QModelIndex &index) const;
    virtual int sizeHintForRow(int row) const;
    virtual int sizeHintForColumn(int column) const;
    void openPersistentEditor(const QModelIndex &index);
    void closePersistentEditor(const QModelIndex &index);
    void setIndexWidget(const QModelIndex &index, QWidget *widget /Transfer/);
%MethodCode
        // We have to break the association with any existing widget.
        QWidget *w = sipCpp->indexWidget(*a0);
        
        if (w)
        {
            PyObject *wo = sipGetPyObject(w, sipType_QWidget);
        
            if (wo)
                sipTransferTo(wo, 0);
        }
        
        Py_BEGIN_ALLOW_THREADS
        sipCpp->setIndexWidget(*a0, a1);
        Py_END_ALLOW_THREADS
%End

    QWidget *indexWidget(const QModelIndex &index) const;

public slots:
    virtual void reset();
    virtual void setRootIndex(const QModelIndex &index);
    virtual void selectAll();
    void edit(const QModelIndex &index);
    void clearSelection();
    void setCurrentIndex(const QModelIndex &index);
    void scrollToTop();
    void scrollToBottom();
%If (Qt_4_3_0 -)
    void update();
%End
%If (Qt_4_3_0 -)
    void update(const QModelIndex &index);
%End

protected slots:
%If (Qt_5_0_0 -)
    virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles /DocValue="[]"/ = QVector<int>());
%End
%If (- Qt_5_0_0)
    virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
%End
    virtual void rowsInserted(const QModelIndex &parent, int start, int end);
    virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
    virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
    virtual void currentChanged(const QModelIndex &current, const QModelIndex &previous);
    virtual void updateEditorData();
    virtual void updateEditorGeometries();
    virtual void updateGeometries();
    virtual void verticalScrollbarAction(int action);
    virtual void horizontalScrollbarAction(int action);
    virtual void verticalScrollbarValueChanged(int value);
    virtual void horizontalScrollbarValueChanged(int value);
    virtual void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint);
    virtual void commitData(QWidget *editor);
    virtual void editorDestroyed(QObject *editor);

signals:
    void pressed(const QModelIndex &index);
    void clicked(const QModelIndex &index);
    void doubleClicked(const QModelIndex &index);
    void activated(const QModelIndex &index);
    void entered(const QModelIndex &index);
    void viewportEntered();

protected:
    void setHorizontalStepsPerItem(int steps);
    int horizontalStepsPerItem() const;
    void setVerticalStepsPerItem(int steps);
    int verticalStepsPerItem() const;

    enum CursorAction
    {
        MoveUp,
        MoveDown,
        MoveLeft,
        MoveRight,
        MoveHome,
        MoveEnd,
        MovePageUp,
        MovePageDown,
        MoveNext,
        MovePrevious,
    };

    virtual QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers) = 0;
    virtual int horizontalOffset() const = 0;
    virtual int verticalOffset() const = 0;
    virtual bool isIndexHidden(const QModelIndex &index) const = 0;
    virtual void setSelection(const QRect &rect, QFlags<QItemSelectionModel::SelectionFlag> command) = 0;
    virtual QRegion visualRegionForSelection(const QItemSelection &selection) const = 0;
    virtual QModelIndexList selectedIndexes() const;
    virtual bool edit(const QModelIndex &index, QAbstractItemView::EditTrigger trigger, QEvent *event);
    virtual QFlags<QItemSelectionModel::SelectionFlag> selectionCommand(const QModelIndex &index, const QEvent *event = 0) const;
    virtual void startDrag(Qt::DropActions supportedActions);
    virtual QStyleOptionViewItem viewOptions() const;

    enum State
    {
        NoState,
        DraggingState,
        DragSelectingState,
        EditingState,
        ExpandingState,
        CollapsingState,
%If (Qt_4_2_0 -)
        AnimatingState,
%End
    };

    QAbstractItemView::State state() const;
    void setState(QAbstractItemView::State state);
    void scheduleDelayedItemsLayout();
    void executeDelayedItemsLayout();
    void scrollDirtyRegion(int dx, int dy);
    void setDirtyRegion(const QRegion &region);
    QPoint dirtyRegionOffset() const;
    virtual bool event(QEvent *event);
    virtual bool viewportEvent(QEvent *e);
    virtual void mousePressEvent(QMouseEvent *e);
    virtual void mouseMoveEvent(QMouseEvent *e);
    virtual void mouseReleaseEvent(QMouseEvent *e);
    virtual void mouseDoubleClickEvent(QMouseEvent *e);
    virtual void dragEnterEvent(QDragEnterEvent *e);
    virtual void dragMoveEvent(QDragMoveEvent *e);
    virtual void dragLeaveEvent(QDragLeaveEvent *e);
    virtual void dropEvent(QDropEvent *e);
    virtual void focusInEvent(QFocusEvent *e);
    virtual void focusOutEvent(QFocusEvent *e);
    virtual void keyPressEvent(QKeyEvent *e);
    virtual void resizeEvent(QResizeEvent *e);
    virtual void timerEvent(QTimerEvent *e);

    enum DropIndicatorPosition
    {
        OnItem,
        AboveItem,
        BelowItem,
        OnViewport,
    };

    QAbstractItemView::DropIndicatorPosition dropIndicatorPosition() const;

public:
%If (Qt_4_2_0 -)
    void setVerticalScrollMode(QAbstractItemView::ScrollMode mode);
%End
%If (Qt_4_2_0 -)
    QAbstractItemView::ScrollMode verticalScrollMode() const;
%End
%If (Qt_4_2_0 -)
    void setHorizontalScrollMode(QAbstractItemView::ScrollMode mode);
%End
%If (Qt_4_2_0 -)
    QAbstractItemView::ScrollMode horizontalScrollMode() const;
%End
%If (Qt_4_2_0 -)
    void setDragDropOverwriteMode(bool overwrite);
%End
%If (Qt_4_2_0 -)
    bool dragDropOverwriteMode() const;
%End
%If (Qt_4_2_0 -)
    void setDragDropMode(QAbstractItemView::DragDropMode behavior);
%End
%If (Qt_4_2_0 -)
    QAbstractItemView::DragDropMode dragDropMode() const;
%End
%If (Qt_4_2_0 -)
    void setItemDelegateForRow(int row, QAbstractItemDelegate *delegate /KeepReference/);
%End
%If (Qt_4_2_0 -)
    QAbstractItemDelegate *itemDelegateForRow(int row) const;
%End
%If (Qt_4_2_0 -)
    void setItemDelegateForColumn(int column, QAbstractItemDelegate *delegate /KeepReference/);
%End
%If (Qt_4_2_0 -)
    QAbstractItemDelegate *itemDelegateForColumn(int column) const;
%End
%If (Qt_4_2_0 -)
    QAbstractItemDelegate *itemDelegate(const QModelIndex &index) const;
%End
%If (Qt_4_2_0 -)
    virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
%End
%If (Qt_4_4_0 -)
    void setAutoScrollMargin(int margin);
%End
%If (Qt_4_4_0 -)
    int autoScrollMargin() const;
%End

protected:
%If (Qt_4_2_0 -)
    virtual bool focusNextPrevChild(bool next);
%End
%If (Qt_4_2_0 -)
    virtual void inputMethodEvent(QInputMethodEvent *event);
%End

public:
%If (Qt_4_6_0 -)
    void setDefaultDropAction(Qt::DropAction dropAction);
%End
%If (Qt_4_6_0 -)
    Qt::DropAction defaultDropAction() const;
%End

private:
    QAbstractItemView(const QAbstractItemView &);
};

QFlags<QAbstractItemView::EditTrigger> operator|(QAbstractItemView::EditTrigger f1, QFlags<QAbstractItemView::EditTrigger> f2);
