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.
|
The step size of the activity indicator, and the number of blocks are set using the following functions.
|
When in continuous mode, the progress bar can also display a configurable text string within its trough, using the following function.
|
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:
|
The show_text argument is a boolean TRUE/FALSE value. The appearance of the text can be modified further using:
|
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.
|
There is yet another way to change the range and value of a progress object using the following function:
|
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:
|
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.
|
推荐文章
精彩文章
|