Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

umsclient.hpp

00001 /* ==================================================== ======== ======= *
00002  *
00003  *  umsclient.hpp : UMS [Ubit Mouse Server] client
00004  *  Ubit Project  [Elc][2003]
00005  *  Author: Eric Lecolinet
00006  *
00007  *  Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs
00008  *
00009  *  (C) 1999-2003 Eric Lecolinet @ ENST Paris
00010  *  WWW: http://www.enst.fr/~elc/ubit   Email: elc@enst.fr (subject: ubit)
00011  *
00012  * ***********************************************************************
00013  * COPYRIGHT NOTICE : 
00014  * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE 
00015  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 
00016  * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU 
00017  * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 
00018  * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
00019  * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
00020  * ***********************************************************************
00021  *
00022  * ==================================================== [Elc:03] ======= *
00023  * ==================================================== ======== ======= */
00024 
00025 #ifndef _umsclient_hpp_
00026 #define _umsclient_hpp_
00027 //pragma ident  "@(#)umsclient.hpp      ubit:03.06.04"
00028 #include <ubit/udefs.hpp>
00029 #include <ubit/ubrick.hpp>
00030 #include <ubit/ustr.hpp>
00031 
00032 
00033 class UMSclient {
00034 public:
00035   enum Stat {
00036     HostNotFound  = -2,
00037     CannotOpen    = -1,
00038     NotOpened     =  0,
00039     Opened        =  1
00040   };
00041 
00042   UMSclient(UAppli&);
00043   UMSclient(const UStr& client_name) ;
00044   ~UMSclient();
00045 
00046   int open(const UStr& umsd_hostname, int umsd_port = 0);
00060   void close();
00061 
00062   int getStatus() const;
00067   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00068 
00069   bool sendMessage(const char* target, const UStr& message);
00070   bool sendMessage(const char* target, const char* message);
00078   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00079 
00080   bool sendMouseClick(const char* target, u_pos x, u_pos y, u_id mouse_button);
00081   bool sendMousePress(const char* target, u_pos x, u_pos y, u_id mouse_button);
00082   bool sendMouseRelease(const char* target, u_pos x, u_pos y, u_id mouse_button);
00094   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00095 
00096   bool moveMouse(int mouse_event_flow, u_pos x, u_pos y, bool absolute_coords);
00107   bool pressMouse(int mouse_event_flow, u_id mouse_button);
00108   bool releaseMouse(int mouse_event_flow, u_id mouse_button);
00120   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00121 
00122   bool winOpened(u_id win_id);
00123   bool winClosed(u_id win_id);
00124   bool cnxOpened(const UStr& cnx_name);
00125   bool cnxClosed();
00126 
00127   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00128 
00129 private:
00130   class UAppli* appli;
00131   struct sockaddr_in* rhost;
00132   uptr<UInput> input;
00133   UStr client_name;
00134   UStr remote_host;
00135   int  remote_port;
00136   int  com_sock;
00137   int  stat;
00138 
00139   void constructs(UAppli*, const UStr& client_name);
00140   int  openCom(const UStr& cnx_name, bool keep_cnx_request);
00141   bool sendRequest(class UMSrequest& request);
00142   void receive();
00143 };
00144 
00145 #endif
00146 /* ==================================================== [TheEnd] ======= */
00147 /* ==================================================== [Elc:03] ======= */

Generated on Sat Nov 20 11:58:04 2004 for Ubit[Eric.Lecolinet@enst.fr] by  doxygen 1.3.9.1