Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches

Detailed Description

Namespace: kodi::gui::dialogs::YesNo

Yes / No dialog
The Yes / No dialog can be used to inform the user about questions and get the answer.

In order to achieve a line break is a \n directly in the text or in the "./resources/language/resource.language.??_??/strings.po" to call with std::string kodi::general::GetLocalizedString(...);.

It has the header #include <kodi/gui/dialogs/YesNo.h> be included to enjoy it.

Function Documentation

◆ ShowAndGetInput() [1/3]

bool ATTR_DLL_LOCAL ShowAndGetInput ( const std::string & heading,
const std::string & text,
bool & canceled,
const std::string & noLabel = "",
const std::string & yesLabel = "" )
inline

Use dialog to get numeric new password with one text string shown everywhere and cancel return field.

Parameters
[in]headingDialog heading
[in]textMulti-line text
[out]canceledReturn value about cancel button
[in]noLabel[opt] label to put on the no button
[in]yesLabel[opt] label to put on the yes button
Returns
Returns True if 'Yes' was pressed, else False
Note
It is preferred to only use this as it is actually a multi-line text.

Example:

#include <kodi/gui/dialogs/YesNo.h>
bool canceled = false;
"Yes / No test call", // The Header
"You has opened Yes / No dialog for test\n\nIs this OK for you?",
canceled, // return value about cancel button
"Not really", // No label, is optional and if empty "No"
"Ohhh yes"); // Yes label, also optional and if empty "Yes"
fprintf(stderr, "You has called Yes/No, returned '%s' and was %s\n",
ret ? "yes" : "no",
canceled ? "canceled" : "not canceled");
bool ATTR_DLL_LOCAL ShowAndGetInput(const std::string &heading, const std::string &text, bool &canceled, const std::string &noLabel="", const std::string &yesLabel="")
Use dialog to get numeric new password with one text string shown everywhere and cancel return field.
Definition YesNo.h:74

◆ ShowAndGetInput() [2/3]

bool ATTR_DLL_LOCAL ShowAndGetInput ( const std::string & heading,
const std::string & line0,
const std::string & line1,
const std::string & line2,
const std::string & noLabel = "",
const std::string & yesLabel = "" )
inline

Use dialog to get numeric new password with separated line strings.

Parameters
[in]headingDialog heading
[in]line0Line #0 text
[in]line1Line #1 text
[in]line2Line #2 text
[in]noLabel[opt] label to put on the no button
[in]yesLabel[opt] label to put on the yes button
Returns
Returns True if 'Yes' was pressed, else False

Example:

#include <kodi/gui/dialogs/YesNo.h>
"Yes / No test call", // The Header
"You has opened Yes / No dialog for test",
"",
"Is this OK for you?",
"Not really", // No label, is optional and if empty "No"
"Ohhh yes"); // Yes label, also optional and if empty "Yes"
fprintf(stderr, "You has called Yes/No, returned '%s'\n",
ret ? "yes" : "no");

◆ ShowAndGetInput() [3/3]

bool ATTR_DLL_LOCAL ShowAndGetInput ( const std::string & heading,
const std::string & line0,
const std::string & line1,
const std::string & line2,
bool & canceled,
const std::string & noLabel = "",
const std::string & yesLabel = "" )
inline

Use dialog to get numeric new password with separated line strings and cancel return field.

Parameters
[in]headingDialog heading
[in]line0Line #0 text
[in]line1Line #1 text
[in]line2Line #2 text
[out]canceledReturn value about cancel button
[in]noLabel[opt] label to put on the no button
[in]yesLabel[opt] label to put on the yes button
Returns
Returns True if 'Yes' was pressed, else False

Example:

#include <kodi/gui/dialogs/YesNo.h>
bool canceled = false;
"Yes / No test call", // The Header
"You has opened Yes / No dialog for test",
"",
"Is this OK for you?",
canceled, // return value about cancel button
"Not really", // No label, is optional and if empty "No"
"Ohhh yes"); // Yes label, also optional and if empty "Yes"
fprintf(stderr, "You has called Yes/No, returned '%s' and was %s\n",
ret ? "yes" : "no",
canceled ? "canceled" : "not canceled");