Laxkit  0.0.7.1
panpopup.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_PANPOPUP_H
24 #define _LAX_PANPOPUP_H
25 
26 #include <lax/anxapp.h>
27 #include <lax/pancontroller.h>
28 #include <lax/panuser.h>
29 #include <lax/laximages.h>
30 
31 namespace Laxkit {
32 
33  // Specifies that the window should try to center itself and the selbox
34  // around the mouse.
35 #define PAN_IS_POPUP (1<<16)
36 #define PAN_NEEDS_BDOWN (1<<17)
37 
38 //--------------------------------- PanPopup --------------------------------------
39 class PanPopup : public PanUser, public anXWindow
40 {
41  protected:
42  public:
43  unsigned long bgcolor;
44  int padx,pady;
45  PanPopup(anXWindow *pwindow,const char *nname,const char *ntitle,unsigned long nstyle,
46  int nx,int ny,int nw,int nh,int brder,
47  anXWindow *prev,unsigned long nowner=0,const char *nsend=NULL,
48  PanController *pan=NULL);
49  virtual ~PanPopup();
50  virtual void Refresh();
51  virtual const char *whattype() { return "PanPopup"; }
52  virtual int LBDown(int x,int y,unsigned int state,int count, const LaxMouse *d);
53  virtual int send();
54 };
55 
56 //--------------------------------- PanWindow --------------------------------------
57 class PanWindow : public anXWindow, public PanUser
58 {
59  protected:
60  LaxImage *image; // contains the scaled down image
61  XRectangle imagerect; // x,y of image in window
62  int imagex,imagey; // x,y of image in window
63  int xs,ys; // the x,y scaling
64  int mx,my;
65  unsigned long bgcolor;
66  int buttondown;
67  int bdowndevice;
68  public:
69  int pad,maxdim;
70  PanWindow(anXWindow *pwindow,const char *nname,const char *ntitle,unsigned long nstyle,
71  int nx,int ny,int nw,int nh,int brder,
72  anXWindow *prev,unsigned long nowner,const char *nsend,
73  int mouseid,
74  PanController *pan,LaxImage *img,int nxs=0,int nys=0,int npad=0);
75  virtual ~PanWindow();
76  virtual void UseThisPanner(PanController *npanner);
77  virtual void centerOnMouse(int mouseid);
78  virtual void CenterImage();
79  virtual int SetImage(LaxImage *imag);
80  virtual int Event(const EventData *e,const char *mes);
81  virtual int init();
82  virtual void Refresh();
83  virtual const char *whattype() { return "PanWindow"; }
84  virtual int LBDown(int x,int y,unsigned int state,int count, const LaxMouse *d);
85  virtual int LBUp(int x,int y,unsigned int state, const LaxMouse *d);
86  virtual int MouseMove(int x,int y,unsigned int state, const LaxMouse *d);
87  virtual int MoveResize(int nx,int ny,int nw,int nh);
88  virtual int Resize(int nw,int nh);
89  virtual int send();
90 };
91 
92 } // namespace Laxkit
93 
94 #endif
95 

Mon Feb 17 2014 11:52:57, Laxkit