Laxkit  0.0.7.1
pancontroller.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-2010,2012 by Tom Lechner
22 //
23 #ifndef _LAX_PAN_CONROLLER_H
24 #define _LAX_PAN_CONROLLER_H
25 
26 #include <lax/anobject.h>
27 #include <lax/anxapp.h>
28 
29 namespace Laxkit {
30 
31  // Setting this lets the whole space to be smaller than the selbox. Otherwise
32  // no area of the selbox is allowed to not be a part of the whole space.
33 #define PANC_ALLOW_SMALL (1<<0)
34  // If the whole space is smaller than the selection rectangle, then
35  // selecting CENTER_SMALL causes the space to always be centered within the selbox, rather
36  // than allowing the space to be shifted around the selbox.
37 #define PANC_CENTER_SMALL (1<<1)
38  // Whether the pagesize or element size is absolute in workspace coordinates,
39  // or if they are a percent of (start-end).
40 #define PANC_PAGE_IS_PERCENT (1<<2)
41 #define PANC_ELEMENT_IS_PERCENT (1<<3)
42  // whether x and y should scale in a synchronized way
43 #define PANC_SYNC_XY (1<<4)
44 
45 class PanController : virtual public anObject
46 {
47  protected:
49  public:
50  anXWindow *donttell;
51  unsigned int pan_style;
52  int sendstatus;
53  long minsel[2],maxsel[2],min[2],max[2],start[2],end[2]; // workspace info, 0=x 1=y
54  long pagesize[2],elementsize[2];
55  int boxaspect[2];
56  double pixelaspect; // =pixw/pixh
57 
58  PanController();
59  PanController(const PanController &pan);
61  PanController(long xmin,long xmax,long xstart,long xend,
62  long ymin,long ymax,long ystart,long yend,
63  int w,int h,unsigned long panstyle=PANC_ELEMENT_IS_PERCENT|PANC_PAGE_IS_PERCENT);
64  virtual ~PanController();
65  virtual long SetPageSize(int which,long nps);
66  virtual long GetPageSize(int which);
67  virtual double GetMagToBox(int which,int boxwidth,long *wholestartret,long *wholeendret);
68  virtual double GetMagToWhole(int which,int trackwidth,long *boxstartret,long *boxendret);
69  virtual void SetSelBounds(int which, long small,long big);
70  virtual void SetPixelAspect(double npixaspect=1.0);
71  virtual double findpixelaspect();
72  virtual void SetBoxAspect(int w,int h);
73  virtual int SetWholebox(long xmin,long xmax,long ymin,long ymax);
74  virtual int SetStuff(int which,long nmin,long nmax,long nps,long nes,long posstart,long posend);
75  virtual int SetSize(int which, long nmin,long nmax,long nps);
76  virtual long GetCurPos(int which,long *curpos=NULL,long *curposend=NULL);
77  virtual long SetCurPos(int which,long pos);
78  virtual long SetCurPos(int which,long poss,long pose);
79  virtual int validateSelbox(int which=3);
80  virtual int adjustSelbox(int which=2,char validatetoo=1);
81 
82  virtual int Center(int which=3);
83  virtual long Shift(int which,long d, long wholelen=0, long boxlen=0);
84  virtual int ShiftEnd(int which,long d,int center=0,long wholelen=0,long boxlen=0);
85  virtual int ShiftStart(int which,long ds,int center=0,long wholelen=0,long boxlen=0);
86 
87  virtual long OneUp(int which);
88  virtual long OneDown(int which);
89  virtual long PageUp(int which,int numpages=1);
90  virtual long PageDown(int which,int numpages=1);
91 
92  virtual void sendMessages();
93  virtual void tell(anXWindow *win);
94  virtual void tellPop(anXWindow *win=NULL);
95  virtual void dontTell(anXWindow *win);
96 };
97 
98 } // namespace Laxkit
99 
100 #endif
101 

Mon Feb 17 2014 11:52:57, Laxkit