fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Input_.cxx
Go to the documentation of this file.
1 //
2 // "$Id$"
3 //
4 // Common input widget routines for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2011 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 
19 #include <FL/Fl.H>
20 #include <FL/Fl_Input_.H>
21 #include <FL/Fl_Window.H>
22 #include <FL/fl_draw.H>
23 #include <FL/fl_ask.H>
24 #include <math.h>
25 #include <FL/fl_utf8.h>
26 #include "flstring.h"
27 #include <stdlib.h>
28 #include <ctype.h>
29 
30 #define MAXBUF 1024
31 #if defined(USE_X11) && !USE_XFT
32 const int secret_char = '*'; // asterisk to hide secret input
33 #else
34 const int secret_char = 0x2022; // bullet to hide secret input
35 #endif
36 static int l_secret;
37 
38 extern void fl_draw(const char*, int, float, float);
39 
41 
55 const char* Fl_Input_::expand(const char* p, char* buf) const {
56  char* o = buf;
57  char* e = buf+(MAXBUF-4);
58  const char* lastspace = p;
59  char* lastspace_out = o;
60  int width_to_lastspace = 0;
61  int word_count = 0;
62  int word_wrap;
63 // const char *pe = p + strlen(p);
64 
65  if (input_type()==FL_SECRET_INPUT) {
66  while (o<e && p < value_+size_) {
67  if (fl_utf8len((char)p[0]) >= 1) {
69  o += l_secret;
70  }
71  p++;
72  }
73 
74  } else while (o<e) {
75  if (wrap() && (p >= value_+size_ || isspace(*p & 255))) {
76  word_wrap = w() - Fl::box_dw(box()) - 2;
77  width_to_lastspace += (int)fl_width(lastspace_out, (int) (o-lastspace_out));
78  if (p > lastspace+1) {
79  if (word_count && width_to_lastspace > word_wrap) {
80  p = lastspace; o = lastspace_out; break;
81  }
82  word_count++;
83  }
84  lastspace = p;
85  lastspace_out = o;
86  }
87 
88  if (p >= value_+size_) break;
89  int c = *p++ & 255;
90  if (c < ' ' || c == 127) {
91  if (c=='\n' && input_type()==FL_MULTILINE_INPUT) {p--; break;}
92  if (c == '\t' && input_type()==FL_MULTILINE_INPUT) {
93  for (c = fl_utf_nb_char((uchar*)buf, (int) (o-buf))%8; c<8 && o<e; c++) {
94  *o++ = ' ';
95  }
96  } else {
97  *o++ = '^';
98  *o++ = c ^ 0x40;
99  }
100  } else {
101  *o++ = c;
102  }
103  }
104  *o = 0;
105  return p;
106 }
107 
120  const char* p, // real string
121  const char* e, // pointer into real string
122  const char* buf, // conversion of real string by expand()
123  int* returnn // return offset into buf here
124 ) const {
125  int n = 0;
126  int chr = 0;
127  int l;
128  if (input_type()==FL_SECRET_INPUT) {
129  while (p<e) {
130  l = fl_utf8len((char)p[0]);
131  if (l >= 1) n += l_secret;
132  p += l;
133  }
134  } else while (p<e) {
135  int c = *p & 255;
136  if (c < ' ' || c == 127) {
137  if (c == '\t' && input_type()==FL_MULTILINE_INPUT) {
138  n += 8-(chr%8);
139  chr += 7-(chr%8);
140  } else n += 2;
141  } else {
142  n++;
143  }
144  chr += fl_utf8len((char)p[0]) >= 1;
145  p++;
146  }
147  if (returnn) *returnn = n;
148  return fl_width(buf, n);
149 }
150 
152 
168  if (damage() & FL_DAMAGE_ALL) return; // don't waste time if it won't be done
169  if (damage() & FL_DAMAGE_EXPOSE) {
170  if (p < mu_p) mu_p = p;
171  } else {
172  mu_p = p;
173  }
174 
176  erase_cursor_only = 0;
177 }
178 
188 void Fl_Input_::minimal_update(int p, int q) {
189  if (q < p) p = q;
190  minimal_update(p);
191 }
192 
194 
195 /* Horizontal cursor position in pixels while moving up or down. */
196 double Fl_Input_::up_down_pos = 0;
197 
198 /* Flag to remember last cursor move. */
199 int Fl_Input_::was_up_down = 0;
200 
204 void Fl_Input_::setfont() const {
205  fl_font(textfont(), textsize());
206 }
207 
217 void Fl_Input_::drawtext(int X, int Y, int W, int H) {
218  int do_mu = !(damage()&FL_DAMAGE_ALL);
219 
220  if (Fl::focus()!=this && !size()) {
221  if (do_mu) { // we have to erase it if cursor was there
222  draw_box(box(), X-Fl::box_dx(box()), Y-Fl::box_dy(box()),
223  W+Fl::box_dw(box()), H+Fl::box_dh(box()), color());
224  }
225  return;
226  }
227 
228  int selstart, selend;
229  if (Fl::focus()!=this && /*Fl::selection_owner()!=this &&*/ Fl::pushed()!=this)
230  selstart = selend = 0;
231  else if (position() <= mark()) {
232  selstart = position(); selend = mark();
233  } else {
234  selend = position(); selstart = mark();
235  }
236 
237  setfont();
238  const char *p, *e;
239  char buf[MAXBUF];
240 
241  // count how many lines and put the last one into the buffer:
242  // And figure out where the cursor is:
243  int height = fl_height();
244  int threshold = height/2;
245  int lines;
246  int curx, cury;
247  for (p=value(), curx=cury=lines=0; ;) {
248  e = expand(p, buf);
249  if (position() >= p-value() && position() <= e-value()) {
250  curx = int(expandpos(p, value()+position(), buf, 0)+.5);
251  if (Fl::focus()==this && !was_up_down) up_down_pos = curx;
252  cury = lines*height;
253  int newscroll = xscroll_;
254  if (curx > newscroll+W-threshold) {
255  // figure out scrolling so there is space after the cursor:
256  newscroll = curx+threshold-W;
257  // figure out the furthest left we ever want to scroll:
258  int ex = int(expandpos(p, e, buf, 0))+4-W;
259  // use minimum of both amounts:
260  if (ex < newscroll) newscroll = ex;
261  } else if (curx < newscroll+threshold) {
262  newscroll = curx-threshold;
263  }
264  if (newscroll < 0) newscroll = 0;
265  if (newscroll != xscroll_) {
266  xscroll_ = newscroll;
267  mu_p = 0; erase_cursor_only = 0;
268  }
269  }
270  lines++;
271  if (e >= value_+size_) break;
272  p = e+1;
273  }
274 
275  // adjust the scrolling:
277  int newy = yscroll_;
278  if (cury < newy) newy = cury;
279  if (cury > newy+H-height) newy = cury-H+height;
280  if (newy < -1) newy = -1;
281  if (newy != yscroll_) {yscroll_ = newy; mu_p = 0; erase_cursor_only = 0;}
282  } else {
283  yscroll_ = -(H-height)/2;
284  }
285 
286  fl_push_clip(X, Y, W, H);
288 
289  p = value();
290  // visit each line and draw it:
291  int desc = height-fl_descent();
292  float xpos = (float)(X - xscroll_ + 1);
293  int ypos = -yscroll_;
294  for (; ypos < H;) {
295 
296  // re-expand line unless it is the last one calculated above:
297  if (lines>1) e = expand(p, buf);
298 
299  if (ypos <= -height) goto CONTINUE; // clipped off top
300 
301  if (do_mu) { // for minimal update:
302  const char* pp = value()+mu_p; // pointer to where minimal update starts
303  if (e < pp) goto CONTINUE2; // this line is before the changes
304  if (readonly()) erase_cursor_only = 0; // this isn't the most efficient way
305  if (erase_cursor_only && p > pp) goto CONTINUE2; // this line is after
306  // calculate area to erase:
307  float r = (float)(X+W);
308  float xx;
309  if (p >= pp) {
310  xx = (float)X;
311  if (erase_cursor_only) r = xpos+2;
312  else if (readonly()) xx -= 3;
313  } else {
314  xx = xpos + (float)expandpos(p, pp, buf, 0);
315  if (erase_cursor_only) r = xx+2;
316  else if (readonly()) xx -= 3;
317  }
318  // clip to and erase it:
319  fl_push_clip((int)xx-1-height/8, Y+ypos, (int)(r-xx+2+height/4), height);
320  draw_box(box(), X-Fl::box_dx(box()), Y-Fl::box_dy(box()),
321  W+Fl::box_dw(box()), H+Fl::box_dh(box()), color());
322  // it now draws entire line over it
323  // this should not draw letters to left of erased area, but
324  // that is nyi.
325  }
326 
327  // Draw selection area if required:
328  if (selstart < selend && selstart <= e-value() && selend > p-value()) {
329  const char* pp = value()+selstart;
330  float x1 = xpos;
331  int offset1 = 0;
332  if (pp > p) {
333  fl_color(tc);
334  x1 += (float)expandpos(p, pp, buf, &offset1);
335  fl_draw(buf, offset1, xpos, (float)(Y+ypos+desc));
336  }
337  pp = value()+selend;
338  float x2 = (float)(X+W);
339  int offset2;
340  if (pp <= e) x2 = xpos + (float)expandpos(p, pp, buf, &offset2);
341  else offset2 = (int) strlen(buf);
342 #ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state != 0) text
343  if (Fl::compose_state) {
344  fl_color(textcolor());
345  }
346  else
347 #endif
348  {
350  fl_rectf((int)(x1+0.5), Y+ypos, (int)(x2-x1+0.5), height);
352  }
353  fl_draw(buf+offset1, offset2-offset1, x1, (float)(Y+ypos+desc));
354 #ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state != 0) text
355  if (Fl::compose_state) {
357  float width = fl_width(buf+offset1, offset2-offset1);
358  fl_line(x1, Y+ypos+height-1, x1+width, Y+ypos+height-1);
359  }
360 #endif
361  if (pp < e) {
362  fl_color(tc);
363  fl_draw(buf+offset2, (int) strlen(buf+offset2), x2, (float)(Y+ypos+desc));
364  }
365  } else {
366  // draw unselected text
367  fl_color(tc);
368  fl_draw(buf, (int) strlen(buf), xpos, (float)(Y+ypos+desc));
369  }
370 
371  if (do_mu) fl_pop_clip();
372 
373  CONTINUE2:
374  // draw the cursor:
375  if (Fl::focus() == this && (
376 #ifdef __APPLE__
378 #endif
379  selstart == selend) &&
380  position() >= p-value() && position() <= e-value()) {
382  // cursor position may need to be recomputed (see STR #2486)
383  curx = int(expandpos(p, value()+position(), buf, 0)+.5);
384  if (readonly()) {
385  fl_line((int)(xpos+curx-2.5f), Y+ypos+height-1,
386  (int)(xpos+curx+0.5f), Y+ypos+height-4,
387  (int)(xpos+curx+3.5f), Y+ypos+height-1);
388  } else {
389  fl_rectf((int)(xpos+curx+0.5), Y+ypos, 2, height);
390  }
391 #ifdef __APPLE__
392  Fl::insertion_point_location(xpos+curx, Y+ypos+height, height);
393 #endif
394  }
395 
396  CONTINUE:
397  ypos += height;
398  if (e >= value_+size_) break;
399  if (*e == '\n' || *e == ' ') e++;
400  p = e;
401  }
402 
403  // for minimal update, erase all lines below last one if necessary:
404  if (input_type()==FL_MULTILINE_INPUT && do_mu && ypos<H
405  && (!erase_cursor_only || p <= value()+mu_p)) {
406  if (ypos < 0) ypos = 0;
407  fl_push_clip(X, Y+ypos, W, H-ypos);
408  draw_box(box(), X-Fl::box_dx(box()), Y-Fl::box_dy(box()),
409  W+Fl::box_dw(box()), H+Fl::box_dh(box()), color());
410  fl_pop_clip();
411  }
412 
413  fl_pop_clip();
414  if (Fl::focus() == this) {
416  (int)xpos+curx, Y+ypos-fl_descent(), W, H, window());
417  }
418 }
419 
424 static int isword(char c) {
425  return (c&128 || isalnum(c) || strchr("#%-@_~", c));
426 }
427 
441 int Fl_Input_::word_end(int i) const {
442  if (input_type() == FL_SECRET_INPUT) return size();
443  while (i < size() && !isword(index(i))) i++;
444  while (i < size() && isword(index(i))) i++;
445  return i;
446 }
447 
461 int Fl_Input_::word_start(int i) const {
462  if (input_type() == FL_SECRET_INPUT) return 0;
463  while (i > 0 && !isword(index(i-1))) i--;
464  while (i > 0 && isword(index(i-1))) i--;
465  return i;
466 }
467 
477 int Fl_Input_::line_end(int i) const {
478  if (input_type() != FL_MULTILINE_INPUT) return size();
479 
480  if (wrap()) {
481  // go to the start of the paragraph:
482  int j = i;
483  while (j > 0 && index(j-1) != '\n') j--;
484  // now measure lines until we get past i, end of that line is real eol:
485  setfont();
486  for (const char* p=value()+j; ;) {
487  char buf[MAXBUF];
488  p = expand(p, buf);
489  int k = (int) (p-value());
490  if (k >= i) return k;
491  p++;
492  }
493  } else {
494  while (i < size() && index(i) != '\n') i++;
495  return i;
496  }
497 }
498 
508 int Fl_Input_::line_start(int i) const {
509  if (input_type() != FL_MULTILINE_INPUT) return 0;
510  int j = i;
511  while (j > 0 && index(j-1) != '\n') j--;
512  if (wrap()) {
513  // now measure lines until we get past i, start of that line is real eol:
514  setfont();
515  for (const char* p=value()+j; ;) {
516  char buf[MAXBUF];
517  const char* e = expand(p, buf);
518  if ((int) (e-value()) >= i) return (int) (p-value());
519  p = e+1;
520  }
521  } else return j;
522 }
523 
524 static int strict_word_start(const char *s, int i, int itype) {
525  if (itype == FL_SECRET_INPUT) return 0;
526  while (i > 0 && !isspace(s[i-1]))
527  i--;
528  return i;
529 }
530 
531 static int strict_word_end(const char *s, int len, int i, int itype) {
532  if (itype == FL_SECRET_INPUT) return len;
533  while (i < len && !isspace(s[i]))
534  i++;
535  return i;
536 }
537 
542 void Fl_Input_::handle_mouse(int X, int Y, int /*W*/, int /*H*/, int drag) {
543  was_up_down = 0;
544  if (!size()) return;
545  setfont();
546 
547  const char *p, *e;
548  char buf[MAXBUF];
549 
550  int theline = (input_type()==FL_MULTILINE_INPUT) ?
551  (Fl::event_y()-Y+yscroll_)/fl_height() : 0;
552 
553  int newpos = 0;
554  for (p=value();; ) {
555  e = expand(p, buf);
556  theline--; if (theline < 0) break;
557  if (e >= value_+size_) break;
558  p = e+1;
559  }
560  const char *l, *r, *t; double f0 = Fl::event_x()-X+xscroll_;
561  for (l = p, r = e; l<r; ) {
562  double f;
563  int cw = fl_utf8len((char)l[0]);
564  if (cw < 1) cw = 1;
565  t = l+cw;
566  f = X-xscroll_+expandpos(p, t, buf, 0);
567  if (f <= Fl::event_x()) {l = t; f0 = Fl::event_x()-f;}
568  else r = t-cw;
569  }
570  if (l < e) { // see if closer to character on right:
571  double f1;
572  int cw = fl_utf8len((char)l[0]);
573  if (cw > 0) {
574  f1 = X-xscroll_+expandpos(p, l + cw, buf, 0) - Fl::event_x();
575  if (f1 < f0) l = l+cw;
576  }
577  }
578  newpos = (int) (l-value());
579 
580  int newmark = drag ? mark() : newpos;
581  if (Fl::event_clicks()) {
582  if (newpos >= newmark) {
583  if (newpos == newmark) {
584  if (newpos < size()) newpos++;
585  else newmark--;
586  }
587  if (Fl::event_clicks() > 1) {
588  newpos = line_end(newpos);
589  newmark = line_start(newmark);
590  } else {
591  newpos = strict_word_end(value(), size(), newpos, input_type());
592  newmark = strict_word_start(value(), newmark, input_type());
593  }
594  } else {
595  if (Fl::event_clicks() > 1) {
596  newpos = line_start(newpos);
597  newmark = line_end(newmark);
598  } else {
599  newpos = strict_word_start(value(), newpos, input_type());
600  newmark = strict_word_end(value(), size(), newmark, input_type());
601  }
602  }
603  // if the multiple click does not increase the selection, revert
604  // to single-click behavior:
605  if (!drag && (mark() > position() ?
606  (newmark >= position() && newpos <= mark()) :
607  (newmark >= mark() && newpos <= position()))) {
608  Fl::event_clicks(0);
609  newmark = newpos = (int) (l-value());
610  }
611  }
612  position(newpos, newmark);
613 }
614 
632 int Fl_Input_::position(int p, int m) {
633  int is_same = 0;
634  was_up_down = 0;
635  if (p<0) p = 0;
636  if (p>size()) p = size();
637  if (m<0) m = 0;
638  if (m>size()) m = size();
639  if (p == m) is_same = 1;
640 
641  while (p < position_ && p > 0 && (size() - p) > 0 &&
642  (fl_utf8len((char)(value() + p)[0]) < 1)) { p--; }
643  int ul = fl_utf8len((char)(value() + p)[0]);
644  while (p < size() && p > position_ && ul < 0) {
645  p++;
646  ul = fl_utf8len((char)(value() + p)[0]);
647  }
648 
649  while (m < mark_ && m > 0 && (size() - m) > 0 &&
650  (fl_utf8len((char)(value() + m)[0]) < 1)) { m--; }
651  ul = fl_utf8len((char)(value() + m)[0]);
652  while (m < size() && m > mark_ && ul < 0) {
653  m++;
654  ul = fl_utf8len((char)(value() + m)[0]);
655  }
656  if (is_same) m = p;
657  if (p == position_ && m == mark_) return 0;
658 
659 
660  //if (Fl::selection_owner() == this) Fl::selection_owner(0);
661  if (p != m) {
663  if (m != mark_) minimal_update(mark_, m);
664  } else {
665  // new position is a cursor
666  if (position_ == mark_) {
667  // old position was just a cursor
668  if (Fl::focus() == this && !(damage()&FL_DAMAGE_EXPOSE)) {
670  }
671  } else { // old position was a selection
673  }
674  }
675  position_ = p;
676  mark_ = m;
677  return 1;
678 }
679 
692 int Fl_Input_::up_down_position(int i, int keepmark) {
693  // unlike before, i must be at the start of the line already!
694 
695  setfont();
696  char buf[MAXBUF];
697  const char* p = value()+i;
698  const char* e = expand(p, buf);
699  const char *l, *r, *t;
700  for (l = p, r = e; l<r; ) {
701  t = l+(r-l+1)/2;
702  int f = (int)expandpos(p, t, buf, 0);
703  if (f <= up_down_pos) l = t; else r = t-1;
704  }
705  int j = (int) (l-value());
706  j = position(j, keepmark ? mark_ : j);
707  was_up_down = 1;
708  return j;
709 }
710 
724 int Fl_Input_::copy(int clipboard) {
725  int b = position();
726  int e = mark();
727  if (b != e) {
728  if (b > e) {b = mark(); e = position();}
729  if (input_type() == FL_SECRET_INPUT) e = b;
730  Fl::copy(value()+b, e-b, clipboard);
731  return 1;
732  }
733  return 0;
734 }
735 
736 #define MAXFLOATSIZE 40
737 
738 static char* undobuffer;
739 static int undobufferlength;
741 static int undoat; // points after insertion
742 static int undocut; // number of characters deleted there
743 static int undoinsert; // number of characters inserted
744 static int yankcut; // length of valid contents of buffer, even if undocut=0
745 
746 static void undobuffersize(int n) {
747  if (n > undobufferlength) {
748  if (undobuffer) {
749  do {undobufferlength *= 2;} while (undobufferlength < n);
750  undobuffer = (char*)realloc(undobuffer, undobufferlength);
751  } else {
752  undobufferlength = n+9;
754  }
755  }
756 }
757 
803 int Fl_Input_::replace(int b, int e, const char* text, int ilen) {
804  int ul, om, op;
805  was_up_down = 0;
806 
807  if (b<0) b = 0;
808  if (e<0) e = 0;
809  if (b>size_) b = size_;
810  if (e>size_) e = size_;
811  if (e<b) {int t=b; b=e; e=t;}
812  while (b != e && b > 0 && (size_ - b) > 0 &&
813  (fl_utf8len((value_ + b)[0]) < 1)) { b--; }
814  ul = fl_utf8len((char)(value_ + e)[0]);
815  while (e < size_ && e > 0 && ul < 0) {
816  e++;
817  ul = fl_utf8len((char)(value_ + e)[0]);
818  }
819  if (text && !ilen) ilen = (int) strlen(text);
820  if (e<=b && !ilen) return 0; // don't clobber undo for a null operation
821 
822  // we must count UTF-8 *characters* to determine whether we can insert
823  // the full text or only a part of it (and how much this would be)
824 
825  int nchars = 0; // characters in value() - deleted + inserted
826  const char *p = value_;
827  while (p < (char *)(value_+size_)) {
828  if (p == (char *)(value_+b)) { // skip removed part
829  p = (char *)(value_+e);
830  if (p >= (char *)(value_+size_)) break;
831  }
832  int ulen = fl_utf8len(*p);
833  if (ulen < 1) ulen = 1; // invalid UTF-8 character: count as 1
834  nchars++;
835  p += ulen;
836  }
837  int nlen = 0; // length (in bytes) to be inserted
838  p = text;
839  while (p < (char *)(text+ilen) && nchars < maximum_size()) {
840  int ulen = fl_utf8len(*p);
841  if (ulen < 1) ulen = 1; // invalid UTF-8 character: count as 1
842  nchars++;
843  p += ulen;
844  nlen += ulen;
845  }
846  ilen = nlen;
847 
848  put_in_buffer(size_+ilen);
849 
850  if (e>b) {
851  if (undowidget == this && b == undoat) {
852  undobuffersize(undocut+(e-b));
853  memcpy(undobuffer+undocut, value_+b, e-b);
854  undocut += e-b;
855  } else if (undowidget == this && e == undoat && !undoinsert) {
856  undobuffersize(undocut+(e-b));
857  memmove(undobuffer+(e-b), undobuffer, undocut);
858  memcpy(undobuffer, value_+b, e-b);
859  undocut += e-b;
860  } else if (undowidget == this && e == undoat && (e-b)<undoinsert) {
861  undoinsert -= e-b;
862  } else {
863  undobuffersize(e-b);
864  memcpy(undobuffer, value_+b, e-b);
865  undocut = e-b;
866  undoinsert = 0;
867  }
868  memmove(buffer+b, buffer+e, size_-e+1);
869  size_ -= e-b;
870  undowidget = this;
871  undoat = b;
872  if (input_type() == FL_SECRET_INPUT) yankcut = 0; else yankcut = undocut;
873  }
874 
875  if (ilen) {
876  if (undowidget == this && b == undoat)
877  undoinsert += ilen;
878  else {
879  undocut = 0;
880  undoinsert = ilen;
881  }
882  memmove(buffer+b+ilen, buffer+b, size_-b+1);
883  memcpy(buffer+b, text, ilen);
884  size_ += ilen;
885  }
886  undowidget = this;
887  om = mark_;
888  op = position_;
889  mark_ = position_ = undoat = b+ilen;
890 
891  // Insertions into the word at the end of the line will cause it to
892  // wrap to the next line, so we must indicate that the changes may start
893  // right after the whitespace before the current word. This will
894  // result in sub-optimal update when such wrapping does not happen
895  // but it is too hard to figure out for now...
896  if (wrap()) {
897  // if there is a space in the pasted text, the whole line may have rewrapped
898  int i;
899  for (i=0; i<ilen; i++)
900  if (text[i]==' ') break;
901  if (i==ilen)
902  while (b > 0 && !isspace(index(b) & 255) && index(b)!='\n') b--;
903  else
904  while (b > 0 && index(b)!='\n') b--;
905  }
906 
907  // make sure we redraw the old selection or cursor:
908  if (om < b) b = om;
909  if (op < b) b = op;
910 
911  minimal_update(b);
912 
913  mark_ = position_ = undoat;
914 
915  set_changed();
917  return 1;
918 }
919 
928  was_up_down = 0;
929  if ( undowidget != this || (!undocut && !undoinsert) ) return 0;
930 
931  int ilen = undocut;
932  int xlen = undoinsert;
933  int b = undoat-xlen;
934  int b1 = b;
935 
936  put_in_buffer(size_+ilen);
937 
938  if (ilen) {
939  memmove(buffer+b+ilen, buffer+b, size_-b+1);
940  memcpy(buffer+b, undobuffer, ilen);
941  size_ += ilen;
942  b += ilen;
943  }
944 
945  if (xlen) {
946  undobuffersize(xlen);
947  memcpy(undobuffer, buffer+b, xlen);
948  memmove(buffer+b, buffer+b+xlen, size_-xlen-b+1);
949  size_ -= xlen;
950  }
951 
952  undocut = xlen;
953  if (xlen) yankcut = xlen;
954  undoinsert = ilen;
955  undoat = b;
956  mark_ = b /* -ilen */;
957  position_ = b;
958 
959  if (wrap())
960  while (b1 > 0 && index(b1)!='\n') b1--;
961  minimal_update(b1);
962  set_changed();
964  return 1;
965 }
966 
978  // put the yank buffer into the X clipboard
979  if (!yankcut || input_type()==FL_SECRET_INPUT) return 0;
981  return 1;
982 }
983 
988  if (changed() || (when()&FL_WHEN_NOT_CHANGED)) {
989  do_callback();
990  }
991 }
992 
999 int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
1000  switch (event) {
1001 
1002  case FL_ENTER:
1003  case FL_MOVE:
1004  if (active_r() && window()) window()->cursor(FL_CURSOR_INSERT);
1005  return 1;
1006 
1007  case FL_LEAVE:
1008  if (active_r() && window()) window()->cursor(FL_CURSOR_DEFAULT);
1009  return 1;
1010 
1011  case FL_FOCUS:
1012  fl_set_spot(textfont(), textsize(), x(), y(), w(), h(), window());
1013  if (mark_ == position_) {
1014  minimal_update(size()+1);
1015  } else //if (Fl::selection_owner() != this)
1017  return 1;
1018 
1019  case FL_UNFOCUS:
1020  if (active_r() && window()) window()->cursor(FL_CURSOR_DEFAULT);
1021  if (mark_ == position_) {
1023  } else //if (Fl::selection_owner() != this)
1025  case FL_HIDE:
1026  fl_reset_spot();
1027  if (!readonly() && (when() & FL_WHEN_RELEASE))
1029  return 1;
1030 
1031  case FL_PUSH:
1032  if (active_r() && window()) window()->cursor(FL_CURSOR_INSERT);
1033 
1035 
1036  if (Fl::focus() != this) {
1037  Fl::focus(this);
1038  handle(FL_FOCUS);
1039  }
1040  return 1;
1041 
1042  case FL_DRAG:
1043  handle_mouse(X, Y, W, H, 1);
1044  return 1;
1045 
1046  case FL_RELEASE:
1047  copy(0);
1048  return 1;
1049 
1050  case FL_PASTE: {
1051  // Don't allow pastes into readonly widgets...
1052  if (readonly()) {
1054  return 1;
1055  }
1056 
1057  // See if we have anything to paste...
1058  if (!Fl::event_text() || !Fl::event_length()) return 1;
1059 
1060  // strip trailing control characters and spaces before pasting:
1061  const char* t = Fl::event_text();
1062  const char* e = t+Fl::event_length();
1063  if (input_type() != FL_MULTILINE_INPUT) while (e > t && isspace(*(e-1) & 255)) e--;
1064  if (!t || e <= t) return 1; // Int/float stuff will crash without this test
1065  if (input_type() == FL_INT_INPUT) {
1066  while (isspace(*t & 255) && t < e) t ++;
1067  const char *p = t;
1068  if (*p == '+' || *p == '-') p ++;
1069  if (strncmp(p, "0x", 2) == 0) {
1070  p += 2;
1071  while (isxdigit(*p & 255) && p < e) p ++;
1072  } else {
1073  while (isdigit(*p & 255) && p < e) p ++;
1074  }
1075  if (p < e) {
1077  return 1;
1078  } else return replace(0, size(), t, (int) (e-t));
1079  } else if (input_type() == FL_FLOAT_INPUT) {
1080  while (isspace(*t & 255) && t < e) t ++;
1081  const char *p = t;
1082  if (*p == '+' || *p == '-') p ++;
1083  while (isdigit(*p & 255) && p < e) p ++;
1084  if (*p == '.') {
1085  p ++;
1086  while (isdigit(*p & 255) && p < e) p ++;
1087  if (*p == 'e' || *p == 'E') {
1088  p ++;
1089  if (*p == '+' || *p == '-') p ++;
1090  while (isdigit(*p & 255) && p < e) p ++;
1091  }
1092  }
1093  if (p < e) {
1095  return 1;
1096  } else return replace(0, size(), t, (int) (e-t));
1097  }
1098  return replace(position(), mark(), t, (int) (e-t));}
1099 
1100  case FL_SHORTCUT:
1101  if (!(shortcut() ? Fl::test_shortcut(shortcut()) : test_shortcut()))
1102  return 0;
1103  if (Fl::visible_focus() && handle(FL_FOCUS)) {
1104  Fl::focus(this);
1105  return 1;
1106  } // else fall through
1107 
1108  default:
1109  return 0;
1110  }
1111 }
1112 
1113 /*------------------------------*/
1114 
1125 Fl_Input_::Fl_Input_(int X, int Y, int W, int H, const char* l)
1126 : Fl_Widget(X, Y, W, H, l) {
1127  box(FL_DOWN_BOX);
1133  cursor_color_ = FL_FOREGROUND_COLOR; // was FL_BLUE
1134  mark_ = position_ = size_ = 0;
1135  bufsize = 0;
1136  buffer = 0;
1137  value_ = "";
1138  xscroll_ = yscroll_ = 0;
1139  maximum_size_ = 32767;
1140  shortcut_ = 0;
1143  tab_nav(1);
1144 }
1145 
1152  if (value_ == buffer && bufsize > len) {
1153  buffer[size_] = 0;
1154  return;
1155  }
1156  if (!bufsize) {
1157  if (len > size_) len += 9; // let a few characters insert before realloc
1158  bufsize = len+1;
1159  buffer = (char*)malloc(bufsize);
1160  } else if (bufsize <= len) {
1161  // we may need to move old value in case it points into buffer:
1162  int moveit = (value_ >= buffer && value_ < buffer+bufsize);
1163  // enlarge current buffer
1164  if (len > size_) {
1165  do {bufsize *= 2;} while (bufsize <= len);
1166  } else {
1167  bufsize = len+1;
1168  }
1169  // Note: the following code is equivalent to:
1170  //
1171  // if (moveit) value_ = value_ - buffer;
1172  // char* nbuffer = (char*)realloc(buffer, bufsize);
1173  // if (moveit) value_ = value_ + nbuffer;
1174  // buffer = nbuffer;
1175  //
1176  // We just optimized the pointer arithmetic for value_...
1177  //
1178  char* nbuffer = (char*)realloc(buffer, bufsize);
1179  if (moveit) value_ += (nbuffer-buffer);
1180  buffer = nbuffer;
1181  }
1182  memmove(buffer, value_, size_); buffer[size_] = 0;
1183  value_ = buffer;
1184 }
1185 
1204 int Fl_Input_::static_value(const char* str, int len) {
1205  clear_changed();
1206  if (undowidget == this) undowidget = 0;
1207  if (str == value_ && len == size_) return 0;
1208  if (len) { // non-empty new value:
1209  if (xscroll_ || yscroll_) {
1210  xscroll_ = yscroll_ = 0;
1211  minimal_update(0);
1212  } else {
1213  int i = 0;
1214  // find first different character:
1215  if (value_) {
1216  for (; i<size_ && i<len && str[i]==value_[i]; i++) {/*empty*/}
1217  if (i==size_ && i==len) return 0;
1218  }
1219  minimal_update(i);
1220  }
1221  value_ = str;
1222  size_ = len;
1223  } else { // empty new value:
1224  if (!size_) return 0; // both old and new are empty.
1225  size_ = 0;
1226  value_ = "";
1227  xscroll_ = yscroll_ = 0;
1228  minimal_update(0);
1229  }
1230  position(readonly() ? 0 : size());
1231  return 1;
1232 }
1233 
1248 int Fl_Input_::static_value(const char* str) {
1249  return static_value(str, str ? (int) strlen(str) : 0);
1250 }
1251 
1267 int Fl_Input_::value(const char* str, int len) {
1268  int r = static_value(str, len);
1269  if (len) put_in_buffer(len);
1270  return r;
1271 }
1272 
1284 int Fl_Input_::value(const char* str) {
1285  return value(str, str ? (int) strlen(str) : 0);
1286 }
1287 
1294 void Fl_Input_::resize(int X, int Y, int W, int H) {
1295  if (W != w()) xscroll_ = 0;
1296  if (H != h()) yscroll_ = 0;
1297  Fl_Widget::resize(X, Y, W, H);
1298 }
1299 
1307  if (undowidget == this) undowidget = 0;
1308  if (bufsize) free((void*)buffer);
1309 }
1310 
1316  int n = 1;
1317  if (input_type() == FL_MULTILINE_INPUT) {
1318  fl_font(textfont(),textsize()); //ensure current font is set to ours
1319  n = h()/fl_height(); // number of lines to scroll
1320  if (n<=0) n = 1;
1321  }
1322  return n;
1323 }
1324 
1334 unsigned int Fl_Input_::index(int i) const
1335 {
1336  int len = 0;
1337  return fl_utf8decode(value_+i, value_+size_, &len);
1338 }
1339 
1340 //
1341 // End of "$Id$".
1342 //
Fl_Input_::value_
const char * value_
Definition: Fl_Input_.H:97
fl_font
void fl_font(Fl_Font face, Fl_Fontsize fsize)
Definition: fl_draw.H:509
fl_width
FL_EXPORT double fl_width(const char *txt)
Definition: fl_font.cxx:65
FL_ALIGN_LEFT
const Fl_Align FL_ALIGN_LEFT
Definition: Enumerations.H:839
Fl_Widget::y
int y() const
Definition: Fl_Widget.H:289
FL_DAMAGE_ALL
Definition: Enumerations.H:1112
Fl.H
buf
static char * buf
Definition: fl_encoding_mac_roman.cxx:76
Fl_Widget::align
Fl_Align align() const
Definition: Fl_Widget.H:348
fl_line
void fl_line(int x, int y, int x1, int y1)
Definition: fl_draw.H:223
fl_rectf
void fl_rectf(int x, int y, int w, int h)
Definition: fl_draw.H:206
Fl_Input_::copy_cuts
int copy_cuts()
Definition: Fl_Input_.cxx:977
FL_HIDE
Definition: Enumerations.H:369
Fl_Widget::draw_box
void draw_box() const
Definition: fl_boxtype.cxx:442
Fl_Input_::expandpos
double expandpos(const char *, const char *, const char *, int *) const
Definition: Fl_Input_.cxx:119
Fl_Color
unsigned int Fl_Color
Definition: Enumerations.H:934
FL_UNFOCUS
Definition: Enumerations.H:288
Fl_Input_::cursor_color_
Fl_Color cursor_color_
Definition: Fl_Input_.H:146
Fl_Input_::bufsize
int bufsize
Definition: Fl_Input_.H:106
Fl::box_dx
static int box_dx(Fl_Boxtype)
Definition: fl_boxtype.cxx:360
Fl_Input_::textsize
Fl_Fontsize textsize() const
Definition: Fl_Input_.H:395
fl_set_spot
FL_EXPORT void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win=0)
Definition: Fl_win32.cxx:275
undocut
static int undocut
Definition: Fl_Input_.cxx:742
fl_descent
int fl_descent()
Definition: fl_draw.H:533
Fl::event_state
static int event_state()
Definition: Fl.H:704
FL_CURSOR_DEFAULT
Definition: Enumerations.H:1049
fl_ask.H
Fl_Input_::minimal_update
void minimal_update(int, int)
Definition: Fl_Input_.cxx:188
fl_color
void fl_color(Fl_Color c)
Definition: fl_draw.H:52
FL_WHEN_NOT_CHANGED
Do the callback whenever the user interacts with the widget.
Definition: Enumerations.H:442
Fl_Input_::maximum_size
int maximum_size() const
Definition: Fl_Input_.H:266
Fl_Input_::maximum_size_
int maximum_size_
Definition: Fl_Input_.H:128
Fl_Widget::window
Fl_Window * window() const
Definition: Fl_Window.cxx:118
secret_char
const int secret_char
Definition: Fl_Input_.cxx:34
Fl_Widget::clear_changed
void clear_changed()
Definition: Fl_Widget.H:791
FL_WHEN_RELEASE
Do the callback when the button or key is released and the value changes.
Definition: Enumerations.H:443
FL_DRAG
Definition: Enumerations.H:268
fl_utf8len
int fl_utf8len(char c)
Definition: fl_utf8.cxx:111
FL_SHIFT
#define FL_SHIFT
One of the shift keys is down.
Definition: Enumerations.H:557
Fl_Input_::setfont
void setfont() const
Definition: Fl_Input_.cxx:204
Fl::event_text
static const char * event_text()
Definition: Fl.H:792
FL_SECRET_INPUT
#define FL_SECRET_INPUT
Definition: Fl_Input_.H:34
Fl_Input_::shortcut_
int shortcut_
Definition: Fl_Input_.H:131
Fl_Widget::changed
unsigned int changed() const
Definition: Fl_Widget.H:781
free
void free()
H
static int H
Definition: Fl_Tooltip.cxx:76
Fl_Input_::put_in_buffer
void put_in_buffer(int newsize)
Definition: Fl_Input_.cxx:1151
undowidget
static Fl_Input_ * undowidget
Definition: Fl_Input_.cxx:740
fl_height
int fl_height()
Definition: fl_draw.H:527
Fl_Widget::set_flag
void set_flag(unsigned int c)
Definition: Fl_Widget.H:149
Fl_Widget::x
int x() const
Definition: Fl_Widget.H:284
Fl_Input_::index
Fl_Char index(int i) const
Definition: Fl_Input_.cxx:1334
FL_PASTE
Definition: Enumerations.H:383
Fl_Input_::wrap
int wrap() const
Definition: Fl_Input_.H:444
Fl_Input_::size
int size() const
Definition: Fl_Input_.H:257
Fl_Input_::erase_cursor_only
uchar erase_cursor_only
Definition: Fl_Input_.H:134
Fl_Widget::when
Fl_When when() const
Definition: Fl_Widget.H:621
Fl_Widget::do_callback
void do_callback()
Definition: Fl_Widget.H:861
fl_contrast
Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg)
Definition: fl_color.cxx:435
Fl_Input_::shortcut
int shortcut() const
Definition: Fl_Input_.H:374
FL_LEAVE
Definition: Enumerations.H:259
undoinsert
static int undoinsert
Definition: Fl_Input_.cxx:743
Fl_Input_::input_type
int input_type() const
Definition: Fl_Input_.H:424
b
long b
Definition: jpegint.h:397
Fl_Input_::linesPerPage
int linesPerPage()
Definition: Fl_Input_.cxx:1315
Fl_Input_::expand
const char * expand(const char *, char *) const
Definition: Fl_Input_.cxx:55
Fl::event_x
static int event_x()
Definition: Fl.H:598
Fl::box_dh
static int box_dh(Fl_Boxtype)
Definition: fl_boxtype.cxx:397
Fl_Input_::line_end
int line_end(int i) const
Definition: Fl_Input_.cxx:477
Fl_Widget::w
int w() const
Definition: Fl_Widget.H:294
FL_FOREGROUND_COLOR
const Fl_Color FL_FOREGROUND_COLOR
the default foreground color (0) used for labels and text
Definition: Enumerations.H:937
FL_MULTILINE_INPUT
#define FL_MULTILINE_INPUT
Definition: Fl_Input_.H:33
Fl::box_dw
static int box_dw(Fl_Boxtype)
Definition: fl_boxtype.cxx:391
fl_utf8decode
unsigned fl_utf8decode(const char *p, const char *end, int *len)
Definition: fl_utf.c:137
math.h
Fl_Window.H
FL_CURSOR_INSERT
Definition: Enumerations.H:1053
Fl_Widget::color
Fl_Color color() const
Definition: Fl_Widget.H:378
Fl::test_shortcut
static int test_shortcut(Fl_Shortcut)
Definition: fl_shortcut.cxx:54
p
static menustate * p
Definition: Fl_Menu.cxx:606
FL_WHEN_CHANGED
Do the callback only when the widget value changes.
Definition: Enumerations.H:441
Fl::box_dy
static int box_dy(Fl_Boxtype)
Definition: fl_boxtype.cxx:385
Fl_Widget::selection_color
Fl_Color selection_color() const
Definition: Fl_Widget.H:396
Fl_Input_::resize
void resize(int, int, int, int)
Definition: Fl_Input_.cxx:1294
fl_utf8.h
header for Unicode and UTF-8 character handling
FL_MOVE
Definition: Enumerations.H:335
Fl_Input_::word_end
int word_end(int i) const
Definition: Fl_Input_.cxx:441
Fl_Input_::textsize_
Fl_Fontsize textsize_
Definition: Fl_Input_.H:140
fl_draw.H
utility header to pull drawing functions together
FL_HELVETICA
const Fl_Font FL_HELVETICA
Helvetica (or Arial) normal (0)
Definition: Enumerations.H:879
FL_DOWN_BOX
see figure 1
Definition: Enumerations.H:608
fl_inactive
Fl_Color fl_inactive(Fl_Color c)
Definition: fl_color.cxx:423
Fl_Input_::up_down_pos
static double up_down_pos
Definition: Fl_Input_.H:149
Fl_Widget::active_r
int active_r() const
Definition: Fl_Widget.cxx:265
FL_FOCUS
Definition: Enumerations.H:283
fl_beep
void fl_beep(int type=FL_BEEP_DEFAULT)
Definition: fl_ask.cxx:283
Fl_Input_::position_
int position_
Definition: Fl_Input_.H:109
Fl_Input_::handle_mouse
void handle_mouse(int, int, int, int, int keepmark=0)
Definition: Fl_Input_.cxx:542
Fl_Input_::undo
int undo()
Definition: Fl_Input_.cxx:927
FL_FLOAT_INPUT
#define FL_FLOAT_INPUT
Definition: Fl_Input_.H:30
Fl_Input_::position
int position() const
Definition: Fl_Input_.H:283
undobuffer
static char * undobuffer
Definition: Fl_Input_.cxx:738
FL_PUSH
Definition: Enumerations.H:236
Fl_Input_::cursor_color
Fl_Color cursor_color() const
Definition: Fl_Input_.H:415
Fl_Input_::handletext
int handletext(int e, int, int, int, int)
Definition: Fl_Input_.cxx:999
Fl_Widget::damage
uchar damage() const
Definition: Fl_Widget.H:917
Fl_Widget::test_shortcut
int test_shortcut()
Definition: fl_shortcut.cxx:494
fl_push_clip
void fl_push_clip(int x, int y, int w, int h)
Definition: fl_draw.H:82
Fl::event_length
static int event_length()
Definition: Fl.H:799
undobufferlength
static int undobufferlength
Definition: Fl_Input_.cxx:739
Fl_Input_::textcolor_
Fl_Color textcolor_
Definition: Fl_Input_.H:143
FL_NORMAL_SIZE
Fl_Fontsize FL_NORMAL_SIZE
normal font size
Definition: Fl_Widget.cxx:117
Fl_Widget
Definition: Fl_Widget.H:101
Fl_Input_::static_value
int static_value(const char *)
Definition: Fl_Input_.cxx:1248
Fl::focus
static Fl_Widget * focus()
Definition: Fl.H:840
Fl_Input_::up_down_position
int up_down_position(int, int keepmark=0)
Definition: Fl_Input_.cxx:692
Fl_Widget::box
Fl_Boxtype box() const
Definition: Fl_Widget.H:363
Fl_Input_::~Fl_Input_
~Fl_Input_()
Definition: Fl_Input_.cxx:1306
Fl_Input_::word_start
int word_start(int i) const
Definition: Fl_Input_.cxx:461
Fl_Input_::textfont
Fl_Font textfont() const
Definition: Fl_Input_.H:386
fl_reset_spot
FL_EXPORT void fl_reset_spot(void)
Definition: Fl_win32.cxx:271
Fl_Widget::h
int h() const
Definition: Fl_Widget.H:299
Fl::event_y
static int event_y()
Definition: Fl.H:603
isword
static int isword(char c)
Definition: Fl_Input_.cxx:424
Fl::pushed
static Fl_Widget * pushed()
Definition: Fl.H:837
Fl::copy
static void copy(const char *stuff, int len, int destination, const char *type)
Definition: Fl_win32.cxx:680
yankcut
static int yankcut
Definition: Fl_Input_.cxx:744
FL_SELECTION_COLOR
const Fl_Color FL_SELECTION_COLOR
the default selection/highlight color
Definition: Enumerations.H:940
Fl::event_clicks
static int event_clicks()
Definition: Fl.H:645
Fl_Widget::set_changed
void set_changed()
Definition: Fl_Widget.H:786
fl_utf_nb_char
int fl_utf_nb_char(const unsigned char *buf, int len)
Definition: fl_utf8.cxx:167
Fl_Widget::handle
virtual int handle(int event)
Definition: Fl_Widget.cxx:112
Fl_Input_::textfont_
Fl_Font textfont_
Definition: Fl_Input_.H:137
Fl_Input_::size_
int size_
Definition: Fl_Input_.H:103
Fl_Widget::MAC_USE_ACCENTS_MENU
On the Mac OS platform, pressing and holding a key on the keyboard opens an accented-character menu w...
Definition: Fl_Widget.H:175
fl_pop_clip
void fl_pop_clip()
Definition: fl_draw.H:103
Fl_Input_::line_start
int line_start(int i) const
Definition: Fl_Input_.cxx:508
Fl_Window::cursor
void cursor(Fl_Cursor)
Definition: fl_cursor.cxx:111
Fl_Input_::Fl_Input_
Fl_Input_(int, int, int, int, const char *=0)
Definition: Fl_Input_.cxx:1125
MAXBUF
#define MAXBUF
Definition: Fl_Input_.cxx:30
FL_DAMAGE_EXPOSE
Definition: Enumerations.H:1107
Fl_Input_::xscroll_
int xscroll_
Definition: Fl_Input_.H:121
Fl_Input_::yscroll_
int yscroll_
Definition: Fl_Input_.H:121
FL_BACKGROUND2_COLOR
const Fl_Color FL_BACKGROUND2_COLOR
the default background color for text, list, and valuator widgets
Definition: Enumerations.H:938
fl_draw
void fl_draw(const char *, int, float, float)
Definition: fl_font.cxx:87
undobuffersize
static void undobuffersize(int n)
Definition: Fl_Input_.cxx:746
FL_SHORTCUT
Definition: Enumerations.H:349
strict_word_start
static int strict_word_start(const char *s, int i, int itype)
Definition: Fl_Input_.cxx:524
Fl::visible_focus
static int visible_focus()
Definition: Fl.H:1197
fl_utf8encode
int fl_utf8encode(unsigned ucs, char *buf)
Definition: fl_utf.c:309
Fl_Input_::textcolor
Fl_Color textcolor() const
Definition: Fl_Input_.H:405
f
Fl_Box_Draw_F * f
Definition: fl_boxtype.cxx:285
malloc
voidp malloc()
Fl_Input_::drawtext
void drawtext(int, int, int, int)
Definition: Fl_Input_.cxx:217
Y
static int Y
Definition: Fl_Tooltip.cxx:76
Fl_Input_::mark
int mark() const
Definition: Fl_Input_.H:287
flstring.h
Fl::compose_state
static int compose_state
Definition: Fl.H:166
Fl_Widget::SHORTCUT_LABEL
the label contains a shortcut we need to draw
Definition: Fl_Widget.H:162
Fl_Input_.H
Fl_Input_
Definition: Fl_Input_.H:94
Fl_Widget::resize
virtual void resize(int x, int y, int w, int h)
Definition: Fl_Widget.cxx:150
Fl_Input_::mu_p
int mu_p
Definition: Fl_Input_.H:125
FL_BEEP_ERROR
Error beep.
Definition: fl_ask.H:35
Fl_Input_::maybe_do_callback
void maybe_do_callback()
Definition: Fl_Input_.cxx:987
FL_RELEASE
Definition: Enumerations.H:244
Fl_Input_::copy
int copy(int clipboard)
Definition: Fl_Input_.cxx:724
fl_color_average
Fl_Color fl_color_average(Fl_Color c1, Fl_Color c2, float weight)
Definition: fl_color.cxx:402
Fl_Input_::buffer
char * buffer
Definition: Fl_Input_.H:100
l_secret
static int l_secret
Definition: Fl_Input_.cxx:36
uchar
unsigned char uchar
Definition: fl_types.h:30
undoat
static int undoat
Definition: Fl_Input_.cxx:741
FL_ENTER
Definition: Enumerations.H:253
Fl_Input_::tab_nav
int tab_nav() const
Definition: Fl_Input_.H:490
strict_word_end
static int strict_word_end(const char *s, int len, int i, int itype)
Definition: Fl_Input_.cxx:531
Fl_Input_::replace
int replace(int b, int e, const char *text, int ilen=0)
Definition: Fl_Input_.cxx:803
Fl_Input_::readonly
int readonly() const
Definition: Fl_Input_.H:433
Fl_Input_::mark_
int mark_
Definition: Fl_Input_.H:113
FL_INT_INPUT
#define FL_INT_INPUT
Definition: Fl_Input_.H:31
Fl_Input_::was_up_down
static int was_up_down
Definition: Fl_Input_.H:152
Fl_Input_::value
const char * value() const
Definition: Fl_Input_.H:244