OpenCPN Partial API docs
Loading...
Searching...
No Matches
AlertDialog Class Reference

A modal message dialog with confirmation button and cancel button. More...

#include <dialog_alert.h>

Inheritance diagram for AlertDialog:
BaseDialog InputDialog RoutePrintDialog TrackPrintDialog

Public Member Functions

 AlertDialog (wxWindow *parent, const std::string &title)
 Alert dialog with close button.
 
 AlertDialog (wxWindow *parent, const std::string &title, const std::string &action)
 Alert dialog with labelled confirmation button and cancel.
 
void SetListener (IAlertConfirmation *listener)
 Listen for response.
 
void SetTimer (int seconds)
 Activate timer.
 
void SetMessage (const std::string &msg)
 Set alert message.
 
void SetDefaultButton (int id)
 Set default button (for enter).
 
void SetCancelLabel (const std::string &label)
 Overwrite cancel button label.
 
int ShowModal () override
 Show dialog and return response.
 
- Public Member Functions inherited from BaseDialog
 BaseDialog (wxWindow *parent, const std::string &title, long style=wxDEFAULT_DIALOG_STYLE)
 
void SetInitialSize ()
 Initialize by display geometry.
 
void AddHtmlContent (const std::stringstream &html)
 Display HTML content.
 

Static Public Member Functions

static int GetConfirmation (wxWindow *parent, const std::string &title, const std::string &action, const std::string &msg)
 Helper that returns the dialog response.
 

Additional Inherited Members

- Protected Attributes inherited from BaseDialog
wxBoxSizer * m_layout
 
wxBoxSizer * m_content
 
- Static Protected Attributes inherited from BaseDialog
static const int kDialogPadding = 2
 

Detailed Description

A modal message dialog with confirmation button and cancel button.

Can be used with a listener to handle the response. Alternatively the static GetConfirmation function can be used without listener.

Definition at line 47 of file dialog_alert.h.

Constructor & Destructor Documentation

◆ AlertDialog() [1/2]

AlertDialog::AlertDialog ( wxWindow *  parent,
const std::string &  title 
)

Alert dialog with close button.

Parameters
parentParent window.
titleDialog title.

◆ AlertDialog() [2/2]

AlertDialog::AlertDialog ( wxWindow *  parent,
const std::string &  title,
const std::string &  action 
)

Alert dialog with labelled confirmation button and cancel.

Parameters
parentParent window.
titleDialog title.
actionAction button label.

Member Function Documentation

◆ GetConfirmation()

static int AlertDialog::GetConfirmation ( wxWindow *  parent,
const std::string &  title,
const std::string &  action,
const std::string &  msg 
)
static

Helper that returns the dialog response.

Returns
OK/Cancel response.

◆ SetCancelLabel()

void AlertDialog::SetCancelLabel ( const std::string &  label)

Overwrite cancel button label.

Parameters
labelLabel for cancel button.

◆ SetDefaultButton()

void AlertDialog::SetDefaultButton ( int  id)

Set default button (for enter).

Parameters
idButton ID.

◆ SetListener()

void AlertDialog::SetListener ( IAlertConfirmation listener)

Listen for response.

Parameters
listenerConfirmation listener.

◆ SetMessage()

void AlertDialog::SetMessage ( const std::string &  msg)

Set alert message.

Parameters
msgAlert message.

◆ SetTimer()

void AlertDialog::SetTimer ( int  seconds)

Activate timer.

Parameters
secondsTimer in seconds.

◆ ShowModal()

int AlertDialog::ShowModal ( )
override

Show dialog and return response.

Returns
OK/Cancel response.

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