Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / examples / Borland / ChatClientWnd.h
blob296e70d4b506f97d4c5af90b228925c0991b548c
1 //---------------------------------------------------------------------------
2 #ifndef ChatClientWndH
3 #define ChatClientWndH
4 //---------------------------------------------------------------------------
5 #include "ReceiverImpl.h"
6 #include "BroadcasterC.h"
7 #include "ORBThread.h"
8 #include <Classes.hpp>
9 #include <Dialogs.hpp>
10 #include <Controls.hpp>
11 #include <StdCtrls.hpp>
12 #include <memory>
14 //---------------------------------------------------------------------------
15 // Message used to notify window of incoming data
16 #define WM_MESSAGE_RECEIVED (WM_APP + 0x123)
17 //---------------------------------------------------------------------------
18 class TChatClientWindow : public TForm
20 __published: // IDE-managed Components
21 TMemo *OutputMemo;
22 TMemo *InputMemo;
23 TOpenDialog *OpenDialog;
24 void __fastcall FormClose (TObject *Sender, TCloseAction &Action);
25 void __fastcall InputMemoKeyPress (TObject *Sender, char &Key);
27 private:
28 // Function to read the server ior from a file.
29 void __fastcall ReadIOR (String filename);
31 // IOR of the obj ref of the server.
32 String ior_;
34 // The filename that stores the ior of the server
35 String ior_file_name_;
37 // Nickname of the user chatting.
38 String nickname_;
40 // We run the orb's main loop in a separate thread.
41 std::unique_ptr<TORBThread> orb_thread_;
43 // Our orb. Order is important! The orb must have a longer lifetime than
44 // any of the servants or stub vars/ptrs. Therefore we declare the orb var
45 // first. There is probably a better way to do this, maybe by using a
46 // singleton.
47 CORBA::ORB_var orb_;
49 // Server object ptr.
50 Broadcaster_var server_;
52 // The receiver object.
53 TReceiverImplementation receiver_i_;
55 // Pointer to the receiver object registered with the ORB.
56 Receiver_var receiver_var_;
58 public: // User declarations
59 __fastcall TChatClientWindow (TComponent* Owner);
61 protected: // Message handlers
62 void __fastcall WMMessageReceived (TMessage& Message);
63 BEGIN_MESSAGE_MAP
64 VCL_MESSAGE_HANDLER (WM_MESSAGE_RECEIVED, TMessage, WMMessageReceived)
65 END_MESSAGE_MAP (TForm)
67 //---------------------------------------------------------------------------
68 extern PACKAGE TChatClientWindow *ChatClientWindow;
69 //---------------------------------------------------------------------------
70 #endif