LGI is an open source GUI framework (on
Phabricator)
for abstracting out all the operating system dependencies
that you can produce portable code. It handles all the graphical interface functions,
threading and semaphores, network connectivity and lots of other bits and peices to
help build small, fast and reliable applications.
The strengths of LGI is that it's a small enough library that one person can understand
it all. Also it's not too much of a burden on an application, both in increased download
time and memory footprint. LGI at the moment compresses to about 519 KiB, which while not
insignificant is quite a bit smaller than the other options.
Ultimately however size is a secondary consideration to the core feature of LGI and that
is portability. Currently 3 serious ports exist: Windows, Mac and Linux. There is also a
legacy Haiku/BeOS port which is unsupported.
I have completed some basic documentation for the
library and scripting language,
and there are a number of apps with source code available on github.
- File system abstraction (GFile, GDirectory)
- Basic windows (GView, GWindow, GLayout, GDialog). GView is the base
window class and handles all the basic window API calls and events. GView
API looks like:
virtual Events
| Properties (Get/Set)
|
- int OnEvent(GMessage *Msg);
- void OnMouseClick(GMouse &m);
- void OnMouseEnter(GMouse &m);
- void OnMouseExit(GMouse &m);
- void OnMouseMove(GMouse &m);
- void OnKey(GKey &k);
- void OnMouseWheel(double Lines);
- void OnCreate();
- void OnDestroy();
- void OnFocus(bool Has);
- void OnPulse();
- void OnPosChange();
- bool OnRequestClose();
- int OnHitTest(int x, int y);
- int OnNotify(GView *Ctrl, int Flags);
- void OnChildrenChanged(GView *Wnd, bool Attaching);
- int OnCommand(int Cmd, int Event, OsView Wnd);
- void OnPaint(GSurface *pDC);
- bool OnViewKey(GView *v, GKey &k);
|
- char *Name();
- int Value();
- GRegion &GetPos();
- int GetId();
- bool Enabled();
- bool Visible();
- bool Focus();
- bool DropTarget();
- bool Sunken();
- bool Flat();
- bool Raised();
- GView *GetParent();
- GView *GetNotify();
- bool Capture(bool c); // mouse capture
|
- Widgets (A lot are native controls on Windows, and owner draw on Linux/Mac)
- GEdit - Edit control (Win32: Native, Mac/Linux: GTextView3)
- GCheckBox - Boolean control (On/Off)
- GText - Label
- GRadio/GRadioGroup - Select one of many options
- GCombo - Combo box
- GList - List control
- GTree - Tree control
- GBitmap - Bitmap
- GProgress - Progress meter
- GSlider - Slider control
- GSplitter - Split 2 panes
- GBox - Split into "n" panes
- GTabView - Tabbed control
- GTextView3 - Unicode text editor
- GToolBar - Toolbar control
- GStatusBar - Status bar
- GMenu / GSubMenu / GMenuItem - Menu controls
- GPopup - Popup windows
- GControlTree - A tree of settings with suitable edit controls
- Internally all text is Utf-8
- Unicode font support (GFont, GFontType, GDisplayString).
Tools for converting to/from
native OS text and other codepages are provided. iso-8859-x and
windows-12xx codepage support is native, other codepages supported via
the iconv library.
- Multi-threading (GThread, GMutex)
- Graphics library (GSurface, GMemDC, GScreenDC, GPrintDC)
- Supports internally, all the basic primitives: Line, Circle, Rect,
Blt, Flood, Polygon, Ellipse etc. No OS support required.
- Bit depth conversion for bitmaps and colours.
- Palette management.
- Alpha blending.
- Vector art library, anti-aliased rasterisation of primitives & text.
Includes TTF -> path capability.
- Graphic file format support (GIF, TIFF, JPEG(dll), PNG(dll), BMP, ICO).
- Recursive file search.
- Full OS independant file open/save dialog.
There is also support for the Win32 and Mac native file open/save
dialogs (API compatible).
- Mime type detection lookup API with support for finding a suitable app for
a Mimetype.
- Platform independant XML resource file format for strings, dialogs and
menus. All fully multi-lingual.
LgiRes is a graphical
editor for this format.
- Clipboard IO for text and bitmaps.
- Drag'n'drop events/API.
- Commonly used dialogs (GInput, MsgBox, GAlert, GFindReplace, GFileSelect).
- Date time handling (GDateTime). Date subtraction/addition, conversion
to/from native format, conversion to/from strings.
- Container classes (GArray, List, StringPipe).
- Network abstraction including OpenSSL support (GNetwork, GSocket, OpenSSLSocket).
- Network protocol client classes:
- FTP (IFtp)
- HTTP (IHttp)
- SMTP (MailSmtp)
- POP (MailPop3)
- IMAP (MailIMap)
- DNS (IDns)
- Xml input/output (GXmlTree).
- String tokenization (GToken);
- 450kb packed/zipping redistributable (circa mid 2014).
- Simple HTML control. Support for charsets, CSS classes/styles, tables (colspan etc).
Does most things but can get stuck on advanced layouts (ie floats are not supported).
Some form support. Hooks for scripting, but no Javascript engine.
Building LGI
First check out the source:
hg clone https://phab.mallen.id.au/source/lgi/ lgi/trunk
Windows
Support Libraries
For full graphics and charset support download (or check you already have)
iconv,
libpng and zlib,
libjpeg;
then add their include paths to your compilers include paths. Or find the defines
in Lgi.h for the various libraries and set them to 0.
Visual Studio
Install a supported version of Visual Studio: 2015 or 2019.
Adding build folders to the shared library path:
Add this to your path:
| Mac
Install XCode
Go to the Apple Developer site and grab XCode
Build
Open Lgi.xcodeproj in XCode and run the build command.
| Linux
Building on Ubuntu:
sudo apt-get install mercurial libmagic-dev libgtk3.0-dev \
libgstreamer1.0-dev libappindicator3-dev libssh-dev
hg clone https://phab.mallen.id.au/source/lgi/ lgi/trunk
cd lgi/trunk
ln -s Makefile.linux makefile
make -j 4
If apt can't find the gtk 3 dev libraries, on some systems it's called 'libgtk-3-dev' just
to be different I guess.
If the makefile doesn't work on your system:
- Download a binary of LgiIde
- Project->Open and select lgi/trunk/Ide/LgiIde.xml
- Project->Create Makefile->Linux
- Project->Build
|
History:
A bunch of very old builds. For anything current you should use the git repositry:
3.4.0 [Stable]
Accumulation of fixes and features to date.