2024年4月11日发(作者:)

2010-9-13GTK学习个人笔记for个人 - 我的文章 …

博客首页

注册

建议与交流

排行榜

加入友情链接

推荐

投诉

搜索:

搜索

帮助

bo_00

首页文章相册音乐博客圈收藏夹留言发表文章管理博客

GTK

学习个人笔记

for

个人

学习

GTK

过程,遇到很多参考手册中的

API

函数。个人随笔记忆,乱序。

GTK

的版本编号,对于新人来说的确是让人非常抓狂的,

你会看在

API

手册和

glade

界面中看到如下文字或状态

“As of GTK+ 2.4, GtkOptionMenu has been deprecated in favor of GtkComboBox. ”

or:

可是目前

GTK+

stable

版式

2.18

unstable

版是

2.19.3

哪里跑出来的

2.8

2.4

呀。原来

------------------------------------------

table Release

To build GTK+ 2.18 you may find the user guide helpful. For additional help, the FAQ is a good starting point.

* GTK+ 2.18 2009.9~

* GLib 2.22

* Pango 1.26

* Installation guide

-------------------------------

Older Versions

Some applications still require GTK+ 1.2, an older stable version of GTK+. You can have the run-time and development environments for both GTK+ 2.x and GTK+ 1.2 i

simultaneously on your computer.

Version Packages

GTK+ 2.16 Sources 2009.3~

GTK+ 2.14 Sources 2008.9~

GTK+ 2.12 Sources 2007.9~

GTK+ 2.10 Sources 2006.7~

GTK+ 2.8 Sources 2005.8~

GTK+ 2.6 Sources 2004.12~

GTK+ 2.4 Sources 2004.3~

GTK+ 1.2 Sources 1999.2~

------------------------------------------

原来是

4/6/8/10/12/16/18

的意思

而不是,在我心中已经根深蒂固的

2.04/2.06/2.08/2.10/2.12/2.14/2.16/2.18

的感觉

刚刚开始看的时候,的确困惑了好久(一直以为

2.4

2.18

新的多得多)!

GTK+

和以下

函数库

存在着依赖关系

Glib

Pango

ATK

GDK

GdkPixbuf

Cairo

Glib

是一种通用的函数库。她提供了各种各样的语言特性,譬如说:各种数据类型,字符串函数,错误通知,消息队列和线程。

Pango

是一种函数库,用来实现国际化和本地化的功能。

ATK

一种平易近人的工具函数包,她提供了快捷键服务为肢体有缺陷的人使用电脑提供了便利。

GDK

是一种函数库,她为整个

GTK+

图形库系统提供了一些底层的

图形实现

窗口实现

的方法。在

Linux

GDK

是位于

X

服务器和

GTK+

函数库之间的。在最近的

GTK+

发行版本中,越来越多的功

Cairo

函数库来处理。

GdkPixbuf

函数库是一种函数库工具包用于加载图像和维护图像

缓存

的(

pixel buffer

)。

Cairo

是一种函数库用于制作二维图像。从

GTK+2.8

版本以后,

Cairo

就正式成为

GTK+

系统中的一员了。

Gnome and XFce

桌面环境系统都是用

GTK+

来编程实现的

. SWT and wxWidgets

是种很著名的编程框架

,

也是用

GTK+

来编程实现的。最杰出的

GTK+

软件的代表是

Firefox

(火狐浏览器)和

I

引至:

GTK+ 2.x Tutorial for Beginners

的中文译版

(

)

gtk_button_new_with_mnemonic ()

…/…/showart_2152698.…1/12

2010-9-13GTK学习个人笔记for个人 - 我的文章 …

GtkWidget* gtk_button_new_from_stock (const gchar *stock_id)

从一个

"

常备项目

/

固化词条

/glib

提供的固有原料

"(stock item)

,创建一个

GtkButton

包含图像和文本

.

一些

stock ids

具有预处理宏,例如

GTK_STOCK_OK

GTK_STOCK_APPLY.

如果遇到不识别的

stock_id

,

那么他们将被视为

mnemonic label

(

参见

gtk_button_new_with_mnemonic()

).

stock_id

:the name of the stock item

Returns:a new GtkButton

gtk_button_new ()

GtkWidget* gtk_button_new (void)

创建一个新的

GtkButton

构件

(widget).

gtk_container_add()为

button

构件添加一个子构件。

Returns :The newly created GtkButton widget.

gtk_box_pack_start ()

void gtk_box_pack_start (GtkBox *box,

GtkWidget *child,

gboolean expand,

gboolean fill,

guint padding)

BOX

添加

child

,

box

的起点开始装入

child.

这个child

被装入后,其他的任何

child

装入时都将从起点装入

child

(

从左向右,从上到下

)

box

:

一个

GtkBox

child

:

被添加到

box

中的

GtkWidget

expand

:

TRUE

if the new child is to be given extra space allocated to

box

. The extra space will be divided evenly between all children of

box

that use this option

fill

:

TRUE

if space given to

child

by the

expand

option is actually allocated to

child

, rather than just padding it.

如果

expand

被设为

FLASE

的时候,这个属性将无效

. A child is

allocated the full height of a GtkHBox and the full width of a GtkVBox. This option affects the other dimension

padding

:

extra space in pixels to put between this child and its neighbors, over and above the global amount specified by "spacing" property. If

child

is a widget at o

reference ends of

box

, then

padding

pixels are also put between

child

and the reference edge of

box

----------------------------

gtk_box_pack_end ()

void gtk_box_pack_end (GtkBox *box,

GtkWidget *child,

gboolean expand,

gboolean fill,

guint padding)

BOX

添加

child

,

box

的尾部

(end)

开始装入

child.

这个child

被装入后,其他的任何

child

装入时都将从尾部

(end)

装入

child

(

从右向左,从下到上

)

其他同上记

gtk_box_pack_start()

expand / fill / padding

参数的动作,基本如下图

…/…/showart_2152698.…2/12