6 #ifndef GUILIB_GUIEditControl_H
7 #define GUILIB_GUIEditControl_H
12 * Copyright (C) 2005-2013 Team XBMC
15 * This Program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
20 * This Program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with XBMC; see the file COPYING. If not, see
27 * <http://www.gnu.org/licenses/>.
31 #include "GUIButtonControl.h"
32 #include "utils/Stopwatch.h"
39 class CGUIEditControl : public CGUIButtonControl
43 INPUT_TYPE_READONLY = -1,
51 INPUT_TYPE_PASSWORD_MD5,
54 INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW
57 CGUIEditControl(int parentID, int controlID, float posX, float posY,
58 float width, float height, const CTextureInfo &textureFocus, const CTextureInfo &textureNoFocus,
59 const CLabelInfo& labelInfo, const std::string &text);
60 CGUIEditControl(const CGUIButtonControl &button);
61 virtual ~CGUIEditControl(void);
62 virtual CGUIEditControl *Clone() const { return new CGUIEditControl(*this); };
64 virtual bool OnMessage(CGUIMessage &message);
65 virtual bool OnAction(const CAction &action);
66 virtual void OnClick();
68 virtual void SetLabel(const std::string &text);
69 virtual void SetLabel2(const std::string &text);
70 void SetHint(const CGUIInfoLabel& hint);
72 virtual CStdString GetLabel2() const;
74 unsigned int GetCursorPosition() const;
75 void SetCursorPosition(unsigned int iPosition);
77 void SetInputType(INPUT_TYPE type, int heading);
79 void SetTextChangeActions(const CGUIAction& textChangeActions) { m_textChangeActions = textChangeActions; };
81 bool HasTextChangeActions() { return m_textChangeActions.HasActionsMeetingCondition(); };
84 virtual void ProcessText(unsigned int currentTime);
85 virtual void RenderText();
86 CStdStringW GetDisplayedText() const;
87 void RecalcLabelPosition();
88 void ValidateCursor();
89 void UpdateText(bool sendUpdate = true);
90 void OnPasteClipboard();
91 void OnSMSCharacter(unsigned int key);
92 void DefaultConstructor();
94 /*! \brief Clear out the current text input if it's an MD5 password.
95 \return true if the password is cleared, false otherwise.
101 CGUIInfoLabel m_hintInfo;
104 CRect m_clipRect; ///< clipping rect for the second label
106 static const int spaceWidth = 5;
108 unsigned int m_cursorPos;
109 unsigned int m_cursorBlink;
112 INPUT_TYPE m_inputType;
115 CGUIAction m_textChangeActions;
117 unsigned int m_smsKeyIndex;
118 unsigned int m_smsLastKey;
119 CStopWatch m_smsTimer;
121 static const char* smsLetters[10];
122 static const unsigned int smsDelay;