2
2
##########################################################################
4
4
# STFL - The Structured Terminal Forms Language/Library #
5
# Copyright (C) 2006 Clifford Wolf <clifford@clifford.at> #
5
# Copyright (C) 2006, 2007 Clifford Wolf <clifford@clifford.at> #
7
# This program is free software; you can redistribute it and/or modify #
8
# it under the terms of the GNU General Public License as published by #
9
# the Free Software Foundation; either version 2 of the License, or #
10
# (at your option) any later version. #
7
# This library is free software; you can redistribute it and/or #
8
# modify it under the terms of the GNU Lesser General Public #
9
# License as published by the Free Software Foundation; either #
10
# version 3 of the License, or (at your option) any later version. #
12
12
##########################################################################
44
44
Simply run 'make' and 'make install'. You might want to edit the Makefile.cfg
45
45
file before building and installing STFL.
47
In order to build a full-featured STFL with all scripting language bindings
48
enabled you need to have the following packages installed (including the
49
development packages):
52
The wide-character ncurses library. On some distributions
53
this might be part of the ncurses package, on other
54
distrubutions this might be an extra package.
57
STFL is using SWIG for generating the Perl, Python and Ruby
60
Perl, Python, Ruby, SPL
61
In order to create the language bindings you need to have
62
the languages themself installed.
64
Since STFL is a wide-character library it will only work on systems which
65
do have wide-character support in the system libraries. This might not be
66
the case for in older Linux distributions or other UNIXes.
48
69
The Structured Terminal Forms Language
49
70
--------------------------------------
236
257
white default background.
260
Key and Keybinding Descriptions
261
-------------------------------
263
Key descriptings are strings describing a key press event. With some
264
exceptions this are the return values of the ncurses keyname() and key_name()
265
functions. The exceptions are:
268
The return key has been pressed.
271
The space key has been pressed.
274
The tabulator key has been pressed.
277
The escape key has been pressed.
280
A function key has been pressed.
283
An unkown key has been pressed.
284
(Usually this is the result of a broken multibyte sequence)
286
A key binding description is a whitespace-seperated list of key descriptions
287
used in bind_* variables to bind keys to widget actions. Each widget provides
288
default bindings for all its actions. If you want to extend the list of bind
289
keys instead of overwriting them you must use the special key-description "**"
290
in the keybinding description to refer to the default bindings.
292
Key values can e.g. be dumped using the following little Perl script:
294
perl -mstfl -le '$_ = stfl::create("label text:\"Press a key\"")->run(0);
295
stfl::reset(); print;'
239
298
The STFL Widget Library
240
299
-----------------------
296
365
A simple input widget for one line of text input. The following variables are
297
366
supported by this widget:
368
bind_left, bind_right
369
Move the cursor left and right. Default values are the LEFT
373
Move the cursor to the first character. Default values are
374
the HOME key or Ctrl-A.
377
Move the cursor after the last character. Default values are
378
the END key or Ctrl-E.
381
Delete the character under the cursor. Default value is the
385
Delete the character before the cursor. Default value is the
300
389
The style of this widget when it does not have the
320
409
mark the begin of a new table row. The following variables are supported by
412
bind_left, bind_right, bind_up, bind_down
413
The keybindings for changing the focus within a table.
414
Default values are the UP, DOWN, LEFT and RIGHT keys.
324
417
The style for the table bordes.
368
DOCUMENTME (Not implemented yet)
373
DOCUMENTME (Not implemented yet)
378
DOCUMENTME (Not implemented yet)
383
DOCUMENTME (Not implemented yet)
388
DOCUMENTME (Not implemented yet)
456
The list widget can be used to display a list of items, one per line. The
457
items are stored as 'listitem' child widgets of the 'list' widget. When
458
there are more items then the list widget has lines the list widget is
459
automatically scrolling. The list widget implements the following variables:
462
The key bindings for scrolling up or down by line. Default
463
values are the UP and DOWN keys.
465
bind_page_up, bind_page_down
466
The key bindings for scrolling up or down by page. Default
467
values are the PAGE_UP and PAGE_DOWN keys.
470
Style of the active list item when the widget has the focus.
473
Style of the active list item when the widget has not the
477
Style of the currently not active list items.
480
The number of the current list item
483
The widget name of the current list item.
486
The numer of the list item displayed in the first line (this
487
becomes >0 when scrolling).
493
An in a list widget. Implements the following variables:
496
The text displayed in this list item.
501
A widget for displaying multiline text. The text itself is stored within
502
listitem child widgets. Implements the following variables:
505
The key bindings for scrolling up or down by line. Default
506
values are the UP and DOWN keys.
508
bind_page_up, bind_page_down
509
The key bindings for scrolling up or down by page. Default
510
values are the PAGE_UP and PAGE_DOWN keys.
513
The style the text itself is displayed.
516
The style used for the EOT-Markers.
519
The number of the first line displayed
520
(becomes >0 when scrolling).
526
There are some variables which are used by the STFL core to configure some
527
widget-independent features.
532
A widget which has the modal variable set to '1' will not pass any events
533
to its parent widgets. Eighter the event is handled by the widget itself or
534
it is returned directly to the caller of stfl_run().
539
Setting autobind to '0' disables all automatically assigned keybindings for
540
this widget. Actions which aren't set explicitely bind to keys using the
541
bind_* variables are left unbind and can't be triggered using the user
547
The on_* variables can be used to catch keypresses in this widget and return
548
the value of the on_* variable to the caller of stfl_run(). The on_* variables
549
are evaluated before the keypresses are passed to the widget. The '*' part
550
of the on_* variables is a key description. E.g. "on_^X:foobar" will let
551
stfl_run() return the string "foobar" when Ctrl-X is beeing pressed.
391
554
The Common STFL Scripting Language API
414
577
in C. All string parameters which are null-pointers are interpreted as they
415
578
where empty strings.
583
The STFL C Library handles all strings as wide character strings (wchar_t*). So
584
the STFL library itself has complete Unicode support.
586
All current scripting language bindings convert all strings passed between STFL
587
and the scripting language to UTF-8.
589
Programs using STFL directly might use the STFL "ipool" API for easy conversion
590
betweed wide characters and other encodings.
476
651
~~~~~~~~~~~~~~~~~~~~~~~
478
653
Return the next event. If no more prior generated events are waiting display
479
the form and process one input character. The following events are generated
480
directly by the STFL core:
483
The timeout has been reached.
486
The return key has been pressed.
489
The escape key has been pressed.
492
A function key has been pressed.
654
the form and process one input character. The event string can be an undefined
655
value when something chaned in the form (e.g. the user changed the focus of
656
the current widget) but all inputs have been handled internally inside of STFL.
657
The event string can be "TIMEOUT" when the timeout has been reached, a key
658
description is key has been pressed that is not beeing hadled internally in
659
STFL or the value of an on_* variable can be returned if a keypress has been
660
catched using such a variable.
494
662
The 2nd parameter is a timeout in ms. When no key has been pressed until this
495
timeout has been reached. Set this parameter to 0 to disable the timeout.
663
timeout has been reached the function returns with a "TIMEOUT" event. Set this
664
parameter to 0 to disable the timeout.
497
666
When the timeout parameter is set to -1 the form is displayed independent of
498
667
the current status of the event queue and the function returns right after
499
668
displaying the form without handling any input characters. In this mode always
500
669
an undefined value is returned.
671
When the timeout parameter is set to -2 the displayed is not updated and the
672
next pending event is returned. If there are no pending events an undefined
629
806
The default mode is "interactive".
808
WARNING: This is a planned feature! This version of STFL simply calls abort()
809
if an internal error is catched.
638
Event Handler Variables
639
-----------------------
641
DOCUMENTME (Not implemented yet)
815
When a widget has a name (declared using the 'widget[name]' syntax in the STFL
816
code), there are also some special pseudo-variables which can only be accessed
817
for reading. Note that this pseudo-variables do only have valid values after
818
the widget has been drawed already. So it is always a good idea to run
819
stfl_run() with a timeout of -1 before accessing the pseudo-variables.
824
The absolute x-position of the widget on the screen. (from the left border)
829
The absolute y-position of the widget on the screen. (from the upper border)
834
The width of the widget.
839
The height of the widget.
844
The minimal width (i.e. before expanding) of the widget.
849
The minimal height (i.e. before expanding) of the widget.
653
855
- Implement so far unimplemented widgets
654
- Common 'on*' event handler variables
655
856
- Missing error handling and reporting
656
857
- Implement stfl_lookup() function