# Glade Reference Manual

2000
Michael Vance

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. You may obtain a copy of the GNU Free Documentation License from the Free Software Foundation by visiting their Web site or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Many of the names used by companies to distinguish their products and services are claimed as trademarks. Where those names appear in any GNOME documentation, and those trademarks are made aware to the members of the GNOME Documentation Project, the names have been printed in caps or initial caps.

Initial release of Glade Reference Manual.

## Introduction

Glade is an application for creating graphical user interfaces that use the Gtk+ and GNOME libraries. Glade allows you to rapidly develope these interfaces, and can create source code in a variety of languages that will construct the interfaces for you. Glade can also be used in conjunction with libglade to dynamically create user interfaces from the XML description file that Glade creates.

Glade can be obtained from here. Links are provided there for various package formats. Glade is also available from the GNOME CVS server. See the GNOME CVS page for more information on how to get Glade from CVS.

In order to use Glade's GNOME support, you will need to have a very recent version of GNOME, or compile Glade with `--disable-gnome`.

Once installed, Glade can be started from the command-line by typing `glade`.

## Using Glade

Glade is composed of several windows which each server a particular purpose. The main window contains the menu, toolbar and a list of top-level windows. The palette lists the various UI objects which you can use to bulid an inteface. The property editor lets you manipulate the properties of widgets, such as their size, color, signal masks, etc.

Typically a Glade project begins with the construction of the user interface. Using the palette, you composite and insert widgets until you arrive at the desired interface. While doing this you usually use the property editor to manipulate the various packing settings, dimensions, etc., of the widgets.

When the interface is finished, you then usually save the project and build the C source files that will be used to generate the user interface. Integration with your project logic then follows. Some other things you may do:

- Use libglade to build the interface

- Use Glade to set the signal handlers for your widgets

- Emit Perl or Eiffel code instead of C

The various parts of Glade are described in detail in the sections that follow.

## Menus

### Glade menu

### File

#### File menu

#### New Project

Create a new, empty Glade project. Glade will prompt you to create a new project. If you have not saved an existing project, select `Cancel` and then save it. Otherwise, select `OK`.

#### Open

Open an existing Glade project. A standard Gtk+ dialog box will appear allowing you to specify the project file. Note that Gtk+ file dialog boxes have tab-completion in their filename field.

#### Save

Save your project. If you have never saved your project, you will be presented with the Project Options dialog, which will have default values entered in it. If you have specified the project settings in the past it will simply save your your current projectwithout comment.

#### Build Source Code

Generate the desired source code (C, Perl, Ada, etc.). If you have never saved your project, you will be presented with the Project Options dialog, which will have defaults values entered in it. If you have specified the project settings in the past it will simply emit code without comment.

#### Project Options

The project options dialog is described here.

#### Exit

Exit Glade. Currently Glade does not query you to save unsaved project data (although it does ask you if you wish to quit), so be sure to save your project before exiting.

### Edit menu

#### Edit menu

#### Cut

This command will remove a widget from its parent and place it on the clipboard.

#### Copy

This command will copy a widget to the clipboard. The original widget remains attached to its parent.

#### Paste

If a widget currently exists on the clipboard, this command will allow you to copy the widget from the clipboard

#### Clear

If a widget is currently selected, this command will delete it from its parent without moving it to the clipboard.

### View menu

#### View menu

#### Show Palette

Display the palette if it is currently hidden, or raise it to the top of the window stack if it is obscured.

#### Show Property Editor

Display the property editor dialog if it is currently hidden, or raise it to the top of the window stack if it is obscured.

#### Show Widget Tree

Display the widget tree dialog if it is currently hidden, or raise it to the top of the window stack if it is obscured.

#### Show Clipboard

Display the widget clipboard if it is currently hidden, or raise it to the top of the window stack if it is obscured.

### Settings menu

#### Settings menu

#### Show Grid

When placing widgets on a GtkFixed container, should Glade draw a grid for easy widget alignment?

#### Snap to Grid

When placing widgets on a GtkFixed container, do you want Glade to snap them to the grid?

#### Show Widget Tooltips

When resting your cursor over an widget, should it display tooltips describing that widget?

#### Grid Options

##### Grid options

- Horizontal spacing - number of pixels to skip horizontally before drawing a line

- Vertical spacing - number of pixels to skip vertically before drawing a line

- Grid style - should the grid be drawn as a series of dots or as lines?

#### Snap Options

##### Snap Options

- Horizontal snapping - should Glade snap the left and/or right edges of a widget to the grid?

- Vertical snapping - should Glade snap the top and/or bottom edges of a widget to the grid?

### Help menu

#### Help menu

#### About

Displays the About dialog, which shows the Glade logo, and provides authorship and contact information for Glade.

### Toolbar

#### Toolbar

#### Open

Corresponds to `File:Open`.

#### Save

Corresponds to `File:Save`.

#### Options

Corresponds to `File:Project Options`.

#### Build

Corresponds to `File:Build`.

## Project Options

### General

#### General Options

#### Basic Options

Project Directory

  Directory in which the Glade project lies. You can select this using a file dialog box by clicking on `Browse`.

Project Name

  Name of your project. Editing this will cause your program name and project filename to change automatically.

Program Name

  Name of the executable used when Glade generates code for your project. Editing this will cause the project file to automatically change.

Project File

  Filename of the Glade project file, where all of your project information will be stored.

#### Subdirectories

Source Directory

  Directory where Glade should emit its source code when told to do so.

Pixmaps Directory

  Directory where Glade should expect to find any pixmaps that are used in the project.

#### Language

Pick the programming language in which Glade should emit code. As of the writing of this document C, C++, Ada95, Perl and Eiffel are supported options.

#### GNOME

Should Glade emit code that uses the GNOME libraries?

### C Options

#### C Options

#### General Options

Gettext Support

  Should Glade emit code to suppport GNU gettext for internationalization?

Set Widget Names

  Should Glade emit code to set the names of all widgets? This is useful if you intend to use Gtk+ calls such as `gtk_widget_path()`. Also see `gtk_widget_set_name()`.

Backup Source Files

  Should Glade make a backup of all your source files when you build new ones?

#### File Output Options

Output `main.c` File

  Should Glade output a file, `main.c`, which contains a simple bootstrap? If you enabled GNOME support, it will call `gnome_init()`, otherwise it calls `gtk_init()`.

Output Support Functions

  Should Glade output a file, `support.c`, which contains utility functions for such tasks as creating a pixmap, or looking for a widget by name?

Output Build Files

  Should Glade output files to support configuring your project through automake/autoconf? This option will create several files:

  - `AUTHORS` - Authorship file for contributors.
  - `ChangeLog` - Log describing changes you've made.
  - `Makefile.am` - Automake template for the project.
  - `NEWS` - Announcements for new releases.
  - `README` - Describes general information about the project.
  - `acconfig.h` - Defines default preprocessor symbols for autoconf.
  - `autogen.sh` - Script for building a configure script.
  - `configure.in` - Template for building a configure script.
  - `macros/` - Directory containing automake macros for Glade, GNOME, etc.
  - `stamp-h.in` - Timestamp file.
  - `src/Makefile.am` - Automake template for src/ directory.

#### Interface Creation Functions

Source File

  When emitting user interface code, store it in this file.

Header File

  When emitting user interface code, store the function prototypes, etc., in this file.

#### Signal Handler & Callback Functions

Source File

  When emitting signal handler code, store it in this file.

Header File

  When emitting signal handler code, store the function prototypes, etc., in this file.

#### Support Functions

Source File

  When emitting the support function code, store it in this file.

Header File

  When emitting the support function code, store the function prototypes, etc., in this file.

### Libglade Options

#### Libglade Options

#### Save Translatable Strings

If you wish to internationalize your application, and want to use libglade to construct the interface, you may wish to save the translatable trings into a file. This option tells Glade if you wish to do this.

## Windows

### Main Window

#### Main window

#### Menu

Menus are documented here.

#### Toolbar

The toolbar is documented here.

#### Top-Level Window List

The main window displays a list of the top-level Gtk+ and GNOME windows that are defined for the current project. This includes:

- GtkWindow

- GtkDialog

- GtkFileSelection

- GtkColorSelectionDialog

- GtkFontSelectionDialog

- GtkInputDialog

- GnomeApp

- GnomeDialog

- GnomeMessageBox

- GnomeAbout

- GnomePropertyBox

### Palette

The palette allows you to pick widgets to be added to your current Glade proejct. There are three major modes of operation to the palette. The first mode is selection, and can be used by clicking on the large black arrow with "Selector" labeled next to it. In this mode mouse clicks will select already existing widgets from your project, allowing you to edit them using the property editor. Selection mode is also indicated by an arrow cursor.

The second mode of operation is widget placement. When selecting most widgets, Glade will change the cursor to a cross and then allow you to place widgets inside of containers, top-level widgets, etc. After placing a widget Glade returns to selection mode.

The third mode of operation is top level placement. For certain top-level widgets, selecting them in the palette will cause them to instantly appear on your desktop for editing. This contrasts with the usual mode of widget placement described above. After selecting a top-level widget the mode is changed back to selection.

The palette groups widgets into three distinct sections: Gtk+ Basic, Gtk+ Additional, and Gnome. The Gtk+ Basic category contains often used Gtk+ widgets such as GtkWindow, GtkLabel, etc. Gtk+ Additional contains widgets such as GtkAlignment, GtkPacker, and GtkCalendar. The Gnome category includes all of the GNOME widgets that Glade supports.

A list of all widgets supported is provided below. In order to determine exactly what a widget is in the palette (i.e., the picture provided is not obvious), you can get a tooltip with a description by resting your cursor over the widget in question.

#### Gtk+ Basic

##### Gtk+ Basic

GtkWindow | GtkMenuBar | GtkToolbar | GtkHandleBox
GtkLabel | GtkEntry | GtkCombo | GtkText
GtkButton | GtkToggleButton | GtkCheckButton | GtkRadioButton
GtkList | GtkTree | GtkCList | GtkCTree
GtkOptionMenu | GtkSpinButton | GtkProgressBar | GtkStatusbar
GtkHSeparator | GtkVSeparator | GtkPixmap | GtkDrawingArea
GtkDialog | GtkFileSelection | GtkColorSelectionDialog | GtkFontSelectionDialog
GtkHBox | GtkVBox | GtkTable | GtkFixed
GtkHButtonBox | GtkVButtonBox | GtkHPaned | GtkVPaned
GtkNotebook | GtkFrame | GtkScrolledWindow | GtkViewport

#### Gtk+ Additional

##### Gtk+ Additional

GtkHScale | GtkVScale | GtkHRuler | GtkVRuler
GtkAlignment | GtkEventBox | GtkAccelLabel | GtkCalendar
GtkLayout | GtkPacker | GtkAspectFrame | GtkPopopMenu
GtkCurve | GtkGammaCurve | GtkHScrollbar | GtkVScrollbar
GtkImage | GtkPreview | GtkColorSelection | GtkFontSelection
GtkInputDialog | Custom Widget | GtkArrow

#### GNOME

<imagedata fileref="user-guide-images/window-palette-gnome.png" </imageobject>

##### Gnome

GnomeApp | GnomeDialog | GnomeMessageBox | GnomeAbout
GnomeColorPicker | GnomeFontPicker | GnomeIconEntry | GnomeHRef
GnomeEntry | GnomeFileEntry | GnomeNumberEntry | GnomePixmapEntry
GnomeDateEdit | GtkDial | GtkClock | GnomeAppBar
GnomeCalculator | GnomeLess | GnomePaperSelector | GnomeSpell (deprecated)
GnomeCanvas | GnomeIconList | GnomeIconSelection | GnomePropertyBox
GnomeDruid | GnomePixmap | GnomeAnimator

### Property Editor

FIXME

### Widget Tree

FIXME

### Clipboard

FIXME

## Output

Please write me.

## Libglade

Please write me.

## Quick Start

Please write me.

## Hello, World - A Simple Project

Please write me.

## Authors

Glade was written by Damon Chaplin damon@ximian.com. To find more information about Glade, please visit the Glade web page.

Please send all comments, suggestions, and bug reports to the Glade mailing list. Information on how to join this list is available at this page.

This reference manual is maintained by Michael Vance briareos@lokigames.com. Please send all comments, suggestions, and bug reports regarding the manual his way.

### Contributors

Ray Barker fatray@home.com

  Contributed menu dialog, file output documentation

Paul J. Drongowski pjd@ives.lkg.dec.com

  Contributed quick start tutorial

You can also add your comments online by using GNOME Documentation Status Table.