source: rtems-graphics-toolkit/fltk-1.1.10/documentation/Fl_Input_.html @ 513eea1

Last change on this file since 513eea1 was 513eea1, checked in by Joel Sherrill <joel.sherrill@…>, on 01/09/10 at 22:43:24

2010-01-08 Joel Sherrill <joel.sherrill@…>

fltk 1.1.10. imported

  • ORIGIN: Updated.
  • Property mode set to 100644
File size: 9.2 KB
Line 
1<HTML>
2<HEAD>
3        <TITLE>Fl_Input_</TITLE>
4</HEAD>
5<BODY>
6
7<!-- NEW PAGE -->
8
9<H2><A name="Fl_Input_">class Fl_Input_</A></H2>
10
11<HR>
12
13<H3>Class Hierarchy</H3>
14
15<UL><PRE>
16<A href=Fl_Widget.html#Fl_Widget>Fl_Widget</A>
17   |
18   +----<B>Fl_Input_</B>
19           |
20           +----<A href=Fl_Input.html#Fl_Input>Fl_Input</A>
21</PRE></UL>
22
23<H3>Include Files</H3>
24
25<UL><PRE>
26#include &lt;FL/Fl_Input_.H&gt;
27</PRE></UL>
28
29<H3>Description</H3>
30
31<P>This is a virtual base class below <A
32href="Fl_Input.html#Fl_Input"><TT>Fl_Input</TT></A>. It has all
33the same interfaces, but lacks the <TT>handle()</TT> and
34<TT>draw()</TT> method. You may want to subclass it if you are
35one of those people who likes to change how the editing keys
36work.
37
38<P>This can act like any of the subclasses of Fl_Input, by
39setting <TT>type()</TT> to one of the following values:</P>
40
41<UL><PRE>
42#define FL_NORMAL_INPUT         0
43#define FL_FLOAT_INPUT          1
44#define FL_INT_INPUT            2
45#define FL_MULTILINE_INPUT      4
46#define FL_SECRET_INPUT         5
47#define FL_INPUT_TYPE           7
48#define FL_INPUT_READONLY       8
49#define FL_NORMAL_OUTPUT        (FL_NORMAL_INPUT | FL_INPUT_READONLY)
50#define FL_MULTILINE_OUTPUT     (FL_MULTILINE_INPUT | FL_INPUT_READONLY)
51#define FL_INPUT_WRAP           16
52#define FL_MULTILINE_INPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_WRAP)
53#define FL_MULTILINE_OUTPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_READONLY | FL_INPUT_WRAP)
54</PRE></UL>
55
56<H3>Methods</H3>
57
58<CENTER>
59<TABLE width="90%" summary="Fl_Input_ methods.">
60<TR><TD align="left" valign="top">
61<UL>
62<LI><A href="#Fl_Input_.Fl_Input_">Fl_Input_</A></LI>
63<LI><A href="#Fl_Input_.~Fl_Input_">~Fl_Input_</A></LI>
64<LI><A href="#Fl_Input_.copy">copy</A></LI>
65<LI><A href="#Fl_Input_.copy_cuts">copy_cuts</A></LI>
66</UL>
67</TD><TD align="left" valign="top">
68<UL>
69<LI><A href="#Fl_Input_.cut">cut</A></LI>
70<LI><A href="#Fl_Input_.drawtext">drawtext</A></LI>
71<LI><A href="#Fl_Input_.handletext">handletext</A></LI>
72<LI><A href="#Fl_Input_.input_type">input_type</A></LI>
73</UL>
74</TD><TD align="left" valign="top">
75<UL>
76<LI><A href="#Fl_Input_.insert">insert</A></LI>
77<LI><A href="#Fl_Input_.lineboundary">lineboundary</A></LI>
78<LI><A href="#Fl_Input_.mark">mark</A></LI>
79<LI><A href="#Fl_Input_.maybe_do_callback">maybe_do_callback</A></LI>
80</UL>
81</TD><TD align="left" valign="top">
82<UL>
83<LI><A href="#Fl_Input_.maximum_size">maximum_size</A></LI>
84<LI><A href="#Fl_Input_.position">position</A></LI>
85<LI><A href="#Fl_Input_.readonly">readonly</A></LI>
86<LI><A href="#Fl_Input_.replace">replace</A></LI>
87</UL>
88</TD><TD align="left" valign="top">
89<UL>
90<LI><A href="#Fl_Input_.undo">undo</A></LI>
91<LI><A href="#Fl_Input_.up_down_position">up_down_position</A></LI>
92<LI><A href="#Fl_Input_.wrap">wrap</A></LI>
93</UL>
94</TD></TR>
95</TABLE>
96</CENTER>
97
98<H4><A name="Fl_Input_.Fl_Input_">Fl_Input_::Fl_Input_(int x, int y, int
99w, int h, const char *label = 0)</A></H4>
100
101<P>Creates a new <TT>Fl_Input_</TT> widget using the given
102position, size, and label string. The default boxtype is
103<TT>FL_DOWN_BOX</TT>.
104
105<H4><A name="Fl_Input_.~Fl_Input_">virtual Fl_Input_::~Fl_Input_()</A></H4>
106
107<P>The destructor removes the widget and any value associated with it.
108
109<H4><A name="Fl_Input_.wordboundary">int Fl_Input_::wordboundary(int i)
110const</A></H4>
111
112<P>Returns true if position <TT>i</TT> is at the start or end of a word.
113
114<H4><A name="Fl_Input_.lineboundary">int Fl_Input_::lineboundary(int i)
115const</A></H4>
116
117<P>Returns true if position <TT>i</TT> is at the start or end of a line.
118
119<H4><A name="Fl_Input_.drawtext">void Fl_Input_::drawtext(int,int,int,int)</A></H4>
120
121<P>Draw the text in the passed bounding box.  If <TT>damage()
122&amp; FL_DAMAGE_ALL</TT> is true, this assumes the area has
123already been erased to <TT>color()</TT>. Otherwise it does
124minimal update and erases the area itself.
125
126<H4><A name="Fl_Input_.handletext">int Fl_Input_::handletext(int
127e,int,int,int,int)</A></H4>
128
129<P>Default handler for all event types. Your <TT>handle()</TT>
130method should call this for all events that it does not handle
131completely. You must pass it the same bounding box as you do
132when calling <TT>drawtext()</TT> from your <tt>draw()</tt>
133method. Handles <TT>FL_PUSH</TT>, <TT>FL_DRAG</TT>,
134<TT>FL_RELEASE</TT> to select text, handles <TT>FL_FOCUS</TT>
135and <TT>FL_UNFOCUS</TT> to show and hide the cursor.
136
137<H4><A name="Fl_Input_.up_down_position">int
138Fl_Input_::up_down_position(int i, int keepmark=0)</A></H4>
139
140<P>Do the correct thing for arrow keys. Sets the position (and
141mark if <I>keepmark</I> is zero) to somewhere in the same line
142as <I>i</I>, such that pressing the arrows repeatedly will cause
143the point to move up and down.
144
145<H4><A name="Fl_Input_.maybe_do_callback">void
146Fl_Input_::maybe_do_callback()</A></H4>
147
148<P>Does the callback if <TT>changed()</TT> is true or if
149<TT>when() &amp; FL_WHEN_NOT_CHANGED</TT> is non-zero. You
150should call this at any point you think you should generate a
151callback.
152
153<H4><A name="Fl_Input_.maximum_size">void Fl_Input_::maximum_size(int m)<BR>
154int Fl_Input_::maximum_size() const</A></H4>
155
156<P>Sets or returns the maximum length of the input field.
157
158<H4><A name="Fl_Input_.position">int Fl_Input_::position() const
159<BR>int Fl_Input_::position(int new_position, int new_mark)
160<BR>int Fl_Input_::position(int new_position_and_new_mark)</A></H4>
161
162<P>The input widget maintains two pointers into the string. The
163&quot;position&quot; is where the cursor is. The
164&quot;mark&quot; is the other end of the selected text. If they
165are equal then there is no selection. Changing this does not
166affect the clipboard (use <TT>copy()</TT> to do that).
167
168<P>Changing these values causes a <TT>redraw()</TT>. The new
169values are bounds checked. The return value is non-zero if the
170new position is different than the old one. <TT>position(n)</TT>
171is the same as <TT>position(n,n)</TT>. <TT>mark(n)</TT> is the
172same as <TT>position(position(),n)</TT>.</P>
173
174<H4><A name="Fl_Input_.mark">int Fl_Input_::mark() const
175<BR> int Fl_Input_::mark(int new_mark)</A></H4>
176
177<P>Gets or sets the current selection mark. <TT>mark(n)</TT> is
178the same as <TT>position(position(),n)</TT>.
179
180<H4><A name="Fl_Input_.replace">int Fl_Input_::replace(int a, int b,
181const char *insert, int length=0)</A></H4>
182
183<P>This call does all editing of the text. It deletes the region
184between <TT>a</TT> and <TT>b</TT> (either one may be less or
185equal to the other), and then inserts the string <TT>insert</TT>
186at that point and leaves the <TT>mark()</TT> and
187<TT>position()</TT> after the insertion. Does the callback if
188<TT>when() &amp; FL_WHEN_CHANGED</TT> and there is a change.
189
190<P>Set <TT>start</TT> and <TT>end</TT> equal to not delete
191anything. Set <TT>insert</TT> to <TT>NULL</TT> to not insert
192anything.</P>
193
194<P><TT>length</TT> must be zero or <TT>strlen(insert)</TT>, this
195saves a tiny bit of time if you happen to already know the
196length of the insertion, or can be used to insert a portion of a
197string or a string containing nul's.</P>
198
199<P><TT>a</TT> and <TT>b</TT> are clamped to the
2000..<TT>size()</TT> range, so it is safe to pass any values.</P>
201
202<P><TT>cut()</TT> and <TT>insert()</TT> are just inline
203functions that call <TT>replace()</TT>.</P>
204
205<H4><A name="Fl_Input_.cut">int Fl_Input_::cut()
206<BR> int Fl_Input_::cut(int n)
207<BR> int Fl_Input_::cut(int a, int b);</A></H4>
208
209<P><TT>Fl_Input_::cut()</TT> deletes the current selection.
210<TT>cut(n)</TT> deletes <TT>n</TT> characters after the
211<TT>position()</TT>. <TT>cut(-n)</TT> deletes <TT>n</TT>
212characters before the <TT>position()</TT>. <TT>cut(a,b)</TT>
213deletes the characters between offsets <TT>a</TT> and
214<TT>b</TT>. <TT>A</TT>, <TT>b</TT>, and <TT>n</TT> are all
215clamped to the size of the string. The mark and point are left
216where the deleted text was.
217
218<P>If you want the data to go into the clipboard, do
219<TT>Fl_Input_::copy()</TT> before calling
220<TT>Fl_Input_::cut()</TT>, or do <TT>Fl_Input_::copy_cuts()</TT>
221afterwards.</P>
222
223<H4><A name="Fl_Input_.insert">int Fl_Input_::insert(const char *t,int
224l=0)</A></H4>
225
226<P>Insert the string <TT>t</TT> at the current position, and
227leave the mark and position after it. If <TT>l</TT> is not zero
228then it is assumed to be <TT>strlen(t)</TT>.
229
230<H4><A name="Fl_Input_.copy">int Fl_Input_::copy(int clipboard)</A></H4>
231
232<P>Put the current selection between <TT>mark()</TT> and
233<TT>position()</TT> into the specified clipboard.  Does not
234replace the old clipboard contents if <TT>position()</TT> and
235<TT>mark()</TT> are equal. Clipboard 0 maps to the current text
236selection and clipboard 1 maps to the cut/paste clipboard.
237
238<H4><A name="Fl_Input_.undo">int Fl_Input_::undo()</A></H4>
239
240<P>Does undo of several previous calls to <TT>replace()</TT>.
241Returns non-zero if any change was made.
242
243<H4><A name="Fl_Input_.copy_cuts">int Fl_Input_::copy_cuts()</A></H4>
244
245<P>Copy all the previous contiguous cuts from the undo
246information to the clipboard. This is used to make ^K work.
247
248<H4><A name="Fl_Input_.input_type">int Fl_Input_::input_type() const
249<BR>void Fl_Input_::input_type(int)</A></H4>
250
251<P>Gets or sets the input field type.
252
253<H4><A name="Fl_Input_.readonly">int Fl_Input_::readonly() const
254<BR>void Fl_Input_::readonly(int)</A></H4>
255
256<P>Gets or sets the read-only state of the input field.
257
258<H4><A name="Fl_Input_.wrap">int Fl_Input_::wrap() const
259<BR>void Fl_Input_::wrap(int)</A></H4>
260
261<P>Gets or sets the word wrapping state of the input field. Word
262wrap is only functional with multi-line input fields.
263
264</BODY>
265</HTML>
Note: See TracBrowser for help on using the repository browser.