ubit
flow.hpp
1 /*************************************************************************
2  *
3  * umsflow.hpp: UMS Server: UMS Event flows.
4  * Ubit GUI Toolkit - Version 6.0
5  * (C) 2003-2008 Eric Lecolinet / ENST Paris / www.enst.fr/~elc/ubit
6  *
7  * ***********************************************************************
8  * COPYRIGHT NOTICE :
9  * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE
10  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
11  * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU
12  * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
13  * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
14  * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
15  * ***********************************************************************/
16 
17 #ifndef _flow_hpp_
18 #define _flow_hpp_
19 #include "umserver.hpp"
20 
21 /* ==================================================== ======== ======= */
24 class EventFlow {
25 public:
26  EventFlow(class UMServer*, int flow_id);
27  virtual ~EventFlow();
28 
29  int getID() const {return id;}
30  virtual WindowID getPointer() const {return 0;}
31 
32  class UMServer& ums;
33  class Events& events;
34  const int id;
35 };
36 
37 /* ==================================================== ======== ======= */
40 class MouseFlow : public EventFlow {
41 public:
42  MouseFlow(class UMServer*, int flow_id, bool create_pointer);
43  virtual ~MouseFlow();
44 
45  long getX() const {return mx;}
46  long getY() const {return my;}
47  bool isPressed(int btn_id) const {return (btn_mask & btn_id) != 0;}
49 
50  WindowID getPointer() const {return pointer_win;}
51  void movePointer(long x, long y);
52  void showPointer(bool);
53  void createPointer();
54  void changePointer(const char* fgcolor, const char* bgcolor);
55 
56  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
57 
58  void pressMouse(int btn_id);
59  void releaseMouse(int btn_id);
60  void pressMouse(const class UMSbutton*);
61  void releaseMouse(const class UMSbutton*);
63 
64  void pressKey(unsigned long keysym);
65  void releaseKey(unsigned long keysym);
66 
67  void releaseAll();
69 
70  void moveMouse(long x, long y, bool absolute_coords);
73 
74  bool moveMouseOutsideDisplay(long x, long y);
76 
77  void syncMouse(long x, long y);
79 
80  bool isOutside(long x, long y, long& n_x, long& n_y, class UMService*&);
82 
83  void keepMouseInsideScreen(long& mx, long& my);
84 
85  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
86 
87  friend class UMServer;
88  long mx, my;
89  int btn_mask;
90  int mod_mask;
91  WindowID pointer_win;
92  WindowID last_entered_win;
93  bool last_entered_in_ubitwin;
94  int last_entered_winsock;
95  bool h_out, v_out;
96 };
97 
98 #endif
99 /* ==================================================== [TheEnd] ======= */
100 /* ==================================================== [(c)Elc] ======= */
int mod_mask
current modifier mask
Definition: flow.hpp:90
Definition: events.cpp:9
Mouse button mapping specifies the events generated by the buttons of the mouses rule: source_button_...
Definition: source.hpp:29
UMService: Ubit Mouse/Message Service.
Definition: umservice.hpp:25
UMS mouse event flow.
Definition: flow.hpp:40
UMS event flow.
Definition: flow.hpp:24
long my
absolute pos of the mouse
Definition: flow.hpp:88
UMS server main class.
Definition: umserver.hpp:152
bool isPressed(int btn_id) const
btn_mask is a combination of Button1Mask, etc and can be ORed.
Definition: flow.hpp:47
int btn_mask
current button mask
Definition: flow.hpp:89