2008-04-24 14:49:12 +02:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
CEmbedder.cpp
|
|
|
|
|
2009-08-17 12:41:51 +02:00
|
|
|
(c) 2000-2009 Benoît Minisini <gambas@users.sourceforge.net>
|
2008-04-24 14:49:12 +02:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2009-08-17 12:41:51 +02:00
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
2008-04-24 14:49:12 +02:00
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed 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 this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#define __CEMBEDDER_CPP
|
|
|
|
|
|
|
|
#include "CEmbedder.h"
|
|
|
|
|
|
|
|
DECLARE_EVENT(EVENT_Embed);
|
|
|
|
DECLARE_EVENT(EVENT_Close);
|
|
|
|
DECLARE_EVENT(EVENT_Error);
|
|
|
|
|
2010-01-21 17:46:21 +01:00
|
|
|
#ifdef NO_X_WINDOW
|
|
|
|
|
|
|
|
BEGIN_METHOD(CEMBEDDER_new, GB_OBJECT parent)
|
|
|
|
|
|
|
|
QWidget *wid = new QWidget(QCONTAINER(VARG(parent)));
|
|
|
|
|
|
|
|
//QObject::connect(wid, SIGNAL(clientIsEmbedded()), &CEmbedder::manager, SLOT(embedded()));
|
|
|
|
//QObject::connect(wid, SIGNAL(clientClosed()), &CEmbedder::manager, SLOT(closed()));
|
|
|
|
//QObject::connect(wid, SIGNAL(error(QX11EmbedContainer::Error)), &CEmbedder::manager, SLOT(error()));
|
|
|
|
|
|
|
|
CWIDGET_new(wid, (void *)_object);
|
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CEMBEDDER_client)
|
|
|
|
|
|
|
|
GB.ReturnInteger(0);
|
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_METHOD(CEMBEDDER_embed, GB_INTEGER client)
|
|
|
|
|
|
|
|
//WIDGET->embedClient(VARG(client));
|
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_METHOD_VOID(CEMBEDDER_discard)
|
|
|
|
|
|
|
|
//WIDGET->discardClient();
|
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2008-04-24 14:49:12 +02:00
|
|
|
BEGIN_METHOD(CEMBEDDER_new, GB_OBJECT parent)
|
|
|
|
|
|
|
|
QX11EmbedContainer *wid = new QX11EmbedContainer(QCONTAINER(VARG(parent)));
|
|
|
|
|
|
|
|
QObject::connect(wid, SIGNAL(clientIsEmbedded()), &CEmbedder::manager, SLOT(embedded()));
|
|
|
|
QObject::connect(wid, SIGNAL(clientClosed()), &CEmbedder::manager, SLOT(closed()));
|
2009-12-24 10:19:51 +01:00
|
|
|
QObject::connect(wid, SIGNAL(error(QX11EmbedContainer::Error)), &CEmbedder::manager, SLOT(error()));
|
2008-04-24 14:49:12 +02:00
|
|
|
|
|
|
|
CWIDGET_new(wid, (void *)_object);
|
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CEMBEDDER_client)
|
|
|
|
|
|
|
|
GB.ReturnInteger((int)WIDGET->clientWinId());
|
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_METHOD(CEMBEDDER_embed, GB_INTEGER client)
|
|
|
|
|
|
|
|
WIDGET->embedClient(VARG(client));
|
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_METHOD_VOID(CEMBEDDER_discard)
|
|
|
|
|
|
|
|
WIDGET->discardClient();
|
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
2010-01-21 17:46:21 +01:00
|
|
|
/*--- CEmbedder -----------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
CEmbedder CEmbedder::manager;
|
|
|
|
|
|
|
|
void CEmbedder::embedded()
|
|
|
|
{
|
|
|
|
RAISE_EVENT(EVENT_Embed);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CEmbedder::closed()
|
|
|
|
{
|
|
|
|
RAISE_EVENT(EVENT_Close);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CEmbedder::error()
|
|
|
|
{
|
|
|
|
RAISE_EVENT(EVENT_Error);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2008-04-24 14:49:12 +02:00
|
|
|
|
|
|
|
GB_DESC CEmbedderDesc[] =
|
|
|
|
{
|
|
|
|
GB_DECLARE("Embedder", sizeof(CEMBEDDER)),
|
|
|
|
GB_INHERITS("Control"),
|
|
|
|
|
|
|
|
GB_METHOD("_new", NULL, CEMBEDDER_new, "(Parent)Container;"),
|
|
|
|
|
|
|
|
GB_PROPERTY_READ("Client", "i", CEMBEDDER_client),
|
|
|
|
GB_METHOD("Embed", NULL, CEMBEDDER_embed, "(Client)i"),
|
|
|
|
GB_METHOD("Discard", NULL, CEMBEDDER_discard, NULL),
|
|
|
|
|
|
|
|
EMBEDDER_DESCRIPTION,
|
|
|
|
|
|
|
|
GB_EVENT("Embed", NULL, NULL, &EVENT_Embed),
|
|
|
|
GB_EVENT("Close", NULL, NULL, &EVENT_Close),
|
|
|
|
GB_EVENT("Error", NULL, NULL, &EVENT_Error),
|
|
|
|
|
|
|
|
GB_END_DECLARE
|
|
|
|
};
|
|
|
|
|
|
|
|
|