Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

Etk_Progress_Bar


Detailed Description

An Etk_Progress_Bar is a widget used to indicates the progress of an operation.

progress_bar.png
A progress bar can work in two different modes: the progress mode and the pulse mode.
  • In the progress mode, the progress bar has a growing bar that indicates the progress of the current operation. You can change the fraction of the total progress with etk_progress_bar_fraction_set(). This mode is used when you can have an accurate value of the progress.
  • In the pulse mode, the bar has a constant width and bounces inside the progress bar. It is moved each time you call etk_progress_bar_pulse(). You can also set the pulse-step with etk_progress_bar_pulse_step_set(). This mode is used when you can't know the progress of the operation (for example, it can be used for a download when you can't know the total size of the file)

Object Hierarchy:
  • Etk_Object
    • Etk_Widget
      • Etk_Progress_Bar
Properties:
  • "text": The text to display in the progress bar
    • Type: String (char *)
    • Access: Read/Write
    • Default Value: NULL
  • "fraction": The progress, between 0.0 and 1.0, of the progress bar
    • Type: Double
    • Access: Read/Write
    • Default Value: 0.0
  • "direction": The growth direction of the progress mode
    • Type: Integer (Etk_Progress_Bar_Direction)
    • Access: Read/Write
    • Default Value: ETK_PROGRESS_BAR_LEFT_TO_RIGHT
  • "pulse-step": The fraction of the total progress to move the filler when the progress bar is pulsed
    • Type: Double
    • Access: Read/Write
    • Default Value: 0.1


Data Structures

struct  Etk_Progress_Bar
 [Widget] A widget used to indicates the progress of an operation More...

Defines

#define ETK_PROGRESS_BAR_TYPE   (etk_progress_bar_type_get())
#define ETK_PROGRESS_BAR(obj)   (ETK_OBJECT_CAST((obj), ETK_PROGRESS_BAR_TYPE, Etk_Progress_Bar))
#define ETK_IS_PROGRESS_BAR(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_PROGRESS_BAR_TYPE))

Enumerations

enum  Etk_Progress_Bar_Direction {
  ETK_PROGRESS_BAR_LEFT_TO_RIGHT,
  ETK_PROGRESS_BAR_RIGHT_TO_LEFT
}
 Possible growth directions for the progress bar (left to right by default). More...

Functions

Etk_Widget * etk_progress_bar_new (void)
 Creates a new progress bar.
Etk_Widget * etk_progress_bar_new_with_text (const char *text)
 Creates a new progress bar with a text.
void etk_progress_bar_text_set (Etk_Progress_Bar *progress_bar, const char *text)
 Sets the text of the progress bar.
const char * etk_progress_bar_text_get (Etk_Progress_Bar *progress_bar)
 Gets the text of the progress bar.
void etk_progress_bar_fraction_set (Etk_Progress_Bar *progress_bar, double fraction)
 Sets the fraction (percentage) of the progress bar.
double etk_progress_bar_fraction_get (Etk_Progress_Bar *progress_bar)
 Gets the fraction (percentage) of the progress bar.
void etk_progress_bar_pulse (Etk_Progress_Bar *progress_bar)
 Causes the progress bar to enter pulse mode, subsequent calls simply move the bar around.
void etk_progress_bar_pulse_step_set (Etk_Progress_Bar *progress_bar, double pulse_step)
 Set the step-size for the pulse mode, between 0.0 and 1.0. The step-size is the fraction of total progress to move the filler when it is pulsed.
double etk_progress_bar_pulse_step_get (Etk_Progress_Bar *progress_bar)
 Get the step-size for the pulse mode.
void etk_progress_bar_direction_set (Etk_Progress_Bar *progress_bar, Etk_Progress_Bar_Direction direction)
 Sets the growth direction of the progress bar (left to right, or right to left).
Etk_Progress_Bar_Direction etk_progress_bar_direction_get (Etk_Progress_Bar *progress_bar)
 Gets the growth direction of the progress bar (left to right, or right to left).


Define Documentation

#define ETK_PROGRESS_BAR_TYPE   (etk_progress_bar_type_get())

Gets the type of a progress bar

Referenced by etk_progress_bar_new(), and etk_progress_bar_new_with_text().

#define ETK_PROGRESS_BAR ( obj   )     (ETK_OBJECT_CAST((obj), ETK_PROGRESS_BAR_TYPE, Etk_Progress_Bar))

Casts the object to an Etk_Progress_Bar

#define ETK_IS_PROGRESS_BAR ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_PROGRESS_BAR_TYPE))

Checks if the object is an Etk_Progress_Bar


Enumeration Type Documentation

enum Etk_Progress_Bar_Direction

Possible growth directions for the progress bar (left to right by default).

Enumerator:
ETK_PROGRESS_BAR_LEFT_TO_RIGHT  The progress bar grows from left to right
ETK_PROGRESS_BAR_RIGHT_TO_LEFT  The progress bar grows from right to left


Function Documentation

Etk_Widget * etk_progress_bar_new ( void   ) 

Creates a new progress bar.

Returns:
Returns the new progress bar widget

References ETK_PROGRESS_BAR_TYPE, and etk_widget_new().

Etk_Widget * etk_progress_bar_new_with_text ( const char *  text  ) 

Creates a new progress bar with a text.

Parameters:
text the text to display in the progress bar
Returns:
Returns the new progress bar widget

References ETK_PROGRESS_BAR_TYPE, and etk_widget_new().

void etk_progress_bar_text_set ( Etk_Progress_Bar *  progress_bar,
const char *  text 
)

Sets the text of the progress bar.

Parameters:
progress_bar a progress bar
text the text to set

References ETK_OBJECT, etk_object_notify(), and text.

const char * etk_progress_bar_text_get ( Etk_Progress_Bar *  progress_bar  ) 

Gets the text of the progress bar.

Parameters:
progress_bar a progress bar
Returns:
Returns the text of the progress bar

References text.

void etk_progress_bar_fraction_set ( Etk_Progress_Bar *  progress_bar,
double  fraction 
)

Sets the fraction (percentage) of the progress bar.

Parameters:
progress_bar a progress bar
fraction the fraction (percentage) to set

References ETK_CLAMP, ETK_OBJECT, etk_object_notify(), ETK_WIDGET, fraction, and is_pulsing.

double etk_progress_bar_fraction_get ( Etk_Progress_Bar *  progress_bar  ) 

Gets the fraction (percentage) of the progress bar.

Parameters:
progress_bar a progress bar
Returns:
Returns the fraction (percentage) of the progress bar

References fraction.

void etk_progress_bar_pulse ( Etk_Progress_Bar *  progress_bar  ) 

Causes the progress bar to enter pulse mode, subsequent calls simply move the bar around.

Parameters:
progress_bar a progress bar

References ETK_PROGRESS_BAR_LEFT_TO_RIGHT, ETK_PROGRESS_BAR_RIGHT_TO_LEFT, is_pulsing, pulse_dir, pulse_pos, and pulse_step.

void etk_progress_bar_pulse_step_set ( Etk_Progress_Bar *  progress_bar,
double  pulse_step 
)

Set the step-size for the pulse mode, between 0.0 and 1.0. The step-size is the fraction of total progress to move the filler when it is pulsed.

Parameters:
progress_bar a progress bar
pulse_step the step size

References ETK_CLAMP, ETK_OBJECT, etk_object_notify(), and pulse_step.

double etk_progress_bar_pulse_step_get ( Etk_Progress_Bar *  progress_bar  ) 

Get the step-size for the pulse mode.

Parameters:
progress_bar a progress bar
Returns:
Returns the step-size of the pulse mode

References pulse_step.

void etk_progress_bar_direction_set ( Etk_Progress_Bar *  progress_bar,
Etk_Progress_Bar_Direction  direction 
)

Sets the growth direction of the progress bar (left to right, or right to left).

Parameters:
progress_bar a progress bar
direction the direction to use

References direction, ETK_OBJECT, and etk_object_notify().

Etk_Progress_Bar_Direction etk_progress_bar_direction_get ( Etk_Progress_Bar *  progress_bar  ) 

Gets the growth direction of the progress bar (left to right, or right to left).

Parameters:
progress_bar a progress bar
Returns:
Returns the growth direction of the progress bar

References direction, and ETK_PROGRESS_BAR_LEFT_TO_RIGHT.