diff --git a/FL/Fl.H b/FL/Fl.H index 8eed4224b..1bfb168f0 100644 --- a/FL/Fl.H +++ b/FL/Fl.H @@ -1,5 +1,5 @@ // -// "$Id: Fl.H,v 1.8.2.1 1999/04/17 01:02:27 bill Exp $" +// "$Id: Fl.H,v 1.8.2.2 2000/02/21 10:45:58 bill Exp $" // // Main header file for the Fast Light Tool Kit (FLTK). // @@ -57,6 +57,7 @@ public: // should be private! static FL_EXPORT Fl_Widget* selection_owner_; static FL_EXPORT Fl_Window* modal_; static FL_EXPORT Fl_Window* grab_; + static FL_EXPORT int compose_state; static void damage(int x) {damage_ = x;} @@ -87,7 +88,7 @@ public: static FL_EXPORT int ready(); static FL_EXPORT int run(); static FL_EXPORT Fl_Widget* readqueue(); - static FL_EXPORT void add_timeout(double t,void (*cb)(void*),void* = 0); + static FL_EXPORT void add_timeout(double t,void (*cb)(void*),void* v = 0); static FL_EXPORT void remove_timeout(void (*cb)(void*), void* = 0); static FL_EXPORT void add_fd(int fd, int when, void (*cb)(int,void*),void* =0); static FL_EXPORT void add_fd(int fd, void (*cb)(int, void*), void* = 0); @@ -125,6 +126,8 @@ public: static FL_EXPORT int get_key(int); static FL_EXPORT const char* event_text() {return e_text;} static FL_EXPORT int event_length() {return e_length;} + static FL_EXPORT int compose(int &del); + static FL_EXPORT void compose_reset() {compose_state = 0;} static FL_EXPORT int event_inside(int,int,int,int); static FL_EXPORT int event_inside(const Fl_Widget*); static FL_EXPORT int test_shortcut(int); @@ -205,5 +208,5 @@ public: #endif // -// End of "$Id: Fl.H,v 1.8.2.1 1999/04/17 01:02:27 bill Exp $". +// End of "$Id: Fl.H,v 1.8.2.2 2000/02/21 10:45:58 bill Exp $". // diff --git a/documentation/Fl_Input.html b/documentation/Fl_Input.html index 0c65dc962..d6af54f69 100644 --- a/documentation/Fl_Input.html +++ b/documentation/Fl_Input.html @@ -27,16 +27,23 @@ will correctly display anything, using ^X notation for unprintable control characters and \nnn notation for unprintable characters with the high bit set. It assummes the font can draw any characters in the ISO8859-1 character set. + +
| Mouse button 1 | Moves the cursor to this point. - Drag selects characters. Double click selects words. Triple click -selects all text. Shift+click extends the selection. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Mouse button 2 | Insert the current X selection at -the cursor (unlike Motif this does not move the insertion point to the -mouse). If the widget does not have the input focus (and thus no -cursor) it puts the cursor where clicked and inserts the selection -there. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Mouse button 1 | Moves the cursor to + this point. Drag selects characters. Double click selects words. + Triple click selects all text. Shift+click extends the selection. + When you select text it is automatically copied to the clipboard. + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Mouse button 2 | Insert the clipboard at +the point clicked. You can also select a region to replace with the +clipboard by selecting a region with mouse button 2. + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Mouse button 3 | Currently acts like button 1. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Backspace | Deletes one character to the left, or deletes the selected region. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Enter | May cause the callback, see when(). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ^B or Left | Move left | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ^C | Copy the selection to the clipboard | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ^D or Delete | Deletes one character to the right -or deletes the selected region. Due to silly historical X problems, -the Delete key will act like Backspace until you type a "real" -backspace. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ^E or End | Go to the end of line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ^F or Right | Move right | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ^K | Delete to the end of line (next \n character) @@ -56,11 +61,6 @@ into the clipboard. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ^P or Up | Move up (for Fl_Multiline_Input only, otherwise it moves to the previous input field). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ^Q or
- RightCtrl or - Compose | Start a compose-character - sequence. The next one or two keys typed define the character to -insert. This also can be used to "quote" control characters. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ^U | Delete everything. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ^V or ^Y | Paste the clipboard | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ^X or ^W | Copy the region to the clipboard and @@ -71,6 +71,158 @@ into a single "undo". Often this will undo a lot more than you expected. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Shift+move | Move the cursor but also extend the selection. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RightCtrl or
+ Compose |
+Start a compose-character
+sequence. The next one or two keys typed define the character to insert:
+
+
For instance, to type "á" type [compose][a]['] or [compose]['][a]. + + The character "nbsp" (non-breaking space) is typed by using +[compose][space]. + + The single-character sequences may be followed by a space if +necessary to remove ambiguity. For instance, if you really want to +type "ª~" rather than "ã" you must type [compose][a][space][~]. + + The same key may be used to "quote" control characters into the +text. If you need a ^Q character you can get one by typing +[compose][Control+Q]. + + X may have a key on the keyboard +defined as XK_Multi_key. If so this key may be used as well +as the right-hand control key. You can set this up with the program +xmodmap. + + If your keyboard is set to support a foreign language you should +also be able to type "dead key" prefix characters. On X you will +actually be able to see what dead key you typed, and if you then move +the cursor without completing the sequence the accent will remain +inserted. |
To receive FL_KEYBOARD events you must also respond to the
FL_FOCUS and FL_UNFOCUS events.
+
If you are writing a text-editing widget you may also want to call +the Fl::compose() function to translate +individual keystrokes into foreign characters. +
To insert them, type the [compose] key and then one or two -characters. The two characters can be in either order. The [compose] -key is any of: Ctrl+Q, the righthand control key, or any key your X server -calls XK_Multi_key. +
Fltk uses it's own compose processing to allow "preview" of the +partially composed sequence, which is impossible with the usual +"dead key" processing. -
| Keys | Char | - | Keys | Char | - | Keys | Char | - | Keys | Char | - | Keys | Char | - | Keys | Char - |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| space | nbsp | - | * | ° | - | A` | À | - | D- | Ð | - | a` | à | - | d- | ð - |
| ! | ¡ | - | +- | ± | - | A' | Á | - | N~ | Ñ | - | a' | á | - | n~ | ñ - |
| % | ¢ | - | 2 | ² | - | A^ | Â | - | O` | Ò | - | a^ | â | - | o` | ò - |
| # | £ | - | 3 | ³ | - | A~ | Ã | - | O' | Ó | - | a~ | ã | - | o' | ó - |
| $ | ¤ | - | ' | ´ | - | A: | Ä | - | O^ | Ô | - | a: | ä | - | o^ | ô - |
| y= | ¥ | - | u | µ | - | A* | Å | - | O~ | Õ | - | a* | å | - | o~ | õ - |
| | | ¦ | - | p | ¶ | - | AE | Æ | - | O: | Ö | - | ae | æ | - | o: | ö - |
| & | § | - | . | · | - | C, | Ç | - | x | × | - | c, | ç | - | -: | ÷ - |
| : | ¨ | - | , | ¸ | - | E` | È | - | O/ | Ø | - | e` | è | - | o/ | ø - |
| c | © | - | 1 | ¹ | - | E' | É | - | U` | Ù | - | e' | é | - | u` | ù - |
| a | ª | - | o | º | - | E^ | Ê | - | U' | Ú | - | e^ | ê | - | u' | ú - |
| << | « | - | >> | » | - | E: | Ë | - | U^ | Û | - | e: | ë | - | u^ | û - |
| ~ | ¬ | - | 14 | ¼ | - | I` | Ì | - | U: | Ü | - | i` | ì | - | u: | ü - |
| - | | - | 12 | ½ | - | I' | Í | - | Y' | Ý | - | i' | í | - | y' | ý - |
| r | ® | - | 34 | ¾ | - | I^ | Î | - | TH | Þ | - | i^ | î | - | th | þ - |
| _ | ¯ | - | ? | ¿ | - | I: | Ï | - | ss | ß | - | i: | ï | - | y: | ÿ - |
Although currently only characters in the ISO-8859-1 character set are +handled, you should call this in case any enhancements to the +processing are done in the future. The interface has been designed to +handle arbitrary UTF-8 encoded text. -
For instance, to type "á" type [compose][a]['] or [compose]['][a]. +
The character "nbsp" (non-breaking space) is typed by using -[compose][space]. +
Use of this function is very simple. Any text editing widget should +call this for each FL_KEYBOARD event. -
The single-character sequences may be followed by a space if -necessary to remove ambiguity. For instance, if you really want to -type "ª~" rather than "ã" you must type [compose][a][space][~]. +
If true is returned, then it has modified the +Fl::event_text() and Fl::event_length() to a set of bytes to +insert (it may be of zero length!). In will also set the "del" +parameter to the number of bytes to the left of the cursor to +delete, this is used to delete the results of the previous call to +Fl::compose(). -
If you wish to use the compose function in your own code, your -widget's handle() method must call fl_compose() -in response to FL_KEYPRESS events: +
If false is returned, the keys should be treated as function +keys, and del is set to zero. You could insert the text anyways, if +you don't know what else to do. -
Though the current implementation returns immediately, future +versions may take quite awhile, as they may pop up a window or do +other user-interface things to allow characters to be selected. -Starts or adds a single ASCII character to a compose sequence. This -will return the number of old bytes to delete and a set of new bytes to -insert, and a new state value. If this returns zero you can -ignore the result (which just says to insert the character unchanged) -and handle the keystroke yourself. +
state must either be the return value of the last call to -fl_compose() or zero to start a new compose sequence. Be sure to reset -to zero if the user ever moves the cursor. +
If the user moves the cursor, be sure to call Fl::compose_reset(). +The next call to Fl::compose() will start out in an initial state. In +particular it will not set "del" to non-zero. This call is very fast +so it is ok to call it many times and in many places. -
c is the ASCII character that the user typed. - -
del is set to the number of bytes to delete backwards. This -will always be less or equal to the ins from the last call to -fl_compose(), and will be zero if state is zero. - -
buffer will have the first ins bytes set to the data -to insert and display (it is not nul-terminated). - -
ins will be the number of characters to insert. - -