Shellminator V3.0.1
Simple Terminal
|
This class can create a simple plotter object. More...
#include <Shellminator-Progress.hpp>
Public Member Functions | |
ShellminatorProgress () | |
void | init (Shellminator *parent_p, Stream *channel_p) override |
Init function. More... | |
void | draw (bool noClear=false) override |
Draw function. More... | |
void | update (int width_p, int height_p) override |
Update function. More... | |
void | forceRedraw () override |
void | setText (const char *text_p) |
Set progress text. More... | |
void | setFormat (const char *format_p) |
Format options. More... | |
void | setPercentage (float percentage_p) |
Set current percentage. More... | |
void | setStep (int current, int total) |
Set current step. More... | |
void | setColor (Shellminator::textColor_t color_p) |
You can modify the color of the bar. More... | |
void | start () |
Start trigger event. More... | |
![]() | |
virtual void | draw (bool noClear=false) |
Draw function. More... | |
virtual void | init (Shellminator *parent_p, Stream *channel_p) |
Init function. More... | |
virtual void | setOrigin (int x, int y) |
Origin of the top left corner. More... | |
virtual void | update (int width_p, int height_p) |
Update function. More... | |
virtual void | forceRedraw () |
int | left () |
Return the coordinate of the left column next to the object. More... | |
int | right () |
Return the coordinate of the right column next to the object. More... | |
int | up () |
Return the coordinate of the upper row next to the object. More... | |
int | down () |
Return the coordinate of the lower row next to the object. More... | |
Shellminator * | getParent () |
void | attachEndFunction (void(*end_func_p)(Shellminator *)) |
void | removeEndFunction () |
Private Attributes | |
bool | redraw = true |
This flag shows that redraw is necessary. More... | |
Shellminator::textColor_t | color = Shellminator::WHITE |
float | percentage = 0.0 |
const char * | text = NULL |
const char * | format = NULL |
unsigned long | timerStart = 0 |
Additional Inherited Members | |
![]() | |
int | row = 1 |
It is used by the grid layout. More... | |
int | column = 1 |
It is used by the grid layout. More... | |
int | columnSpan = 1 |
It is used by the grid layout. More... | |
int | rowSpan = 1 |
It is used by the grid layout. More... | |
ShellminatorScreen * | nextElement = NULL |
It is used by the grid layout. More... | |
void(*)(Shellminator *) | getEndFunction () |
![]() | |
Shellminator * | parent = NULL |
Pointer to the caller terminal object. More... | |
Stream * | channel = NULL |
int | width = 1 |
Actual width of the object. More... | |
int | height = 1 |
Actual height of the object. More... | |
int | originX = 1 |
X coordinate of the origin. More... | |
int | originY = 1 |
Y coordinate of the origin. More... | |
void(* | end_func )(Shellminator *) = NULL |
This class can create a simple plotter object.
With this class, you can easily create a plotter object, which is capable of real time plotting. It can be attached to the main terminal with the beginScreen function.
Definition at line 60 of file Shellminator-Progress.hpp.
ShellminatorProgress::ShellminatorProgress | ( | ) |
Definition at line 36 of file Shellminator-Progress.cpp.
|
overridevirtual |
Draw function.
This function is called by the caller terminal if redraw is requested. If you need to draw your screen, the requestRedraw function must be called on the parent terminal object. The reason for this is to save some CPU time and do not waste it to draw something unnecessarily.
Reimplemented from ShellminatorScreen.
Definition at line 46 of file Shellminator-Progress.cpp.
|
overridevirtual |
Reimplemented from ShellminatorScreen.
Definition at line 375 of file Shellminator-Progress.cpp.
|
overridevirtual |
Init function.
This function is called by the host terminal, when the plot object gets registered to it. You can put all the initialisation section here.
parent_p | Pointer to the caller terminal object. |
channel_p | This is a pointer to a Stream object, which can be used to print the output data. |
channel_p
object instead of parent -> channel
method. This object can be a regular channel or a buffer accelerated one. The logic behind the buffering and flushing is handled by the caller terminal. Reimplemented from ShellminatorScreen.
Definition at line 40 of file Shellminator-Progress.cpp.
void ShellminatorProgress::setColor | ( | Shellminator::textColor_t | color_p | ) |
You can modify the color of the bar.
Definition at line 367 of file Shellminator-Progress.cpp.
void ShellminatorProgress::setFormat | ( | const char * | format_p | ) |
Format options.
You can specify a custom format to add some useful informations about the progress.
format_p | Format string. |
Format string option characters: -s
: Seconds since start event. -m
: Minutes since start event. -t
: Time since start event[ mm:ss ]. -r
: Estimated remaining time[ mm:ss ].
|
: Vertical separator will be printed.For example this format ms| r
will produce this string: 0m 3s | 01:30 left
Definition at line 346 of file Shellminator-Progress.cpp.
void ShellminatorProgress::setPercentage | ( | float | percentage_p | ) |
Set current percentage.
percentage_p | Percentage value[ 0.0 - 100.0 ]. |
Definition at line 351 of file Shellminator-Progress.cpp.
void ShellminatorProgress::setStep | ( | int | current, |
int | total | ||
) |
Set current step.
current | Current step index. |
total | Number of total steps. |
Definition at line 363 of file Shellminator-Progress.cpp.
void ShellminatorProgress::setText | ( | const char * | text_p | ) |
Set progress text.
You can give some information about the current process step.
text_p | Progress text. |
Definition at line 341 of file Shellminator-Progress.cpp.
void ShellminatorProgress::start | ( | ) |
Start trigger event.
Start event for timings.
Definition at line 371 of file Shellminator-Progress.cpp.
|
overridevirtual |
Update function.
The update function must be used to process events and not to draw the objects. It is called much frequently than, the draw function. All the event handling should be done in the update function, including key and mouse detection along with various events.
width_p | The width of the screen area in characters. |
height_p | The height of the screen area in characters. |
Reimplemented from ShellminatorScreen.
Definition at line 316 of file Shellminator-Progress.cpp.
|
private |
Definition at line 151 of file Shellminator-Progress.hpp.
|
private |
Definition at line 160 of file Shellminator-Progress.hpp.
|
private |
Definition at line 154 of file Shellminator-Progress.hpp.
|
private |
This flag shows that redraw is necessary.
In this implementation redraw is only required when the screen is resized.
Definition at line 148 of file Shellminator-Progress.hpp.
|
private |
Definition at line 157 of file Shellminator-Progress.hpp.
|
private |
Definition at line 163 of file Shellminator-Progress.hpp.