Home2L - C/C++ API  v1.2-2-ga4fe (2023-04-15)
Smart Tools for a Private Home
List of all members
CMessageBox Class Reference

Description

Message box widget.

See CModalWidget for options to run the message box.

Definition at line 683 of file ui_widgets.H.

#include "ui_widgets.H"

Inheritance diagram for CMessageBox:
Inheritance graph
[legend]

Public Member Functions

Setup ...
void Setup (const char *title, int contentW, int contentH, int _buttons, CButton **_buttonArr, TColor color=MSGBOX_COLOR, int titleHAlign=0)
 The most flexible way. More...
 
CButtonGetStdButton (EMessageButtonId buttonId)
 Initialize and return a standard button to be used by the previous method.
 
void Setup (const char *title, int contentW, int contentH, int buttonMask, TColor color=MSGBOX_COLOR)
 The easier way, if only standard buttons are used. 'buttonMask' is a bit-wise "or" of the message mask constants ('mbm...').
 
void Setup (const char *title, const char *text, SDL_Surface *icon=NULL, int buttonMask=mbmOk, int hAlign=0, TTF_Font *font=NULL)
 The easiest way for standard text boxes.
 
Properties ...
SDL_Rect * ContentArea ()
 
Obtaining the result ...
int GetChoice ()
 Return the number of the button pushed, numbered from right to left; the rightmost button (typically "Cancel") has number 0.
 
Callbacks ...
virtual void Start (CScreen *_screen)
 Just start the modal widget.
 
virtual void Stop ()
 Remove widget from screen (e.g. useful for inactivity timeout).
 
virtual void OnButtonPushed (CButton *button, bool)
 
- Public Member Functions inherited from CModalWidget
int Run (CScreen *_screen)
 Run the widget until it is cancelled or a status >= 0 is set; return status.
 
bool IsRunning ()
 Must be invoked regularly (in each UI iteration), if Run() is not used.
 
int GetStatus ()
 Get status: -2: running, -1: cancelled (e.g. by touching outside), >= 0: success, user-defined code set by 'SetStatus'.
 
void SetStatus (int _status)
 Set a status code.
 
void SetNoCancelArea (SDL_Rect _rNoCancel)
 Set the no-cancel area. More...
 
void RemoveNoCancelArea ()
 
virtual bool HandleEvent (SDL_Event *ev)
 Handle event: must always be called last.
 
- Public Member Functions inherited from CWidget
void Set (SDL_Surface *_surf, int x0, int y0)
 
void SetArea (SDL_Rect _area)
 
SDL_Rect * GetArea ()
 
class CScreenGetScreen ()
 
bool IsOnScreen (class CScreen *_screen)
 
class CCanvasGetCanvas ()
 
void LocalToScreenCoords (int *x, int *y)
 
void ScreenToLocalCoords (int *x, int *y)
 
void GetMouseEventPos (SDL_Event *ev, int *x, int *y)
 
void SetSurface (SDL_Surface *_surface)
 Set the static surface to display. The caller stays owner of surface, must not delete it as long as it is set here. The surface dimensions must match 'area'.
 
virtual SDL_Surface * GetSurface ()
 Get an up-to-date surface or 'NULL' if none is available.
 
void GetRenderArea (SDL_Rect *ra)
 Transpose 'area' to the current screen coordinates to be passed to all SDL rendering functions.
 
virtual SDL_Texture * GetTexture ()
 Return an up-to-date texture. More...
 
void SetTextureBlendMode (SDL_BlendMode _sdlBlendMode)
 Set the blend mode for the texture created by the default implementation of GetTexture(). The default is SDL_BLENDMODE_NONE.
 
virtual void Render (SDL_Renderer *ren)
 Render this widget. More...
 
void ClearTexture ()
 Clear the internally cached texture object to save memory.
 

Additional Inherited Members

- Protected Member Functions inherited from CWidget
void ChangedSurface ()
 Mark (only) the surface as changed to trigger a redrawing at next occasion.
 
void Changed ()
 Anything may have changed: Trigger a redrawing at next occasion.
 

Member Function Documentation

◆ Setup()

void CMessageBox::Setup ( const char *  title,
int  contentW,
int  contentH,
int  _buttons,
CButton **  _buttonArr,
TColor  color = MSGBOX_COLOR,
int  titleHAlign = 0 
)

The most flexible way.

'content' is arbitrary content and must be transparent in empty areas. The buttons must be predefined, only the areas and the push action of all buttons will be (re-)set by 'Setup'. All parameters must remain valid until the message box is stopped.


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