gambas-source-code/gb.qt4/src/CEmbedder.cpp
Benoît Minisini f65184802d [CONFIGURATION]
* NEW: Update copyright and license string in all source files.


git-svn-id: svn://localhost/gambas/trunk@2241 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2009-08-17 10:41:51 +00:00

105 lines
2.5 KiB
C++

/***************************************************************************
CEmbedder.cpp
(c) 2000-2009 Benoît Minisini <gambas@users.sourceforge.net>
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
the Free Software Foundation; either version 2, or (at your option)
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);
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()));
QObject::connect(wid, SIGNAL(error(int)), &CEmbedder::manager, SLOT(error()));
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
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
};
/*--- 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);
}