第 2 页
目 录
目 录 ...................................................................................................................................................2
修订历史 .............................................................................................................................................3
一.
关于 GTK+................................................................................................................................5
1.1
什么是 GNOME、..................................................................................................................................................5
1.2
什么是 GIMP、GTK+............................................................................................................................................5
1.3
GTK+使用的库........................................................................................................................................................5
1.4
GTK+的安装............................................................................................................................................................5
1.5
使用 GTK+工具集编写程序 ..................................................................................................................................6
二.
GTK+基础.................................................................................................................................7
2.1.1
初始化 GTK+.......................................................................................................................................................7
2.1.2
建立窗口 ..............................................................................................................................................................8
2.1.3
GTK+的事件循环.................................................................................................................................................8
2.1.4
结束应用程序.....................................................................................................................................................10
2.5
回调函数 ...............................................................................................................................................................10
2.2.1
其它窗体函数.....................................................................................................................................................12
2.3.1
构件 ....................................................................................................................................................................13
2.3.2
构件的敏感性.....................................................................................................................................................14
2.3.3
构件的类型转换.................................................................................................................................................15
2.3.4
统一构件函数.....................................................................................................................................................15
2.4.1
容器 ....................................................................................................................................................................17
2.4.2
统一容器函数.....................................................................................................................................................17
2.5.1
组装盒 ................................................................................................................................................................18
2.5.2
组合表 ................................................................................................................................................................21
2.5.3
固定容器构件.....................................................................................................................................................24
三.
GTK+界面设计.......................................................................................................................26
3.1
常用构件函数 .......................................................................................................................................................26
3.2.1
按钮 ....................................................................................................................................................................27
3.2.2
触发按钮 ............................................................................................................................................................29
3.2.3
检查按钮 ............................................................................................................................................................31
3.2.4
选择按钮 ............................................................................................................................................................32
3.3.1 标签构件 .............................................................................................................................................................34
3.3.2
事件盒构件 ........................................................................................................................................................40
3.4.1
录入构件 ............................................................................................................................................................41
3.5.1
建立菜单 ............................................................................................................................................................47
3.5.2
菜单的信号处理.................................................................................................................................................53