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
|
/*
# Copyright (C) 2001-2013, Parrot Foundation.
=head1 NAME
examples/nci/PQt.cpp - Qt/Parrot Library
=head1 SYNOPSIS
Compile with:
*NIX:
$ g++ -fPIC -I$QTDIR/include -I$QTDIR/include/QtGui -L$QTDIR examples/nci/PQt.cpp -shared -o runtime/parrot/dynext/libPQt.so $QTDIR/lib/libQtCore4.so $QTDIR/lib/libQtGui4.so
Debian:
$ apt-get install libqt4-dev
$ g++ -shared -fPIC -o runtime/parrot/dynext/libPQt.so examples/nci/PQt.cpp -I/usr/include/qt4/QtGui -I/usr/include/qt4 -lQtGui -lQtCore
Macports:
$ sudo port install qt4-mac
$ c++ -I/opt/local/include -I/opt/local/Library/Frameworks/QtGui.framework/Header -undefined dynamic_lookup -o runtime/parrot/dynext/libPQt.dylib examples/nci/PQt.cpps -L/opt/local/lib -lQtGui -lQtCore
Windows:
> "%VS90COMNTOOLS%\vsvars32.bat"
> set INCLUDE=%QTDIR%\include;%QTDIR%\include\QtGui;%INCLUDE%
> set LIB=%QTDIR%\lib;%LIB%
> cl /LD PQt.cpp QtGui4.lib QtCore4.lib
Or something like that...
=head1 DESCRIPTION
Qt Native interface for Parrot. See F<examples/nci/QtHelloWorld.pir>
for more information.
=cut
*/
#ifdef _WIN32
#define PQT_API __declspec(dllexport)
#else
#define PQT_API
#endif
#include <QtGui>
extern "C" {
PQT_API QApplication * pApp;
/*
=head2 QApplication bindings
=over 4
=item C<QApplication *QApplication_new(void)>
=cut
*/
PQT_API QApplication *QApplication_new(void) {
int PQtargc = 0;
char *PQtargv[2];
PQtargv[0] = "";
PQtargv[1] = NULL;
pApp = new QApplication(PQtargc, PQtargv);
return pApp;
}
/*
=item C<void QApplication_exec(QApplication *app)>
=cut
*/
PQT_API void QApplication_exec(QApplication *app)
{
app->exec();
}
/*
=back
=head2 QLabel bindings
=over 4
=item C<QLabel * QLabel_new(const char *txt)>
=cut
*/
PQT_API QLabel * QLabel_new(const char *txt)
{
QLabel * pLabel = new QLabel(txt, 0);
return pLabel;
}
/*
=item C<void QLabel_show(QLabel *label)>
=cut
*/
PQT_API void QLabel_show(QLabel *label)
{
label->show();
}
/*
=item C<void QLabel_resize(QLabel *label, int x, int y)>
=cut
*/
PQT_API void QLabel_resize(QLabel *label, int x, int y)
{
label->resize(x, y);
}
}
/*
=back
=head1 SEE ALSO
F<examples/nci/QtHelloWorld.pir>,
F<docs/pdds/pdd03_calling_conventions.pod>.
=cut
*/
/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4:
*/
|