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 "GUIKeyboard.h"
12 
13 #include <string>
14 
15 class CVariant;
16 
17 class CGUIKeyboardFactory
18 {
19 
20   public:
21     CGUIKeyboardFactory(void);
22     virtual ~CGUIKeyboardFactory(void);
23 
24     static bool ShowAndGetInput(std::string& aTextString, bool allowEmptyResult, unsigned int autoCloseMs = 0);
25     static bool ShowAndGetInput(std::string& aTextString,
26                                 const CVariant& heading,
27                                 bool allowEmptyResult,
28                                 bool hiddenInput = false,
29                                 unsigned int autoCloseMs = 0);
30     static bool ShowAndGetNewPassword(std::string& strNewPassword, unsigned int autoCloseMs = 0);
31     static bool ShowAndGetNewPassword(std::string& newPassword,
32                                       const CVariant& heading,
33                                       bool allowEmpty,
34                                       unsigned int autoCloseMs = 0);
35     static bool ShowAndVerifyNewPassword(std::string& strNewPassword, unsigned int autoCloseMs = 0);
36     static bool ShowAndVerifyNewPassword(std::string& newPassword,
37                                          const CVariant& heading,
38                                          bool allowEmpty,
39                                          unsigned int autoCloseMs = 0);
40     static int  ShowAndVerifyPassword(std::string& strPassword, const std::string& strHeading, int iRetries, unsigned int autoCloseMs = 0);
41     static bool ShowAndGetFilter(std::string& aTextString, bool searching, unsigned int autoCloseMs = 0);
42 
43     static bool SendTextToActiveKeyboard(const std::string &aTextString, bool closeKeyboard = false);
44 
isKeyboardActivated()45     static bool isKeyboardActivated() { return g_activeKeyboard != NULL; }
46   private:
47     static CGUIKeyboard *g_activeKeyboard;
48     static FILTERING m_filtering;
49     static void keyTypedCB(CGUIKeyboard *ref, const std::string &typedString);
50 };
51