# Glade 界面设计器手册

Glade 是 GTK+ 应用程序的一个图形界面设计器。

2006 Vincent Geddes
2004 2003 Sun Microsystems
2002 2000 Michael Vance
GNOME 文档项目
Vincent Geddes
GNOME 文档项目

    vincent.geddes@gmail.com

Sun GNOME 文档团队
Sun Microsystems
Michael Vance
GNOME 文档项目
Glade 手册 3.0 版
2006年12月5日

Vincent Geddes

GNOME 文档项目

Glade 手册 2.1 版
2004年6月17日

Sun GNOME 文档团队

GNOME 文档项目

Glade 用户手册 2.0 版
2004年2月25日

Sun GNOME 文档团队

GNOME 文档项目

Glade 用户手册 1.2 版
2004年2月10日

Sun GNOME 文档团队

GNOME 文档项目

Glade 用户手册 1.1 版
2002年5月30日

Michael Vance

GNOME 文档项目

Glade 用户手册 1.0 版
2000年5月11日

Michael Vance

GNOME 文档项目

本手册描述了 3.1.0 版的 Glade。

反馈

To report a bug or make a suggestion regarding the Glade application or this manual, follow the directions in the GNOME Feedback Page.

## 导言

The Glade interface designer enables you to create and edit user interface designs for GTK+ applications.

The GTK+ library provides an extensive collection of user interface building blocks such as text boxes, dialog labels, numeric entries, check boxes, and menus. These building blocks are called widgets. You can use Glade to place widgets in a GUI. Glade allows you to modify the layout and properties of these widgets. You can also use Glade to add connections between widgets and application source code.

The user interfaces designed in Glade are stored in an XML format, enabling easy integration with external tools. You can use the libglade library to dynamically create GUIs from the XML description.

## 开始

### 启动 Glade

You can start Glade in the following ways:

Applications menu

  Choose Programming Glade Interface Designer .

命令行

  To start Glade from a command line, type the following command, then press Return: `glade-3`

### 启动 Glade 时

When you start Glade, the following window is displayed.

Glade 窗口

显示 Glade 窗口

The Glade window contains the following elements:

菜单栏

  The menus on the menubar contain all of the commands you need to work with files in Glade.

工具栏

  工具栏包括了你可以从菜单栏里找到的命令中的一部分。

设计区

  设计区是可以可视化设计用户界面的地方。

构件库

  构件库包含了可以用来构建用户界面的 widgets。

检查器

  检查器显示工程中控件的信息。

属性编辑器

  属性编辑器是用来处理控件的属性以及添加和源代码之间联系的。

状态栏

  The statusbar displays information about current Glade activity and contextual information about the menu items.

## 使用工程

### 新建一个工程

To create a new project, choose File New. The application displays a new blank project in the Glade window.

### 打开一个工程

To open an existing project, choose File Open. The application displays the project in the Glade window.

### 保存当前工程

您可以按以下方法保存工程：

- To save changes to an existing project file, choose File Save.

- To save a new project file or to save an existing project file under a new filename, choose File Save As . Enter a name for the project file in the Save As dialog, then click Save.

## 使用构件

### 从构件库选择控件

You can work with the widgets in the 构件库 window in the following ways:

选择模式

  To use selection mode, click on the Selector arrow. The pointer changes to an arrow to indicate that selection mode is active. In this mode, you use the mouse to select widgets in your project. You can then use the Properties window to edit the properties of the widgets.

  您也可以使用构件的右键菜单选择一个构件。在构件上右击来打开构件快捷菜单。

  You can add multiple widgets of a specific type from the 构件库 to your project by holding down the Control key when you select a widget. You need to click on the Selector arrow or another widget in the 构件库 to return to normal mode.

构件定位模式

  To use widget placement mode, select a widget in the 构件库 window. When you select most widgets, the pointer changes to a pointer-plus-cross. You can then place the widget inside containers, top-level widgets, and so on. After you place a widget, the mode returns to selection mode.

顶层模式

  To use top level placement mode, select a defined top-level widget in the 构件库 window. When you select a top-level widget in the 构件库 window, the widget appears immediately on your desktop. You can then edit the widget. After you select a top-level widget, the mode returns to selection mode.

### 在工程中组织控件

You use widget containers, or boxes, to layout and organize widgets in your project window. You can choose the following widget containers from the 构件库 window:

- Horizontal Box

- Vertical Box

- Table

- Fixed Positions

- Horizontal Button Box

- Vertical Button Box

- Horizontal Panes

- Vertical Panes

- Notebook

- Frame

- Scrolled Window

- Viewport

You can nest boxes to create complex layout structures. When you create horizontal and vertical boxes, Glade asks you how many rows or columns to create initially, though rows and columns can easily be added or deleted later.

When you have created all the boxes you require, you can add specific widgets like labels, buttons, and more complicated widgets into the boxes. Notice that Glade packs widgets into the layout which eliminates a lot of tedious work. The use of boxes enables windows to change size to accommodate different size labels in different languages when the application is localized.

### 放置一个控件到剪切板

To remove a widget from a parent and place the widget on the clipboard, select the widget then choose Edit Cut .

### 复制一个控件到剪切板

To copy a widget to the clipboard, select the widget then choose Edit Copy . The original widget remains attached to the parent.

### 从剪切板粘贴控件到您的工程

To paste a widget that exists on the clipboard into your project, choose Edit Paste .

All widgets must have a unique name within Glade. If you cut a widget, and then paste the widget into your project, then the widget and all of the children of the widget keep their original names. If you copy a widget, or paste the widget multiple times into your project, then Glade generates new names for the widget copies.

### 删除控件

To delete a widget from the parent without moving the widget to the clipboard, select the widget then choose Edit Delete .

### 更改控件属性

属性编辑器是用来编辑选中控件的属性的。要更改一个控件的属性，选中一个控件然后在属性窗口的属性域中输入合适的值。

## 关于 Glade

Glade is maintained by the Glade developers and GNOME community volunteers. To find more information about Glade, please visit the Glade Web site.

To report a bug or make a suggestion regarding this application or this manual, you can submit them using bugzilla.

Another excellent source of information are the Glade user and developer mailing lists. In addition to subscribing, you might also want to browse the list archives, available via these same links.

This program is distributed under the terms of the GNU General Public license as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. A copy of this license can be found at this link, or in the file COPYING included with the source code of this program.

glade
用户界面设计器