Laxkit  0.0.7.1
lineinput.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_LINEINPUT_H
24 #define _LAX_LINEINPUT_H
25 
26 
27 #include <lax/lineedit.h>
28 #include <lax/strmanip.h>
29 
30 #define LINP_ONLEFT (1<<16)
31 #define LINP_ONRIGHT (1<<17)
32 #define LINP_ONTOP (1<<18)
33 #define LINP_ONBOTTOM (1<<19)
34 #define LINP_LEFT (1<<20)
35 #define LINP_RIGHT (1<<21)
36 #define LINP_CENTER (1<<22)
37 #define LINP_POPUP (1<<23)
38 #define LINP_INT (1<<24)
39 #define LINP_FLOAT (1<<25)
40 #define LINP_FILE (1<<26)
41 #define LINP_STYLEMASK (1<<16|1<<17|1<<18|1<<19|1<<20|1<<21|1<<22|1<<23|1<<24|1<<25|1<<26)
42 
43 
44 
45 namespace Laxkit {
46 
47 class LineInput : public anXWindow
48 {
49  protected:
50  LineEdit *le;
51  char *label;
52  int lx,ly,lew,leh; // lw,lh<0 means use remainder, >0 is absolute
54  public:
55  LineInput(anXWindow *parnt,const char *nname,const char *ntitle,unsigned int nstyle,
56  int xx,int yy,int ww,int hh,int brder,
57  anXWindow *prev,unsigned long nowner=0,const char *nsend=NULL,
58  const char *newlabel=NULL,const char *newtext=NULL,unsigned int ntstyle=0,
59  int nlew=0,int nleh=0,int npadx=-1,int npady=-1,int npadlx=-1,int npadly=-1);
60  virtual ~LineInput();
61  virtual const char *whattype() { return "LineInput"; }
62  virtual const char *tooltip(const char *ntip);
63  virtual anXWindow *GetController() { return le; }
64  virtual int init();
65  virtual int Event(const EventData *data, const char *mes);
66  virtual int FocusOn(const FocusChangeData *e);
67  virtual int FocusOff(const FocusChangeData *e);
68  virtual void Refresh();
69  virtual int MoveResize(int nx,int ny,int nw,int nh);
70  virtual int Resize(int nw,int nh);
71 
72  virtual char *GetText() { if (le) return le->GetText(); else return NULL; }
73  virtual const char *GetCText() { if (le) return le->GetCText(); else return NULL; }
74  virtual long GetLong(int *error_ret=NULL);
75  virtual double GetDouble(int *error_ret=NULL);
76  virtual void SetLabel(const char *newlabel);
77  virtual void SetText(const char *newtext);
78  virtual void SetText(int newtext);
79  virtual void SetText(double newtext);
80  virtual void SetOwner(anXWindow *nowner,const char *mes=NULL) { if (le) le->SetOwner(nowner,mes); }
81  virtual void SetPlacement(); // this must follow any change to label
82  virtual int send() { return 0; }
83  virtual int CloseControlLoop() { if (le) return le->CloseControlLoop(); return 0; }
84  virtual LineEdit *GetLineEdit();
85 
86  virtual LaxFiles::Attribute *dump_out_atts(LaxFiles::Attribute *att,int what,Laxkit::anObject *savecontext);
87  virtual void dump_in_atts(LaxFiles::Attribute *att,int flag,Laxkit::anObject *loadcontext);
88 };
89 
90 
91 
92 } // namespace Laxkit
93 
94 #endif
95 

Mon Feb 17 2014 11:52:57, Laxkit