Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BaseDialog Class Referenceabstract

#include <BaseDialog.h>

Inheritance diagram for BaseDialog:
MenuBasedDialog NoRenderDialog

Public Member Functions

 BaseDialog ()
void setButtons (ButtonType btn1, ButtonType btn2, int defVal=0)
void show (const char *headerPgm, bool allowRemote, CompletedHandlerFn completedHandler=NULL)
void showRam (const char *headerRam, bool allowRemote, CompletedHandlerFn completedHandler=NULL)
void showController (bool allowRemote, BaseDialogController *controller)
void setUserData (void *data)
virtual void copyIntoBuffer (const char *sz)
virtual void internalSetVisible (bool visible)
virtual char * getBufferData ()
void hide ()
bool isUsingOOController ()
bool isInUse ()
bool isCompressedMode ()
void dialogRendering (unsigned int currentValue, bool userClicked)
bool isMenuItemBased ()
bool isRenderNeeded ()
bool isRemoteUpdateNeeded (int remote)
void setRemoteUpdateNeeded (int remote, bool b)
void setRemoteUpdateNeededAll ()
void clearRemoteUpdateNeededAll ()
void setRemoteAllowed (bool allowed)
void encodeMessage (TagValueRemoteConnector *remote)
void remoteAction (ButtonType type)
bool copyButtonText (char *data, int buttonNum, int currentValue, bool isActive)
bool copyButtonText (char *data, int buttonNum, int currentValue)
void actionPerformed (int btnNum)

Protected Member Functions

void setInUse (bool b)
virtual void internalRender (int currentValue)=0
void setNeedsDrawing (bool b)
ButtonType findActiveBtn (unsigned int currentValue)
void internalShow (bool allowRemote)

Protected Attributes

char header [20]
const char * headerPgm
union {
CompletedHandlerFn completedHandler
void * userData
ButtonType button1
ButtonType button2
uint8_t lastBtnVal
uint16_t flags
MenuRedrawState needsDrawing

Detailed Description

A dialog is able to take over the display completely in order to present the user with information or a question. Similar to a message box on desktop platforms. These allow for the simplest of user interactions in a display independent way. This base class has most of the functions needed to handle the non-rendering related activities. Never create one directly, always use the instance that's available from the renderer using renderer.getDialog().

Constructor & Destructor Documentation

◆ BaseDialog()

BaseDialog::BaseDialog ( )

Create the base dialog and clear down all the fields

Member Function Documentation

◆ setButtons()

void BaseDialog::setButtons ( ButtonType  btn1,
ButtonType  btn2,
int  defVal = 0 

Sets the buttons that are available for pressing. One of the ButtonType definitions. You can optionally define if 0 or 1 should be the default.

btn1the first button type (can be BTNTYPE_NONE, and btn2 becomes the only button)
btn2the second button type
defValoptionally, set which button is active (0 based).

◆ show()

void BaseDialog::show ( const char *  headerPgm,
bool  allowRemote,
CompletedHandlerFn  completedHandler = NULL 

Create a dialog that takes over the display and presents the header and buffer, the header text is in program memory, with the buttons set up as per setButtons

◆ showRam()

void BaseDialog::showRam ( const char *  headerRam,
bool  allowRemote,
CompletedHandlerFn  completedHandler = NULL 

Create a dialog that takes over the display and presents the header and buffer, the header text is in RAM, with the buttons set up as per setButtons

◆ showController()

void BaseDialog::showController ( bool  allowRemote,
BaseDialogController controller 

Create a dialog that takes over the display and presents the header and buffer, the header text is in program memory, with the buttons set up as per setButtons

A valid controller object pointer is mandatory.

◆ setUserData()

void BaseDialog::setUserData ( void *  data)

You can set an item of data that will be passed to the callback when executed.

dataa pointer to your own data that will be given back to you in the call back.

◆ copyIntoBuffer()

void BaseDialog::copyIntoBuffer ( const char *  sz)

Copy text into the buffer, that will be displayed along with the header.

szthe text to copy

Reimplemented in MenuBasedDialog.

◆ internalSetVisible()

void BaseDialog::internalSetVisible ( bool  visible)

overriden in other types to handle show and hide differently

Reimplemented in MenuBasedDialog.

◆ hide()

void BaseDialog::hide ( )

Close the current dialog by taking off the display and clearing the inuse flag.

◆ isUsingOOController()

bool BaseDialog::isUsingOOController ( )

Indicates that the registered completion / callback is a controller

◆ isInUse()

bool BaseDialog::isInUse ( )

Indicates that this dialog is presently in use

◆ isCompressedMode()

bool BaseDialog::isCompressedMode ( )

Indicates that this menu is on a very limited display size

◆ dialogRendering()

void BaseDialog::dialogRendering ( unsigned int  currentValue,
bool  userClicked 

Called by the renderer to draw our dialog, in a game loop style as per all tcMenu rendering.

currentValuethe value of the encoder used to handle which button is active.
userClickedindicates when the user clicks an item.

◆ copyButtonText()

bool BaseDialog::copyButtonText ( char *  data,
int  buttonNum,
int  currentValue,
bool  isActive 

Copies button text into the buffer provided by data, based on the button number (0 or 1) and the current value of the encoder.

datathe buffer to copy into, must fit at least the largest button copyButtonText
buttonNumthe button number either 0, 1
currentValuecurrent value from encoder.
true if this button is active, otherwise false.

◆ actionPerformed()

void BaseDialog::actionPerformed ( int  btnNum)

Perform the action of the button numbered in the parameter. For example if button 1 is set to OK, then OK is pressed.


◆ setInUse()

void BaseDialog::setInUse ( bool  b)

Sets the inuse flag to true or false

◆ internalRender()

virtual void BaseDialog::internalRender ( int  currentValue)
protectedpure virtual

Needs to be overriden by each leaf renderer implementation in order to draw the actual dialog onto the display.

currentValuethe encoder currentValue

Implemented in MenuBasedDialog, and NoRenderDialog.

◆ setNeedsDrawing()

void BaseDialog::setNeedsDrawing ( bool  b)

Set if redraw is needed

btrue for redraw needed

◆ findActiveBtn()

ButtonType BaseDialog::findActiveBtn ( unsigned int  currentValue)

Finds the button that is currently selected

thecurrent value of the encoder
the active button

The documentation for this class was generated from the following files: