blob: 95832aa361c6eb5a52b6d8ae36d84773a123c24f (
plain)
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
|
// $Id$
//---------------------------------------------------------------------------
#ifndef ChatClientWndH
#define ChatClientWndH
//---------------------------------------------------------------------------
#include "ReceiverImpl.h"
#include "BroadcasterC.h"
#include "ace/Auto_Ptr.h"
#include "ORBThread.h"
#include <Classes.hpp>
#include <Dialogs.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
//---------------------------------------------------------------------------
// Message used to notify window of incoming data
#define WM_MESSAGE_RECEIVED (WM_APP + 0x123)
//---------------------------------------------------------------------------
class TChatClientWindow : public TForm
{
__published: // IDE-managed Components
TMemo *OutputMemo;
TMemo *InputMemo;
TOpenDialog *OpenDialog;
void __fastcall FormClose (TObject *Sender, TCloseAction &Action);
void __fastcall InputMemoKeyPress (TObject *Sender, char &Key);
private:
void __fastcall ReadIOR (String filename);
// Function to read the server ior from a file.
String ior_;
// IOR of the obj ref of the server.
String ior_file_name_;
// The filename that stores the ior of the server
String nickname_;
// Nickname of the user chatting.
auto_ptr<TORBThread> orb_thread_;
// We run the orb's main loop in a separate thread.
CORBA::ORB_var orb_;
// Our orb. Order is important! The orb must have a longer lifetime than
// any of the servants or stub vars/ptrs. Therefore we declare the orb var
// first. There is probably a better way to do this, maybe by using a
// singleton.
Broadcaster_var server_;
// Server object ptr.
TReceiverImplementation receiver_i_;
// The receiver object.
Receiver_var receiver_var_;
// Pointer to the receiver object registered with the ORB.
public: // User declarations
__fastcall TChatClientWindow (TComponent* Owner);
protected: // Message handlers
void __fastcall WMMessageReceived (TMessage& Message);
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER (WM_MESSAGE_RECEIVED, TMessage, WMMessageReceived)
END_MESSAGE_MAP (TForm)
};
//---------------------------------------------------------------------------
extern PACKAGE TChatClientWindow *ChatClientWindow;
//---------------------------------------------------------------------------
#endif
|