Version 0.8g
ClassOverview : Class
This module implements inheritance and the creation of objects from classes.
Class:checkDescend()
- Checks if an object descends from a classClass:getClass()
- Returns the class of an object, or the super class of a classClass:getClassName()
- Returns the class name of an object or classClass:getSuper()
- Returns the super class of an object or classClass.new()
- Creates and returns a new objectClass.newClass()
- Creates a child class from a super classClass:setClass()
- Changes the class of an object, or the super class of a class
is_descendant = object:checkDescend(class)
Returns true if object
is an instance of a class descending
from the specified class
. It is also possible to apply this function
to a class instead of an object, e.g.:
Class.checkDescend(Button, Area)
class = object:getClass()
This function returns the class of an object
. If applied to a
class instead of an object, it returns its super class, e.g.:
superclass = Class.getClass(class)
name = object:getClassName()
This function returns the _NAME
attribute of the object
's class. It is also possible to apply this
function to a class instead of an object.
object:getSuper()
Gets the super class of an object or class.
For example, to forward a call to a method
to its super class,
without knowing its class:
self:getSuper().method(self, ...)
object = Class.new(class[, object])
Creates and returns a new object of the given class
. Optionally,
it just prepares the specified object
(a table) for inheritance and
attaches the class
' methods and data.
class = Class.newClass(superclass[, class])
Derives a new class from the specified superclass
. Optionally,
an existing class
(a table) can be specified. If a _NAME
field
exists in this class, it will be used. Otherwise, or if a new class is
created, class._NAME
will be composed from superclass._NAME
and
an unique identifier. The same functionality can be achieved by calling
a class like a function, so the following invocations are equivalent:
class = Class.newClass(superclass) class = superclass()
The second notation allows a super class to be passed as the second
argument to Lua's module
function, which will set up a child class
inheriting from superclass
in the module table.
ClassOverview : Class / List
This class implements a list container.
List:addItem()
- Adds an item to the listList:changeItem()
- Replaces an item in the listList:clear()
- Removes all items from the listList:getItem()
- Returns the item at the specified positionList:getN()
- Returns the number of items in the listList:remItem()
- Removes an item from the list
Items
[I] (table)Table of initial list items, indexed numerically
pos = List:addItem(entry[, pos])
Adds an item to the list, optionally inserting it at the specified position. Returns the position at which the item was added.
success = List:changeItem(entry, pos)
Changes the item at the specified position in the list. Returns true if an item was changed.
entry = List:remItem(pos)
Removes an item at the specified position in the list. The item is returned to the caller.
ClassOverview : Class / Markup
This class implements a markup parser and converter for producing feature-rich XHTML 1.0 from plain text with special formattings.
parser = Markup:new(args)
Creates a new markup parser. args
can be a
table of initial arguments that constitute its behavior. Supported fields
in args
are:
indentchar
|
Character recognized for indentation, default "\t"
|
input
|
Filehandle or string, default io.stdin
|
rdfunc
|
Line reader, by default reads using args.input:lines
|
wrfunc
|
Writer func, by default io.stdout.write
|
docname
|
Name of document, default "Manual"
|
features
|
Feature codes, default "hespcadlint"
|
The parser supports the following features, which can be combined into
a string and passed to the constructor in args.features
:
Code | Description | rough HTML equivalent |
h
|
Heading |
<h1> , <h2> , ...
|
e
|
Emphasis |
<strong>
|
s
|
Separator |
<hr>
|
p
|
Preformatted block |
<pre>
|
c
|
Code |
<code>
|
a
|
Anchor, link |
<a href="...">
|
d
|
Definition |
<dfn>
|
l
|
List |
<ul> , <li>
|
i
|
Image |
<img>
|
n
|
Node header |
<a name="...">
|
t
|
Table |
<table>
|
f
|
Function | (undocumented, internal use only) |
After creation of the parser, conversion starts by calling Markup:run()
.
ClassOverview : Class / Object
This class implements notifications.
Notifications [I]
(table)Initial set of notifications. Static initialization of notifications has this form:
Notifications = { ["attribute-name1"] = { [value1] = { action1, action2, ... } [value2] = ... }, ["attribute-name2"] = ... }Refer to
Object:addNotify()
for possible placeholders and a description of the action data structure.
Object:addNotify()
- Adds a notification to an objectObject.init()
- (Re-)initializes an objectObject:remNotify()
- Removes a notification from an objectObject:setValue()
- Sets an attribute, triggering notifications
Object:addNotify(attr, val, dest[, pos])
Adds a notification to an object. attr
is the name of an attribute to
react on setting its value. val
is the value that triggers the
notification. The placeholder ui.NOTIFY_ALWAYS
can be used for
reacting on any change of the value.
dest
is a table describing the action to take when the notification
occurs; it has the general form:
{ object, method, arg1, ... }
object
denotes the target of the notification, i.e. the self
that will be passed to the method
as its first argument.
ui.NOTIFY_SELF
is a placeholder for the object causing the
notification. (See below for the additional placeholders ui.NOTIFY_ID
,
ui.NOTIFY_WINDOW
, and ui.NOTIFY_APPLICATION
). method
can be
either a string denoting the name of a function in the addressed object,
or ui.NOTIFY_FUNCTION
followed by a function value. The following
placeholders are supported in the Object class:
ui.NOTIFY_SELF
- the object causing the notificationui.NOTIFY_VALUE
- the value causing the notificationui.NOTIFY_TOGGLE
- the logical negation of the valueui.NOTIFY_OLDVALUE
- the attributes's value prior to setting itui.NOTIFY_FORMAT
- taking the next argument as a format string for formatting the valueui.NOTIFY_FUNCTION
- to pass a function in the next argument
The following additional placeholders are supported if the notification is triggered in a child of the Element class:
ui.NOTIFY_ID
- to address the Element with the Id given in the next argumentui.NOTIFY_WINDOW
- to address the Window the object is connected toui.NOTIFY_APPLICATION
- to address the Application the object is connected toui.NOTIFY_COROUTINE
- likeui.NOTIFY_FUNCTION
, but the function will be launched as a coroutine by the Application. See alsoApplication:addCoroutine()
for further details.
In any case, the method
will be invoked as follows:
method(object, arg1, ...)
The optional pos
argument allows for insertion at the specified
position in the list of notifications. By default, notifications are
added at the end, and the only reasonable value for pos
is 1
.
If the destination object or addressed method cannot be determined, nothing else besides setting the attribute will happen.
Notifications should be removed using Object:remNotify()
when they are
no longer needed, to reduce overhead and memory use.
object = Object.init(object)
This function is called during Object.new()
before passing control to superclass.new()
. By convention, new()
is used to claim resources (e.g. to create tables), whereas the init()
function is used to initialize them. Calling init()
separately from
new()
can be reasonable for reinitializing and reusing objects.
success = Object:remNotify(attr, val, dest)
Removes a notification from an object and returns true if it
was found and removed successfully. You must specify the exact set of
arguments as for Object:addNotify()
to identify a notification.
Object:setValue(key, value[, notify])
Sets an object
's key
to
the specified value
, and, if notify
is not false, triggers
notifications that were previously registered with the object. If
value
is nil, the key's present value is reset. To enforce a
notification regardless of its value, set notify
to true.
For details on registering notifications, see Object:addNotify()
.
ClassOverview : Class / UTF8String
This class supports the manipulation of UTF-8 encoded strings.
UTF8String:byte()
- Returns Unicode character codesUTF8String.char()
- Returns UTF8-encoded character sequencesUTF8String:erase()
- Removes substringUTF8String:get()
- Returns the string in UTF-8 encoded formUTF8String:insert()
- Inserts a string at a given positionUTF8String:len()
- Returns the length in charactersUTF8String:overwrite()
- Overwrites stringUTF8String:set()
- Sets a stringUTF8String:sub()
- Returns a substring of a string
UTF8String.new()
- Creates an UTF-8 string object from a string
UTF8String:byte(i[, j])
Equivalent to string.byte()
, except for that
it may return characters in the Unicode range.
UTF8String.char(...)
Equivalent to string.char()
, except for that it
accepts character codes in the Unicode range.
UTF8String:erase(i[, j])
Erases the characters at the positions from
i
to j
. The semantics for the range are the same as for
UTF8String:sub()
.
UTF8String:insert(string[, position])
Inserts the UTF-8 encoded string
at the specified position
to the string object. If position
is
absent, the string is added to the end.
string = UTF8String.new(class, string)
Creates a string object from an (already UTF-8 encoded) regular string.
UTF8String:overwrite(s[, pos])
Overwrites the string object with the specified (already UTF-8 encoded) string, starting a the given position.
substring = UTF8String:sub(i[, j])
Returns an UTF-8 encoded substring.
The semantics are the same as for string.sub()
.
This library implements an argument parser.
A string is parsed into an array of arguments according to a format template. Arguments in the template are separated by commas. Each argument in the template consists of a keyword, optionally followed by one or more aliases delimited by equal signs, and an optional set of modifiers delimited by slashes. Modifiers denote a) the expected datatype, b) if the argument is mandatory and c) whether a keyword must precede its value to form a valid argument. Example argument template:
SOURCE=-s/A/M,DEST=-d/A/KThis template would require one or more arguments to satisfy
SOURCE
, and exactly one argument to satisfyDEST
. Neither can be omitted. Either-d
orDEST
must precede a value to be accepted as the second argument. Examples:
SOURCE one two three DEST foo
valid DEST foo -s one
valid DEST foo
rejected; source argument missing one two three foo
rejected; keyword missing one two dest foo
valid, keys are case insensitive one two three -d="foo" four
valid, "four" added to SOURCE
An option without modifiers represents an optional string argument. Available modifiers are:
/S
- Switch; considered a boolean value. When the keyword is present, true will be written into the respective slot in the results array./N
- Number; the value will be converted to a number./K
- Keyword; the keyword (or an alias) must precede its value./A
- Required; This argument cannot be omitted./M
- Multiple; Any number of strings will be accepted, and all values that cannot be assigned to other arguments will show up in this argument. No more than one/M
modifier may appear in a template./F
- Fill; literal rest of line. If present, this must be the last argument.Quoting and escaping: Double quotes can be used to enclose arguments containing equal signs and spaces.
Backslashes for escaping quotes, spaces and themselves
res, msg = read(template, args)
Parses args
according to
template
. args
can be a string or a table of strings. If the
arguments can be successfully matched against the template, the result
will be a table of parsed arguments, indexed by both keywords and
numerical order in which they appear in template
, and the second
argument will be set to the number of arguments in the template. If the
arguments cannot be matched against the template, the result will be
nil followed by an error message.
Debug library - implements debug output and debug levels:
2 | TRACE | used for tracking bugs |
4 | INFO | informational messages |
5 | WARN | something unexpected happened |
10 | ERROR | something went wrong, e.g. resource unavailable |
20 | FAIL | something went wrong that can't be coped with |
The default debug level is 5 WARN
. To set the debug level
globally, e.g.:
db = require "tek.lib.debug" db.level = db.INFO
The default debug output stream is stderr
.
To override it globally, e.g.:
db = require "tek.lib.debug" db.out = io.open("logfile", "w")
debug.console()
- Enters the debug consoledebug.dump()
- Dumps a table recursivelydebug.error()
- Prints a text in theERROR
debug leveldebug.execute()
- Executes a function in the specified debug leveldebug.fail()
- Prints a text in theFAIL
debug leveldebug.info()
- Prints a text in theINFO
debug leveldebug.print()
- Prints a text in the specified debug leveldebug.stacktrace()
- Prints a stacktrace in the specified debug leveldebug.trace()
- Prints a text in theTRACE
debug leveldebug.warn()
- Prints a text in theWARN
debug level
dump(table)
Dump a table as Lua source using out
as the output
stream. Cyclic references are silently dropped.
execute(lvl, func, ...)
Executes the specified function if the global debug library is less or equal the specified level.
print(lvl, msg, ...)
Prints formatted text if the global debug level is less or equal the specified level.
stacktrace(debuglevel, stacklevel)
Prints a stacktrace starting at
the function of the given level
on the stack (excluding the
stracktrace
function itself) if the global debug level is less
or equal the specified debuglevel
.
This library implements the management of regions, which are collections of non-overlapping rectangles.
Region:andRect()
- Ands a rectangle to a regionRegion:andRegion()
- Ands a region to a regionRegion:checkOverlap()
- Checks if a rectangle intersects a regionRegion:forEach()
- Calls a function for each rectangle in a regionRegion.new()
- Creates a new RegionRegion:orRect()
- Ors a rectangle to a regionRegion:orRegion()
- Ors a region to a regionRegion.intersect()
- Returns an intersection of two rectanglesRegion:setRect()
- Resets a region to a single rectangleRegion:subRect()
- Subtracts a rectangle from a regionRegion:subRegion()
- Subtracts a region from a regionRegion:xorRect()
- Exclusive Ors a rectangle to a region region with a rectangle
success = region:checkOverlap(x0, y0, x1, y1)
Returns a boolean indicating whether a rectangle specified by its coordinates overlaps with a region.
region:forEach(func, obj, ...)
For each rectangle in a region, calls the specified function according the following scheme:
func(obj, x0, y0, x1, y1, ...)
Extra arguments are passed through to the function.
x0, y0, x1, y1 = Region.intersect(d1, d2, d3, d4, s1, s2, s3, s4)
Returns the coordinates of a rectangle where a rectangle specified by the coordinates s1, s2, s3, s4 overlaps with the rectangle specified by the coordinates d1, d2, d3, d4. The return value is nil if the rectangles do not overlap.
This is the base library of the user interface toolkit. It implements a class loader and provides a central place for various toolkit constants. To invoke the class loader, simply aquire a class from the
tek.ui
table, e.g. this will load the tek.ui.class.application class (as well as all subsequently needed classes):ui = require "tek.ui" ui.Application:new { ...
ui.createHook()
- Creates a hook objectui.destroyHook()
- Destroys a hook objectui.getStockImage()
- Gets a stock image objectui.extractKeyCode()
- Extracts a keycode from a stringui.getLocale()
- Gets a locale catalogui.loadClass()
- Loads a named classui.loadImage()
- Loads an image (possibly from an image cache)ui.loadStyleSheet()
- Loads and parse a style sheet fileui.loadTable()
- Tries to load a table from standard pathsui.resolveKeyCode()
- Converts a keycode into keys and qualifiersui.sourceTable()
- Loads a file as a Lua source, returning a tableui.testFlag()
- Tests a bit in a flags field
NOTIFY_ALWAYS
- see ObjectNOTIFY_VALUE
- see ObjectNOTIFY_TOGGLE
- see ObjectNOTIFY_FORMAT
- see ObjectNOTIFY_SELF
- see ObjectNOTIFY_OLDVALUE
- see ObjectNOTIFY_FUNCTION
- see ObjectNOTIFY_WINDOW
- see Object - defined in tek.ui.class.elementNOTIFY_APPLICATION
- see Object - defined in tek.ui.class.elementNOTIFY_ID
- see Object - defined in tek.ui.class.elementNOTIFY_COROUTINE
- see Object - defined in tek.ui.class.elementHUGE
- use this value to express a "huge" spatial extentNULLOFFS
- table{ 0, 0, 0, 0 }
(read-only)MSG_CLOSE
- Input message type: Window closedMSG_FOCUS
- Window activated/deactivatedMSG_NEWSIZE
- Window resizedMSG_REFRESH
- Window needs (partial) refreshMSG_MOUSEOVER
- Mouse pointer entered/left windowMSG_KEYDOWN
- Key pressed downMSG_MOUSEMOVE
- Mouse pointer movedMSG_MOUSEBUTTON
- Mousebutton pressed/releasedMSG_INTERVAL
- Timer interval message (default: 50Hz)MSG_KEYUP
- Key releasedMSG_USER
- User message
hookobject = createHook(domain, classname, parent[, object])
Loads a
class of the given domain
and classname
, instantiates it
(optionally passing it object
for initialization), connects it to
the specified parent
element, and initializes it using its
setup()
method. If name
is the pre-defined name "none"
,
this function returns false. Refer also to loadClass()
for
further details.
false = destroyHook([hookobject])
Destroys a hook object by invoking its
cleanup()
and disconnect()
methods. Always returns false.
extractKeyCode(string[, shortcutmark])
Extract a shortcut character from a string. The default shortcut marker is an underscore.
catalog = getLocale(appid[, vendordomain[, deflang[, language]]])
Returns
a table of locale strings for the given application Id and vendor domain.
deflang
(default: "en") is used as the default language code if a
catalog for the requested language is unavailable. If no language
code is specified, then the preferred language will be obtained from the
operating system or desktop environment. If no catalog file was found
or otherwise non-existent keys are used to access the resulting catalog,
the key will be mirrored with underscores turned into spaces; for
example, if catalog
contained no string for the given key, accessing
catalog.HELLO_WORLD
would return the string "HELLO WORLD".
imgobject = getStockImage(name, ...)
Creates an image of a named class,
corresponding to classes found in tek/ui/image
. Additional arguments
are passed to imageclass:new()
.
class = loadClass(domain, classname)
Loads a class of the specified domain
and the given classname
.
Returns the loaded class or false if the class or domain name is
unknown or if an error was detected in the module. Possible values for
domain
, as currently defined, are:
- "class" - user interface element classes
- "border" - border classes
- "layout" - classes used for layouting a group
- "hook" - drawing hooks
- "image" - images
imgobject = loadImage(name)
Loads an image from a file or retrieves it from the image cache. Note that currently only the PPM file format is recognized.
properties, msg = loadStyleSheet(name)
This function loads a style sheet
and parses it into a table of style classes with properties. If
parsing failed, the return value is false and msg
contains
an error message.
table, msg = loadTable(fname)
This function tries to load a file from
the various possible locations as defined by ui.LocalPath
, to
interprete is as Lua source, and to return its contents as keys and
values of a table. If unsuccessful, returns nil followed by an
error message.
key, quals = resolveKeyCode(code)
Resolves a combined keycode specifier
(e.g. "Ctrl+Shift+Q"
) into a key string and a table of qualifier codes.
table, msg = sourceTable(file[, environment])
Interprete a file as a Lua
source, containing the keys and values forming a table. If file
is a
string, it will be used for opening and reading the named file, otherwise
it will be assumed to be an open file handle. Either way, the file will
be read using the file:read("*a")
method and closed afterwards.
By default, the source will be executed in an empty environment, unless
an environment is specified. The resulting table is returned to the
caller, or nil followed by an error message.
ClassOverview : Class / Family / Application
This class implements the framework's entrypoint and main loop.
ApplicationId [IG]
(string)Name of the application, normally used as an unique identifier in combination with the
Domain
attribute. Default is"unknown"
.Author [IG]
(string)Names of the application's authors. Default:
"unknown"
Copyright [IG]
(string)Copyright notice applying to the application, default
"unknown"
Display [IG]
(Display)An initial Display. By default, the application creates a new one during
Application.new()
.Domain [IG]
(string)An uniquely identifying domain name of the vendor, organization or author manufacturing the application (preferrably without domain parts like
"www."
if they are insignificant for identification). Default is"unknown"
.GCControl [IG]
(boolean or string)The application can perform a garbage collection of the specified type immediately before going to sleep waiting for input. If set to false, no garbage collection is initiated explicitely. If the value is true, the application performs a single garbage collection step. Other values (e.g.
"collect"
) are passed unmodified tocollectgarbage()
. Default: trueProgramName [IG]
(string)Name of the application, as displayed to the user. This is also the fallback for the
Title
attribute in windows. If unset, the default will be"unknown"
.Status [G]
(string) (string)Status of the application, can be
"init"
,"error"
,"run"
,"quit"
.Theme [IG]
(string)Name of a theme, which usually maps to an equally named style sheet file (with the extension ".css") under
tek/ui/style/
. Themes with reserved meaning are:
"internal"
: Uses the hardcoded internal style properties and does not try to load a style sheet file."desktop"
: Tries to import the desktop's color scheme, besides trying to load a style sheet named"desktop.css"
.Default:
"desktop"
Vendor [IG]
(string)Name of the vendor or organization responsible for producing the application, as displayed to the user. Default
"unknown"
.
The
Domain
andApplicationId
attributes are UTF-8 encoded strings, so any international character sequence is valid for them. Anyhow, it is recommended to avoid too adventurous symbolism, as its end up in a hardly decipherable, UTF-8 plus URL-encoded form in the file system, e.g. for loading catalog files fromtek/ui/locale/<domain>/<applicationid>
.
Application:addCoroutine()
- Adds a coroutine to the applicationApplication:addInputHandler()
- Adds input handler to the applicationApplication:connect()
- Connects children recursivelyApplication:easyRequest()
- Opens a message boxApplication:getById()
- Returns an element by IdApplication:getChildren()
- Returns the application's childrenApplication:getGroup()
- Returns the application's groupApplication:getLocale()
- Returns a locale for the applicationApplication:quit()
- Quits the applicationApplication:remInputHandler()
- Removes a registered input handlerApplication:requestFile()
- Opens a file requesterApplication:run()
- Runs the applicationApplication:suspend()
- Suspends the caller's coroutine
addCoroutine(function, arg1, ...)
Adds the specified function and arguments to the application as a new coroutine, and returns to the caller. The new coroutine is not started immediately, but scheduled for later execution during the application's update procedure. This gives the application an opportunity to service all pending messages and updates before the coroutine is actually started.
addInputHandler(msgtype, object, func)
Adds an object
and
function
to the application's chain of handlers for input of
the specified type. Currently, the only message type an appliction is
able to react on is ui.MSG_USER
. All other message types are specific
to a Window. Input handlers are invoked as follows:
message = function(object, message)
The handler is expected to return the message, which will in turn pass
it on to the next handler in the chain.
See also Window:addInputHandler()
for more information.
connect(parent)
Checks member linkage and connects all children by
invoking their connect() methods. Note that
unlike Element:connect()
, this function is recursive.
selected = easyRequest(title, text, buttontext1[, ...])
This function shows a message box or requester. title
will be
displayed as the window title; if this argument is false, the
application's ProgramName
will be used for the title. text
(which may contain line breaks) will be used as the requester's body.
Buttons are ordered from left to right. The first button has the number 1.
If the window is closed using the Escape key or close button, the return
value will be false
. Note: The caller of this function must be
running in a coroutine (see Application:addCoroutine()
).
element = getById(id)
Returns the element that was registered with the
Application under its unique id
. Returns nil if the id was not
found.
getLocale([deflang[, language]])
Returns a table of locale strings for
ApplicationId
and Domain
. See ui.getLocale()
for more information.
remInputHandler(msgtype, object, func)
Removes an input handler that was
previously registered with Application:addInputHandler()
.
status[, path, selection] = requestFile(args)
Requests a single or multiple files or directories. Possible keys in
the args
table are:
Center
- Boolean, whether requester should be opened centeredHeight
- Height of the requester windowLister
- External lister object to operate onLocation
- Initial contents of the requester's location fieldPath
- The initial pathSelectMode
-"multi"
or"single"
[default"single"
]SelectText
- Text to show on the select button [default"open"
]Title
- Window title [default"Select file or directory..."
]Width
- Width of the requester window
The first return value is a string reading either "selected"
or
"cancelled"
. If the status is "selected"
, the second return value
is the path where the requester was left, and the third value is a table
of the items that were selected.
Note: The caller of this function must be running in a coroutine
(see Application:addCoroutine()
).
success, status = run()
Runs the application. Returns when all child
windows are closed or when the application's Status
is set to "quit".
suspend([window])
Suspends the caller (which must be running
in a coroutine) until it is getting rescheduled by the application.
Coroutines can use this as a cooperation point, which gives the
application an opportunity to service all pending messages and updates.
If no argument is given, the application returns to the caller as quickly
as possible. If an optional window
is specified, the coroutine is put
to sleep until something happens in the application, or an interval timer
event is present at the window (i.e. the suspended coroutine is
rescheduled after no longer than 1/50th of a second).
ClassOverview : Class / Object / Element / Area
This is the base class of all visible user interface elements. It implements an outer margin, layouting, drawing, and the relationships to its neighbours.
AutoPosition [IG]
(boolean)When the element receives the focus, this flag instructs it to position itself automatically into the visible area of any Canvas that may contain it. An affected Canvas must have its
AutoPosition
attribute enabled as well for this option to take effect, but unlike the Area class, the Canvas disables it by default.BGColor [IG]
(color specification)A color specification for painting the background of the element. Valid are predefined color numbers (e.g.
ui.PEN_DETAIL
), predefined color names (e.g."detail"
, see also Display for more), or a direct hexadecimal RGB specification (e.g."#334455"
,"#f0f"
. This attribute is controllable via thebackground-color
style property.BGPosition [IG]
(boolean or string)Kind of anchoring for a possible background image or texture:
"scollable"
or false - The texture is anchored to the element and during scrolling moves with it."fixed"
- The texture is anchored to the Window.Note that repainting elements with
"fixed"
anchoring can be expensive. This variant should be used sparingly, and some classes may implement it incompletely or incorrectly. This attribute can be controlled using thebackground-position
attribute.DamageRegion [G]
(Region)see
TrackDamage
Disabled [ISG]
(boolean)If true, the element is in disabled state. This attribute is handled by the Gadget class.
EraseBG [IG]
(boolean)If true, the element's background is painted automatically using the
Area:erase()
method. Set this attribute to false to indicate that you wish to paint the background yourself.Focus [SG]
(boolean)If true, the element has the input focus. This attribute is handled by the Gadget class. Note: The
Focus
attribute cannot be initialized; see also the InitialFocus attribute.HAlign [IG]
("left"
,"center"
,"right"
)Horizontal alignment of the element in its group. This attribute can be controlled using the
horizontal-grid-align
attribute.Height [IG]
(number, false,"auto"
,"fill"
,"free"
)Height of the element, in pixels, or
- false - unspecified; during initialization, the class' default will be used
"auto"
- Reserves the minimal height needed for the element."free"
- Allows the element's height to grow to any size."fill"
- Completely fills up the height that other elements in the same group have left, but does not claim more. This value is useful only once per group.This attribute can be controlled using the
height
style property.Hilite [SG]
(boolean)If true, the element is in highlighted state. This attribute is handled by the Gadget class.
Margin [IG]
(table)An array of four offsets for the element's outer margin in the order left, right, top, bottom [pixels]. If unspecified during initialization, the class' default margins are used. This attribute is controllable via the
margin
style property.MaxHeight [IG]
(number)Maximum height of the element, in pixels [default:
ui.HUGE
]. This attribute is controllable via themax-height
style property.MaxWidth [IG]
(number)Maximum width of the element, in pixels [default:
ui.HUGE
]. This attribute is controllable via themax-width
style property.MinHeight [IG]
(number)Minimum height of the element, in pixels [default: 0]. This attribute is controllable via the
min-height
style property.MinWidth [IG]
(number)Minimum width of the element, in pixels [default: 0]. This attribute is controllable via the
min-width
style property.Padding [IG]
(table)An array of four offsets for the element's inner padding in the order left, right, top, bottom [pixels]. If unspecified during initialization, the class' default paddings are used. This attribute is controllable via the
padding
style property.Selected [ISG]
(boolean)If true, the element is in selected state. This attribute is handled by the Gadget class.
TrackDamage [IG]
(boolean)If true, the element collects intra-area damages in a Region named
DamageRegion
, which can be used by class writers to implement minimally invasive repaints. Default: false, the element is repainted in its entirety.VAlign [IG]
("top"
,"center"
,"bottom"
)Vertical alignment of the element in its group. This attribute can be controlled using the
vertical-grid-align
attribute.Weight [IG]
(number)Determines the weight that is attributed to the element relative to its siblings in its group. Note: By recommendation, the weights in a group should sum up to 0x10000.
Width [IG]
(number, false,"auto"
,"fill"
,"free"
)Width of the element, in pixels, or
- false - unspecified; during initialization, the class' default will be used
"auto"
- Reserves the minimal width needed for the element"free"
- Allows the element's width to grow to any size"fill"
- Completely fills up the width that other elements in the same group have left, but does not claim more.Note: Normally, "fill" is useful only once per group.
background-color |
controls the Area.BGColor attribute
|
background-position |
controls the Area.BGPosition attribute
|
height |
controls the Area.Height attribute
|
horizontal-grid-align |
controls the Area.HAlign attribute
|
margin |
controls the Area.Margin attribute
|
margin-bottom |
controls the Area.Margin attribute
|
margin-left |
controls the Area.Margin attribute
|
margin-right |
controls the Area.Margin attribute
|
margin-top |
controls the Area.Margin attribute
|
max-height |
controls the Area.MaxHeight attribute
|
max-width |
controls the Area.MaxWidth attribute
|
min-height |
controls the Area.MinHeight attribute
|
min-width |
controls the Area.MinWidth attribute
|
padding |
controls the Area.Padding attribute
|
padding-bottom |
controls the Area.Padding attribute
|
padding-left |
controls the Area.Padding attribute
|
padding-right |
controls the Area.Padding attribute
|
padding-top |
controls the Area.Padding attribute
|
vertical-grid-align |
controls the Area.VAlign attribute
|
width |
controls the Area.Width attribute
|
Area:askMinMax()
- Queries element's minimum and maximum dimensionsArea:checkFocus()
- Checks if the element can receive the input focusArea:checkHover()
- Checks if the element can be hovered overArea:damage()
- Notifies the element of a damageArea:draw()
- Paints the elementArea:erase()
- Erases the element's backgroundArea:focusRect()
- Make the element fully visibleArea:getBG()
- Gets the element's background propertiesArea:getBGElement()
- Gets the element's background elementArea:getChildren()
- Gets the element's childrenArea:getByXY()
- Checks if the element covers a coordinateArea:getGroup()
- Gets the element's groupArea:getNext()
- Gets the element's successor in its groupArea:getParent()
- Gets the element's parent elementArea:getPrev()
- Gets the element's predecessor in its groupArea:getRect()
- Returns the element's layouted coordinatesArea:getSiblings()
- Gets the element's siblingsArea:hide()
- Disconnects the element from a DrawableArea:layout()
- Layouts the element into a rectangleArea:passMsg()
- Passes an input message to the elementArea:punch()
- Subtracts the outline of the element from a RegionArea:refresh()
- Repaints the element if necessaryArea:relayout()
- Relayouts the element if necessaryArea:rethinkLayout()
- Causes a relayout of the element and its groupArea:setState()
- Sets the background attribute of an elementArea:show()
- Connects the element to a Drawable
minw, minh, maxw, maxh = askMinMax(minw, minh, maxw, maxh)
This
method is called during the layouting process for adding the required
spatial extents (width and height) of this object to the min/max values
passed from a child class, before passing them on to its super class.
minw
, minh
are cumulative of the minimal size of the element,
while maxw
, maxw
collect the size the element is allowed to
expand to. Use ui.HUGE
to indicate a (practically) unlimited size.
can_hover = checkHover()
Returns true if this element can react on being hovered over by the pointing device.
damage(x0, y0, x1, y1)
If the element overlaps with the given rectangle, this function marks it as damaged.
draw()
Draws the element into the rectangle assigned to it by
the layouter; the coordinates can be found in the element's Rect
table. Note: Applications are not allowed to call this function directly.
focusRect([x0, y0, x1, y1])
Tries to shift any Canvas containing the element into a position that makes the element fully visible. Optionally, a rectangle can be specified that is to be made visible.
bgpen[, tx, ty] = getBG()
Gets the element's background properties.
bgpen
is the background pen (which may be a texture). If the element
background is scrollable, then tx
and ty
are the coordinates of
the texture origin, otherwise (if the background is fixed) nil.
element = getBGElement()
Returns the element that is responsible for painting the surroundings (or the background) of the element. This information is useful for painting transparent or translucent parts of the element, e.g. an inactive focus border.
element = getChildren(init)
Returns a table containing the element's
children, or nil if this element cannot have children. If the
optional init
argument is true, this signals that this function
is called during initialization or deinitialization.
element = getGroup(parent)
Returns the element's closest
Group containing it. If the parent
argument
is true, this function will start looking for the closest group at
its parent (otherwise it returns itself if it is a group already). Returns
nil if the element is not currently connected.
element = getNext()
Returns the next element in the group, or, if the element has no successor, the next element in the parent group (and so forth, until it reaches the topmost group). Returns nil if the element is not currently connected.
element = getPrev()
Returns the previous element in the group, or, if the element has no predecessor, the next element in the parent group (and so forth, until it reaches the topmost group). Returns nil if the element is not currently connected.
x0, y0, x1, y1 = getRect()
This function returns the rectangle which the element has been layouted to, or false if the element has not been layouted yet.
element = getSiblings()
Returns a table containing the element's siblings (including the element itself). Returns nil if the element is not currently connected. Note: The returned table must be treated read-only.
hide()
Clears a drawable from an element. Override this method to free
all display-related resources previously allocated in Area:show()
.
changed = layout(x0, y0, x1, y1[, markdamage])
Layouts the element
into the specified rectangle. If the element's (or any of its childrens')
coordinates change, returns true and marks the element as damaged,
unless the optional argument markdamage
is set to false.
msg = passMsg(msg)
This function filters the specified input message. After processing, it is free to return the message unmodified (thus passing it on to the next message handler), to return a copy that has certain fields in the message modified, or to 'swallow' the message by returning false. If you override this function, you are not allowed to modify any data inside the original message; to alter a message, you must operate on and return a copy.
punch(region)
Subtracts the element from (punching a hole into) the specified Region. This function is called by the layouter.
refresh()
Redraws the element (and all possible children) if they are marked as damaged. This function is called in the Window's update procedure.
found[, changed] = relayout(element, x0, y0, x1, y1)
Traverses the element tree searching for the specified element, and if this class (or the class of one of its children) is responsible for it, layouts it to the specified rectangle. Returns true if the element was found and its layout updated. A secondary return value of true indicates whether relayouting actually caused a change, i.e. a damage to the object.
rethinkLayout([damage])
This method causes a relayout of the element and
possibly the Group in which it resides (and even
parent groups thereof if necessary). The optional numeric argument
damage
indicates the kind of damage to apply to the element:
0
- do not mark the element as damaged1
- slate the group (not its contents) for repaint [default]2
- mark the whole group and its contents as damaged
setState(bg)
Sets the BGPen
attribute according to
the state of the element, and if it changed, slates the element
for repainting.
show(drawable)
This function passes an element the Drawable that it will be rendered to. This function is called when the element's window is opened.
The Button class implements a Text element with a button mode (behavior) and button class (appearance). In addition to that, it enables the initialization of a possible keyboard shortcut from a special initiatory character (by default an underscore) preceding a letter in the element's
Text
attribute.
This class adds redundancy, because it differs from the Text class only in that it specifies a few attributes differently in its
new()
method. To avoid this overhead, use the Text class directly, or create a Button factory like this:function newButton(text) return ui.Text:new { Mode = "button", Class = "button", Text = text, KeyCode = true } end
This class implements a scrollable area acting as a managing container for a child element. Currently, this class is used exclusively for child objects of the ScrollGroup class.
AutoPosition [IG]
(boolean)See Area
AutoHeight [IG]
(boolean)The height of the canvas is automatically adapted to the height of the region it is layouted into. Default: false
AutoWidth [IG]
(boolean)The width of the canvas is automatically adapted to the width of the canvas it is layouted into. Default: false
CanvasHeight [ISG]
(number)The height of the canvas in pixels
CanvasLeft [ISG]
(number)Left visible offset of the canvas in pixels
CanvasTop [ISG]
(number)Top visible offset of the canvas in pixels
CanvasWidth [ISG]
(number)The width of the canvas in pixels
Child [ISG]
(object)The child element being managed by the Canvas
KeepMinHeight [IG]
(boolean)Report the minimum height of the Canvas's child object as the Canvas' minimum display height
KeepMinWidth [IG]
(boolean)Report the minimum width of the Canvas's child object as the Canvas' minimum display width
UnusedRegion [G]
(Region)Region of the Canvas which is not covered by its
Child
UseChildBG [IG]
(boolean)If true, the Canvas borrows its background properties from its child for rendering its
UnusedRegion
. If false, the Canvas' own background properties are used. Default: trueVScrollStep [IG]
(number)Vertical scroll step, used e.g. for mouse wheels
Canvas:checkArea()
- Gets the canvas shift [internal]Canvas:damageChild()
- Damage a child object where it is visibleCanvas:onSetChild()
- Handler called whenChild
is setCanvas:updateUnusedRegion()
- Update region not covered by Child
Area:askMinMax()
Element:cleanup()
Element:connect()
Area:damage()
Element:decodeProperties()
Element:disconnect()
Area:draw()
Area:focusRect()
Area:getBG()
Area:getBGElement()
Area:getChildren()
Area:getByXY()
Area:hide()
Object.init()
Area:layout()
Area:passMsg()
Area:refresh()
Area:relayout()
Element:setup()
Area:show()
sx, sy = checkArea(x, y)
Checks if x, y
are inside the element's
rectangle, and if so, returns the canvas shift by x and y [internal]
damageChild(r1, r2, r3, r4)
Damages the specified region in the child area where it overlaps with the visible part of the canvas.
updateUnusedRegion()
Updates the UnusedRegion
attribute, which
contains the Canvas' area which isn't covered by its Child
.
Specialization of the Text class, implementing a toggle button with a graphical check mark.
This class implements a directory lister.
Kind [IG]
(string)The visual appearance (or purpose) of the lister, which will determine the presence and arrangement of some interface elements:
"requester"
- for a standalone file requester"lister"
- for a directory lister component"simple"
- for the use without accompanying elementsThe default kind is
"lister"
.Location [IG]
(string)The currently selected entry (may be a file or directory)
Path [IG]
(string)Directory in the file system
Selection [G]
(table)An array of selected entries
SelectMode [IG]
(String)Selection mode:
"single"
- allows selections of one entry at a time"multi"
- allows selections of multiple entriesSelectText [IG]
(String)The text to display on the selection button. Default:
"Open"
(or its equivalent in the current locale)Status [G]
(string)Status of the directory lister:
"running"
- the lister is currently being shown"selected"
- the user has selected one or more entries"cancelled"
- the lister has been cancelled by the user
DirList:abortScan()
- Aborts scanningDirList:getCurrentDir()
- Gets the current directoryDirList:getDirIterator()
- Gets an iterator over a directoryDirList:getFileStat()
- Examines a file entryDirList:goParent()
- Goes to the parent of the current directoryDirList:onSelectEntry()
- Handler invoked on selection of an entryDirList:showDirectory()
- Reads and shows a directoryDirList:scanEntry()
- Scans a single entry in a directoryDirList:showDirectory()
- Starts scanning and displays a directoryDirList:splitPath()
- Splits a filename
abortScan()
This function aborts the coroutine which is currently scanning the directory. The caller of this function must be running in its own coroutine.
cdir = getCurrentDir()
Returns the current directory. You can override this function to implement your own filesystem semantics.
iterator = getDirIterator(directory)
Returns an iterator function for
traversal of the entries in the given directory
. You can override this
function to get an iterator over arbitrary kinds of listings.
attr = getFileStat(path, name, attr[, idx])
Returns an attribute for the
entry of the given path
and name
; see the documentation of the
LuaFileSystem module for the attribute names and their meanings.
Currently, only the "mode"
and "size"
attributes are requested,
but if you override this function, it would be smart to implement as many
attributes as possible. idx
is optional and specifies the entry number
inside the list, which is an information that may or may not be supplied
by the calling function.
onSelectEntry(lnr, name, type)
This handler is called when an item in the
list was selected by the user. It is passed the line number, name
and
type
of the entry (which can be "file"
or "directory"
).
table, type = scanEntry(path, name, idx)
Scans a single entry
name
in a directory named path
. idx
is the entry number
with which this scanned entry will appear in the directory listing.
table
is an array of strings, containing entries like name, size,
date, permissions, modification date etc. The type
return value
corresponds to the return values of DirList:getFileStat()
.
path, part = splitPath(path)
Splits a path, returning a path and the rearmost path or file part. You can override this function to implement your own file system naming conventions.
ClassOverview : Class / Object / Display
This class manages a display.
AspectX [IG]
(number)
- X component of the display's aspect ratio
AspectY [IG]
(number)
- Y component of the display's aspect ratio
Display:closeFont()
- Closes fontDisplay:colorToRGB()
- Converts a symbolic color name to RGBDisplay.createPixMap()
- Creates a pixmap from picture file dataDisplay:getFontAttrs()
- Gets font attributesDisplay:getPaletteEntry()
- Gets an entry from the symbolic paletteDisplay.getPixmap()
- Gets a a pixmap from the cacheDisplay:getTime()
- Gets system timeDisplay.loadPixmap()
- Loads a pixmap from the file systemDisplay:openFont()
- Opens a named fontDisplay:openVisual()
- Opens a visualDisplay:sleep()
- Sleeps for a period of time
font
font-fixed
font-huge
font-large
font-menu
font-small
rgb-active
rgb-active-detail
rgb-background
rgb-border-focus
rgb-border-legend
rgb-border-rim
rgb-border-shadow
rgb-border-shine
rgb-cursor
rgb-cursor-detail
rgb-dark
rgb-detail
rgb-disabled
rgb-disabled-detail
rgb-disabled-detail2
rgb-fill
rgb-focus
rgb-focus-detail
rgb-group
rgb-half-shadow
rgb-half-shine
rgb-hover
rgb-hover-detail
rgb-list
rgb-list-active
rgb-list-active-detail
rgb-list-detail
rgb-list2
rgb-menu
rgb-menu-active
rgb-menu-active-detail
rgb-menu-detail
rgb-outline
rgb-shadow
rgb-shine
rgb-user1
rgb-user2
rgb-user3
rgb-user4
r, g, b = colorToRGB(colspec[, defcolspec])
Converts a color
specification to RGB. If colspec
is not a valid color, the optional
defcolspec
can be used as a fallback. Valid color specifications are
#rrggbb
(each color component is noted in 8 bit hexadecimal) and
#rgb
(each color component is noted in 4 bit hexadecimal).
image, width, height, transparency = Display.createPixmap(picture)
Creates a pixmap object from data in a picture file format. Currently only the PPM file format is recognized.
h, up, ut = getFontAttrs(font)
Returns the font attributes height, underline position and underline thickness.
name, r, g, b = getPaletteEntry(index)
Gets the name
and red, green,
blue components of a color of the given index
in the Display's
symbolic color palette.
image, width, height, transparency = Display.getPixmap(fname)
Gets a pixmap object, either by loading it from the filesystem or by retrieving it from the cache.
image, width, height, transparency = Display.loadPixmap(filename)
Creates a pixmap object from an image file in the file system. Currently only the PPM file format is recognized.
ClassOverview : Class / Object / Drawable
This class implements a graphical context that can be painted on.
Drawable:copyArea()
- Copies a rectangular areaDrawable:drawLine()
- Draws a lineDrawable:drawPoint()
- Draws a pointDrawable:drawRect()
- Draws an unfilled rectangleDrawable:drawText()
- Draws textDrawable:fillRect()
- Draws a filled rectangleDrawable:getMsg()
- Gets the next pending input messageDrawable:getShift()
- Gets the current coordinate displacementDrawable:getTextSize()
- Determines the width and height of textDrawable:popClipRect()
- Pops the topmost cliprect from the drawableDrawable:pushClipRect()
- Pushes a new cliprect on the drawableDrawable:setFont()
- Sets a fontDrawable:setShift()
- Adds a coordinate displacement
Drawable:copyArea(x0, y0, x1, y1, deltax, deltay, exposures)
Copy the
specified rectangle to the position determined by the relative
coordinates deltax
and deltay
. The exposures
argument is a
table for collecting the raw coordinates of rectangles getting
exposed as a result of the copy operation.
Drawable:drawText(x0, y0, text, fgpen[, bgpen])
Renders text with the specified foreground pen. If the optional background pen is specified, the background under the text is filled in this color.
msg = Drawable:getMsg([msg])
Gets the next pending message from the Drawable. Optionally, the fields of the new message are inserted into the specified table.
width, height = Drawable:getTextSize(text)
Determines the width and height of a text using the font which is currently set on the Drawable.
Drawable:pushClipRect(x0, y0, x1, y1)
Pushes a new cliprect on the top of the drawable's stack of cliprects.
ClassOverview : Class / Object / Element
This class implements the connection to a global environment and the registration by Id.
ATTRIBUTES:
Application [G]
(Application)The Application the element is registered with. This attribute is set during
Element:setup()
.Class [IG]
(string)The name of the element's style class, which can be referenced in a style sheet. Multiple classes can be specified by separating them with spaces, e.g.
"button knob warn"
Id [IG]
(string)An unique Id identifying the element. If present, this Id will be registered with the Application during
Element:setup()
.Parent [G]
(object)Parent object of the element. This attribute is set during
Element:connect()
.Style [IG]
(string)Direct style formattings of the element, overriding class-wide formattings in a style sheet. Example:
"background-color: #880000; color: #ffff00"Window [G]
(Window)The Window the element is registered with. This attribute is set during
Element:setup()
.
Element:cleanup()
- Unlinks the element from its environmentElement:connect()
- Connects the element to a parent elementElement:disconnect()
- Disconnects the element from its parentElement:getAttr()
- Gets an attribute from an elementElement:getById()
- Get Id of any registered elementElement:getNumProperty()
- Retrieves a numerical style propertyElement:getProperties()
- Retrieves an element's style propertiesElement:getProperty()
- Retrieves a single style propertyElement:setup()
- Links the element to its environment
success = Element:connect(parent)
Attempts to connect the element to the
parent
element; returns a boolean indicating whether the connection
succeeded.
ret1, ... = Element:getAttr(attribute, ...)
This function gets a named
attribute
from an element, and returns nil if it is unknown.
This mechanism can be used by classes for exchanging data without having
to add a getter method in their common base class (which may not be under
the author's control).
Element:getById(id)
Gets the element with the specified id
, that was
previously registered with the Application.
This function is a shortcut for Application:getById()
, applied to
self.Application
.
value = Element:getNumProperty(properties, pseudoclass, attribute)
Gets a
property and converts it to a number value. See also Element:getProperty()
.
Element:getProperties(properties, pseudoclass)
This function is called
after connecting the element, for retrieving style properties from a
style sheet or from decoding the element's Style
attribute
(direct formatting). It can be invoked multiple times with different
properties
and pseudo classes.
When overriding this function, among the reasonable things to do is to
query properties using the Element:getProperty()
function, passing it the
properties
and pseudoclass
arguments. First recurse into your
super class with the pseudo classes your class defines (if any), and
finally pass the call to your super class with the pseudoclass
you
received.
value = Element:getProperty(properties, pseudoclass, attribute)
Returns
the value of a style attribute
from the specified properties
table, or false if the attribute is undefined. pseudoclass
can
be the name of a pseudo class, false if no pseudo class is used, or
true for looking up the attribute
in the properties
table
directly (rather than in a sub table determined by the element's class -
this is used for direct formattings).
Element:setup(app, window)
This function is used to pass the element the environment determined by an Application and a Window.
ClassOverview : Class / Object / Family
This class implements a container for child objects.
Children [IG]
(table)Array of child objects
Family:addMember()
- Adds an element to a FamilyFamily:remMember()
- Removed an element from a Family
success = addMember(child[, pos])
Invokes the child
's
connect() method to check for its ability to
integrate into the family, and if successful, inserts it into the
Family's list of children. Optionally, the child is inserted into the
list at the specified position.
success = remMember(child)
Looks up child
in the family's list of
children, and if it can be found, invokes its
disconnect() method and removes it from the list.
ClassOverview : Class / Object / Element / Area / FloatText
Implements a scrollable text display. An object of this class is normally the immediate
Child
of a Canvas.
FGColor [IG]
(userdata)Pen for rendering the text. This attribute is controllable via the
color
style property.Font [IG]
(string)Font specifier; see Text for a format description. This attribute is controllable via the
font
style property.Preformatted [IG]
(boolean)Boolean, indicating that the text is already formatted and should not be reformatted to fit the element's width.
Text [ISG]]
(string)The text to be displayed
FloatText:appendLine()
- Append a line of textFloatText:onSetText()
- Handler called whenText
is changed
color
- controls theFloatText.FGColor
attributefont
- controls theFloatText.Font
attribute
appendLine(text[, movetail])
Append a line of text; if the
optional boolean movetail
is true, the visible area of the
element is moved towards the end of the text.
ClassOverview : Class / Object / Element / Area / Frame
This class implements an element's borders. The default border class handles up to three sub borders:
- The main border is the innermost of the three sub borders. It is used to render the primary border style, which can be inset, outset, ridge, groove, or solid. This border has priority over the other two.
- The rim border separates the two other borders and may give the composition a more contrastful appearance. This border has the lowest priority.
- The focus border (in addition to the element's focus highlighting style) can be used to visualize that the element is currently receiving the input. This border is designed as the outermost of the three sub borders. When the element is in unfocused state, this border often appears in the same color as the surrounding group, which makes it indistinguishable from the background.
Border classes (which are organized as plug-ins) do not need to implement all sub borders; in fact, these properties are all internally handled by the default border class, and more (and other) sub borders and properties may be defined and implemented in the future (or in other border classes). As the Frame class has no notion of sub borders, their respective widths are subtracted from the Element's total border width, leaving only the remaining width for the main border.
Border [IG]
(table)An array of four widths (in pixels) for the element's border, in the order left, right, top, bottom. This attribute is controllable via the border-width style property.
BorderClass [IG]
(table)Name of the border class used to implement this element's border. Border classes are loaded from
tek.ui.border
. This attribute is controllable via the border-class style property. Default:"default"
BorderRegion [G]
(Region)Region object holding the outline of the element's border
Legend [IG]
(string)Border legend text
border-bottom-color | controls the default border class |
border-bottom-width |
controls Frame.Border
|
border-class |
controls Frame.BorderClass
|
border-color | controls the default border class |
border-focus-color | controls the default border class |
border-focus-width | controls the default border class |
border-left-color | controls the default border class |
border-left-width |
controls Frame.Border
|
border-legend-font | controls the default border class |
border-right-color | controls the default border class |
border-right-width |
controls Frame.Border
|
border-rim-color | controls the default border class |
border-rim-width | controls the default border class |
border-style | controls the default border class |
border-top-color | controls the default border class |
border-top-width |
controls Frame.Border
|
border-width |
controls Frame.Border
|
Frame:drawBorder()
- Draws the element's borderFrame:getBorder()
- Queries the element's border
border = Frame:getBorder()
Returns an element's border widths in the order left, top, right, bottom.
This class implements interactions with the user.
Active [SG]
(boolean)Signifies a change of the Gadget's activation state. While active, the position of the pointing device is being verified (which is also reflected by the
Hover
attribute, see below). When theActive
state changes, the Gadget's behavior depends on itsMode
attribute (see below):
- in button mode, the
Selected
attribute is set to the value of theHover
attribute. ThePressed
attribute is set to the value of theActive
attribute, if it caused a change of theSelected
state.- in toggle mode, the
Selected
attribute of the Gadget is inverted logically, and thePressed
attribute is set to true.- in touch mode, the
Selected
andPressed
attributes are set to true, if the Gadget was not selected already.Changing this attribute invokes the
Gadget:onActivate()
method.DblClick [SG]
(boolean)Signifies that the element was double-clicked; it is set to true when the element was double-clicked and is still being held, and false when it was double-clicked and then released. This attribute normally needs to get a notification handler attached to it before it can be reacted on; see also
Object:addNotify()
.Disabled [ISG]
(boolean)Determines the Gadget's ability to interact with the user. When changed, it invokes the
Gadget:onDisable()
method. When an element is getting disabled, it loses its focus, too.EffectClass [IG]
(string)Name of a hook class for rendering an overlay effect. This attribute is controllable via the effect-class style property. A possible overlay effect is named ripple. As its name suggests, it can paint various ripple effects (e.g. for slider knobs and bar handles). Effect hooks are loaded from
tek.ui.hook
and may define their own style properties.FGColor [IG]
(color specification)A color specification for rendering the foreground details of the element. This attribute is controllable via the color style property.
Hilite [SG]
(boolean)Signifies a change of the Gadget's highligting state. Invokes
Gadget:onHilite()
.Hold [SG]
(boolean)Signifies that the element is being held. While being held, the value is repeatedly set to true in intervals of
n/50
seconds, withn
being determined by the Window.HoldTickRepeat attribute. When the element is getting released, this value is set to false. This attribute normally needs to get a notification handler attached to it before it can be reacted on; see alsoObject:addNotify()
.Hover [SG]
(boolean)Signifies a change of the Gadget being hovered by the pointing device. Invokes
Gadget:onHover()
.InitialFocus [IG]
(boolean)Specifies that the element should receive the focus initially. If true, the element will set the element's
Focus
attribute to true upon invocation of the show method.KeyCode [IG]
(string or boolean)If set, a keyboard equivalent for activating the element. See PopItem for a discussion of denoting keyboard qualifiers. The Text class allows setting this attribute to true, in which case the element's
Text
will be examined during setup for an initiatory character (by default an underscore), and if found, theKeyCode
attribute will be replaced by the character following this marker.Mode [IG]
(string)The element's interaction mode:
"inert"
: The element does not react to input"touch"
: The element does not rebound and keeps itsSelected
state; it cannot be unselected by the user and always submits true for thePressed
andSelected
attributes."toggle"
: The element does not rebound immediately and keeps itsSelected
state until the next activation."button"
: The element rebounds when the mouse button is released or when it is no longer hovering it.See also the
Active
attribute.Pressed [SG]
(boolean)Signifies that a button was pressed or released. Invokes
Gadget:onPress()
.Selected [ISG]
(boolean)Signifies a change of the Gadget's selection state. Invokes
Gadget:onSelect()
.
color |
controls the Gadget.FGColor attribute
|
effect-class |
controls the Gadget.EffectClass attribute
|
effect-color | controls the ripple effect hook |
effect-color2 | controls the ripple effect hook |
effect-kind | controls the ripple effect hook |
effect-maxnum | controls the ripple effect hook |
effect-maxnum2 | controls the ripple effect hook |
effect-orientation | controls the ripple effect hook |
effect-padding | controls the ripple effect hook |
effect-ratio | controls the ripple effect hook |
effect-ratio2 | controls the ripple effect hook |
active | for elements in active state |
disabled | for elements in disabled state |
focus | for elements that have the focus |
hover | for elements that are being hovered by the mouse |
Gadget:onActivate()
- Handler forActive
Gadget:onDisable()
- Handler forDisabled
Gadget:onFocus()
- Handler forFocus
Gadget:onHilite()
- Handler forHilite
Gadget:onHover()
- Handler forHover
Gadget:onPress()
- Handler forPressed
Gadget:onSelect()
- Handler forSelected
Gadget:onFocus(focused)
This method is invoked when the element's
Focus
attribute has changed (see also Area).
This class implements a gauge for the visualization of numerical values.
This class implements a container for child elements and various layouting options.
Children [IG]
(table)A table of the object's children
Columns [IG]
(number)Grid width, in number of elements [Default: 1, not a grid]
FreeRegion [G]
(Region)Region inside the group that is not covered by child elements
Orientation [IG]
(string)Orientation of the group; can be
- "horizontal" - The elements are layouted horizontally
- "vertical" - The elements are layouted vertically
Default: "horizontal"
Rows [IG]
(number)Grid height, in number of elements. [Default: 1, not a grid]
SameSize [IG]
(boolean/string)true indicates that the same width and height should be reserved for all elements in the group;
"width"
and"height"
specify that only the same width or height should be reserved, respectively. Default: false
Group:addMember()
- SeeFamily:addMember()
Group:remMember()
- SeeFamily:remMember()
Implements a handle that can be dragged on the axis of the Group's orientation. It reassigns Weights to its flanking elements.
This class implements a scrollable list or table. Each item in the list is a table consisting of the following elements:
{ { "column1", "column2", ... }, userdata, selected, ... }Description:
entry[1]
is a table containing the text of each column;entry[2]
is a userdata field which can be used at will;entry[3]
is a boolean indicating that the line is selected.The following fields are reserved for internal use by the ListGadget; you should never rely on their contents or modify them.
AlignColumn [IG]
(number)A column number to align the right edge of the list to. [Default: unspecified]
AlignElement [IG]
(Object)The object determining the right edge of the list, which is an information needed for the
AlignColumn
attribute. By default, the ListGadget's parentCanvas
is used, but by use of this attribute it is possible to align the ListGadget to something else.BGAlt [IG]
(userdata)A colored pen for painting the background of alternating lines
ColumnPadding [IG]
(number)The padding between columns, in pixels. By default, the ListGadget's
Font
is used to determine a reasonable offset.CursorBorderClass [IG]
(string)Name of the border class used to implement this element's cursor border. Default: "default"
CursorLine [ISG]
(number)The line number of the ListGadget's cursor; this value may be
0
, in which case the cursor is invisible. Changing this value will invoke theListGadget:onSetCursor()
method.Font [IG]
(string)Font specifier for determining the font used for list entries. See Text for details on its format.
HeaderGroup [IG]
(Group)A group of elements used for the table header. The ListGadget may take these elements into account for determining the initial column widths.
ListObject [IG]
(List)The List object the ListGadget operates on; if none is specified, the ListGadget creates an empty one.
NumSelectedLines [G]
(number)The number of lines currently selected.
SelectedLines [G]
(table)This attribute is a (sparse) table containing the numbers of selected lines in the list. Use
pairs()
to iterate it. See alsoListGadget:getSelectedLines()
for retrieving a numerically indexed list.SelectedLine [ISG]
(number)The ListGadget's current selected line; this value reflects only the line that was most recently selected or unselected - for locating all currently selected lines, you will also need the
SelectedLines
attribute. Setting this value will invoke theListGadget:onSelectLine()
method.SelectMode [IG]
(string)The ListGadget's selection mode, which can be
"none"
,"single"
, or"multi"
.
ListGadget:addItem()
- Adds an item to the listListGadget:changeItem()
- Overwrite item in the listListGadget:changeSelection()
- Changes selection of the listListGadget:clear()
- Removes all items from the listListGadget:damageLine()
- Marks line for repaintingListGadget:getItem()
- Returns the item at the specified lineListGadget:getN()
- Returns the number of entries in the listListGadget:getSelectedLines()
- Returns a table of selected entriesListGadget:onSelectLine()
- Handler invoked forSelectedLine
ListGadget:onSetCursor()
- Handler invoked forCursorLine
ListGadget:repaint()
- Relayouts and repaints the listListGadget:remItem()
- Removes an item from the listListGadget:setList()
- Sets a new list object
background-color2
addItem(item[, line[, quick]])
Adds an item to the list. If
line
is unspecified, the entry is added at the end of the list. The
boolean quick
indicates that the list should not be relayouted and
repainted. (For relayouting and repainting the list after mass addition,
see also ListGadget:repaint()
.)
changeItem(item, line[, quick])
Overwrites the item
at the
specified line
in the list. The boolean quick
indicates that
the list should not be relayouted and repainted. For relayouting and
repainting the list after mass changes, see also ListGadget:repaint()
.
changeSelection(mode)
Changes the selection of the entire list; modes supported are:
- "none": marks all lines as unselected
getSelectedLines([mode])
Returns a table of all selected entries, sorted by (by default) their line number. Currently defined modes are "ascending" or "descending". Default: "ascending"
remItem(line[, quick])
Removes the item from the list at the
specified line. The boolean quick
indicates that the list should not
be relayouted and repainted. (For relayouting and repainting the list
after mass removal, see also ListGadget:repaint()
.)
This class implements a Group containing a ScrollGroup and optionally a group of column headers; its main purpose is to automate the somewhat complicated setup of multi-column lists with headers, but it can be used for single-column lists and lists without column headers as well.
Headers [I]
(table)An array of strings containing the captions of column headers. [Default: unspecified]
HSliderMode [I]
(string)This attribute is passed on the ScrollGroup - see there.
VSliderMode [I]
(string)This attribute is passed on the ScrollGroup - see there.
ClassOverview : Class / Object / Element / Area / Frame / Gadget / Text / PopItem / MenuItem
This class implements basic, recursive items for window and popup menus with a typical menu look; in particular, it displays the PopItem's
Shortcut
string and an arrow to indicate the presence of a sub menu.
This class implements the management of numerical values. Without further specialization it has hardly any real-life use and may be considered an abstract class. See also Gauge and Slider for some of its child classes.
Default [IG]
(number)The default for
Value
, which can be revoked using theNumeric:reset()
method.Max [ISG]
(number)Maximum acceptable
Value
. Setting this value invokes theNumeric:onSetMax()
method.Min [ISG]
(number)Minimum acceptable
Value
. Setting this value invokes theNumeric:onSetMin()
method.Step [ISG]
(number)Default step value [Default: 1]
Value [ISG]
(number)The current value represented by this class. Setting this value causes the
Numeric:onSetValue()
method to be invoked.
Numeric:decrease()
- DecreasesValue
Numeric:increase()
- IncreasesValue
Numeric:onSetMax()
- Handler for theMax
attributeNumeric:onSetMin()
- Handler for theMin
attributeNumeric:onSetValue()
- Handler for theValue
attributeNumeric:reset()
- ResetsValue
to theDefault
value
decrease([delta])
Decrease Value
by the specified delta
.
If delta
is omitted, the Step
attribute is used in its place.
increase([delta])
Increase Value
by the specified delta
.
If delta
is omitted, the Step
attribute is used in its place.
Implements a group whose children are layouted in individual pages.
PageCaptions [IG]
(table)An array of strings containing captions for each page in the group. If false, no page captions will be displayed. [Default: false]
PageNumber [ISG]
(number)Number of the page that is initially selected. [Default: 1] Setting this attribute invokes the
PageGroup:onSetPageNumber()
method.
PageGroup:disablePage()
- Enables a PagePageGroup:onSetPageNumber()
- Handler forPageNumber
disablePage(pagenum, onoff)
This function allows to disable or re-enable
a page button identified by pagenum
.
This class provides an anchorage for popups. This also works recursively, i.e. elements of the PopItem class may contain other PopItems as their children. The most notable child class of the PopItem is the MenuItem.
Children [I]
(table)Array of child objects - will be connected to the application while the popup is open.
Shortcut [IG]
(string)Keyboard shortcut for the object; unlike Gadget.KeyCode, this shortcut is also enabled while the object is invisible. By convention, only combinations with a qualifier should be used here, e.g.
"Alt+C"
,"Shift+Ctrl+Q"
. Qualifiers are separated by"+"
and must precede the key. Valid qualifiers are:
"Alt"
,"LAlt"
,"RAlt"
"Shift"
,"LShift"
,"RShift"
"Ctrl"
,"LCtrl"
,"RCtrl"
"IgnoreCase"
Alias names for keys are
"F1"
..."F12"
(function keys),"Left"
,"Right"
,"Up"
,"Down"
(cursor keys)"BckSpc"
,"Tab"
,"Esc"
,"Insert"
,"Overwrite"
,"PageUp"
,"PageDown"
,"Pos1"
,"End"
,"Print"
,"Scroll"
, and"Pause"
}}.
This class is a specialization of a PopItem allowing the user to choose an item from a list.
ListObject [IG]
(List)List object
SelectedLine [ISG]
(number)Number of the selected entry, or 0 if none is selected. Changing this attribute invokes the
PopList:onSelectLine()
method.
PopList:onSelectLine()
- Handler for theSelectedLine
attributePopList:setList()
- Sets a new list object
ClassOverview : Class / Object / Element / Area / Frame / Gadget / Group / Window / PopupWindow
This class specializes a Window for the use by a PopItem.
ClassOverview : Class / Object / Element / Area / Frame / Gadget / Text / CheckMark / RadioButton
Specialization of a CheckMark to implement mutually exclusive 'radio buttons'; they really make sense only if more than one of their kind are grouped together.
Implements a group containing a Slider and arrow buttons.
Integer [IG]
(boolean)If true, integer steps are enforced. By default, the slider moves continuously.
Max [ISG]
(number)The maximum value the slider can accept. Setting this value invokes the
ScrollBar:onSetMax()
method.Min [ISG]
(number)The minimum value the slider can accept. Setting this value invokes the
ScrollBar:onSetMin()
method.Orientation [IG]
(string)The orientation of the scrollbar, which can be "horizontal" or "vertical"
Range [ISG]
(number)The range of the slider, i.e. the size it represents. Setting this value invokes the
ScrollBar:onSetRange()
method.Value [ISG]
(number)The value of the slider. Setting this value invokes the
ScrollBar:onSetValue()
method.
ScrollBar:onSetMax()
- Handler for theMax
attributeScrollBar:onSetMin()
- Handler for theMin
attributeScrollBar:onSetRange()
- Handler for theRange
attributeScrollBar:onSetValue()
- Handler for theValue
attribute
onSetMax(max)
This handler is invoked when the ScrollBar's Max
attribute has changed. See also Numeric:onSetMax()
.
onSetMin(min)
This handler is invoked when the ScrollBar's Min
attribute has changed. See also Numeric:onSetMin()
.
onSetRange(range)
This handler is invoked when the ScrollBar's Range
attribute has changed. See also Slider:onSetRange()
.
onSetValue(val)
This handler is invoked when the ScrollBar's Value
attribute has changed. See also Numeric:onSetValue()
.
This class implements a group containing a scrollable container and accompanying elements such as horizontal and vertical ScrollBars.
Child [IG]
(Canvas)Specifies the Canvas which encapsulates the scrollable area and children.
HSliderMode [IG]
(string)Specifies when the horizontal ScrollBar should be visible:
"on"
- The horizontal scrollbar is displayed"off"
- The horizontal scrollbar is not displayed"auto"
- The horizontal scrollbar is displayed when the ListGadget is wider than the currently visible area.Note: The use of the
"auto"
mode is currently (v8.0) discouraged.VSliderMode [IG]
(string)Specifies when the vertical ScrollBar should be visible:
"on"
- The vertical scrollbar is displayed"off"
- The vertical scrollbar is not displayed"auto"
- The vertical scrollbar is displayed when the ListGadget is taller than the currently visible area.Note: The use of the
"auto"
mode is currently (v8.0) discouraged.
This class implements a slider for adjusting a numerical value.
AutoFocus [IG]
(boolean)If true and the slider is receiving the focus, it reacts on keyboard shortcuts instantly; otherwise, it must be selected first (and deselected afterwards). Default: false
Child [IG]
(Gadget)A Gadget object for being used as the slider's knob. By default, a knob gadget of the style class
"knob"
is created internally.Integer [IG]
(boolean)If true, integer steps are enforced. By default, the slider knob moves continuously.
Kind [IG]
(string)Kind of the slider:
"scrollbar"
- for scrollbars. Sets the additional style class"knob-scrollbar"
."number"
- for adjusting numbers. Sets the additional style class"knob-number"
.Default: false, the kind is unspecified.
Orientation [IG]
(string)Orientation of the slider, which can be
"horizontal"
or"vertical"
. Default:"horizontal"
Range [ISG]
(number)The size of the slider, i.e. the range that it represents. Setting this value invokes the
Slider:onSetRange()
method.
This class implements a separator that helps to arrange elements in a group.
This class implements gadgets with text.
Font [IG]
(string)A font specification in the form
"[fontname1,fontname2,...][:][size]"Font names, if specified, will be probed in the order of their occurence in the string; the first font that can be opened will be used. For the font names, the following placeholders with predefined meanings are supported:
- ui-fixed - The default fixed font
- ui-main or an empty string - The default main font, e.g. for buttons and menus
- ui-small - The default small font, e.g. for group captions
- ui-large - The default 'large' font
- ui-huge - The default 'huge' font
If no font name is specified, the main font will be used. The size specification (in pixels) is optional as well; if absent, the respective font's default size will be used.
KeepMinHeight [IG]
(boolean)After the initial size calculation, keep the minimal height of the element and do not rethink the layout in response to a possible new minimal height (e.g. resulting from a newly set text).
KeepMinWidth [IG]
(boolean)After the initial size calculation, keep the minimal width of the element and do not rethink the layout in response to a possible new minimal width (e.g. resulting from a newly set text).
Text [ISG]
(string)The text that will be displayed on the element; it may span multiple lines (see also
Text:makeTextRecords()
). Setting this attribute invokes theText:onSetText()
method.TextHAlign [IG]
("left"
,"center"
,"right"
)The text's horizontal alignment, which will be used in
Text:makeTextRecords()
. If unspecified at initialization, the class' default will be used.TextVAlign [IG]
("top"
,"center"
,"bottom"
)The text's vertical alignment, which will be used in
Text:makeTextRecords()
. If unspecified during initialization, the class' default will be used.
color2 | Secondary color for rendering text in disabled state |
font |
Controls the Text.Font attribute
|
text-align |
Controls the Text.TextHAlign attribute
|
vertical-align |
Controls the Text.TextVAlign attribute
|
Text:getTextSize()
- Gets the total extents of text recordsText:makeTextRecords()
- Breaks text into multiple line recordsText:onSetText()
- Handler for changes of theText
attribute
width, height = getTextSize([textrecord])
This function calculates the total space occupied by the object's text records. Optionally, the user can pass a table of text records which are to be evaluated.
makeTextRecords(text)
This function parses a string and breaks it along the encountered newline characters into single-line records. Each record has the form
{ [1]=text, [2]=font, [3]=align-horizontal, [4]=align-vertical, [5]=margin-left, [6]=margin-right, [7]=margin-top, [8]=margin-bottom, [9]=font-height, [10]=text-width }
More undocumented fields may follow at higher indices. font
is taken
from opening the font specified in the object's Font
attribute,
which also determines font-height
and is used for calculating the
text-width
(in pixels). The alignment parameters are taken from the
object's TextHAlign
and TextVAlign
attributes, respectively.
This class implements a gadget for entering and editing text.
Enter [SG]
(string)The text that is being entered (by pressing the Return key) into the input field. Setting this value causes the invocation of the
TextInput:onEnter()
method.EnterNext [IG]
(boolean)Indicates that by pressing the Return key, the focus should advance to the next element that can receive input.
TabEnter [IG]
(boolean)Indicates that leaving the element by pressing the Tab key should set the
Enter
attribute and invoke the respective handler.
cursor-background-color
cursor-color
TextInput:addChar()
- Perform character additionTextInput:backSpace()
- Perform 'Backspace' functionTextInput:delChar()
- Perform 'Del' functionTextInput:getChar()
- Get character under cursor or at positionTextInput:getCursor()
- Get cursor positionTextInput:moveCursorLeft()
- Move the cursor one step to the leftTextInput:moveCursorRight()
- Move the cursor one step to the rightTextInput:onEnter()
- Handler invoked whenEnter
ist setTextInput:setCursor()
- Set cursor position
onEnter(text)
This method is called when the Enter
attribute is
set. It can be overridden for reacting on entering text by pressing
the return key. This method also sets the Text
attribute (see
Text).
self:setCursor(pos)
Set absolute cursor position. If pos
is
"eol"
, the cursor is positioned to the end of the string.
ClassOverview : Class / Theme
Theme.getStyleSheet()
- Gets a style sheet for a named theme
stylesheet = Theme.getStyleSheet([themename])
Returns a style sheet for a named theme. Theme names currently defined are:
"empty"
- returns an empty style sheet"internal"
- the hardcoded internal style sheet"desktop"
- The "desktop" external style sheet (or hardcoded internal style sheet if a desktop style sheet file is unavailable), overlaying the user's desktop colors (if that is possible)
Any other theme name will cause this function to try to load an equally
named style sheet, falling back to the hardcoded internal style sheet if
unavailable. The default for themename
is "default"
.
Center [IG]
(boolean)Instructs the Window to open centered.
DblClickJitter [IG]
(number)Maximum sum of squared pixel deltas (dx² + dy²) between mouse positions to be tolerated for a double click. The default is 70. Large touchscreens require a much larger value.
DblClickTimeout [IG]
(number)Maximum number of microseconds between events to be recognized as a double click. Default: 32000. Use a larger value for touchscreens.
FullScreen [IG]
(boolean)Instructs the Window to open borderless and in fullscreen mode.
HideOnEscape [IG]
(boolean)Instructs the window to invoke the
Window:onHide()
method when the Escape key is pressed. Default: falseLeft [IG]
(number)The window's left offset on the display, in pixels
Modal [IG]
(boolean)Instructs all other windows to reject input while this window is open.
MouseX [G]
(number)MouseY [G]
(number)The current window coordinates of the pointing device.
Status [ISG]
(string)Status of the Window, which can be:
"initializing"
- The window is initializing"hide"
- The window is hidden or about to hide; if you initialize the Window with this value, it will be created in hidden state."opening"
- The window is about to open."show"
- The window is shown."closing"
- The Window is about to hide.Changing this attribute invokes the
Window:onChangeStatus()
method.Title [IG]
(string)The window's title
Top [IG]
(number)The window's top offset on the display, in pixels
Window:addInputHandler()
- Adds an input handler to the windowWindow:addInterval()
- Adds an interval timer to the windowWindow:checkDblClickTime()
- Checks a time for a doubleclick eventWindow:clickElement()
- Simulates a click on an elementWindow:onChangeStatus()
- Handler forStatus
Window:onHide()
- Handler for when the window is about to be closedWindow:postMsg()
- Post an user message in the Window's message queueWindow:remInputHandler()
- Removes an input handler from the windowWindow:remInterval()
- Removes an interval timer from the windowWindow:setActiveElement()
- Sets the window's active elementWindow:setDblClickElement()
- Sets the window's doubleclick elementWindow:setFocusElement()
- Sets the window's focused elementWindow:setHiliteElement()
- Sets the window's hover elementWindow:setMovingElement()
- Sets the window's moving element
addInputHandler(msgtype, object, function)
Adds an object
and
a function
to the window's chain of handlers for input of the
specified type. Multiple input types can be handled by one handler by
logically or'ing message types. Input handlers are invoked as follows:
message = function(object, message)
The handler is expected to return the message, which will in turn pass it on to the next handler in the window's chain.
addInterval()
Adds an interval timer to the window, which will
furtheron generate MSG_INTERVAL messages 50 times per second. These
messages cause a considerable load to the application, therefore each call
to this function should be paired with an matching call to
Window:remInterval()
, which will cause the interval timer to stop when
no clients are needing it anymore.
dblclick = checkDblClickTime(as, au, bs, bu)
Check if the two
given times (first a, second b) are within the doubleclick interval.
Each time is specified in seconds (s
) and microseconds (u
).
Returns true if the two times are indicative of a double click.
clickElement(element)
This function performs a simulated click on
the specified element
; if element
is a string, it will be looked up
using Application:getById()
. This function is actually a shorthand
for Window:setHiliteElement()
, followed by Window:setActiveElement()
twice
(first to enable, then to disable it).
onHide()
This handler is invoked when the window's close button
is clicked (or the Escape key is pressed and the HideOnEscape
flag
is set). The standard behavior is to hide the window by setting the
Status
field to "hide"
. When the last window is closed, the
application is closed down.
remInputHandler(msgtype, object, func)
Removes an input handler
that was previously registered with the window using
Window:addInputHandler()
.
remInterval()
Decreases the use counter for interval messages and
stops sending interval messages to the window when called by the last
client that has previously requested an interval timer using
Window:addInterval()
.
setActiveElement(element)
Sets/unsets the element which is
currently active (or 'in use'). If element
is nil, the currently
active element will be deactivated.
setDblClickElement(element)
Sets/unsets the element which is
candidate for double click detection. If the element is set twice in a
sufficiently short period of time and the pointing device did not move
too much since the first event, the double click is triggered by
notifying the DblClick
attribute in the element. See also
Gadget for further information.
ClassOverview : Class / Layout
Implements a Groups's standard layouting strategy. It is designed as a plug-in so that it can be replaced easily and on a per-Group-basis
Layout:layout()
- Layouts the groupLayout:askMinMax()
- Queries the group's minimum and maximum dimensions
minw, minh, maxw, maxh = askMinMax(group, minw, minh, maxw, maxh)
This function queries the specified Group for its size requirements, which will subsequently invoke child:askMinMax() on all of its children.
layout(group, x0, y0, x1, y1[, markdamage])
Layouts the Group into the specified
rectangle and calculates the sizes and positions of all of its
children. The optional boolean markdamage
is passed to subsequent
invocations of child:layout(). This function will
also call the punch() method on each child for
subtracting their new outlines from the group's FreeRegion
.
Document generated on Mon Jun 15 23:18:29 2009