4 * Copyright (C) 2005-2008 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, write to
19 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20 * http://www.gnu.org/copyleft/gpl.html
24 #include "guilib/GUIDialog.h"
26 class CGUIDialogNumeric :
30 enum INPUT_MODE { INPUT_TIME = 1, INPUT_DATE, INPUT_IP_ADDRESS, INPUT_PASSWORD, INPUT_NUMBER, INPUT_TIME_SECONDS };
31 CGUIDialogNumeric(void);
32 virtual ~CGUIDialogNumeric(void);
33 virtual bool OnMessage(CGUIMessage& message);
34 virtual bool OnAction(const CAction &action);
35 virtual bool OnBack(int actionID);
36 virtual void FrameMove();
38 bool IsConfirmed() const;
39 bool IsCanceled() const;
41 static bool ShowAndVerifyNewPassword(CStdString& strNewPassword);
42 static int ShowAndVerifyPassword(CStdString& strPassword, const CStdString& strHeading, int iRetries);
43 static bool ShowAndVerifyInput(CStdString& strPassword, const CStdString& strHeading, bool bGetUserInput);
45 void SetHeading(const CStdString &strHeading);
46 void SetMode(INPUT_MODE mode, void *initial);
47 void SetMode(INPUT_MODE mode, const CStdString &initial);
48 void GetOutput(void *output);
50 static bool ShowAndGetTime(SYSTEMTIME &time, const CStdString &heading);
51 static bool ShowAndGetDate(SYSTEMTIME &date, const CStdString &heading);
52 static bool ShowAndGetIPAddress(CStdString &IPAddress, const CStdString &heading);
53 static bool ShowAndGetNumber(CStdString& strInput, const CStdString &strHeading);
54 static bool ShowAndGetSeconds(CStdString& timeString, const CStdString &heading);
57 virtual void OnInitWindow();
58 virtual void OnDeinitWindow(int nextWindowID);
60 void OnNumber(unsigned int num);
61 void VerifyDate(bool checkYear);
71 INPUT_MODE m_mode; // the current input mode
72 SYSTEMTIME m_datetime; // for time and date modes
73 WORD m_ip[4]; // for ip address mode
74 unsigned int m_block; // for time, date, and IP methods.
75 unsigned int m_lastblock;
76 bool m_dirty; // true if the current block has been changed.
77 CStdString m_number; ///< for number or password input