Lightweight GUI Library



This library is aimed at producing small, quality applications that run on multiple platforms.

The way this is acheived is by implementing a common API that is simple to use and allows access to the features of the supported platforms in a (preferably) highest common denominator fashion. Features should be synthesised when not present if practical.


Initially you should configure the required and recomended libraries that Lgi uses. If you don't have any of these libraries then you should set the appropriate define in Lgi.h to '0'

Visual C++ Project Setup

If your building on Win32 with Visual C++ then you'll need to make some edits to the default project settings to make linking against the library work. Heres a list of the things you need to change from the defaults:

Where To Start

Firstly include the file LgiMain.cpp into your project, which will handle some of the setup for and then call LgiMain(). In your own source code implement LgiMain() like this:
    int LgiMain(OsAppArguments &Args)
        GApp *App = new GApp("application/x-MyProgram", Args);
        if (App && App->IsOk())
            App->AppWnd = new MyWindow;
            delete App;

        return 0;
Where 'MyWindow' is a class that inherits from GWindow. This class should initialize the user interface for your application and then make itself visible. This is typically done like this:
    class MyWindow : public GWindow
            GRect r(0, 0, 700, 600);
            Name("My Application");
            #ifdef WIN32
            if (Attach(0))
                // Put code to create a menu, toolbar and splitter here

This will put a simple empty window on the screen. The sorts of classes you'll be using to fill in the contents of the window will be: A GWindow will layout controls automatically according to the order you attach (GView::Attach) them. The first window gets to lay itself out anywhere in the client area, and once it's positioned itself, the second window gets the area left over. And so on until the window is filled. There are a number of helper functions for layout: Usually you attach a GToolBar first, as it will automatically slide in below the menu (if any). Then a GStatusBar, if your going to need one. And finally a GSplitter or GList to fill out the rest of the space. The standard method of attaching a view to a GWindow in the constructor of your window:
    GSplitter *s = new GSplitter;
    if (s)
        s->SetViewA(new MyChildWindow1, false);
        s->SetViewB(new MyChildWindow2, false);
Where MyChildWindow1 and MyChildWindow2 are GView based classes.


At some point you may want to put a dialog on the screen to get input from the user or provide the user with information. There are several pre-rolled dialogs, as well as support for custom dialogs. Firstly the pre-rolled dialogs are: To create your own custom dialog you derive from: Throughout Lgi applications windows can be constructed from a variety of Controls (or Widgets, or Views) that form the common methods for interacting with users and displaying information. Lgi has a rich set of bundled controls as well as support for writing your own. Here is an index of the built in controls: However it's fairly easy to write custom controls by inheriting from GLayout (or GView for the hardcore) and implementing the required functionality by override various events like GView::OnPaint and GView::OnMouseClick.

Generated on Wed Dec 1 15:40:51 2010 for Lgi by  doxygen