umservice.hpp

00001 /* ==================================================== ======== ======= *
00002 *
00003 *  umservice.hpp: acess to the UMS (Ubit Mouse/Message Server) services 
00004 *  Ubit Project
00005 *  Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs
00006 *  (C) 1999-2006 / EricLecolinet / ENST Paris / http://www.enst.fr/~elc/ubit
00007 *
00008 * ***********************************************************************
00009 * COPYRIGHT NOTICE :
00010 * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE
00011 * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
00012 * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU
00013 * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
00014 * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
00015 * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
00016 * ***********************************************************************
00017 * ==================================================== [(c)Elc] ======= *
00018 * ==================================================== ======== ======= */
00019 
00020 #ifndef _umservice_hpp_
00021 #define _umservice_hpp_
00022 //pragma ident  "@(#)umservice.hpp      ubit:05.05.00"
00023 #include <ubit/udefs.hpp>
00024 #include <ubit/usocket.hpp>
00025 namespace ubit {
00026 
00027 /* ==================================================== ====== ======= */
00030 class UMService : public USocket {
00031 public:
00032   UMService(const UStr& host, int port = 0);
00048   ~UMService();
00049 
00050   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00051 
00053   struct BrowseReply {
00054     BrowseReply(UMessageEvent&);
00055     int  flags, errorCode;
00056     long interfaceIndex;
00057     UStr serviceName, serviceType, replyDomain;
00058     int  status;
00059     bool isRemoved() {return status == false;}
00060     bool isAdded()   {return status == true;}
00061   };
00062   
00063   bool browseUMServers(UCall& callback);
00081   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00082 
00084   struct ResolveReply {
00085     ResolveReply(UMessageEvent&);
00086     int  flags, errorCode;
00087     long interfaceIndex;
00088     UStr fullname, hosttarget; //, txtRecord;
00089     int  port;
00090   };
00091 
00092   bool resolveUMServer(const UStr& name, UCall& callback);
00113   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00114 
00115   bool browseUMSNeighbors(UCall& callback);
00121   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00122 
00123   //bool tactos(const char* data);
00124   // tactile output stream.
00125   
00126   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00127 
00128   bool pressMouse(int event_flow, int button_id);
00129   bool releaseMouse(int event_flow, int button_id);
00130   bool moveMouse(int event_flow, int x, int y, bool absolute_coords);
00143   bool pressKey(int event_flow, unsigned long keysym);
00144   bool releaseKey(int event_flow, unsigned long keysym);
00149   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00150 
00151   bool sendMouseClick(const char* target, int x, int y, int button_id, int modifiers);
00152   bool sendMousePress(const char* target, int x, int y, int button_id, int modifiers);
00153   bool sendMouseRelease(const char* target, int x, int y, int button_id, int modifiers);
00167   bool sendMessage(const char* target, const UStr& message);
00168   bool sendMessage(const char* target, const char* message);
00177   bool sendRequest(int ums_request, const UStr& data);
00178   bool sendRequest(int ums_request, const char* data = null);
00180 
00181   // - - - impl. - - - - - - - - - - - - - - - - - - - - - - - - - - -
00182 
00183   UMService(const UStr& host, int port, const char* client_name);
00185 
00186   virtual void inputCallback();
00188 
00189 protected:
00190   uptr<UCall> browse_call, neighbor_call; 
00191 };
00192 
00193 }
00194 #endif
00195 /* ==================================================== [TheEnd] ======= */
00196 /* ==================================================== ======== ======= */
00197 

Generated on Mon Jan 29 00:20:39 2007 for Ubit by  doxygen 1.4.7