gtk-sharp2.12.0.0Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details.A widget which indicates progress visually.The is typically used to display the progress of a long running operation.
It provides a visual clue that processing is underway.
The can be used in two different modes: percentage mode and activity mode.When an application can determine how much work needs to take place (e.g. read a fixed number of bytes from a file) and can monitor its progress,
it can use the in percentage mode and the user sees a growing bar indicating the percentage of the work that has been completed.
In this mode, the application is required to set periodically to update the progress bar.When an application has no accurate way of knowing the amount of work to do, it can use the in activity mode, which shows activity by a block moving back and forth within the progress area.
In this mode, the application is required to call perodically to update the progress bar.There is quite a bit of flexibility provided to control the appearance of the .
Functions are provided to control the orientation of the bar, optional text can be displayed along with the bar, and the step size used in activity mode can be set.
The following example show how percentage mode works
using System;
using Gtk;
namespace TestGtkAlone
{
public class TestProgress
{
static Gtk.ProgressBar PBar;
static void Main()
{
Gtk.Application.Init();
Gtk.Window WinPBar = new Window("Test Progress bar - Percentage mode");
Gtk.HBox HContainer = new Gtk.HBox(false, 2);
PBar = new ProgressBar();
Gtk.Button ButtonStart = new Gtk.Button("Start Progress");
HContainer.Add(PBar);
HContainer.Add(ButtonStart);
ButtonStart.Clicked += new EventHandler(ButtonStart_Clicked);
WinPBar.Add(HContainer);
WinPBar.ShowAll();
Gtk.Application.Run();
}
public static void ButtonStart_Clicked(object sender, EventArgs args)
{
PBar.Adjustment.Lower = 0;
PBar.Adjustment.Upper = 1000;
while (PBar.Adjustment.Value < PBar.Adjustment.Upper) {
PBar.Adjustment.Value+=1;
}
}
}
}
Gtk.WidgetMethodSystem.VoidIndicates an unknown amount of progress has been madeIndicates that some progress has been made, but you don't know how much.
This causes the to enter "activity mode," where a block bounces back and forth.
Each call to causes the block to move by a little bit (the amount of movement per pulse is determined by ).ConstructorInternal constructor
Pointer to the C object.
This is an internal constructor, and should not be used by user code.ConstructorCreates a new .Creates a new .PropertyGtk.AdjustmentDetails about the increments used in updating the ProgressBar.an object of type GLib.Property("adjustment")PropertySystem.UInt32The number of blocks that the is divided into.an object of type The number of blocks that the is divided into when the style is discrete.GLib.Property("discrete-blocks")System.ObsoletePropertySystem.StringThe text displayed superimposed on the .an object of type The text displayed superimposed on the , if any, otherwise .
The return value is a reference to the text, not a copy of it, so will become invalid if you change the text in the .GLib.Property("text")PropertyGtk.ProgressBarOrientationThe current orientation.an object of type The current orientation.GLib.Property("orientation")PropertySystem.UInt32The step value used when the is in activity mode.an object of type The step value used when the is in activity mode.
The step is the amount by which the progress is incremented each iteration.GLib.Property("activity-step")System.ObsoletePropertySystem.DoubleThe current fraction of the task that has been completed.an object of type The current fraction of the task that has been completed.GLib.Property("fraction")PropertySystem.UInt32The number of blocks used when the is in activity mode.an object of type The number of blocks used when the is in activity mode.
Larger numbers make the visible block smaller.GLib.Property("activity-blocks")System.ObsoletePropertyGtk.ProgressBarStyleThe style for drawing the .an object of type The style for drawing the .
Continuous - The grows in a smooth, continuous manner.
Discrete - The grows in discrete, visible blocks.GLib.Property("bar-style")System.ObsoletePropertySystem.DoubleThe fraction of total length to move the bouncing block for each call to .an object of type The fraction of total length to move the bouncing block for each call to .GLib.Property("pulse-step")PropertyGLib.GTypeGType Property.a Returns the native value for .ConstructorProtected Constructor.
a Chain to this constructor if you have manually registered a native value for your subclass.System.ObsoleteMethodSystem.VoidUpdate the progress bar with a new percentage-done.
It's marked as obsolete - it's better to use
a , the percentage completed this bar should display.
ConstructorPublic constructor.
a PropertyPango.EllipsizeModeTo be addeda To be addedGLib.Property("ellipsize")