Merge pull request #22816 from CastagnaIT/fix_tx3g
[xbmc.git] / xbmc / dialogs / GUIDialogYesNo.h
blobe8baac22ccc88841128f4d0cce3cf5c20a43f4e2
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "GUIDialogBoxBase.h"
12 #include "utils/Variant.h"
14 namespace KODI
16 namespace MESSAGING
18 namespace HELPERS
20 struct DialogYesNoMessage;
25 class CGUIDialogYesNo :
26 public CGUIDialogBoxBase
28 public:
29 explicit CGUIDialogYesNo(int overrideId = -1);
30 ~CGUIDialogYesNo(void) override;
31 bool OnMessage(CGUIMessage& message) override;
32 bool OnBack(int actionID) override;
34 void Reset();
35 int GetResult() const;
37 enum TimeOut
39 NO_TIMEOUT = 0
42 /*! \brief Show a yes-no dialog, then wait for user to dismiss it.
43 \param heading Localized label id or string for the heading of the dialog
44 \param line0 Localized label id or string for line 1 of the dialog message
45 \param line1 Localized label id or string for line 2 of the dialog message
46 \param line2 Localized label id or string for line 3 of the dialog message
47 \param bCanceled Holds true if the dialog was canceled otherwise false
48 \return true if user selects Yes, otherwise false if user selects No.
50 static bool ShowAndGetInput(const CVariant& heading,
51 const CVariant& line0,
52 const CVariant& line1,
53 const CVariant& line2,
54 bool& bCanceled);
56 /*! \brief Show a yes-no dialog, then wait for user to dismiss it.
57 \param heading Localized label id or string for the heading of the dialog
58 \param line0 Localized label id or string for line 1 of the dialog message
59 \param line1 Localized label id or string for line 2 of the dialog message
60 \param line2 Localized label id or string for line 3 of the dialog message
61 \param iNoLabel Localized label id or string for the no button
62 \param iYesLabel Localized label id or string for the yes button
63 \return true if user selects Yes, otherwise false if user selects No.
65 static bool ShowAndGetInput(const CVariant& heading,
66 const CVariant& line0,
67 const CVariant& line1,
68 const CVariant& line2,
69 const CVariant& noLabel = "",
70 const CVariant& yesLabel = "");
72 /*! \brief Show a yes-no dialog, then wait for user to dismiss it.
73 \param heading Localized label id or string for the heading of the dialog
74 \param line0 Localized label id or string for line 1 of the dialog message
75 \param line1 Localized label id or string for line 2 of the dialog message
76 \param line2 Localized label id or string for line 3 of the dialog message
77 \param bCanceled Holds true if the dialog was canceled otherwise false
78 \param iNoLabel Localized label id or string for the no button
79 \param iYesLabel Localized label id or string for the yes button
80 \param autoCloseTime Time in ms before the dialog becomes automatically closed
81 \return true if user selects Yes, otherwise false if user selects No.
83 static bool ShowAndGetInput(const CVariant& heading,
84 const CVariant& line0,
85 const CVariant& line1,
86 const CVariant& line2,
87 bool& bCanceled,
88 const CVariant& noLabel,
89 const CVariant& yesLabel,
90 unsigned int autoCloseTime);
92 /*! \brief Show a yes-no dialog, then wait for user to dismiss it.
93 \param heading Localized label id or string for the heading of the dialog
94 \param text Localized label id or string for the dialog message
95 \return true if user selects Yes, otherwise false if user selects No.
97 static bool ShowAndGetInput(const CVariant& heading, const CVariant& text);
99 /*! \brief Show a yes-no dialog, then wait for user to dismiss it.
100 \param heading Localized label id or string for the heading of the dialog
101 \param text Localized label id or string for the dialog message
102 \param bCanceled Holds true if the dialog was canceled otherwise false
103 \param iNoLabel Localized label id or string for the no button
104 \param iYesLabel Localized label id or string for the yes button
105 \param autoCloseTime Time in ms before the dialog becomes automatically closed
106 \param defaultButtonId Specifies the default focused button
107 \return true if user selects Yes, otherwise false if user selects No.
109 static bool ShowAndGetInput(const CVariant& heading,
110 const CVariant& text,
111 bool& bCanceled,
112 const CVariant& noLabel,
113 const CVariant& yesLabel,
114 unsigned int autoCloseTime,
115 int defaultButtonId = CONTROL_NO_BUTTON);
117 /*! \brief Show a yes-no dialog with 3rd custom button, then wait for user to dismiss it.
118 \param heading Localized label id or string for the heading of the dialog
119 \param text Localized label id or string for the dialog message
120 \param noLabel Localized label id or string for the no button
121 \param yesLabel Localized label id or string for the yes button
122 \param customLabel Localized label id or string for the custom button
123 \param autoCloseTime Time in ms before the dialog becomes automatically closed
124 \param defaultButtonId Specifies the default focused button
125 \return -1 for cancelled, 0 for No, 1 for Yes and 2 for custom button
127 static int ShowAndGetInput(const CVariant& heading,
128 const CVariant& text,
129 const CVariant& noLabel,
130 const CVariant& yesLabel,
131 const CVariant& customLabel,
132 unsigned int autoCloseTime,
133 int defaultButtonId = CONTROL_NO_BUTTON);
136 \brief Open a Yes/No dialog and wait for input
138 \param[in] options a struct of type DialogYesNoMessage containing
139 the options to set for this dialog.
141 \returns -1 for cancelled, 0 for No and 1 for Yes
142 \sa KODI::MESSAGING::HELPERS::DialogYesNoMessage
144 int ShowAndGetInput(const KODI::MESSAGING::HELPERS::DialogYesNoMessage& options);
146 protected:
147 void OnInitWindow() override;
148 int GetDefaultLabelID(int controlId) const override;
150 bool m_bCanceled;
151 bool m_bCustom;
152 int m_defaultButtonId;