Laxkit  0.0.7.1
scroller.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 by Tom Lechner
22 //
23 #ifndef _LAX_SCROLLER_H
24 #define _LAX_SCROLLER_H
25 
26 #include <lax/anxapp.h>
27 #include <lax/pancontroller.h>
28 #include <lax/panuser.h>
29 #include <lax/buttondowninfo.h>
30 
31 namespace Laxkit {
32 
33 // 00000100 SC_ASPLIT Split arrows
34 // 00001000 SC_ATOP Arrows at top
35 // 00010000 SC_ABOTTOM Arrows at bottom
36 
37 
38 #define SC_XSCROLL (1<<16)
39 #define SC_YSCROLL (1<<17)
40 #define SC_ASPLIT (1<<18)
41 #define SC_ATOP (1<<19)
42 #define SC_ABOTTOM (1<<20)
43 #define SC_NOARROWS (1<<21)
44 #define SC_ZOOM (1<<22)
45 #define SC_PAGE_IS_PERCENT (1<<23)
46 #define SC_ELEMENT_IS_PERCENT (1<<24)
47 #define SC_ALLOW_SMALL (1<<25)
48 
49 
50 
51 class Scroller : public PanUser, public anXWindow
52 {
53  protected:
54  ButtonDownInfo buttondown;
55  int zh,ah,minboxlen;
56  int toff,a1off,a2off,omx,omy;
57  int tid;
58  int idlemx,idlemy;
59  virtual void redoarrows();
60  public:
61  // colors:
62  unsigned long bordercolor,wholecolor,trackcolor;
63  Scroller(anXWindow *parnt,const char *nname, const char *ntitle, unsigned long nstyle,
64  int nx,int ny,int nw,int nh,int brder,
65  anXWindow *prev,unsigned long nowner,const char *mes,
66  PanController *npan,
67  long nmins=0,long nmaxs=0,long nps=0,long nes=0,long ncp=-1,long ncpe=-1); // ncp=ncpe=-1
68  virtual ~Scroller();
69  virtual int Event(const EventData *e,const char *mes);
70  virtual void Refresh();
71  virtual int Idle(int id=0);
72  virtual int MoveResize(int nx,int ny,int nw,int nh);
73  virtual int Resize(int nw,int nh);
74  virtual int RBDown(int mx,int my,unsigned int state,int count,const LaxMouse *d);
75  virtual int RBUp(int mx,int my, unsigned int state,const LaxMouse *d);
76  virtual int LBDown(int mx,int my,unsigned int state,int count,const LaxMouse *d);
77  virtual int LBUp(int mx,int my, unsigned int state,const LaxMouse *d);
78  virtual int WheelUp(int x,int y,unsigned int state,int count,const LaxMouse *d);
79  virtual int WheelDown(int x,int y,unsigned int state,int count,const LaxMouse *d);
80  virtual int MouseMove(int mx,int my, unsigned int state,const LaxMouse *d);
81  virtual int CharInput(unsigned int ch,const char *buffer,int len,unsigned int state,const LaxKeyboard *d);
82 
83  virtual void drawarrows();
84  virtual void drawtrack();
85  virtual void drawtrackbox();
86  virtual long SetPageSize(long nps);
87  virtual long GetPageSize();
88  virtual long GetCurPos(long *poss=NULL,long *pose=NULL);
89  virtual long GetCurPosEnd();
90  virtual long SetCurPos(long newcurpos);
91  virtual long SetCurPos(long start, long end);
92  virtual long SetSize(long nmins,long nmaxs,long ncurpos,long ncurposend,long nps,long nes);
93  virtual long SetSize(long nmins,long nmaxs,long nps=0);
94  virtual int getpos(int mx,int my);
95  virtual int send();
96  virtual void send(long change,int pagesizechange=0);
97 
98  virtual long PageDown(int numpages=1);
99  virtual long PageUp(int numpages=1);
100  virtual long OneDown();
101  virtual long OneUp();
102 
103  //serializing aids
104  virtual LaxFiles::Attribute *dump_out_atts(LaxFiles::Attribute *att,int what,anObject *context);
105  virtual void dump_in_atts(LaxFiles::Attribute *att,int flag,anObject *context);
106 };
107 
108 } // namespace Laxkit
109 
110 #endif

Mon Feb 17 2014 11:52:57, Laxkit