Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->Linux技术 ->系统管理 ->正文

GTK v1.2 Tutorial(英文)

来源:Linux-cn.com 作者:Webmaster 时间:2007-05-05 点击: [收藏] [投稿]

void gtk_progress_bar_set_discrete_blocks( GtkProgressBar *pbar,
 guint blocks );

  As well as indicating the amount of progress that has occured, the progress bar may be set to just indicate that there is some activity. This can be useful in situations where progress cannot be measured against a value range. Activity mode is not effected by the bar style that is described above, and overrides it. This mode is either TRUE or FALSE, and is selected by the following function.


void gtk_progress_set_activity_mode( GtkProgress *progress,
 guintactivity_mode );

  The step size of the activity indicator, and the number of blocks are set using the following functions.


void gtk_progress_bar_set_activity_step( GtkProgressBar *pbar,
 guint step );
void gtk_progress_bar_set_activity_blocks( GtkProgressBar *pbar,
 guint blocks );

  When in continuous mode, the progress bar can also display a configurable text string within its trough, using the following function.


void gtk_progress_set_format_string(GtkProgress *progress,gchar *format);

  The format argument is similiar to one that would be used in a C printf statement. The following directives may be used within the format string:

  %p - percentage

  %v - value

  %l - lower range value

  %u - upper range value

  The displaying of this text string can be toggled using:


void gtk_progress_set_show_text( GtkProgress *progress,gint show_text );

  The show_text argument is a boolean TRUE/FALSE value. The appearance of the text can be modified further using:


void gtk_progress_set_text_alignment( GtkProgress *progress,
gfloat x_align,gfloat y_align );

  The x_align and y_align arguments take values between 0.0 and 1.0. Their values indicate the position of the text string within the trough. Values of 0.0 for both would place the string in the top left hand corner; values of 0.5 (the default) centres the text, and values of 1.0 places the text in the lower right hand corner.

  The current text setting of a progress object can be retrieved using the current or a specified adjustment value using the following two functions. The character string returned by these functions should be freed by the application (using the g_free() function). These functions return the formatted string that would be displayed within the trough.


gchar *gtk_progress_get_current_text( GtkProgress *progress );
gchar *gtk_progress_get_text_from_value( GtkProgress *progress,
 gfloat value );

  There is yet another way to change the range and value of a progress object using the following function:


void gtk_progress_configure( GtkProgress*progress,
gfloatvalue,gfloatmin,gfloatmax );

  This function provides quite a simple interface to the range and value of a progress object.

  The remaining functions can be used to get and set the current value of a progess object in various types and formats:


void gtk_progress_set_percentage( GtkProgress *progress,
gfloat percentage );
void gtk_progress_set_value( GtkProgress *progress,
 gfloat value );
gfloat gtk_progress_get_value( GtkProgress *progress );
gfloat gtk_progress_get_current_percentage( GtkProgress *progress );
gfloat gtk_progress_get_percentage_from_value( GtkProgress *progress,
 gfloat value );

  These functions are pretty self explanatory. The last function uses the the adjustment of the specified progess object to compute the percentage value of the given range value.

  Progress Bars are usually used with timeouts or other such functions (see section on Timeouts, I/O and Idle Functions) to give the illusion of multitasking. All will employ the gtk_progress_bar_update function in the same manner.

  Here is an example of the progress bar, updated using timeouts. This code also shows you how to reset the Progress Bar.



 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<

上一页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2223 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 下一页


上一篇:GTK入门导引   下一篇:GDK Reference Manual

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
·Motorola微处理器bootloader分析与应用
·Fedora Core5 NFS服务器搭建过程介绍
·Linux系统:让内存不再泄漏的实用技巧
·新手看招 手把手教你安装VMware虚拟机
·“侵权事件” 红帽称微软企图干扰用户
·删除Linux后 如何找回Windows启动菜单
·菜鸟乐园 Linux中常见文件系统格式介绍
·Linux操作系统下IPTables配置方法详解
·实用技巧 Linux系统的经典使用技巧八则
·Linux系统文件优化及磁盘检查方法介绍
Power by linux-cn.com 粤ICP备05006655号