2 // "$Id: Fl_Input_.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
4 // Input base class header file for the Fast Light Tool Kit (FLTK).
6 // Copyright 1998-2002 by Bill Spitzak and others.
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 // Please report all bugs and problems to "fltk-bugs@fltk.org".
30 #include "Fl_Widget.H"
33 #define FL_NORMAL_INPUT 0
34 #define FL_FLOAT_INPUT 1
35 #define FL_INT_INPUT 2
36 #define FL_HIDDEN_INPUT 3
37 #define FL_MULTILINE_INPUT 4
38 #define FL_SECRET_INPUT 5
39 #define FL_INPUT_TYPE 7
40 #define FL_INPUT_READONLY 8
41 #define FL_NORMAL_OUTPUT (FL_NORMAL_INPUT | FL_INPUT_READONLY)
42 #define FL_MULTILINE_OUTPUT (FL_MULTILINE_INPUT | FL_INPUT_READONLY)
43 #define FL_INPUT_WRAP 16
44 #define FL_MULTILINE_INPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_WRAP)
45 #define FL_MULTILINE_OUTPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_READONLY | FL_INPUT_WRAP)
47 class FL_EXPORT Fl_Input_ : public Fl_Widget {
56 int xscroll_, yscroll_;
60 uchar erase_cursor_only;
64 unsigned cursor_color_;
66 const char* expand(const char*, char*) const;
67 double expandpos(const char*, const char*, const char*, int*) const;
68 void minimal_update(int, int);
69 void minimal_update(int p);
70 void put_in_buffer(int newsize);
76 int word_start(int i) const;
77 int word_end(int i) const;
78 int line_start(int i) const;
79 int line_end(int i) const;
80 void drawtext(int, int, int, int);
81 int up_down_position(int, int keepmark=0);
82 void handle_mouse(int, int, int, int, int keepmark=0);
83 int handletext(int e, int, int, int, int);
84 void maybe_do_callback();
85 int xscroll() const {return xscroll_;}
86 int yscroll() const {return yscroll_;}
90 void resize(int, int, int, int);
92 Fl_Input_(int, int, int, int, const char* = 0);
95 int value(const char*);
96 int value(const char*, int);
97 int static_value(const char*);
98 int static_value(const char*, int);
99 const char* value() const {return value_;}
100 char index(int i) const {return value_[i];}
101 int size() const {return size_;}
102 int maximum_size() const {return maximum_size_;}
103 void maximum_size(int m) {maximum_size_ = m;}
105 int position() const {return position_;}
106 int mark() const {return mark_;}
107 int position(int p, int m);
108 int position(int p) {return position(p, p);}
109 int mark(int m) {return position(position(), m);}
110 int replace(int, int, const char*, int=0);
111 int cut() {return replace(position(), mark(), 0);}
112 int cut(int n) {return replace(position(), position()+n, 0);}
113 int cut(int a, int b) {return replace(a, b, 0);}
114 int insert(const char* t, int l=0){return replace(position_, mark_, t, l);}
115 int copy(int clipboard);
119 Fl_Font textfont() const {return (Fl_Font)textfont_;}
120 void textfont(uchar s) {textfont_ = s;}
121 uchar textsize() const {return textsize_;}
122 void textsize(uchar s) {textsize_ = s;}
123 Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
124 void textcolor(unsigned n) {textcolor_ = n;}
125 Fl_Color cursor_color() const {return (Fl_Color)cursor_color_;}
126 void cursor_color(unsigned n) {cursor_color_ = n;}
128 int input_type() const {return type() & FL_INPUT_TYPE; }
129 void input_type(int t) { type((uchar)(t | readonly())); }
130 int readonly() const { return type() & FL_INPUT_READONLY; }
131 void readonly(int b) { if (b) type((uchar)(type() | FL_INPUT_READONLY));
132 else type((uchar)(type() & ~FL_INPUT_READONLY)); }
133 int wrap() const { return type() & FL_INPUT_WRAP; }
134 void wrap(int b) { if (b) type((uchar)(type() | FL_INPUT_WRAP));
135 else type((uchar)(type() & ~FL_INPUT_WRAP)); }
141 // End of "$Id: Fl_Input_.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".