experimental OLE control (the reason for the
recent reshuffle) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2283 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
331
utils/wxOLE/gtk/wxole.cpp
Normal file
331
utils/wxOLE/gtk/wxole.cpp
Normal file
@@ -0,0 +1,331 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wxole.cpp
|
||||||
|
// Purpose: wxOLE
|
||||||
|
// Author: Robert Roebling
|
||||||
|
// Modified by:
|
||||||
|
// Created: 20/04/99
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Robert Roebling
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "wxole.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/defs.h"
|
||||||
|
#include "wxole.h"
|
||||||
|
|
||||||
|
#include "wx/app.h"
|
||||||
|
#include "wx/menu.h"
|
||||||
|
#include "wx/statusbr.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
|
|
||||||
|
#include "wx/gtk/win_gtk.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "gtk/gtk.h"
|
||||||
|
#include "gdk/gdk.h"
|
||||||
|
|
||||||
|
#include <gnome.h>
|
||||||
|
#include <libgnorba/gnorba.h>
|
||||||
|
#include <bonobo/bonobo.h>
|
||||||
|
#include <bonobo/gnome-main.h>
|
||||||
|
#include <bonobo/gnome-component.h>
|
||||||
|
#include <bonobo/gnome-component-factory.h>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// global data
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const wxChar *wxOleNameStr = _T("olecontrol");
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// wxOleServerEnvPrivate
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxOleServerEnvPrivate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxOleServerEnvPrivate() {}
|
||||||
|
~wxOleServerEnvPrivate() {}
|
||||||
|
|
||||||
|
CORBA_Environment m_ev;
|
||||||
|
CORBA_ORB m_orb;
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// wxOleServerEnv
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_CLASS(wxOleServerEnv,wxObject)
|
||||||
|
|
||||||
|
wxOleServerEnv::wxOleServerEnv( const wxString &name, const wxString &version )
|
||||||
|
{
|
||||||
|
m_serverName = name;
|
||||||
|
m_serverVersion = version;
|
||||||
|
|
||||||
|
m_priv = new wxOleServerEnvPrivate();
|
||||||
|
|
||||||
|
CORBA_exception_init( &(m_priv->m_ev) );
|
||||||
|
|
||||||
|
gnome_CORBA_init(
|
||||||
|
m_serverName.mb_str(),
|
||||||
|
m_serverVersion.mb_str(),
|
||||||
|
&wxTheApp->argc,
|
||||||
|
wxTheApp->argv,
|
||||||
|
GNORBA_INIT_SERVER_FUNC,
|
||||||
|
&(m_priv->m_ev) );
|
||||||
|
|
||||||
|
if (m_priv->m_ev._major != CORBA_NO_EXCEPTION)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_priv->m_orb = gnome_CORBA_ORB();
|
||||||
|
|
||||||
|
if (bonobo_init( m_priv->m_orb, NULL, NULL ) == FALSE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
wxOleServerEnv::~wxOleServerEnv()
|
||||||
|
{
|
||||||
|
CORBA_exception_free( &(m_priv->m_ev) );
|
||||||
|
delete m_priv;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// wxOleServerPrivate
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxOleServerPrivate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxOleServerPrivate() {}
|
||||||
|
~wxOleServerPrivate() {}
|
||||||
|
|
||||||
|
GnomeComponentFactory *m_factory;
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// wxOleServer
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static GnomeView*
|
||||||
|
gnome_view_factory_callback( GnomeComponent *WXUNUSED(component), wxOleServer *server )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
printf( "Create OLE control.\n" );
|
||||||
|
*/
|
||||||
|
|
||||||
|
wxOleControl *ctx = server->CreateOleControl();
|
||||||
|
|
||||||
|
if (!ctx) return (GnomeView*) NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
printf( "Creating OLE control succeeded. Returning as GnomeView\n" );
|
||||||
|
*/
|
||||||
|
|
||||||
|
return gnome_view_new( ctx->m_widget );
|
||||||
|
}
|
||||||
|
|
||||||
|
static GnomeComponent*
|
||||||
|
gnome_component_factory_callback( GnomeComponentFactory *factory, const char *path, wxOleServer *server )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
printf( "new component.\n" );
|
||||||
|
if (path) printf( "path is %s.\n", path );
|
||||||
|
*/
|
||||||
|
|
||||||
|
GnomeComponent *component = gnome_component_new( gnome_view_factory_callback, (void*) server );
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (!component)
|
||||||
|
printf( "component creation failed.\n" );
|
||||||
|
else
|
||||||
|
printf( "component creation succeded.\n" );
|
||||||
|
*/
|
||||||
|
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
IMPLEMENT_CLASS(wxOleServer,wxObject)
|
||||||
|
|
||||||
|
wxOleServer::wxOleServer( const wxString &id )
|
||||||
|
{
|
||||||
|
m_ID = "component:";
|
||||||
|
m_ID += id;
|
||||||
|
|
||||||
|
m_priv = new wxOleServerPrivate();
|
||||||
|
|
||||||
|
/*
|
||||||
|
printf( "new component factory.\n" );
|
||||||
|
*/
|
||||||
|
|
||||||
|
m_priv->m_factory = gnome_component_factory_new( m_ID.mb_str(), gnome_component_factory_callback, (void*) this );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxOleServer::~wxOleServer()
|
||||||
|
{
|
||||||
|
delete m_priv;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxOleControl *wxOleServer::CreateOleControl()
|
||||||
|
{
|
||||||
|
return new wxOleControl( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// "size_allocate"
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void gtk_olectx_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxOleControl *win )
|
||||||
|
{
|
||||||
|
if (!win->HasVMT()) return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
printf( "OnFrameResize from " );
|
||||||
|
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||||
|
printf( win->GetClassInfo()->GetClassName() );
|
||||||
|
printf( ".\n" );
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
|
||||||
|
{
|
||||||
|
win->m_sizeSet = FALSE;
|
||||||
|
win->m_width = alloc->width;
|
||||||
|
win->m_height = alloc->height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// "delete_event"
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static gint gtk_olectx_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxOleControl *win )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
printf( "OnDelete from " );
|
||||||
|
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||||
|
printf( win->GetClassInfo()->GetClassName() );
|
||||||
|
printf( ".\n" );
|
||||||
|
*/
|
||||||
|
|
||||||
|
win->Close();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// "configure_event"
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static gint gtk_olectx_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxOleControl *win )
|
||||||
|
{
|
||||||
|
if (!win->HasVMT()) return FALSE;
|
||||||
|
|
||||||
|
win->m_x = event->x;
|
||||||
|
win->m_y = event->y;
|
||||||
|
|
||||||
|
wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() );
|
||||||
|
mevent.SetEventObject( win );
|
||||||
|
win->GetEventHandler()->ProcessEvent( mevent );
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// wxOleControl
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_CLASS(wxOleControl,wxFrame)
|
||||||
|
|
||||||
|
wxOleControl::wxOleControl( wxWindowID id, long style, const wxString &name )
|
||||||
|
{
|
||||||
|
Create( id, style, name );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxOleControl::Create( wxWindowID id, long style, const wxString &name )
|
||||||
|
{
|
||||||
|
wxTopLevelWindows.Append( this );
|
||||||
|
|
||||||
|
m_needParent = FALSE;
|
||||||
|
|
||||||
|
PreCreation( (wxWindow*) NULL, id, wxDefaultPosition, wxDefaultSize, style, name );
|
||||||
|
|
||||||
|
m_title = _T("wxWindows OLE Server");
|
||||||
|
|
||||||
|
/* any widget that can contain another widget and resizes it
|
||||||
|
to its full size */
|
||||||
|
m_widget = gtk_hbox_new(0,0);
|
||||||
|
|
||||||
|
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
||||||
|
|
||||||
|
gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
|
||||||
|
GTK_SIGNAL_FUNC(gtk_olectx_delete_callback), (gpointer)this );
|
||||||
|
|
||||||
|
/* m_mainWidget holds the toolbar, the menubar and the client area */
|
||||||
|
m_mainWidget = gtk_myfixed_new();
|
||||||
|
gtk_widget_show( m_mainWidget );
|
||||||
|
GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS );
|
||||||
|
gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget );
|
||||||
|
|
||||||
|
/* m_wxwindow only represents the client area without toolbar and menubar */
|
||||||
|
m_wxwindow = gtk_myfixed_new();
|
||||||
|
gtk_widget_show( m_wxwindow );
|
||||||
|
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
|
||||||
|
gtk_container_add( GTK_CONTAINER(m_mainWidget), m_wxwindow );
|
||||||
|
|
||||||
|
PostCreation();
|
||||||
|
|
||||||
|
/* the user resized the frame by dragging etc. */
|
||||||
|
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||||
|
GTK_SIGNAL_FUNC(gtk_olectx_size_callback), (gpointer)this );
|
||||||
|
|
||||||
|
/* the only way to get the window size is to connect to this event */
|
||||||
|
gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
|
||||||
|
GTK_SIGNAL_FUNC(gtk_olectx_configure_callback), (gpointer)this );
|
||||||
|
|
||||||
|
gtk_widget_show_all( m_widget );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxOleControl::~wxOleControl()
|
||||||
|
{
|
||||||
|
if (m_frameMenuBar) delete m_frameMenuBar;
|
||||||
|
m_frameMenuBar = (wxMenuBar *) NULL;
|
||||||
|
|
||||||
|
if (m_frameStatusBar) delete m_frameStatusBar;
|
||||||
|
m_frameStatusBar = (wxStatusBar *) NULL;
|
||||||
|
|
||||||
|
if (m_frameToolBar) delete m_frameToolBar;
|
||||||
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
|
|
||||||
|
wxTopLevelWindows.DeleteObject( this );
|
||||||
|
|
||||||
|
if (wxTheApp->GetTopWindow() == this)
|
||||||
|
wxTheApp->SetTopWindow( (wxWindow*) NULL );
|
||||||
|
|
||||||
|
if (wxTopLevelWindows.Number() == 0)
|
||||||
|
wxTheApp->ExitMainLoop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxOleControl::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxOleControl::DoSetClientSize(int width, int height)
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
108
utils/wxOLE/gtk/wxole.h
Normal file
108
utils/wxOLE/gtk/wxole.h
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wxole.h
|
||||||
|
// Purpose: wxOLE
|
||||||
|
// Author: Robert Roebling
|
||||||
|
// Modified by:
|
||||||
|
// Created: 17/8/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Robert Roebling
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "wxole.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _WX_OLE_H_
|
||||||
|
#define _WX_OLE_H_
|
||||||
|
|
||||||
|
#include "wx/defs.h"
|
||||||
|
#include "wx/object.h"
|
||||||
|
#include "wx/frame.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// global data
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern const wxChar *wxOleNameStr;
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// classes
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxOleServerEnv;
|
||||||
|
class wxOleServer;
|
||||||
|
class wxOleControl;
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// wxOleServerEnv
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxOleServerEnvPrivate;
|
||||||
|
|
||||||
|
class wxOleServerEnv : public wxObject
|
||||||
|
{
|
||||||
|
DECLARE_CLASS(wxOleServerEnv)
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxOleServerEnv( const wxString &name, const wxString &version );
|
||||||
|
~wxOleServerEnv();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
wxString m_serverName;
|
||||||
|
wxString m_serverVersion;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxOleServerEnvPrivate *m_priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// wxOleServer
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxOleServerPrivate;
|
||||||
|
|
||||||
|
class wxOleServer : public wxObject
|
||||||
|
{
|
||||||
|
DECLARE_CLASS(wxOleServer)
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxOleServer( const wxString &id );
|
||||||
|
~wxOleServer();
|
||||||
|
|
||||||
|
virtual wxOleControl *CreateOleControl();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
wxString m_ID;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxOleServerPrivate *m_priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// wxOleControl
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxOleControl : public wxFrame
|
||||||
|
{
|
||||||
|
DECLARE_CLASS(wxOleControl)
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxOleControl( wxWindowID id, long style = 0, const wxString &name = wxOleNameStr );
|
||||||
|
~wxOleControl();
|
||||||
|
bool Create( wxWindowID id, long style = 0, const wxString &name = wxOleNameStr );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoSetSize(int x, int y,
|
||||||
|
int width, int height,
|
||||||
|
int sizeFlags = wxSIZE_AUTO);
|
||||||
|
|
||||||
|
virtual void DoSetClientSize(int width, int height);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
7
utils/wxOLE/samples/servlet/.cvsignore
Normal file
7
utils/wxOLE/samples/servlet/.cvsignore
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Linux
|
||||||
|
linux-gnu
|
||||||
|
linux
|
||||||
|
servelt
|
||||||
|
test-coontainer
|
||||||
|
servlet.o
|
||||||
|
wxole.o
|
29
utils/wxOLE/samples/servlet/Makefile
Normal file
29
utils/wxOLE/samples/servlet/Makefile
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#
|
||||||
|
# File: Makefile
|
||||||
|
# Author: Robert Roebling
|
||||||
|
# Created: 1999
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Robert Roebling
|
||||||
|
#
|
||||||
|
# Makefile for OLE demo (GTK version)
|
||||||
|
#
|
||||||
|
# This makefile requires wxWindows/GTK to be
|
||||||
|
# installed (possibly using "make install")
|
||||||
|
# on your system.
|
||||||
|
#
|
||||||
|
|
||||||
|
CC = g++
|
||||||
|
|
||||||
|
servlet: servlet.o wxole.o
|
||||||
|
$(CC) -o servlet servlet.o wxole.o \
|
||||||
|
`wx-config --libs` -lbonobo `gnome-config --libs gnorba` `gnome-config --libs gnomeui`
|
||||||
|
|
||||||
|
servlet.o: servlet.cpp
|
||||||
|
$(CC) `wx-config --cflags` `gtk-config --cflags` -I../../gtk -c servlet.cpp
|
||||||
|
|
||||||
|
wxole.o: ../../gtk/wxole.cpp
|
||||||
|
$(CC) `wx-config --cflags` `gtk-config --cflags` `gnome-config --cflags gnorba` \
|
||||||
|
-I../../gtk -c ../../gtk/wxole.cpp
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o servlet
|
44
utils/wxOLE/samples/servlet/mondrian.xpm
Normal file
44
utils/wxOLE/samples/servlet/mondrian.xpm
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *mondrian_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"32 32 6 1",
|
||||||
|
" c Black",
|
||||||
|
". c Blue",
|
||||||
|
"X c #00bf00",
|
||||||
|
"o c Red",
|
||||||
|
"O c Yellow",
|
||||||
|
"+ c Gray100",
|
||||||
|
/* pixels */
|
||||||
|
" ",
|
||||||
|
" oooooo +++++++++++++++++++++++ ",
|
||||||
|
" oooooo +++++++++++++++++++++++ ",
|
||||||
|
" oooooo +++++++++++++++++++++++ ",
|
||||||
|
" oooooo +++++++++++++++++++++++ ",
|
||||||
|
" oooooo +++++++++++++++++++++++ ",
|
||||||
|
" oooooo +++++++++++++++++++++++ ",
|
||||||
|
" oooooo +++++++++++++++++++++++ ",
|
||||||
|
" ",
|
||||||
|
" ++++++ ++++++++++++++++++ .... ",
|
||||||
|
" ++++++ ++++++++++++++++++ .... ",
|
||||||
|
" ++++++ ++++++++++++++++++ .... ",
|
||||||
|
" ++++++ ++++++++++++++++++ .... ",
|
||||||
|
" ++++++ ++++++++++++++++++ .... ",
|
||||||
|
" ++++++ ++++++++++++++++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++ ",
|
||||||
|
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||||
|
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||||
|
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||||
|
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||||
|
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||||
|
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||||
|
" "
|
||||||
|
};
|
135
utils/wxOLE/samples/servlet/servlet.cpp
Normal file
135
utils/wxOLE/samples/servlet/servlet.cpp
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: servlet.cpp
|
||||||
|
// Purpose: Minimal wxWindows OLE server sample
|
||||||
|
// Author: Robert Roebling
|
||||||
|
// Modified by:
|
||||||
|
// Created: 20/04/99
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Robert Roebling
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "servlet.cpp"
|
||||||
|
#pragma interface "servlet.cpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For OLE stuff
|
||||||
|
#include "wxole.h"
|
||||||
|
|
||||||
|
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||||
|
#include "mondrian.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// MyOleControl
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class MyOleControl : public wxOleControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
MyOleControl();
|
||||||
|
|
||||||
|
void OnPaint( wxPaintEvent &event );
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// MyOleServer
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class MyOleServer : public wxOleServer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
MyOleServer() : wxOleServer( "servlet" ) { }
|
||||||
|
|
||||||
|
wxOleControl *CreateOleControl() { return new MyOleControl(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// MyApp
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class MyApp : public wxApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
MyApp();
|
||||||
|
~MyApp();
|
||||||
|
|
||||||
|
virtual bool OnInit();
|
||||||
|
|
||||||
|
wxOleServerEnv *m_oleEnv;
|
||||||
|
MyOleServer *m_oleServer;
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// main
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_APP(MyApp)
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// MyApp
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MyApp::MyApp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
MyApp::~MyApp()
|
||||||
|
{
|
||||||
|
delete m_oleEnv;
|
||||||
|
delete m_oleServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "gtk/gtk.h"
|
||||||
|
|
||||||
|
bool MyApp::OnInit()
|
||||||
|
{
|
||||||
|
m_oleEnv = new wxOleServerEnv( "MyServer", "1.0" );
|
||||||
|
m_oleServer = new MyOleServer();
|
||||||
|
|
||||||
|
/* how do we get outta here ? */
|
||||||
|
for (;;) wxYield();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// MyOleControl
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyOleControl, wxOleControl)
|
||||||
|
EVT_PAINT(MyOleControl::OnPaint)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
MyOleControl::MyOleControl() :
|
||||||
|
wxOleControl( -1 )
|
||||||
|
{
|
||||||
|
(void)new wxButton( this, -1, "Ole, Ole", wxPoint(5,40), wxSize(120,-1) );
|
||||||
|
(void)new wxButton( this, -1, "Greetings", wxPoint(5,70), wxSize(120,-1) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyOleControl::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||||
|
{
|
||||||
|
wxPaintDC dc(this);
|
||||||
|
dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL, FALSE, "charter" ) );
|
||||||
|
dc.DrawText( "wxWindows rules!", 5, 5 );
|
||||||
|
}
|
||||||
|
|
13
utils/wxOLE/samples/servlet/servlet.gnorba
Normal file
13
utils/wxOLE/samples/servlet/servlet.gnorba
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[component-factory:servlet]
|
||||||
|
type=exe
|
||||||
|
repo_id=IDL:GNOME/ComponentFactory:1.0 IDL:GNOME/GenericFactory:1.0
|
||||||
|
description=wxOLE test object server factory
|
||||||
|
location_info=servlet
|
||||||
|
|
||||||
|
[component:servlet]
|
||||||
|
type=factory
|
||||||
|
repo_id=IDL:Component/servlet:1.0 IDL:GNOME/Component:1.0
|
||||||
|
description=wxOLE Test server component
|
||||||
|
location_info=component-factory:servlet
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user