Fl_Input.H 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //
  2. // "$Id: Fl_Input.H 7903 2010-11-28 21:06:39Z matt $"
  3. //
  4. // Input header file for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-2010 by Bill Spitzak and others.
  7. //
  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.
  12. //
  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.
  17. //
  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
  21. // USA.
  22. //
  23. // Please report all bugs and problems on the following page:
  24. //
  25. // http://www.fltk.org/str.php
  26. //
  27. /* \file
  28. Fl_Input widget . */
  29. #ifndef Fl_Input_H
  30. #define Fl_Input_H
  31. #include "Fl_Input_.H"
  32. /**
  33. This is the FLTK text input widget. It displays a single line
  34. of text and lets the user edit it. Normally it is drawn with an
  35. inset box and a white background. The text may contain any
  36. characters (even 0), and will correctly display any UTF text, using
  37. ^X notation for unprintable control characters. It assumes the
  38. font can draw any characters of the used scripts, which is true
  39. for standard fonts under MSWindows and Mac OS X.
  40. Characters can be input using the keyboard or the character palette/map.
  41. Character composition is done using using dead keys and/or a compose
  42. key as defined by the operating system.
  43. </P>
  44. <CENTER><TABLE border=1 WIDTH=90% summary="Fl_Input keyboard and mouse bindings.">
  45. <TR><TD WIDTH=200><B>Mouse button 1</B></TD><TD>Moves the cursor to
  46. this point. Drag selects characters. Double click selects words.
  47. Triple click selects all text. Shift+click extends the selection.
  48. When you select text it is automatically copied to the clipboard.
  49. </TD></TR>
  50. <TR><TD><B>Mouse button 2</B></TD><TD>Insert the clipboard at
  51. the point clicked. You can also select a region and replace it with the
  52. clipboard by selecting the region with mouse button 2.
  53. </TD></TR>
  54. <TR><TD><B>Mouse button 3</B></TD><TD>Currently acts like button 1.</TD></TR>
  55. <TR><TD><B>Backspace</B></TD><TD>Deletes one character to the left, or
  56. deletes the selected region.</TD></TR>
  57. <TR><TD><B>Enter</B></TD><TD>May cause the callback, see when().</TD></TR>
  58. <TR><TD><B>^A or Home</B></TD><TD>Go to start of line.</TD></TR>
  59. <TR><TD><B>^B or Left</B></TD><TD>Move left</TD></TR>
  60. <TR><TD><B>^C</B></TD><TD>Copy the selection to the clipboard</TD></TR>
  61. <TR><TD><B>^D or Delete</B></TD><TD>Deletes one character to the right
  62. or deletes the selected region.</TD></TR>
  63. <TR><TD><B>^E or End</B></TD><TD>Go to the end of line.</TD></TR>
  64. <TR><TD><B>^F or Right</B></TD><TD>Move right</TD></TR>
  65. <TR><TD><B>^K</B></TD><TD>Delete to the end of line (next \\n character)
  66. or deletes a single \\n character. These deletions are all concatenated
  67. into the clipboard.</TD></TR>
  68. <TR><TD><B>^N or Down</B></TD><TD>Move down (for Fl_Multiline_Input
  69. only, otherwise it moves to the next input field).</TD></TR>
  70. <TR><TD><B>^P or Up</B></TD><TD>Move up (for Fl_Multiline_Input only,
  71. otherwise it moves to the previous input field).</TD></TR>
  72. <TR><TD><B>^U</B></TD><TD>Delete everything.</TD></TR>
  73. <TR><TD><B>^V or ^Y</B></TD><TD>Paste the clipboard</TD></TR>
  74. <TR><TD><B>^X or ^W</B></TD><TD>Copy the region to the clipboard and
  75. delete it.</TD></TR>
  76. <TR><TD><B>^Z or ^_</B></TD><TD>Undo. This is a single-level undo
  77. mechanism, but all adjacent deletions and insertions are concatenated
  78. into a single "undo". Often this will undo a lot more than you
  79. expected.</TD></TR>
  80. <TR><TD><B>Shift+move</B></TD><TD>Move the cursor but also extend the
  81. selection.</TD></TR>
  82. </TABLE></CENTER>
  83. */
  84. class FL_EXPORT Fl_Input : public Fl_Input_ {
  85. int handle_key();
  86. int shift_position(int p);
  87. int shift_up_down_position(int p);
  88. void handle_mouse(int keepmark=0);
  89. protected:
  90. void draw();
  91. public:
  92. int handle(int);
  93. Fl_Input(int,int,int,int,const char * = 0);
  94. };
  95. #endif
  96. //
  97. // End of "$Id: Fl_Input.H 7903 2010-11-28 21:06:39Z matt $".
  98. //