// qkeysequence.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 <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) /NoDerived/;
%MethodCode
        #if QT_VERSION >= 0x050000
        sipCpp = new QKeySequence(a0->value<QKeySequence>());
        #else
        sipCpp = new QKeySequence(qVariantValue<QKeySequence>(*a0));
        #endif
%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
