1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418
|
// qapplication.sip generated by MetaSIP on Sat Jul 15 18:43:36 2006
//
// This file is part of the QtGui Python extension module.
//
// Copyright (c) 2006
// Riverbank Computing Limited <info@riverbankcomputing.co.uk>
//
// This file is part of PyQt.
//
// This copy of PyQt is free software; you can redistribute it and/or modify it
// 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.
//
// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY
// 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
// PyQt; see the file LICENSE. If not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// QApplication *qApp
QApplication *qApp;
%AccessCode
// Qt implements this has a #define to a function call so we have to handle
// it like this.
return qApp;
%End
class QApplication : QCoreApplication /DelayDtor/
{
%TypeHeaderCode
#include <qapplication.h>
%End
%TypeCode
// Convert a Python argv list to a conventional C argc count and argv array.
static char **qtgui_ArgvToC(PyObject *argvlist, int &argc)
{
char **argv;
argc = PyList_GET_SIZE(argvlist);
// Allocate space for two copies of the argument pointers, plus the
// terminating NULL.
if ((argv = (char **)sipMalloc(2 * (argc + 1) * sizeof (char *))) == NULL)
return NULL;
// Convert the list.
for (int a = 0; a < argc; ++a)
{
char *arg;
// Get the argument and allocate memory for it.
if ((arg = PyString_AsString(PyList_GET_ITEM(argvlist, a))) == NULL ||
(argv[a] = (char *)sipMalloc(strlen(arg) + 1)) == NULL)
return NULL;
// Copy the argument and save a pointer to it.
strcpy(argv[a], arg);
argv[a + argc + 1] = argv[a];
}
argv[argc + argc + 1] = argv[argc] = NULL;
return argv;
}
// Remove arguments from the Python argv list that have been removed from the
// C argv array.
static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
{
for (int a = 0, na = 0; a < argc; ++a)
{
// See if it was removed.
if (argv[na] == argv[a + argc + 1])
++na;
else
PyList_SetSlice(argvlist, na, na + 1, NULL);
}
}
%End
%ConvertToSubClassCode
static struct class_graph {
char *name;
sipWrapperType **type;
int yes, no;
} graph[] = {
{sipName_QSound, &sipClass_QSound, -1, 1},
{sipName_QStyle, &sipClass_QStyle, -1, 2},
{sipName_QAction, &sipClass_QAction, -1, 3},
{sipName_QButtonGroup, &sipClass_QButtonGroup, -1, 4},
{sipName_QApplication, &sipClass_QApplication, -1, 5},
{sipName_QAbstractItemDelegate, &sipClass_QAbstractItemDelegate, 26, 6},
{sipName_QLayout, &sipClass_QLayout, 27, 7},
{sipName_QWidget, &sipClass_QWidget, 32, 8},
{sipName_QShortcut, &sipClass_QShortcut, -1, 9},
{sipName_QAbstractTextDocumentLayout, &sipClass_QAbstractTextDocumentLayout, -1, 10},
{sipName_QTextDocument, &sipClass_QTextDocument, -1, 11},
{sipName_QDrag, &sipClass_QDrag, -1, 12},
{sipName_QInputContext, &sipClass_QInputContext, -1, 13},
{sipName_QStandardItemModel, &sipClass_QStandardItemModel, -1, 14},
{sipName_QTextObject, &sipClass_QTextObject, 95, 15},
{sipName_QActionGroup, &sipClass_QActionGroup, -1, 16},
{sipName_QProxyModel, &sipClass_QProxyModel, -1, 17},
{sipName_QMovie, &sipClass_QMovie, -1, 18},
{sipName_QAbstractProxyModel, &sipClass_QAbstractProxyModel, 99, 19},
{sipName_QClipboard, &sipClass_QClipboard, -1, 20},
{sipName_QStringListModel, &sipClass_QStringListModel, -1, 21},
{sipName_QItemSelectionModel, &sipClass_QItemSelectionModel, -1, 22},
{sipName_QSyntaxHighlighter, &sipClass_QSyntaxHighlighter, -1, 23},
{sipName_QDirModel, &sipClass_QDirModel, -1, 24},
{sipName_QValidator, &sipClass_QValidator, 100, 25},
#if defined(SIP_FEATURE_PyQt_SessionManager)
{sipName_QSessionManager, &sipClass_QSessionManager, -1, -1},
#else
{0, 0, -1, -1},
#endif
{sipName_QItemDelegate, &sipClass_QItemDelegate, -1, -1},
{sipName_QBoxLayout, &sipClass_QBoxLayout, 30, 28},
{sipName_QStackedLayout, &sipClass_QStackedLayout, -1, 29},
{sipName_QGridLayout, &sipClass_QGridLayout, -1, -1},
{sipName_QVBoxLayout, &sipClass_QVBoxLayout, -1, 31},
{sipName_QHBoxLayout, &sipClass_QHBoxLayout, -1, -1},
{sipName_QGroupBox, &sipClass_QGroupBox, -1, 33},
{sipName_QDialog, &sipClass_QDialog, 56, 34},
{sipName_QAbstractButton, &sipClass_QAbstractButton, 66, 35},
{sipName_QComboBox, &sipClass_QComboBox, -1, 36},
{sipName_QToolBar, &sipClass_QToolBar, -1, 37},
{sipName_QStatusBar, &sipClass_QStatusBar, -1, 38},
{sipName_QRubberBand, &sipClass_QRubberBand, -1, 39},
{sipName_QTabWidget, &sipClass_QTabWidget, -1, 40},
{sipName_QFrame, &sipClass_QFrame, 70, 41},
{sipName_QFocusFrame, &sipClass_QFocusFrame, -1, 42},
{sipName_QAbstractSlider, &sipClass_QAbstractSlider, 87, 43},
{sipName_QProgressBar, &sipClass_QProgressBar, -1, 44},
{sipName_QSplashScreen, &sipClass_QSplashScreen, -1, 45},
{sipName_QDesktopWidget, &sipClass_QDesktopWidget, -1, 46},
{sipName_QMainWindow, &sipClass_QMainWindow, -1, 47},
{sipName_QTabBar, &sipClass_QTabBar, -1, 48},
{sipName_QWorkspace, &sipClass_QWorkspace, -1, 49},
{sipName_QSplitterHandle, &sipClass_QSplitterHandle, -1, 50},
{sipName_QAbstractSpinBox, &sipClass_QAbstractSpinBox, 90, 51},
{sipName_QMenu, &sipClass_QMenu, -1, 52},
{sipName_QDockWidget, &sipClass_QDockWidget, -1, 53},
{sipName_QLineEdit, &sipClass_QLineEdit, -1, 54},
{sipName_QMenuBar, &sipClass_QMenuBar, -1, 55},
{sipName_QSizeGrip, &sipClass_QSizeGrip, -1, -1},
{sipName_QFileDialog, &sipClass_QFileDialog, -1, 57},
{sipName_QMessageBox, &sipClass_QMessageBox, -1, 58},
{sipName_QFontDialog, &sipClass_QFontDialog, -1, 59},
{sipName_QInputDialog, &sipClass_QInputDialog, -1, 60},
{sipName_QProgressDialog, &sipClass_QProgressDialog, -1, 61},
{sipName_QAbstractPrintDialog, &sipClass_QAbstractPrintDialog, 65, 62},
{sipName_QErrorMessage, &sipClass_QErrorMessage, -1, 63},
{sipName_QPageSetupDialog, &sipClass_QPageSetupDialog, -1, 64},
{sipName_QColorDialog, &sipClass_QColorDialog, -1, -1},
{sipName_QPrintDialog, &sipClass_QPrintDialog, -1, -1},
{sipName_QPushButton, &sipClass_QPushButton, -1, 67},
{sipName_QCheckBox, &sipClass_QCheckBox, -1, 68},
{sipName_QRadioButton, &sipClass_QRadioButton, -1, 69},
{sipName_QToolButton, &sipClass_QToolButton, -1, -1},
{sipName_QLCDNumber, &sipClass_QLCDNumber, -1, 71},
{sipName_QToolBox, &sipClass_QToolBox, -1, 72},
{sipName_QSplitter, &sipClass_QSplitter, -1, 73},
{sipName_QStackedWidget, &sipClass_QStackedWidget, -1, 74},
{sipName_QLabel, &sipClass_QLabel, -1, 75},
{sipName_QAbstractScrollArea, &sipClass_QAbstractScrollArea, 76, -1},
{sipName_QTextEdit, &sipClass_QTextEdit, 79, 77},
{sipName_QAbstractItemView, &sipClass_QAbstractItemView, 80, 78},
{sipName_QScrollArea, &sipClass_QScrollArea, -1, -1},
{sipName_QTextBrowser, &sipClass_QTextBrowser, -1, -1},
{sipName_QListView, &sipClass_QListView, 84, 81},
{sipName_QTableView, &sipClass_QTableView, 85, 82},
{sipName_QTreeView, &sipClass_QTreeView, 86, 83},
{sipName_QHeaderView, &sipClass_QHeaderView, -1, -1},
{sipName_QListWidget, &sipClass_QListWidget, -1, -1},
{sipName_QTableWidget, &sipClass_QTableWidget, -1, -1},
{sipName_QTreeWidget, &sipClass_QTreeWidget, -1, -1},
{sipName_QScrollBar, &sipClass_QScrollBar, -1, 88},
{sipName_QSlider, &sipClass_QSlider, -1, 89},
{sipName_QDial, &sipClass_QDial, -1, -1},
{sipName_QDoubleSpinBox, &sipClass_QDoubleSpinBox, -1, 91},
{sipName_QSpinBox, &sipClass_QSpinBox, -1, 92},
{sipName_QDateTimeEdit, &sipClass_QDateTimeEdit, 93, -1},
{sipName_QTimeEdit, &sipClass_QTimeEdit, -1, 94},
{sipName_QDateEdit, &sipClass_QDateEdit, -1, -1},
{sipName_QTextBlockGroup, &sipClass_QTextBlockGroup, 97, 96},
{sipName_QTextFrame, &sipClass_QTextFrame, 98, -1},
{sipName_QTextList, &sipClass_QTextList, -1, -1},
{sipName_QTextTable, &sipClass_QTextTable, -1, -1},
{sipName_QSortFilterProxyModel, &sipClass_QSortFilterProxyModel, -1, -1},
{sipName_QRegExpValidator, &sipClass_QRegExpValidator, -1, 101},
{sipName_QDoubleValidator, &sipClass_QDoubleValidator, -1, 102},
{sipName_QIntValidator, &sipClass_QIntValidator, -1, -1},
};
int i = 0;
sipClass = NULL;
do
{
struct class_graph *cg = &graph[i];
if (cg->name != NULL && sipCpp->inherits(cg->name))
{
sipClass = *cg->type;
i = cg->yes;
}
else
i = cg->no;
}
while (i >= 0);
%End
public:
QApplication(SIP_PYLIST argv) /PostHook=__pyQtQAppHook__/ [(int &argc, char **argv)];
%MethodCode
// The Python interface is a list of argument strings that is modified.
int argc;
char **argv;
// Convert the list.
if ((argv = qtgui_ArgvToC(a0, argc)) == NULL)
sipIsErr = 1;
else
{
// Create it now the arguments are right.
static int nargc = argc;
sipCpp = new sipQApplication(nargc, argv);
// Now modify the original list.
qtgui_UpdatePyArgv(a0, argc, argv);
}
%End
QApplication(SIP_PYLIST argv, bool GUIenabled) /PostHook=__pyQtQAppHook__/ [(int &argc, char **argv, bool GUIenabled)];
%MethodCode
// The Python interface is a list of argument strings that is modified.
int argc;
char **argv;
// Convert the list.
if ((argv = qtgui_ArgvToC(a0, argc)) == NULL)
sipIsErr = 1;
else
{
// Create it now the arguments are right.
static int nargc = argc;
sipCpp = new sipQApplication(nargc, argv, a1);
// Now modify the original list.
qtgui_UpdatePyArgv(a0, argc, argv);
}
%End
enum Type
{
Tty,
GuiClient,
GuiServer,
};
QApplication(SIP_PYLIST argv, QApplication::Type) /PostHook=__pyQtQAppHook__/ [(int &argc, char **argv, QApplication::Type)];
%MethodCode
// The Python interface is a list of argument strings that is modified.
int argc;
char **argv;
// Convert the list.
if ((argv = qtgui_ArgvToC(a0, argc)) == NULL)
sipIsErr = 1;
else
{
// Create it now the arguments are right.
static int nargc = argc;
sipCpp = new sipQApplication(nargc, argv, a1);
// Now modify the original list.
qtgui_UpdatePyArgv(a0, argc, argv);
}
%End
virtual ~QApplication();
static QApplication::Type type();
static QStyle *style();
static void setStyle(QStyle * /Transfer/);
static QStyle *setStyle(const QString &);
enum ColorSpec
{
NormalColor,
CustomColor,
ManyColor,
};
static int colorSpec();
static void setColorSpec(int);
static QCursor *overrideCursor();
static void setOverrideCursor(const QCursor &);
static void changeOverrideCursor(const QCursor &);
static void restoreOverrideCursor();
static QPalette palette();
static QPalette palette(const QWidget *);
static QPalette palette(const char *className);
static void setPalette(const QPalette &, const char *className = 0);
static QFont font(const QWidget * = 0);
static void setFont(const QFont &, const char *className = 0);
static QFontMetrics fontMetrics();
static void setWindowIcon(const QIcon &icon);
static QIcon windowIcon();
static QWidgetList allWidgets();
static QWidgetList topLevelWidgets();
static QDesktopWidget *desktop();
static QWidget *activePopupWidget();
static QWidget *activeModalWidget();
static QClipboard *clipboard();
static QWidget *focusWidget();
static QWidget *activeWindow();
static void setActiveWindow(QWidget *act);
static QWidget *widgetAt(const QPoint &p);
static QWidget *widgetAt(int x, int y);
static QWidget *topLevelAt(const QPoint &p);
static QWidget *topLevelAt(int x, int y);
static void syncX();
static void beep();
static Qt::KeyboardModifiers keyboardModifiers();
static Qt::MouseButtons mouseButtons();
static void setDesktopSettingsAware(bool);
static bool desktopSettingsAware();
static void setCursorFlashTime(int);
static int cursorFlashTime();
static void setDoubleClickInterval(int);
static int doubleClickInterval();
static void setKeyboardInputInterval(int);
static int keyboardInputInterval();
static void setWheelScrollLines(int);
static int wheelScrollLines();
static void setGlobalStrut(const QSize &);
static QSize globalStrut();
static void setStartDragTime(int ms);
static int startDragTime();
static void setStartDragDistance(int l);
static int startDragDistance();
static void setLayoutDirection(Qt::LayoutDirection direction);
static Qt::LayoutDirection layoutDirection();
static bool isRightToLeft();
static bool isLeftToRight();
static bool isEffectEnabled(Qt::UIEffect);
static void setEffectEnabled(Qt::UIEffect, bool enable = true);
%If (PyQt_SessionManager)
bool isSessionRestored() const;
%End
%If (PyQt_SessionManager)
QString sessionId() const;
%End
%If (PyQt_SessionManager)
QString sessionKey() const;
%End
%If (PyQt_SessionManager)
virtual void commitData(QSessionManager &sm);
%End
%If (PyQt_SessionManager)
virtual void saveState(QSessionManager &sm);
%End
void setInputContext(QInputContext *);
QInputContext *inputContext() const;
static int exec() /PostHook=__pyQtPostEventLoopHook__, PreHook=__pyQtPreEventLoopHook__, PyName=exec_, ReleaseGIL/;
virtual bool notify(QObject *, QEvent *) /ReleaseGIL/;
static void setQuitOnLastWindowClosed(bool quit);
static bool quitOnLastWindowClosed();
signals:
void focusChanged(QWidget *old, QWidget *now);
void lastWindowClosed();
public slots:
static void closeAllWindows();
static void aboutQt();
protected:
virtual bool event(QEvent *);
private:
QApplication(const QApplication &);
};
%ModuleCode
// Handle any delayed dtors calls.
extern "C" {static void sipDelayedDtors(const sipDelayedDtor *ddlist);}
static void sipDelayedDtors(const sipDelayedDtor *ddlist)
{
// QApplication is the only DelayDtor class and there should only be one
// instance.
while (ddlist)
{
if (ddlist->dd_isderived)
delete reinterpret_cast<sipQApplication *>(ddlist->dd_ptr);
else
delete reinterpret_cast<QApplication *>(ddlist->dd_ptr);
ddlist = ddlist->dd_next;
}
}
%End
|