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.
11 #include "AddonClass.h"
12 #include "AddonString.h"
13 #include "Exception.h"
15 class CGUIDialogKeyboardGeneric
;
21 XBMCCOMMONS_STANDARD_EXCEPTION(KeyboardException
);
24 /// \defgroup python_keyboard Keyboard
25 /// \ingroup python_xbmc
27 /// @brief **Kodi's keyboard class.**
29 /// \python_class{ xbmc.Keyboard([default, heading, hidden]) }
31 /// Creates a new Keyboard object with default text
32 /// heading and hidden input flag if supplied.
34 /// @param default : [opt] string - default text entry.
35 /// @param heading : [opt] string - keyboard heading.
36 /// @param hidden : [opt] boolean - True for hidden text entry.
39 ///-------------------------------------------------------------------------
42 /// ~~~~~~~~~~~~~{.py}
44 /// kb = xbmc.Keyboard('default', 'heading', True)
45 /// kb.setDefault('password') # optional
46 /// kb.setHeading('Enter password') # optional
47 /// kb.setHiddenInput(True) # optional
49 /// if (kb.isConfirmed()):
50 /// text = kb.getText()
54 class Keyboard
: public AddonClass
62 bool bConfirmed
= false;
65 Keyboard(const String
& line
= emptyString
, const String
& heading
= emptyString
, bool hidden
= false);
68 #ifdef DOXYGEN_SHOULD_USE_THIS
70 /// \ingroup python_keyboard
71 /// @brief \python_func{ doModal([autoclose]) }
72 /// Show keyboard and wait for user action.
74 /// @param autoclose [opt] integer - milliseconds to autoclose
75 /// dialog. (default=do not autoclose)
78 ///-----------------------------------------------------------------------
81 /// ~~~~~~~~~~~~~{.py}
89 void doModal(int autoclose
= 0);
92 #ifdef DOXYGEN_SHOULD_USE_THIS
93 // setDefault() Method
95 /// \ingroup python_keyboard
96 /// @brief \python_func{ setDefault(line) }
97 /// Set the default text entry.
99 /// @param line string - default text entry.
102 ///-----------------------------------------------------------------------
105 /// ~~~~~~~~~~~~~{.py}
107 /// kb.setDefault('password')
113 void setDefault(const String
& line
= emptyString
);
116 #ifdef DOXYGEN_SHOULD_USE_THIS
118 /// \ingroup python_keyboard
119 /// @brief \python_func{ setHiddenInput(hidden) }
120 /// Allows hidden text entry.
122 /// @param hidden boolean - True for hidden text entry.
125 ///-----------------------------------------------------------------------
128 /// ~~~~~~~~~~~~~{.py}
130 /// kb.setHiddenInput(True)
136 void setHiddenInput(bool hidden
= false);
139 // setHeading() Method
140 #ifdef DOXYGEN_SHOULD_USE_THIS
142 /// \ingroup python_keyboard
143 /// @brief \python_func{ setHeading(heading) }
144 /// Set the keyboard heading.
146 /// @param heading string - keyboard heading.
149 ///-----------------------------------------------------------------------
152 /// ~~~~~~~~~~~~~{.py}
154 /// kb.setHeading('Enter password')
160 void setHeading(const String
& heading
);
164 #ifdef DOXYGEN_SHOULD_USE_THIS
166 /// \ingroup python_keyboard
167 /// @brief \python_func{ getText() }
168 /// Returns the user input as a string.
170 /// @note This will always return the text entry even if you cancel the keyboard.
171 /// Use the isConfirmed() method to check if user cancelled the keyboard.
173 /// @return get the in keyboard entered text
176 ///-----------------------------------------------------------------------
179 /// ~~~~~~~~~~~~~{.py}
181 /// text = kb.getText()
190 // isConfirmed() Method
191 #ifdef DOXYGEN_SHOULD_USE_THIS
193 /// \ingroup python_keyboard
194 /// @brief \python_func{ isConfirmed() }
195 /// Returns False if the user cancelled the input.
197 /// @return true if confirmed, if cancelled false
199 ///-----------------------------------------------------------------------
202 /// ~~~~~~~~~~~~~{.py}
204 /// if (kb.isConfirmed()):