// qkeysequence.sip generated by MetaSIP
//
// This file is part of the QtGui Python extension module.
//
// Copyright (c) 2015 Riverbank Computing Limited <info@riverbankcomputing.com>
// 
// This file is part of PyQt4.
// 
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file.  Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
// 
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license.  For more information contact
// info@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 <qkeysequence.h>
%End

class QKeySequence
{
%TypeHeaderCode
#include <qkeysequence.h>
%End

%ConvertToTypeCode
// Allow a StandardKey, QString or an integer whenever a QKeySequence is
// expected.

if (sipIsErr == NULL)
{
    if (sipCanConvertToType(sipPy, sipType_QKeySequence, SIP_NO_CONVERTORS))
        return 1;

#if QT_VERSION >= 0x040200
    if (PyObject_TypeCheck(sipPy, sipTypeAsPyTypeObject(sipType_QKeySequence_StandardKey)))
        return 1;
#endif

    if (sipCanConvertToType(sipPy, sipType_QString, 0))
        return 1;

    PyErr_Clear();

    SIPLong_AsLong(sipPy);

    return !PyErr_Occurred();
}

if (sipCanConvertToType(sipPy, sipType_QKeySequence, SIP_NO_CONVERTORS))
{
    *sipCppPtr = reinterpret_cast<QKeySequence *>(sipConvertToType(sipPy, sipType_QKeySequence, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr));

    return 0;
}

#if QT_VERSION >= 0x040200
if (PyObject_TypeCheck(sipPy, sipTypeAsPyTypeObject(sipType_QKeySequence_StandardKey)))
{
    *sipCppPtr = new QKeySequence((QKeySequence::StandardKey)SIPLong_AsLong(sipPy));

    return sipGetState(sipTransferObj);
}
#endif

if (sipCanConvertToType(sipPy, sipType_QString, 0))
{
    int state;
    QString *qs = reinterpret_cast<QString *>(sipConvertToType(sipPy, sipType_QString, 0, 0, &state, sipIsErr));

    if (*sipIsErr)
    {
        sipReleaseType(qs, sipType_QString, state);
        return 0;
    }

    *sipCppPtr = new QKeySequence(*qs);

    sipReleaseType(qs, sipType_QString, state);

    return sipGetState(sipTransferObj);
}

int key = SIPLong_AsLong(sipPy);

*sipCppPtr = new QKeySequence(key);

return sipGetState(sipTransferObj);
%End

%PickleCode
    sipRes = Py_BuildValue((char *)"iiii", sipCpp->operator[](0), sipCpp->operator[](1), sipCpp->operator[](2), sipCpp->operator[](3));
%End

public:
    enum SequenceFormat
    {
        NativeText,
        PortableText,
    };

    enum SequenceMatch
    {
        NoMatch,
        PartialMatch,
        ExactMatch,
    };

%If (Qt_4_2_0 -)

    enum StandardKey
    {
        UnknownKey,
        HelpContents,
        WhatsThis,
        Open,
        Close,
        Save,
        New,
        Delete,
        Cut,
        Copy,
        Paste,
        Undo,
        Redo,
        Back,
        Forward,
        Refresh,
        ZoomIn,
        ZoomOut,
        Print,
        AddTab,
        NextChild,
        PreviousChild,
        Find,
        FindNext,
        FindPrevious,
        Replace,
        SelectAll,
        Bold,
        Italic,
        Underline,
        MoveToNextChar,
        MoveToPreviousChar,
        MoveToNextWord,
        MoveToPreviousWord,
        MoveToNextLine,
        MoveToPreviousLine,
        MoveToNextPage,
        MoveToPreviousPage,
        MoveToStartOfLine,
        MoveToEndOfLine,
        MoveToStartOfBlock,
        MoveToEndOfBlock,
        MoveToStartOfDocument,
        MoveToEndOfDocument,
        SelectNextChar,
        SelectPreviousChar,
        SelectNextWord,
        SelectPreviousWord,
        SelectNextLine,
        SelectPreviousLine,
        SelectNextPage,
        SelectPreviousPage,
        SelectStartOfLine,
        SelectEndOfLine,
        SelectStartOfBlock,
        SelectEndOfBlock,
        SelectStartOfDocument,
        SelectEndOfDocument,
        DeleteStartOfWord,
        DeleteEndOfWord,
        DeleteEndOfLine,
%If (Qt_4_5_0 -)
        InsertParagraphSeparator,
%End
%If (Qt_4_5_0 -)
        InsertLineSeparator,
%End
%If (Qt_4_5_0 -)
        SaveAs,
%End
%If (Qt_4_6_0 -)
        Preferences,
%End
%If (Qt_4_6_0 -)
        Quit,
%End
%If (Qt_5_0_0 -)
        FullScreen,
%End
    };

%End
    QKeySequence();
    QKeySequence(const QKeySequence &ks);
%If (Qt_5_0_0 -)
    QKeySequence(const QString &key, QKeySequence::SequenceFormat format = QKeySequence::NativeText);
%End
%If (Qt_4_7_0 - Qt_5_0_0)
    QKeySequence(const QString &key, QKeySequence::SequenceFormat format);
%End
    QKeySequence(int k1, int key2 = 0, int key3 = 0, int key4 = 0);
    QKeySequence(const QVariant &variant /GetWrapper/) /NoDerived/;
%MethodCode
        #if QT_VERSION >= 0x050000
        if (a0->canConvert<QKeySequence>())
            sipCpp = new QKeySequence(a0->value<QKeySequence>());
        #else
        if (qVariantCanConvert<QKeySequence>(*a0))
            sipCpp = new QKeySequence(qVariantValue<QKeySequence>(*a0));
        #endif
        else
            sipError = sipBadCallableArg(0, a0Wrapper);
%End

    ~QKeySequence();
%If (Qt_5_0_0 -)
    int count() const /__len__/;
%End
%If (- Qt_5_0_0)
    uint count() const /__len__/;
%End
    bool isEmpty() const;
    QKeySequence::SequenceMatch matches(const QKeySequence &seq) const;
    static QKeySequence mnemonic(const QString &text);
%If (PyQt_Deprecated_5_0)
    operator QString() const;
%End
%If (PyQt_Deprecated_5_0)
    operator int() const;
%End
    int operator[](int i) const;
%MethodCode
        SIP_SSIZE_T idx = sipConvertFromSequenceIndex(a0, sipCpp->count());
        
        if (idx < 0)
            sipIsErr = 1;
        else
            sipRes = sipCpp->operator[]((uint)idx);
%End

    bool operator==(const QKeySequence &other) const;
    bool operator!=(const QKeySequence &other) const;
    bool operator<(const QKeySequence &ks) const;
    bool operator>(const QKeySequence &other) const;
    bool operator<=(const QKeySequence &other) const;
    bool operator>=(const QKeySequence &other) const;
    bool isDetached() const;
    QString toString(QKeySequence::SequenceFormat format = QKeySequence::PortableText) const;
    static QKeySequence fromString(const QString &str, QKeySequence::SequenceFormat format = QKeySequence::PortableText);
%If (Qt_4_2_0 -)
    static QList<QKeySequence> keyBindings(QKeySequence::StandardKey key);
%End
%If (Qt_4_8_0 -)
    void swap(QKeySequence &other);
%End
};

QDataStream &operator<<(QDataStream &in, const QKeySequence &ks /Constrained/);
QDataStream &operator>>(QDataStream &out, QKeySequence &ks /Constrained/);
%If (Qt_4_3_0 -)
void qSwap(QKeySequence &value1, QKeySequence &value2);
%End
