4 * Copyright (C) 2005-2013 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, see
19 * <http://www.gnu.org/licenses/>.
23 #include "guilib/GUIDialog.h"
25 class CGUIDialogNumeric
:
29 enum INPUT_MODE
{ INPUT_TIME
= 1, INPUT_DATE
, INPUT_IP_ADDRESS
, INPUT_PASSWORD
, INPUT_NUMBER
, INPUT_TIME_SECONDS
};
30 CGUIDialogNumeric(void);
31 virtual ~CGUIDialogNumeric(void);
32 virtual bool OnMessage(CGUIMessage
& message
);
33 virtual bool OnAction(const CAction
&action
);
34 virtual bool OnBack(int actionID
);
35 virtual void FrameMove();
37 bool IsConfirmed() const;
38 bool IsCanceled() const;
40 static bool ShowAndVerifyNewPassword(CStdString
& strNewPassword
);
41 static int ShowAndVerifyPassword(CStdString
& strPassword
, const CStdString
& strHeading
, int iRetries
);
42 static bool ShowAndVerifyInput(CStdString
& strPassword
, const CStdString
& strHeading
, bool bGetUserInput
);
44 void SetHeading(const CStdString
&strHeading
);
45 void SetMode(INPUT_MODE mode
, void *initial
);
46 void SetMode(INPUT_MODE mode
, const CStdString
&initial
);
47 void GetOutput(void *output
) const;
48 CStdString
GetOutput() const;
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
, unsigned int iAutoCloseTimeoutMs
= 0);
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