2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkProgressBar.html
27 * outFile = ProgressBar
28 * strct = GtkProgressBar
48 * - GtkAdjustment* -> Adjustment
53 module gtk
.ProgressBar
;
59 import tango
.io
.Stdout
; // use the tango loging?
63 private import gtkc
.gtktypes
;
65 private import gtkc
.gtk
;
68 private import glib
.Str
;
69 private import gtk
.Adjustment
;
76 * The GtkProgressBar is typically used to display the progress of a long
77 * running operation. It provides a visual clue that processing
78 * is underway. The GtkProgressBar can be used in two different
79 * modes: percentage mode and activity mode.
80 * When an application can determine how much work needs to take place
81 * (e.g. read a fixed number of bytes from a file) and can monitor its
82 * progress, it can use the GtkProgressBar in percentage mode and the user
83 * sees a growing bar indicating the percentage of the work that has
84 * been completed. In this mode, the application is required to call
85 * gtk_progress_bar_set_fraction() periodically to update the progress bar.
86 * When an application has no accurate way of knowing the amount of work
87 * to do, it can use the GtkProgressBar in activity mode, which shows activity
88 * by a block moving back and forth within the progress area. In this mode,
89 * the application is required to call gtk_progress_bar_pulse() perodically
90 * to update the progress bar.
91 * There is quite a bit of flexibility provided to control the appearance
92 * of the GtkProgressBar. Functions are provided to control the
93 * orientation of the bar, optional text can be displayed along with
94 * the bar, and the step size used in activity mode can be set.
96 * The GtkProgressBar/GtkProgress API in GTK 1.2 was bloated, needlessly complex
97 * and hard to use properly. Therefore GtkProgress has been deprecated
98 * completely and the GtkProgressBar API has been reduced to the following 10
99 * functions: gtk_progress_bar_new(), gtk_progress_bar_pulse(),
100 * gtk_progress_bar_set_text(), gtk_progress_bar_set_fraction(),
101 * gtk_progress_bar_set_pulse_step(), gtk_progress_bar_set_orientation(),
102 * gtk_progress_bar_get_text(), gtk_progress_bar_get_fraction(),
103 * gtk_progress_bar_get_pulse_step(), gtk_progress_bar_get_orientation().
104 * These have been grouped at the beginning of this section, followed by
105 * a large chunk of deprecated 1.2 compatibility functions.
107 private import gtk
.Progress
;
108 public class ProgressBar
: Progress
111 /** the main Gtk struct */
112 protected GtkProgressBar
* gtkProgressBar
;
115 public GtkProgressBar
* getProgressBarStruct()
117 return gtkProgressBar
;
121 /** the main Gtk struct as a void* */
122 protected void* getStruct()
124 return cast(void*)gtkProgressBar
;
128 * Sets our main struct and passes it to the parent class
130 public this (GtkProgressBar
* gtkProgressBar
)
134 if ( gtkProgressBar
is null )
139 Stdout("struct gtkProgressBar is null on constructor").newline
;
143 printf("struct gtkProgressBar is null on constructor");
150 assert(gtkProgressBar
!is null, "struct gtkProgressBar is null on constructor");
152 super(cast(GtkProgress
*)gtkProgressBar
);
153 this.gtkProgressBar
= gtkProgressBar
;
161 * Creates a new GtkProgressBar.
167 // GtkWidget* gtk_progress_bar_new (void);
168 this(cast(GtkProgressBar
*)gtk_progress_bar_new() );
172 * Indicates that some progress is made, but you don't know how much.
173 * Causes the progress bar to enter "activity mode," where a block
174 * bounces back and forth. Each call to gtk_progress_bar_pulse()
175 * causes the block to move by a little bit (the amount of movement
176 * per pulse is determined by gtk_progress_bar_set_pulse_step()).
182 // void gtk_progress_bar_pulse (GtkProgressBar *pbar);
183 gtk_progress_bar_pulse(gtkProgressBar
);
187 * Causes the given text to appear superimposed on the progress bar.
191 * a UTF-8 string, or NULL
193 public void setText(char[] text
)
195 // void gtk_progress_bar_set_text (GtkProgressBar *pbar, const gchar *text);
196 gtk_progress_bar_set_text(gtkProgressBar
, Str
.toStringz(text
));
200 * Causes the progress bar to "fill in" the given fraction
201 * of the bar. The fraction should be between 0.0 and 1.0,
206 * fraction of the task that's been completed
208 public void setFraction(double fraction
)
210 // void gtk_progress_bar_set_fraction (GtkProgressBar *pbar, gdouble fraction);
211 gtk_progress_bar_set_fraction(gtkProgressBar
, fraction
);
215 * Sets the fraction of total progress bar length to move the
216 * bouncing block for each call to gtk_progress_bar_pulse().
220 * fraction between 0.0 and 1.0
222 public void setPulseStep(double fraction
)
224 // void gtk_progress_bar_set_pulse_step (GtkProgressBar *pbar, gdouble fraction);
225 gtk_progress_bar_set_pulse_step(gtkProgressBar
, fraction
);
229 * Causes the progress bar to switch to a different orientation
230 * (left-to-right, right-to-left, top-to-bottom, or bottom-to-top).
234 * orientation of the progress bar
236 public void setOrientation(GtkProgressBarOrientation orientation
)
238 // void gtk_progress_bar_set_orientation (GtkProgressBar *pbar, GtkProgressBarOrientation orientation);
239 gtk_progress_bar_set_orientation(gtkProgressBar
, orientation
);
243 * Sets the mode used to ellipsize (add an ellipsis: "...") the text
244 * if there is not enough space to render the entire string.
248 * a PangoEllipsizeMode
251 public void setEllipsize(PangoEllipsizeMode mode
)
253 // void gtk_progress_bar_set_ellipsize (GtkProgressBar *pbar, PangoEllipsizeMode mode);
254 gtk_progress_bar_set_ellipsize(gtkProgressBar
, mode
);
259 * Retrieves the text displayed superimposed on the progress bar,
260 * if any, otherwise NULL. The return value is a reference
261 * to the text, not a copy of it, so will become invalid
262 * if you change the text in the progress bar.
266 * text, or NULL; this string is owned by the widget
267 * and should not be modified or freed.
269 public char[] getText()
271 // const gchar* gtk_progress_bar_get_text (GtkProgressBar *pbar);
272 return Str
.toString(gtk_progress_bar_get_text(gtkProgressBar
) );
276 * Returns the current fraction of the task that's been completed.
280 * a fraction from 0.0 to 1.0
282 public double getFraction()
284 // gdouble gtk_progress_bar_get_fraction (GtkProgressBar *pbar);
285 return gtk_progress_bar_get_fraction(gtkProgressBar
);
289 * Retrieves the pulse step set with gtk_progress_bar_set_pulse_step()
293 * a fraction from 0.0 to 1.0
295 public double getPulseStep()
297 // gdouble gtk_progress_bar_get_pulse_step (GtkProgressBar *pbar);
298 return gtk_progress_bar_get_pulse_step(gtkProgressBar
);
302 * Retrieves the current progress bar orientation.
306 * orientation of the progress bar
308 public GtkProgressBarOrientation
getOrientation()
310 // GtkProgressBarOrientation gtk_progress_bar_get_orientation (GtkProgressBar *pbar);
311 return gtk_progress_bar_get_orientation(gtkProgressBar
);
315 * Returns the ellipsizing position of the progressbar.
316 * See gtk_progress_bar_set_ellipsize().
323 public PangoEllipsizeMode
getEllipsize()
325 // PangoEllipsizeMode gtk_progress_bar_get_ellipsize (GtkProgressBar *pbar);
326 return gtk_progress_bar_get_ellipsize(gtkProgressBar
);
331 * gtk_progress_bar_new_with_adjustment is deprecated and should not be used in newly-written code.
332 * Creates a new GtkProgressBar with an associated GtkAdjustment.
338 public this (Adjustment adjustment
)
340 // GtkWidget* gtk_progress_bar_new_with_adjustment (GtkAdjustment *adjustment);
341 this(cast(GtkProgressBar
*)gtk_progress_bar_new_with_adjustment((adjustment
is null) ?
null : adjustment
.getAdjustmentStruct()) );
346 * gtk_progress_bar_set_bar_style is deprecated and should not be used in newly-written code.
347 * Sets the style of the GtkProgressBar. The default style is
348 * GTK_PROGRESS_CONTINUOUS.
352 * a GtkProgressBarStyle value indicating the desired style.
354 public void setBarStyle(GtkProgressBarStyle style
)
356 // void gtk_progress_bar_set_bar_style (GtkProgressBar *pbar, GtkProgressBarStyle style);
357 gtk_progress_bar_set_bar_style(gtkProgressBar
, style
);
363 * gtk_progress_bar_set_discrete_blocks is deprecated and should not be used in newly-written code.
364 * Sets the number of blocks that the progress bar is divided into
365 * when the style is GTK_PROGRESS_DISCRETE.
369 * number of individual blocks making up the bar.
371 public void setDiscreteBlocks(uint blocks
)
373 // void gtk_progress_bar_set_discrete_blocks (GtkProgressBar *pbar, guint blocks);
374 gtk_progress_bar_set_discrete_blocks(gtkProgressBar
, blocks
);
379 * gtk_progress_bar_set_activity_step is deprecated and should not be used in newly-written code.
380 * Sets the step value used when the progress bar is in activity
381 * mode. The step is the amount by which the progress is incremented
386 * the amount which the progress is incremented in activity
389 public void setActivityStep(uint step
)
391 // void gtk_progress_bar_set_activity_step (GtkProgressBar *pbar, guint step);
392 gtk_progress_bar_set_activity_step(gtkProgressBar
, step
);
397 * gtk_progress_bar_set_activity_blocks is deprecated and should not be used in newly-written code.
398 * Sets the number of blocks used when the progress bar is in activity
399 * mode. Larger numbers make the visible block smaller.
403 * number of blocks which can fit within the progress bar area.
405 public void setActivityBlocks(uint blocks
)
407 // void gtk_progress_bar_set_activity_blocks (GtkProgressBar *pbar, guint blocks);
408 gtk_progress_bar_set_activity_blocks(gtkProgressBar
, blocks
);
413 * gtk_progress_bar_update is deprecated and should not be used in newly-written code.
414 * This function is deprecated. Please use gtk_progress_set_value() or
415 * gtk_progress_set_percentage() instead.
419 * the new percent complete value.
421 * The "activity-blocks" property
422 * "activity-blocks" guint : Read / Write
423 * The number of blocks which can fit in the progress bar area in activity mode (Deprecated).
424 * Allowed values: >= 2
427 public void update(double percentage
)
429 // void gtk_progress_bar_update (GtkProgressBar *pbar, gdouble percentage);
430 gtk_progress_bar_update(gtkProgressBar
, percentage
);