From b583a643deeaf0a21dac5ee5a2ae0f84f9648dad Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Mon, 21 Feb 2000 10:45:59 +0000 Subject: Forgot to commit the header files and fixed documentation! git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1008 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl.H | 9 +- documentation/Fl_Input.html | 184 +++++++++++++++++++++++++++++++++++---- documentation/events.html | 203 +++++++++----------------------------------- 3 files changed, 215 insertions(+), 181 deletions(-) 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. + +

- - + + + + + + @@ -44,9 +51,7 @@ deletes the selected region. +or deletes the selected region. only, otherwise it moves to the next input field). - + +
Mouse button 1Moves the cursor to this point. - Drag selects characters. Double click selects words. Triple click -selects all text. Shift+click extends the selection.
Mouse button 2Insert 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 1Moves 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 2Insert 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 3Currently acts like button 1.
BackspaceDeletes one character to the left, or deletes the selected region.
EnterMay cause the callback, see when().
^B or LeftMove left
^CCopy the selection to the clipboard
^D or DeleteDeletes 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 EndGo to the end of line.
^F or RightMove right
^KDelete to the end of line (next \n character) @@ -56,11 +61,6 @@ into the clipboard.
^P or UpMove 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.
^UDelete everything.
^V or ^YPaste the clipboard
^X or ^WCopy 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+moveMove 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: + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeysCharKeysCharKeysCharKeysCharKeysCharKeysChar
spacenbsp*°`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õ +
|¦pAEÆ: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ÿ +
+ +

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.

Methods

diff --git a/documentation/events.html b/documentation/events.html index 88ec9b9f3..502be762f 100644 --- a/documentation/events.html +++ b/documentation/events.html @@ -80,6 +80,10 @@ event.

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. +

FL_SHORTCUT

If the Fl::focus() widget is zero or ignores an FL_KEYBOARD event then FLTK tries sending this @@ -102,7 +106,8 @@ active_r() to check this). This widget is now active, due to activate() being called on it or one of its parents.

FL_HIDE

- This widget is no longer visible, due to +href=Fl_Widget.html#Fl_Widget.show> show() being called on it or one of its parents, or due to a parent window being restored. Child Fl_Windows respond to this by actually creating the window if not done already, so if you @@ -128,7 +133,8 @@ Fl::event_length(). The Fl::selection_owner() will get this event before the selection is moved to another widget. This indicates that some other widget or program has claimed the -selection. +selection. Motif programs used this to clear the selection +indication. Most modern programs ignore this.

Fl::event_*() methods

FLTK keeps the information about the most recent event in static storage. This information is good until the next event is processed. @@ -181,172 +187,45 @@ to leaf widgets. These procedures control those leaf widgets:

FLTK Compose-Character Sequences

-The Fl_Input widget lets you type all the -characters in the standard ISO-8859-1 character set. Most fonts will -display these characters correctly. - -

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. - -

- - - - - - - - - - - - - - - - - -
KeysChar - KeysChar - KeysChar - KeysChar - KeysChar - KeysChar -
spacenbsp - *° - 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:ÿ -
-
- -

For instance, to type "á" type [compose][a]['] or [compose]['][a]. - -

The character "nbsp" (non-breaking space) is typed by using -[compose][space]. +The foreign-letter compose processing done by the Fl_Input widget is provided in +a function that you can call if you are writing your own text editor +widget. -

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][~]. +

Fltk uses it's own compose processing to allow "preview" of the +partially composed sequence, which is impossible with the usual +"dead key" processing. -

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: +

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. -

int fl_compose(int state, char c, int &del, char *buffer, int &ins)

+

int Fl::compose(int& del)

-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. +

Use of this function is very simple. Any text editing widget should +call this for each FL_KEYBOARD event. -

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 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(). -

c is the ASCII character that the user typed. +

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. -

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. +

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. -

buffer will have the first ins bytes set to the data -to insert and display (it is not nul-terminated). +

int Fl::compose_reset()

-

ins will be the number of characters to insert. +

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. - + -- cgit v1.2.3