Shellminator V3.0.1
Simple Terminal
Loading...
Searching...
No Matches
ShellminatorList Class Reference

#include <Shellminator-List.hpp>

Inheritance diagram for ShellminatorList:
Collaboration diagram for ShellminatorList:

Public Member Functions

 ShellminatorList ()
 Empty constructor. More...
 
 ShellminatorList (const char *optionsList_p[], int listSize_p, const char *instruction_p)
 
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 attachCallback (void(*func_p)(const char *[], int, int, ShellminatorScreen *))
 
virtual void printExtra (int index, bool noClear)
 
- Public Member Functions inherited from ShellminatorScreen
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...
 
ShellminatorgetParent ()
 
void attachEndFunction (void(*end_func_p)(Shellminator *))
 
void removeEndFunction ()
 

Protected Attributes

bool redraw = true
 This flag shows that redraw is necessary. More...
 
int selected = 0
 
int drawOffset = 0
 
void(* func )(const char *[], int, int, ShellminatorScreen *) = NULL
 Pointer to the event callback function. More...
 
const char ** optionsList = NULL
 Pointer to the options list. More...
 
int listSize = 0
 Size of the options list. More...
 
const char * instruction = NULL
 Pointer to the instruction list. More...
 
int instructionLines = 0
 
- Protected Attributes inherited from ShellminatorScreen
Shellminatorparent = 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
 

Additional Inherited Members

- Public Attributes inherited from ShellminatorScreen
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...
 
ShellminatorScreennextElement = NULL
 It is used by the grid layout. More...
 
void(*)(Shellminator *) getEndFunction ()
 

Detailed Description

Definition at line 55 of file Shellminator-List.hpp.

Constructor & Destructor Documentation

◆ ShellminatorList() [1/2]

ShellminatorList::ShellminatorList ( )

Empty constructor.

Definition at line 36 of file Shellminator-List.cpp.

◆ ShellminatorList() [2/2]

ShellminatorList::ShellminatorList ( const char *  optionsList_p[],
int  listSize_p,
const char *  instruction_p 
)

Definition at line 46 of file Shellminator-List.cpp.

Member Function Documentation

◆ attachCallback()

void ShellminatorList::attachCallback ( void(*)(const char *[], int, int, ShellminatorScreen *)  func_p)

Definition at line 135 of file Shellminator-List.cpp.

◆ draw()

void ShellminatorList::draw ( bool  noClear = false)
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 146 of file Shellminator-List.cpp.

Here is the call graph for this function:

◆ forceRedraw()

void ShellminatorList::forceRedraw ( )
overridevirtual

Reimplemented from ShellminatorScreen.

Definition at line 261 of file Shellminator-List.cpp.

◆ init()

void ShellminatorList::init ( Shellminator parent_p,
Stream *  channel_p 
)
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.

Parameters
parent_pPointer to the caller terminal object.
channel_pThis is a pointer to a Stream object, which can be used to print the output data.
Note
Please use the 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 60 of file Shellminator-List.cpp.

◆ printExtra()

void ShellminatorList::printExtra ( int  index,
bool  noClear 
)
virtual

Reimplemented in ShellminatorListDetailed.

Definition at line 139 of file Shellminator-List.cpp.

Here is the caller graph for this function:

◆ update()

void ShellminatorList::update ( int  width_p,
int  height_p 
)
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.

Parameters
width_pThe width of the screen area in characters.
height_pThe height of the screen area in characters.

Reimplemented from ShellminatorScreen.

Definition at line 68 of file Shellminator-List.cpp.

Member Data Documentation

◆ drawOffset

int ShellminatorList::drawOffset = 0
protected

Definition at line 111 of file Shellminator-List.hpp.

◆ func

void(* ShellminatorList::func) (const char *[], int, int, ShellminatorScreen *) = NULL
protected

Pointer to the event callback function.

It it is null, the callback is disabled.

Definition at line 115 of file Shellminator-List.hpp.

◆ instruction

const char* ShellminatorList::instruction = NULL
protected

Pointer to the instruction list.

Definition at line 124 of file Shellminator-List.hpp.

◆ instructionLines

int ShellminatorList::instructionLines = 0
protected

Definition at line 126 of file Shellminator-List.hpp.

◆ listSize

int ShellminatorList::listSize = 0
protected

Size of the options list.

Definition at line 121 of file Shellminator-List.hpp.

◆ optionsList

const char** ShellminatorList::optionsList = NULL
protected

Pointer to the options list.

Definition at line 118 of file Shellminator-List.hpp.

◆ redraw

bool ShellminatorList::redraw = true
protected

This flag shows that redraw is necessary.

In this implementation redraw is only required when the screen is resized.

Definition at line 108 of file Shellminator-List.hpp.

◆ selected

int ShellminatorList::selected = 0
protected

Definition at line 110 of file Shellminator-List.hpp.