Laxkit  0.0.7.1
buttondowninfo.h
1 //
2 //
3 // The Laxkit, a windowing toolkit
4 // Please consult http://laxkit.sourceforge.net about where to send any
5 // correspondence about this software.
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //
21 // Copyright (C) 2010 by Tom Lechner
22 //
23 #ifndef _LAX_BUTTONDOWNINFO_H
24 #define _LAX_BUTTONDOWNINFO_H
25 
26 #include <cstdlib>
27 #include <lax/anobject.h>
28 
29 namespace Laxkit {
30 
31 //-------------------------- ButtonDownInfo ------------------------------
33 {
35  {
36  public:
37  int device;
38  int button;
39  int initial_x, initial_y;
40  int last_x, last_y;
41  int current_x, current_y;
42  int dragged;
43  int info1,info2;
44  anObject *extra;
46  ButtonDownInfoSpecific(int d, int b, int x,int y, int i1,int i2,anObject *e,int absorbcount);
48  };
50  ButtonDownInfoSpecific *exists(int d, int b);
51 
52  public:
53  ButtonDownInfo() : info(NULL) {}
54  ~ButtonDownInfo() { if (info) delete info; }
55  void clear();
56  void down(int device_id, int button_id, int x=0, int y=0, int i1=0, int i2=0,anObject *e=NULL,int absorb=0);
57  int move(int device_id, int x=0, int y=0, int *lastx=NULL, int *lasty=NULL);
58  void moveinfo(int device_id, int button_id, int i1,int i2=0,int *oldi1=NULL,int *oldi2=NULL);
59  int up(int device_id, int button_id, int *i1=NULL, int *i2=NULL);
60  int any(int device_id=0,int button_id=0,int *device=NULL); //1 if any button of device_id is logged as down
61  int whichdown(int afterthis, int button_id=0);
62  int isdown(int device_id, int button_id, int *i1=NULL,int *i2=NULL);
63  int isdragged(int device_id, int button_id);
64  int average(int button_id, int *xavg, int *yavg);
65  int getextrainfo(int device_id, int button_id, int *i1=NULL,int *i2=NULL);
66  int getinitial(int device_id, int button_id, int *x0,int *y0);
67  int getlast(int device_id, int button_id, int *xp,int *yp);
68  int getcurrent(int device_id, int button_id, int *xp,int *yp);
69  int getinfo(int device_id, int button_id, int *x0,int *y0, int *xp,int *yp, int *xc,int *yc,
70  int *i1=NULL,int *i2=NULL);
71  anObject *getextra(int device_id, int button_id);
72  int replaceextra(int device_id, int button_id,anObject *e,int absorbcount);
73 };
74 
75 } // namespace Laxkit
76 
77 #endif
78 

Mon Feb 17 2014 11:52:56, Laxkit