You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
3.0 KiB
114 lines
3.0 KiB
13 years ago
|
// This is the SIP interface definition for TQKeySequence.
|
||
13 years ago
|
//
|
||
|
// Copyright (c) 2007
|
||
|
// Riverbank Computing Limited <info@riverbankcomputing.co.uk>
|
||
|
//
|
||
13 years ago
|
// This file is part of PyTQt.
|
||
13 years ago
|
//
|
||
13 years ago
|
// This copy of PyTQt is free software; you can redistribute it and/or modify it
|
||
13 years ago
|
// under the terms of the GNU General Public License as published by the Free
|
||
|
// Software Foundation; either version 2, or (at your option) any later
|
||
|
// version.
|
||
|
//
|
||
13 years ago
|
// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY
|
||
13 years ago
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||
|
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||
|
// details.
|
||
|
//
|
||
|
// You should have received a copy of the GNU General Public License along with
|
||
13 years ago
|
// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation,
|
||
13 years ago
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||
|
|
||
|
|
||
|
%ExportedDoc
|
||
13 years ago
|
<Sect2><Title>TQKeySequence (TQt v3+)</Title>
|
||
13 years ago
|
<Para>
|
||
13 years ago
|
<Literal>TQKeySequence</Literal> is fully implemented including the operators
|
||
|
<Literal>==</Literal>, <Literal>!=</Literal>, <Literal>TQString()</Literal> and
|
||
|
<Literal>int()</Literal>. A <Literal>TQString</Literal> instance or a Python
|
||
|
integer may be used whenever a <Literal>TQKeySequence</Literal> can be used.
|
||
13 years ago
|
</Para>
|
||
|
</Sect2>
|
||
|
%End
|
||
|
|
||
|
|
||
13 years ago
|
class TQKeySequence : TQt
|
||
13 years ago
|
{
|
||
|
%TypeHeaderCode
|
||
13 years ago
|
#include <tqkeysequence.h>
|
||
13 years ago
|
%End
|
||
|
|
||
|
public:
|
||
13 years ago
|
TQKeySequence();
|
||
|
TQKeySequence(const TQString &);
|
||
|
TQKeySequence(int);
|
||
|
TQKeySequence(int,int,int = 0,int = 0);
|
||
13 years ago
|
|
||
13 years ago
|
bool operator==(const TQKeySequence &) const;
|
||
|
bool operator!=(const TQKeySequence &) const;
|
||
13 years ago
|
|
||
|
uint count() const;
|
||
|
bool isEmpty() const;
|
||
13 years ago
|
TQt::SequenceMatch matches(const TQKeySequence &) const;
|
||
13 years ago
|
|
||
|
int __int__() const;
|
||
|
|
||
|
%ConvertToTypeCode
|
||
13 years ago
|
// Allow a TQString or a Python integer whenever a TQKeySequence is
|
||
13 years ago
|
// expected.
|
||
|
|
||
|
if (sipIsErr == NULL)
|
||
|
{
|
||
13 years ago
|
if (sipCanConvertToInstance(sipPy,sipClass_TQKeySequence,SIP_NO_CONVERTORS))
|
||
13 years ago
|
return 1;
|
||
|
|
||
13 years ago
|
if (sipCanConvertToInstance(sipPy,sipClass_TQString,0))
|
||
13 years ago
|
return 1;
|
||
|
|
||
|
PyErr_Clear();
|
||
|
|
||
2 years ago
|
PyLong_AsLong(sipPy);
|
||
13 years ago
|
|
||
|
return !PyErr_Occurred();
|
||
|
}
|
||
|
|
||
|
// We do this case before the int case because, otherwise,
|
||
|
// PyInt_AsLong() would achieve the same result but less efficiently.
|
||
|
|
||
13 years ago
|
if (sipCanConvertToInstance(sipPy,sipClass_TQKeySequence,SIP_NO_CONVERTORS))
|
||
13 years ago
|
{
|
||
13 years ago
|
*sipCppPtr = reinterpret_cast<TQKeySequence *>(sipConvertToInstance(sipPy,sipClass_TQKeySequence,sipTransferObj,SIP_NO_CONVERTORS,0,sipIsErr));
|
||
13 years ago
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
13 years ago
|
if (sipCanConvertToInstance(sipPy,sipClass_TQString,0))
|
||
13 years ago
|
{
|
||
|
int state;
|
||
13 years ago
|
TQString *s = reinterpret_cast<TQString *>(sipConvertToInstance(sipPy,sipClass_TQString,0,0,&state,sipIsErr));
|
||
13 years ago
|
|
||
|
if (*sipIsErr)
|
||
|
{
|
||
13 years ago
|
sipReleaseInstance(s,sipClass_TQString,state);
|
||
13 years ago
|
return 0;
|
||
|
}
|
||
|
|
||
|
Py_BEGIN_ALLOW_THREADS
|
||
13 years ago
|
*sipCppPtr = new TQKeySequence(*s);
|
||
13 years ago
|
Py_END_ALLOW_THREADS
|
||
|
|
||
13 years ago
|
sipReleaseInstance(s,sipClass_TQString,state);
|
||
13 years ago
|
|
||
|
return sipGetState(sipTransferObj);
|
||
|
}
|
||
|
|
||
2 years ago
|
int key = (int)PyLong_AsLong(sipPy);
|
||
13 years ago
|
|
||
|
Py_BEGIN_ALLOW_THREADS
|
||
13 years ago
|
*sipCppPtr = new TQKeySequence(key);
|
||
13 years ago
|
Py_END_ALLOW_THREADS
|
||
|
|
||
|
return sipGetState(sipTransferObj);
|
||
|
%End
|
||
|
};
|