Chinaunix首页 | 论坛 | 博客
  • 博客访问: 886726
  • 博文数量: 380
  • 博客积分: 3495
  • 博客等级: 中校
  • 技术积分: 3996
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-02 09:35
文章分类

全部博文(380)

文章存档

2015年(2)

2014年(5)

2013年(9)

2012年(9)

2011年(67)

2010年(103)

2009年(182)

2008年(3)

我的朋友

分类: C/C++

2009-02-28 14:11:07

做为一个GUI系统,很自然的会有部局的要求。
那么GTK是用什么来控制部局的呢?跟现在大家熟悉的WTP,SWING基本上一样,
用box来管理的。下面就是box涉及到的函数
GtkWidget *gtk_hbox_new ( gboolean homogeneous,       //设定所有的box内的对象大小是否一样
gint spacing ); //设定box内对象间的间距
gtk_vbox_new() //创建竖向的,而上面的是横向的。

void gtk_box_pack_start( GtkBox *box, //box对象
GtkWidget *child, //要放到box中的对象
gboolean expand, //是否自动调整大小,随窗口
gboolean fill, //是否填充所有的空白
guint padding ); //设定对象的padding

这里要说明的spacing与padding的区别。
spacing:设定对象间的间距。
padding:设定对象自己周围的空白。

gtk_box_pack_end() //结束部局处理

当然了,还有一种更强大的部局管理。
TABLE

GtkWidget *gtk_table_new( guint rows, //行
guint columns, //列
gboolean homogeneous ); //对象大小相同
原始的放置对象函数
void gtk_table_attach( GtkTable *table,
GtkWidget *child,
guint left_attach,
guint right_attach,
guint top_attach,
guint bottom_attach,
GtkAttachOptions xoptions,
GtkAttachOptions yoptions,
guint xpadding,
guint ypadding );

默认的放置对象函数
void gtk_table_attach_defaults( GtkTable *table,
GtkWidget *widget,
guint left_attach,
guint right_attach,
guint top_attach,
guint bottom_attach );
设定行间距
void gtk_table_set_row_spacing( GtkTable *table,
guint row,
guint spacing );
设定列间距
void gtk_table_set_col_spacing ( GtkTable *table,
guint column,
guint spacing );

设定所有行或列的间距
void gtk_table_set_row_spacings( GtkTable *table,
guint spacing );
void gtk_table_set_col_spacings( GtkTable *table,
guint spacing );
阅读(574) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~