Mobile interface toolkit (Mint for short) is a successor to libdialog, which provides many common features for graphical applications.
I intend to port all core programs to this library. Brief description of features:
1) Shared appearance settings (themes)
2) Stock of standard icons
3) New and restyled dialogs
4) Event loops
5) Easily implemented fancy menus
So, details about library
1) It is themeable
I learned that to look good on different phones programs need to use different fonts and icon sizes. Well, now this is configurable! Mint provides convenient access to the global settings program can use. Currently there are only 4 settings, others can be added on demand. These settings are:
* dialog font
* dialog icon size
* list icon size
* icon theme
To change this settings you can edit /cfg/mintprefs or better install graphical tool
mintconfig.
You may have noticed that most of these settings are devoted to icons. Which brings us to the second feature:
2) Icon themes
libmint provides a pool of standard icons which you can use in your programs. Currently there are 66 of them. Well, since phones may be limited on memory and storage there are NO icons by default. To get real icons you need to install one or more icon themes. The package archive currently contains one icon theme in three sizes. While installing them be aware of sizes (RMS file system may be very short of space, you've been warned). These are the packages:
icons-oxygen-16 (~40 kB)
icons-oxygen-24 (~60 kB)
icons-oxygen-32 (~100 kB)
Loading needed icon in a program then is a cake:
// reading "file-new" icon of size 16 or closest
themeIcon(FILE_NEW, 16)
// reading "folder" icon in default dialog icon size
themeIcon(FOLDER, SIZE_DIALOG)
3) Dialogs
Mint provides new and restyled dialogs from libdialog. These dialogs also respect settings mentioned above.
Color dialog was rewritten and now should be more convenient.
New Font dialog, obviously, allows to choose font.
File dialog was split in two: OpenFileDialog and SaveFileDialog.
The first only allows to choose existing files while the latter allows to create files and asks confirmation if you try to rewrite existing file.
There's also a set of message dialogs that can be shown using on of showInfo, showError, showWarning - these will not only present text but also a suitable icon.
4) Event loop
Tired of writing loops for ui_wait_event()? Let EventLoop do that for you!
You need just to add functions for desired actions using onShow(), onMenu() and to start it.
Example:
/* MINT hello world. */
use "mint/eventloop"
use "stdscreens"
use "ui"
def main(args: [String]) {
// create screen
var msgbox = new MsgBox("Hello, world!")
// create event loop for it
var loop = new EventLoop(msgbox)
// add menu item to exit
loop.onMenu(new Menu("Ok", 1), loop.quit)
// start processing of events
loop.start()
}5) ActionLists.
ActionList is both a dialog and an event loop in one. Just put into it pairs of string
and function. Then run it. You will see a menu and choosing item in it automatically
calls corresponding function.