Gtk Lo Gafet – Tour Guide


This page gives an example of how Lo Gafet is used to create a simple Gtk application.
It includes screenshots.
(Click on the thumbnail images to get full-size screenshots).

To start a new project, run glg executable.

Working windows are floating windows.
Their position and size can be saved
and restored into project file.

To start a new application,
choose ‘Module’ then ‘New Window’.

The first window of the application is
then created.

Right-click on the window from the
project window brings a
configuration dialog for
this window.

From the Resources Windows,
change the resources you need.

Resources are organized following
the widget hierarchy.

Using the Palette Window
(Select one widget, then click into the
module window which is created),
we add some widgets into
the window.

Some widgets are added.

Edit a Text resource.

Now let’s attach a Callback function
to a specific widget:

When the user will click
(CB_ACTIVATE event)
on the button.

Right-click on a widget
(either on the widget, or from the Tree)
brings a contextual menu.

You’ll find the first 8 callbacks
attached to the widget
(and also the attached style,
if any)

Selecting a callback will call the
text editor, at the proper position into
the file (cursor into the function body).

We have selected the callback
from the right-click menu.

LG has created the body for the
callback function and ask your
preferred editor to position at
the function.

GLG also contains a
Styles Editor
J

Then we go to a dialog where we
can ask LG to:
- generate the code
- make
- run

Note that it is possible to only
generate, then edit, make and run
outside LG.

Source Code (C) generated by GTK Lo Gafet

Application

glg

 

This directory contains all the project information
stored/retrieved by GLG. All files are text files and
therefore can be edited if needed.

 

glg

 

Contain the list of modules (Window, Menu,  etc.) along with some properties
associated with these modules.

styles

 

Contain the definition of the styles defined and used with this project.

window1.glg

 

Contain the definition of the 1st module (a Window, named ‘window1’).

menu1.glg

 

Contain the definition of the 2nd module (a Menu, named ‘menu1’).

obj

 

This directory contains the Makefile. You should compile the project
from this directory (apply for a ‘C’ project):
(i.e.: cd app/obj ; make)

 

Makefile

 

Makefile, ready to go.

src

 

This directory contains the source of the application. Some of
the files are generated by GLG (and therefore must not be
changed), and some of the files are yours.

 

startup.c

 

The startup(argc argv) is called from the main(), and can be customized. Note
that the startup() function is called before any opening of windows modules
(for the one that are opened automatically).

xx.c

In our small example, we have created some callback functions (signal), and
we choose to store them into this file. Each callback function can be stored
in any file.

 

xpm

 

This sub-directory should contain the bitmaps (.xpm format only)
that you are using into your project. Note that you can create
sub-directories if you want.

 

 

abc.xpm

In our example, we used a bitmap, and the .xpm definition of the bitmap has
to sit into this directory (only used at compilation time).

 

glg

 

This sub-directory contain the generated source code for each of
your modules (Windows, Menus, etc.). Callbacks (signals) are not
defined into this directory. None of these files into this directory
should be modified (custom changes would be overwritten by GLG
at next code generation).

 

main.c

Contain the main() function, and also some few functions that used internally
by the code generated by GLG.

main.h

Contain some extern definitions.

syles.c

C-code that defines the styles used by the project. Note that all styles are
defined as global, and not static.

styles.h

Contain the extern definitions for the styles.

modules.h

Contain the prototypes of all modules (there is a C function associated for
each module).

window1.c

C-code for the definition of the 1st module (Window).

window1.h

#defined for all global widgets defined into the 1st module.

menu1.c

C-code for the definition of the 2nd module (Menu).

menu1.h

#defined for all global widgets defined into the 1st module.


SourceForge.net Logo