LGI is an open source GUI framework (on Github
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 450 KB, 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: Win32, Mac and Linux. There is also a
legacy 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
- 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).
First check out the source:
git pull https://github.com/memecode/Lgi.git
For full graphics and charset support download (or check you already have)
libpng and zlib,
then add their include paths to your compilers include paths. Or find the defineds
in Lgi.h for the various libraries and set them to 0.
Visual Studio 2008 and 2010
Install a supported version of Visual Studio. Build the appropriate workspace:
- vs2008: Lgi_vc9.sln
- vs2010: Lgi_vc10.sln
Adding build folders to the shared library path:
Add this to your path:
Go to the Apple Developer site and grab XCode
Open Lgi.xcodeproj in XCode and run the build command.
Building on Ubuntu:
sudo apt-get install subversion
sudo apt-get install g++
sudo apt-get install libgtk2.0-dev
svn co https://svn.code.sf.net/p/lgi/code/trunk Lgi/trunk
ln -s Makefile.linux makefile
Adding build folders to the shared library path:
sudo ln -s [install_path]/Lgi/trunk/Debug/liblgid.so liblgid.so
sudo ln -s [install_path]/Lgi/trunk/Release/liblgi.so liblgi.so
MS VC++ Tip
Add this to your Common/MsDev98/Bin/AUTOEXP.DAT file to show various LGI types inline:
; LGI types
Accumulation of fixes and features to date.