mirror of
https://github.com/20kdc/OC-KittenOS.git
synced 2024-11-27 04:48:05 +11:00
6c0659de60
Now if only I actually finished us-perms rather than delaying.
92 lines
2.2 KiB
Plaintext
92 lines
2.2 KiB
Plaintext
The "neoux" (aka NeoUX) library is a
|
|
UI framework for KittenOS NEO, meant
|
|
to provide a consistent set of
|
|
controls and a consistent way to
|
|
navigate the UI in any given case.
|
|
|
|
Thus, it's not used by text editing
|
|
programs such as Neolithic.
|
|
|
|
To get ahold of NeoUX in your app,
|
|
use code similar to:
|
|
|
|
local event, neoux
|
|
event = require("event")(neo)
|
|
neoux = require("neoux")(event, neo)
|
|
|
|
The neo table is used for retrieving
|
|
the required accesses for APIs.
|
|
|
|
The NeoUX API is divided into three
|
|
parts - the part that connects it to
|
|
Everest & utility functions, the UI
|
|
framework's "tcwindow" root, and the
|
|
basic set of controls.
|
|
|
|
The most reliable reference on the
|
|
API a control implements is given
|
|
at the top of libs/neoux.lua, and
|
|
for updatability reasons will not
|
|
be repeated here, except with the
|
|
note that "xI"/"yI" is within-char
|
|
position from 0 to 1.
|
|
|
|
Main functions:
|
|
|
|
fileDialog(mode[, callback]):
|
|
Creates a file dialog, returning a
|
|
file wrapper (see ul-fwrap) on
|
|
success, or nil on failure.
|
|
If a callback is given, then nil is
|
|
always returned immediately, and
|
|
the callback is called when the
|
|
dialog has shown.
|
|
mode is the mode used for the file,
|
|
so see ul-fwrap for values.
|
|
|
|
neoux.create = TODO
|
|
function (w, h, title, callback)
|
|
callback(window, evt, ...)
|
|
|
|
pad: See ul-fmttx, but loaded on
|
|
demand and unloaded after use.
|
|
|
|
fmtText: See ul-fmttx, but loaded on
|
|
demand and unloaded after use.
|
|
|
|
neoux.tcwindow = TODO
|
|
function (w, h, controls, closing,
|
|
bg, fg, selIndex)
|
|
|
|
startDialog(fmt, title, wait):
|
|
Shows a text dialog.
|
|
fmt is some un-safeTextFormat'd
|
|
text for the dialog.
|
|
title can be nil, or more un-STF'd
|
|
text for the dialog title.
|
|
wait can be nil/false to not wait,
|
|
and otherwise.
|
|
|
|
UI framework controls (TODO):
|
|
|
|
neoux.tcrawview =
|
|
function (x, y, lines)
|
|
table of lines not STF'd
|
|
neoux.tchdivider =
|
|
function (x, y, w)
|
|
neoux.tcvdivider =
|
|
function (x, y, h)
|
|
neoux.tcbutton =
|
|
function (x, y, text, callback)
|
|
callback(window)
|
|
neoux.tcfield =
|
|
function (x, y, w, textprop)
|
|
textprop(newval) -> nil
|
|
textprop() -> val
|
|
|
|
-- This is released into
|
|
the public domain.
|
|
-- No warranty is provided,
|
|
implied or otherwise.
|
|
|