推荐bo00.cublog
可是目前GTK+的stable版式 2.18 ,unstable版是2.19.3
哪里跑出来的2.8和2.4呀。原来↓:
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 参数的动作,基本如下图
gtk_widget_set_size_request ()
设置widget的最小尺寸(拉动窗口的话,到这个最小size为止,不能在小了); 也就是说,要求这个wideget的尺寸高度宽度. 你可以用这个函数来强制设定widget的尺寸,比通常的size大或小.
In most cases, gtk_window_set_default_size() is a better choice for toplevel windows than this function; setting the default size will still allow users to shrink the window size request will force them to leave the window at least as large as the size request. When dealing with window sizes, gtk_window_set_geometry_hints() can be a usefu well.
Note the inherent danger of setting any fixed size - themes, translations into other languages, different fonts, and user action can all change the appropriate size for So, it's basically impossible to hardcode a size that will always be correct.
The size request of a widget is the smallest size a widget can accept while still functioning well and drawing itself correctly. However in some strange cases a widget less than its requested size, and in many cases a widget may be allocated more space than it requested.
If the size request in a given direction is -1 (unset), then the "natural" size request of the widget will be used instead.
如果这个size给定了一个'-1'的值的话,那么这个widget就会利用'自然值'。(我觉得就是,可随窗口的拉伸而自由的放大缩小)
Widgets can't actually be allocated a size less than 1 by 1, but you can pass 0,0 to this function to mean "as small as possible."
widget:a GtkWidget
字符串函数title作用width:width widget should request, or -1 to unset
height:height widget should request, or -1 to unset
gtk_timeout_add ()
gtk_timeout_add已经被遗弃自从2.4版之后,并且在新写的代码中也不使用。请用替代寒素g_timeout_add().
g_timeout_add ()
guint g_timeout_add (guint interval,
GSourceFunc function,
gpointer data)
设定一个函数,每隔一段时间就被调用, 并是默认优先权, G_PRIORITY_DEFAULT. 这个函数反复地被调用知道返回FALSE, 在那个点上timeout将被自动地消除,从此不再调用那个指定函数.首次调达设置的interval的尽头.
注意,这个timeout函数是有可能被延时的, 因为其他的event源被处理. 因此他们不被用来做精确定时. 这个timeout函数在每一次被调用之后, 下次timeout的时间将被基于当前时间来重新计算并给会加快时间试图赶上弥补延时的影响).
如果你想有一个基于“秒”单位的定时器并且不在乎是否为精确时间,可以使用g_timeout_add_seconds(); this function allows for more optimizations and more efficient system power u This internally creates a main loop source using g_timeout_source_new() and attaches it to the main loop context using g_source_attach(). You can do these steps manual greater control.
interval :两次调用函数之间的时间间隔, 单位毫秒 (1/1000ths of a second)
function :调用的指定函数function to call
data :传递给指定函数的参数data to pass to function
Returns:事件源的ID。the ID (大于 >0) of the event source.
gtk_dialog_new_with_buttons ()
GtkWidget* gtk_dialog_new_with_buttons (const gchar *title,
GtkWindow *parent,
GtkDialogFlags flags,
const gchar *first_button_text,
...)
创建个新的GtkDi l并有标题i l (或为NULL利用默认titl请看k i d i l()) 以及 t i t t  (或为NULL f k i d i f()

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。