Laxkit  0.0.7.1
splitwindow.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_SPLITWINDOW_H
24 #define _LAX_SPLITWINDOW_H
25 
26 #include <lax/anxapp.h>
27 #include <lax/strmanip.h>
28 #include <lax/menuinfo.h>
29 #include <lax/buttondowninfo.h>
30 #include <lax/newwindowobject.h>
31 
32 
33 namespace Laxkit {
34 
35 //---------------------------- PlainWinBox ---------------------------------
37 {
38  protected:
39  anXWindow *window, *prev,*next;
40  public:
41  int x1,y1,x2,y2;
42  PlainWinBox(anXWindow *nwin,int xx1,int yy1,int xx2,int yy2);
43  virtual ~PlainWinBox();
44  virtual void NewWindow(anXWindow *nwin);
45  virtual anXWindow *win() { return window; }
46  virtual void sync(int inset,int mapit=-1);
47 };
48 
49 
50 //---------------------------- WinFuncNode ---------------------------------
52 
53 //---------------------------- SplitWindow ---------------------------------
54 
55 #define SPLIT_WITH_SAME (1<<16)
56 #define SPLIT_WITH_DEFAULT (1<<17)
57 #define SPLIT_WITH_BLANK (1<<18)
58 #define SPLIT_BEVEL (1<<19)
59 #define SPLIT_DRAG_MAPPED (1<<20)
60 #define SPLIT_STACKED_PANES (1<<21)
61 #define SPLIT_TABBED_PANES (1<<22)
62 #define SPLIT_NO_MAXIMIZE (1<<23)
63 
64 //These are return codes for the SplitWindow menu:
65 #define SPLITW_Split 1
66 #define SPLITW_Join 2
67 #define SPLITW_ChangeTo_Start 101
68 #define SPLITW_ChangeTo_Blank 100
69 #define SPLITW_Mark 3
70 #define SPLITW_Swap_With_Mark 4
71 #define SPLITW_UnMaximize 5
72 #define SPLITW_Maximize 5
73 
74 
75 class SplitWindow : public anXWindow
76 {
77  protected:
78  ButtonDownInfo buttondown;
79  int mousein;
80  PtrStack<PlainWinBox> windows;
81  PlainWinBox *curbox,*marked;
82  int space; // width of space between windows
83  int bevel; // amount to add per window for a bevel
86  int mx,my;
87  int mode;
88  anXWindow *lastactivewindow;
90  PtrStack<WinFuncNode> winfuncs;
91  int defaultwinfunc;
92  virtual void scaleWindows();
93  virtual void drawmovemarks(int on=1);
94  virtual void drawsplitmarks();
95  virtual PlainWinBox *findcurbox(int x,int y,const LaxMouse *mouse);
96  virtual void setupsplit(int x,int y);
97  virtual int splitthewindow(anXWindow *fillwindow=NULL,int whichside=0);
98  virtual int joinwindow(int x,int y,char keepother);
99  virtual void syncaffected();
100  virtual anXWindow *NewWindow(const char *wtype,anXWindow *likethis=NULL);
101  virtual MenuInfo *GetMenu();
102  public:
103  SplitWindow(anXWindow *parnt,const char *nname,const char *ntitle,unsigned long nstyle,
104  int xx,int yy,int ww,int hh,int brder,
105  anXWindow *prev,unsigned long owner,const char *mes);
106  virtual ~SplitWindow() {}
107  virtual const char *whattype() { return "SplitWindow"; }
108  virtual int init();
109  virtual int LBDown(int x,int y,unsigned int state,int count,const LaxMouse *d);
110  virtual int LBUp(int x,int y,unsigned int state,const LaxMouse *d);
111  virtual int RBDown(int x,int y,unsigned int state,int count,const LaxMouse *d);
112  virtual int RBUp(int x,int y,unsigned int state,const LaxMouse *d);
113  virtual int MouseMove(int x,int y,unsigned int state,const LaxMouse *d);
114  virtual int CharInput(unsigned int ch,const char *buffer,int len,unsigned int state,const LaxKeyboard *d);
115  virtual int FocusOn(const FocusChangeData *e);
116  virtual int FocusOff(const FocusChangeData *e);
117  virtual int Event(const EventData *e,const char *mes);
118  virtual int MoveResize(int nx,int ny,int nw,int nh);
119  virtual int Resize(int nw,int nh);
120  virtual void Refresh();
121 
122  virtual int AddWindowType(const char *wtype,const char *ndesc,
123  unsigned long style,NewWindowFunc winfunc,int settodefault=0);
124  virtual void BoxNearPos(int x,int y,PlainWinBox *box, int *l,int *r,int *t,int *b);
125  virtual void PosInBox(int x,int y,PlainWinBox *box, int *xx,int *yy);
126  virtual void SetSpace(int spc);
127  virtual int Split(int c,int whichside,anXWindow *fillwindow=NULL);
128  virtual int Join(int c,int whichside,char keepother=0);
129  virtual int Mark(int c);
130  virtual int SwapWithMarked();
131  virtual int Curbox(int c);
132  virtual int FindBox(int x,int y);
133  virtual int FindBox(anXWindow *newcurbox);
134  virtual int FindBoxIndex(PlainWinBox *box);
135  virtual int Change(anXWindow *towhat,int absorbcount, int which);
136  virtual int Add(anXWindow *win,unsigned int whichside=LAX_BOTTOM,int absorbcount=0);
137  virtual int Add(const char *type,unsigned int whichside=LAX_BOTTOM);
138  virtual int RemoveCurbox();
139  virtual int GetAffected(int x,int y,const LaxMouse *m);
140  virtual int SetCursor(const char *curs,LaxMouse *d);
141  virtual void validateX();
142  virtual void validateY();
143  virtual int Maximize(int which);
144  virtual int Mode() { return mode; }
145 };
146 
147 } // namespace Laxkit
148 
149 #endif
150 

Mon Feb 17 2014 11:52:57, Laxkit