Laxkit  0.0.7.1
viewerwindow.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-2007,2010-2011 Tom Lechner
22 //
23 #ifndef _LAX_VIEWERWINDOW_H
24 #define _LAX_VIEWERWINDOW_H
25 
26 
27 #include <lax/rowframe.h>
28 #include <lax/rulerwin.h>
29 #include <lax/scroller.h>
30 #include <lax/messagebar.h>
31 #include <lax/interfaces/viewportwindow.h>
32 
33 namespace LaxInterfaces {
34 
35 
36 enum ViewerWindowActions {
37  VIEWER_NextTool,
38  VIEWER_PreviousTool,
39  VIEWER_MAX
40 };
41 
43 {
44  protected:
45  Laxkit::Scroller *xscroller,*yscroller;
46  Laxkit::RulerWindow *xruler,*yruler;
47  Laxkit::MessageBar *mesbar;
48  Laxkit::PtrStack<Laxkit::anXWindow> tonotify; // who to send note of where the mouse is in viewport
51  int rulerh,scrollerh;
52  anInterface *curtool;
53  int lazytool;
54  unsigned long viewer_style;
55 
57  virtual int PerformAction(int action);
58  public:
59  ViewportWindow *viewport;
60  ViewerWindow(Laxkit::anXWindow *parnt,const char *nname,const char *ntitle,unsigned long nstyle,
61  int xx,int yy,int ww,int hh,int brder,
62  ViewportWindow *vw=NULL);
63  virtual ~ViewerWindow();
64  virtual const char *whattype() { return "ViewerWindow"; }
65  virtual int init();
66  virtual Laxkit::ShortcutHandler *GetShortcuts();
67  virtual int CharInput(unsigned int ch, const char *buffer,int len,unsigned int state,const Laxkit::LaxKeyboard *d);
68  virtual int Event(const Laxkit::EventData *e,const char *mes);
69  virtual void PostMessage(const char *mes);
70  virtual void SetRealUnits();
71 
72  virtual int RemoveTool(int id);
73  virtual int AddTool(anInterface *i, char selectalso, int absorbcount);
74  virtual int SelectTool(const char *type);
75  virtual int SelectTool(int id);
76  virtual int SelectToolFor(const char *datatype,ObjectContext *oc=NULL);
77  virtual anInterface *CurrentTool() { return curtool; }
78  virtual anInterface *FindInterface(const char *which);
79 
80  virtual int PushInterface(anInterface *i,int absorbcount);
81  virtual int PopInterface(anInterface *i);
82 
83  virtual int tools_n() { return tools.n; }
84  virtual anInterface *tools_e(int i) { if (i>=0 && i<tools.n) return tools.e[i]; return NULL; }
85 
86  friend class ViewportWindow;
87 };
88 
89 
90 } // namespace LaxInterfaces
91 
92 #endif
93 

Mon Feb 17 2014 11:52:57, Laxkit