Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
Keyboard.h
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "../../AddonBase.h"
12#include "../../c-api/gui/dialogs/keyboard.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace dialogs
21{
22
23//================================================================================
37namespace Keyboard
38{
39//==============================================================================
74inline bool ATTR_DLL_LOCAL ShowAndGetInput(std::string& text,
75 const std::string& heading,
76 bool allowEmptyResult,
77 bool hiddenInput = false,
78 unsigned int autoCloseMs = 0)
79{
80 using namespace ::kodi::addon;
81 char* retString = nullptr;
82 bool ret =
83 CPrivateBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_input_with_head(
84 CPrivateBase::m_interface->toKodi->kodiBase, text.c_str(), &retString, heading.c_str(),
85 allowEmptyResult, hiddenInput, autoCloseMs);
86 if (retString != nullptr)
87 {
88 text = retString;
89 CPrivateBase::m_interface->toKodi->free_string(CPrivateBase::m_interface->toKodi->kodiBase,
90 retString);
91 }
92 return ret;
93}
94//------------------------------------------------------------------------------
95
96//==============================================================================
110inline bool ATTR_DLL_LOCAL ShowAndGetInput(std::string& text,
111 bool allowEmptyResult,
112 unsigned int autoCloseMs = 0)
113{
114 using namespace ::kodi::addon;
115 char* retString = nullptr;
116 bool ret = CPrivateBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_input(
117 CPrivateBase::m_interface->toKodi->kodiBase, text.c_str(), &retString, allowEmptyResult,
118 autoCloseMs);
119 if (retString != nullptr)
120 {
121 text = retString;
122 CPrivateBase::m_interface->toKodi->free_string(CPrivateBase::m_interface->toKodi->kodiBase,
123 retString);
124 }
125 return ret;
126}
127//------------------------------------------------------------------------------
128
129//==============================================================================
143inline bool ATTR_DLL_LOCAL ShowAndGetNewPassword(std::string& newPassword,
144 const std::string& heading,
145 bool allowEmptyResult,
146 unsigned int autoCloseMs = 0)
147{
148 using namespace ::kodi::addon;
149 char* retString = nullptr;
150 bool ret = CPrivateBase::m_interface->toKodi->kodi_gui->dialogKeyboard
151 ->show_and_get_new_password_with_head(
152 CPrivateBase::m_interface->toKodi->kodiBase, newPassword.c_str(), &retString,
153 heading.c_str(), allowEmptyResult, autoCloseMs);
154 if (retString != nullptr)
155 {
156 newPassword = retString;
157 CPrivateBase::m_interface->toKodi->free_string(CPrivateBase::m_interface->toKodi->kodiBase,
158 retString);
159 }
160 return ret;
161}
162//------------------------------------------------------------------------------
163
164//==============================================================================
176inline bool ATTR_DLL_LOCAL ShowAndGetNewPassword(std::string& newPassword,
177 unsigned int autoCloseMs = 0)
178{
179 using namespace ::kodi::addon;
180 char* retString = nullptr;
181 bool ret = CPrivateBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_new_password(
182 CPrivateBase::m_interface->toKodi->kodiBase, newPassword.c_str(), &retString, autoCloseMs);
183 if (retString != nullptr)
184 {
185 newPassword = retString;
186 CPrivateBase::m_interface->toKodi->free_string(CPrivateBase::m_interface->toKodi->kodiBase,
187 retString);
188 }
189 return ret;
190}
191//------------------------------------------------------------------------------
192
193//==============================================================================
249inline bool ATTR_DLL_LOCAL ShowAndVerifyNewPassword(std::string& newPassword,
250 const std::string& heading,
251 bool allowEmptyResult,
252 unsigned int autoCloseMs = 0)
253{
254 using namespace ::kodi::addon;
255 char* retString = nullptr;
256 bool ret = CPrivateBase::m_interface->toKodi->kodi_gui->dialogKeyboard
257 ->show_and_verify_new_password_with_head(
258 CPrivateBase::m_interface->toKodi->kodiBase, &retString, heading.c_str(),
259 allowEmptyResult, autoCloseMs);
260 if (retString != nullptr)
261 {
262 newPassword = retString;
263 CPrivateBase::m_interface->toKodi->free_string(CPrivateBase::m_interface->toKodi->kodiBase,
264 retString);
265 }
266 return ret;
267}
268//------------------------------------------------------------------------------
269
270//==============================================================================
282inline bool ATTR_DLL_LOCAL ShowAndVerifyNewPassword(std::string& newPassword,
283 unsigned int autoCloseMs = 0)
284{
285 using namespace ::kodi::addon;
286 char* retString = nullptr;
287 bool ret =
288 CPrivateBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_verify_new_password(
289 CPrivateBase::m_interface->toKodi->kodiBase, &retString, autoCloseMs);
290 if (retString != nullptr)
291 {
292 newPassword = retString;
293 CPrivateBase::m_interface->toKodi->free_string(CPrivateBase::m_interface->toKodi->kodiBase,
294 retString);
295 }
296 return ret;
297}
298//------------------------------------------------------------------------------
299
300//==============================================================================
314inline int ATTR_DLL_LOCAL ShowAndVerifyPassword(std::string& password,
315 const std::string& heading,
316 int retries,
317 unsigned int autoCloseMs = 0)
318{
319 using namespace ::kodi::addon;
320 char* retString = nullptr;
321 int ret = CPrivateBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_verify_password(
322 CPrivateBase::m_interface->toKodi->kodiBase, password.c_str(), &retString, heading.c_str(),
323 retries, autoCloseMs);
324 if (retString != nullptr)
325 {
326 password = retString;
327 CPrivateBase::m_interface->toKodi->free_string(CPrivateBase::m_interface->toKodi->kodiBase,
328 retString);
329 }
330 return ret;
331}
332//------------------------------------------------------------------------------
333
334//==============================================================================
349inline bool ATTR_DLL_LOCAL ShowAndGetFilter(std::string& text,
350 bool searching,
351 unsigned int autoCloseMs = 0)
352{
353 using namespace ::kodi::addon;
354 char* retString = nullptr;
355 bool ret = CPrivateBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_filter(
356 CPrivateBase::m_interface->toKodi->kodiBase, text.c_str(), &retString, searching,
357 autoCloseMs);
358 if (retString != nullptr)
359 {
360 text = retString;
361 CPrivateBase::m_interface->toKodi->free_string(CPrivateBase::m_interface->toKodi->kodiBase,
362 retString);
363 }
364 return ret;
365}
366//------------------------------------------------------------------------------
367
368//==============================================================================
377inline bool ATTR_DLL_LOCAL SendTextToActiveKeyboard(const std::string& text,
378 bool closeKeyboard = false)
379{
380 using namespace ::kodi::addon;
381 return CPrivateBase::m_interface->toKodi->kodi_gui->dialogKeyboard->send_text_to_active_keyboard(
382 CPrivateBase::m_interface->toKodi->kodiBase, text.c_str(), closeKeyboard);
383}
384//------------------------------------------------------------------------------
385
386//==============================================================================
392inline bool ATTR_DLL_LOCAL IsKeyboardActivated()
393{
394 using namespace ::kodi::addon;
395 return CPrivateBase::m_interface->toKodi->kodi_gui->dialogKeyboard->is_keyboard_activated(
396 CPrivateBase::m_interface->toKodi->kodiBase);
397}
398//------------------------------------------------------------------------------
399}; // namespace Keyboard
400
401} /* namespace dialogs */
402} /* namespace gui */
403} /* namespace kodi */
404
405#endif /* __cplusplus */
bool ATTR_DLL_LOCAL ShowAndVerifyNewPassword(std::string &newPassword, const std::string &heading, bool allowEmptyResult, unsigned int autoCloseMs=0)
Show keyboard twice to get and confirm a user-entered password string.
Definition Keyboard.h:249
bool ATTR_DLL_LOCAL ShowAndGetNewPassword(std::string &newPassword, const std::string &heading, bool allowEmptyResult, unsigned int autoCloseMs=0)
Shows keyboard and prompts for a password. Differs from ShowAndVerifyNewPassword() in that no second ...
Definition Keyboard.h:143
bool ATTR_DLL_LOCAL ShowAndGetInput(std::string &text, const std::string &heading, bool allowEmptyResult, bool hiddenInput=false, unsigned int autoCloseMs=0)
Show keyboard with initial value text and replace with result string.
Definition Keyboard.h:74
int ATTR_DLL_LOCAL ShowAndVerifyPassword(std::string &password, const std::string &heading, int retries, unsigned int autoCloseMs=0)
Show keyboard and verify user input against password.
Definition Keyboard.h:314
bool ATTR_DLL_LOCAL IsKeyboardActivated()
Check for visible keyboard on GUI.
Definition Keyboard.h:392
bool ATTR_DLL_LOCAL SendTextToActiveKeyboard(const std::string &text, bool closeKeyboard=false)
Send a text to a visible keyboard.
Definition Keyboard.h:377
bool ATTR_DLL_LOCAL ShowAndGetFilter(std::string &text, bool searching, unsigned int autoCloseMs=0)
Shows a filter related keyboard.
Definition Keyboard.h:349