Laxkit  0.0.7.1
ellipseinterface.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) 2004-2006,2011 by Tom Lechner
22 //
23 #ifndef _LAX_ELLIPSEINTERFACE_H
24 #define _LAX_ELLIPSEINTERFACE_H
25 
26 #define ELLIPSES_ISCIRCLE 1
27 
28 #include <lax/interfaces/aninterface.h>
29 #include <lax/interfaces/rectinterface.h>
30 #include <lax/interfaces/somedata.h>
31 #include <lax/interfaces/linestyle.h>
32 
33 //using namespace std;
34 
35 namespace LaxInterfaces {
36 
37 class EllipseData : public SomeData
38 {
39  protected:
40 
41  public:
42  unsigned int style;
43  double s,e,a,b;
44  flatpoint center,x,y;
45  LineStyle linestyle;
46  EllipseData() { center=flatpoint(0,0); x=flatpoint(1,0); y=flatpoint(0,1); a=b=0; style=0; s=0; e=2*3.14159265358979; }
47  virtual void usefocus(flatpoint f1,flatpoint f2,double c=-1);
48  const char *whattype() { return "EllipseData"; }
49  void FindBBox();
50 };
51 
52 
53 //-----------------------------
54 
55 
57 {
58  protected:
59  int mx,my;
60  char dataislocal; //*** for creation, deletes easy?? waits to pass on (see Usethis)
61  int curpoint; //0=none 1=f1 2=f2 3=t 4=r 5=b 6=l 7=wildpoint 8=start 9=end
62  flatpoint createp,createx,createy;
63  public:
64  unsigned long controlcolor;
65  int creationstyle,createfrompoint,createangle,showdecs; // cfp: 0 (nw), 1 y, 2 x, 3 xy
66  EllipseData *data;
67  RectInterface *rinterf;
68  RectData rdata;
69  LineStyle linestyle;
70  EllipseInterface(int nid,Laxkit::Displayer *ndp);
72  virtual anInterface *duplicate(anInterface *dup);
73  void deletedata();
74  void rectify();
75  void erectify();
76  virtual int scan(int x,int y);
77  virtual int LBDown(int x,int y,unsigned int state,int count);
78  virtual int LBUp(int x,int y,unsigned int state);
79  virtual int MouseMove(int x,int y,unsigned int state);
80  virtual int CharInput(unsigned int ch, const char *buffer,int len,unsigned int state);
81  virtual int CharRelease(unsigned int ch,unsigned int state);
82  virtual int Refresh();
83  virtual int DrawData(Laxkit::anObject *ndata,Laxkit::anObject *a1=NULL,
84  Laxkit::anObject *a2=NULL,int info=0);
85  virtual int UseThis(Laxkit::anObject *nobj,unsigned int mask=0);
86  virtual int InterfaceOn();
87  virtual int InterfaceOff();
88  const char *whattype() { return "EllipseInterface"; }
89  const char *whatdatatype() { return "EllipseData"; }
90  flatpoint getpoint(int c);
91 };
92 
93 } // namespace LaxInterfaces
94 
95 #endif
96 

Mon Feb 17 2014 11:52:56, Laxkit