![]() |
ezEngine
Release 25.03
|
ezProgressRange is the preferred method to inform the system of progress. More...
#include <Progress.h>
Public Member Functions | |
ezProgressRange (ezStringView sDisplayText, ezUInt32 uiSteps, bool bAllowCancel, ezProgress *pProgressbar=nullptr) | |
Creates a progress range scope. More... | |
ezProgressRange (ezStringView sDisplayText, bool bAllowCancel, ezProgress *pProgressbar=nullptr) | |
Creates a progress range scope without steps. Use SetCompletion to manually set the completion value. | |
~ezProgressRange () | |
The destructor closes the current range. All progress in this range is assumed to have completed, even if BeginNextStep() has not been called once for every subdivision step. | |
ezProgress * | GetProgressbar () const |
Returns the ezProgress instance that this range uses. | |
void | SetStepWeighting (ezUInt32 uiStep, float fWeight) |
Allows to weigh each step differently. More... | |
bool | BeginNextStep (ezStringView sStepDisplayText, ezUInt32 uiNumSteps=1) |
Should be called whenever a new sub-step is started to advance the progress. More... | |
bool | SetCompletion (double fCompletionFactor) |
Manually set the completion value between 0..1. | |
bool | WasCanceled () const |
Whether the user requested to cancel the operation. | |
Friends | |
class | ezProgress |
ezProgressRange is the preferred method to inform the system of progress.
ezProgressRange is a scoped class, ie. upon creation it adds a range to the current progress and upon destruction the entire range is considered to be completed. Ranges can be nested. For instance when a top level range consists of three 'steps', then opening a nested range will sub-divide that first step. When the nested range is closed, the first top-level step is finished and BeginNextStep() should be called on the top-level range. Subsequently the second step is active and can again be further subdivided with another nested ezProgressRange.
ezProgressRange::ezProgressRange | ( | ezStringView | sDisplayText, |
ezUInt32 | uiSteps, | ||
bool | bAllowCancel, | ||
ezProgress * | pProgressbar = nullptr |
||
) |
Creates a progress range scope.
If any other progress range is currently active, it will become the parent range and the currently active step will be subdivided.
szDisplayText | is the main display text for this range. |
uiSteps | is the number of steps that this range will be subdivided into |
bAllowCancel | specifies whether the user can cancel this operation |
pProgressbar | can be specified, if available, otherwise the currently active ezProgress instance is used. |
bool ezProgressRange::BeginNextStep | ( | ezStringView | sStepDisplayText, |
ezUInt32 | uiNumSteps = 1 |
||
) |
Should be called whenever a new sub-step is started to advance the progress.
szStepDisplayText | The sub-text for the next step to be displayed. |
uiNumSteps | How many steps have been completed. |
void ezProgressRange::SetStepWeighting | ( | ezUInt32 | uiStep, |
float | fWeight | ||
) |
Allows to weigh each step differently.
This makes it possible to divide an operation into two steps, but have one part take up 90% and the other 10%.
uiStep | The index for the step to set the weight |
fWeight | The weighting in [0; 1] range |