]> git.saurik.com Git - wxWidgets.git/blob - utils/wxOLE/samples/servlet/servlet.cpp
removed redundant code
[wxWidgets.git] / utils / wxOLE / samples / servlet / servlet.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: servlet.cpp
3 // Purpose: Minimal wxWindows OLE server sample
4 // Author: Robert Roebling
5 // Modified by:
6 // Created: 20/04/99
7 // RCS-ID: $Id$
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "servlet.cpp"
14 #pragma interface "servlet.cpp"
15 #endif
16
17 // For compilers that support precompilation, includes "wx/wx.h".
18 #include "wx/wxprec.h"
19
20 #ifdef __BORLANDC__
21 #pragma hdrstop
22 #endif
23
24 #ifndef WX_PRECOMP
25 #include "wx/wx.h"
26 #endif
27
28 // For OLE stuff
29 #include "wxole.h"
30
31 #if defined(__WXGTK__) || defined(__WXMOTIF__)
32 #include "mondrian.xpm"
33 #endif
34
35 //----------------------------------------------------------------------------
36 // MyOleControl
37 //----------------------------------------------------------------------------
38
39 class MyOleControl : public wxOleControl
40 {
41 public:
42
43 MyOleControl();
44
45 void OnPaint( wxPaintEvent &event );
46
47 private:
48 DECLARE_EVENT_TABLE()
49 };
50
51 //----------------------------------------------------------------------------
52 // MyOleServer
53 //----------------------------------------------------------------------------
54
55 class MyOleServer : public wxOleServer
56 {
57 public:
58
59 MyOleServer() : wxOleServer( "servlet" ) { }
60
61 wxOleControl *CreateOleControl() { return new MyOleControl(); }
62 };
63
64 //----------------------------------------------------------------------------
65 // MyApp
66 //----------------------------------------------------------------------------
67
68 class MyApp : public wxApp
69 {
70 public:
71
72 MyApp();
73 ~MyApp();
74
75 virtual bool OnInit();
76
77 wxOleServerEnv *m_oleEnv;
78 MyOleServer *m_oleServer;
79 };
80
81 //----------------------------------------------------------------------------
82 // main
83 //----------------------------------------------------------------------------
84
85 IMPLEMENT_APP(MyApp)
86
87 //----------------------------------------------------------------------------
88 // MyApp
89 //----------------------------------------------------------------------------
90
91 MyApp::MyApp()
92 {
93 }
94
95 MyApp::~MyApp()
96 {
97 delete m_oleEnv;
98 delete m_oleServer;
99 }
100
101 #include "gtk/gtk.h"
102
103 bool MyApp::OnInit()
104 {
105 m_oleEnv = new wxOleServerEnv( "MyServer", "1.0" );
106 m_oleServer = new MyOleServer();
107
108 /* how do we get outta here ? */
109 for (;;) wxYield();
110
111 return TRUE;
112 }
113
114 //----------------------------------------------------------------------------
115 // MyOleControl
116 //----------------------------------------------------------------------------
117
118 BEGIN_EVENT_TABLE(MyOleControl, wxOleControl)
119 EVT_PAINT(MyOleControl::OnPaint)
120 END_EVENT_TABLE()
121
122 MyOleControl::MyOleControl() :
123 wxOleControl( -1 )
124 {
125 (void)new wxButton( this, -1, "Ole, Ole", wxPoint(5,40), wxSize(120,-1) );
126 (void)new wxButton( this, -1, "Greetings", wxPoint(5,70), wxSize(120,-1) );
127 }
128
129 void MyOleControl::OnPaint( wxPaintEvent &WXUNUSED(event) )
130 {
131 wxPaintDC dc(this);
132 dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL, FALSE, "charter" ) );
133 dc.DrawText( "wxWindows rules!", 5, 5 );
134 }
135