Merge pull request #1129 from jmarshallnz/remove_smb_auth_details_in_add_source
[vuplus_xbmc] / xbmc / dialogs / GUIDialogNumeric.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2008 Team XBMC
5  *      http://www.xbmc.org
6  *
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)
10  *  any later version.
11  *
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.
16  *
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
21  *
22  */
23
24 #include "guilib/GUIDialog.h"
25
26 class CGUIDialogNumeric :
27       public CGUIDialog
28 {
29 public:
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();
37
38   bool IsConfirmed() const;
39   bool IsCanceled() const;
40
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);
44
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);
49
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);
55
56 protected:
57   virtual void OnInitWindow();
58   virtual void OnDeinitWindow(int nextWindowID);
59
60   void OnNumber(unsigned int num);
61   void VerifyDate(bool checkYear);
62   void OnNext();
63   void OnPrevious();
64   void OnBackSpace();
65   void OnOK();
66   void OnCancel();
67
68   bool m_bConfirmed;
69   bool m_bCanceled;
70
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
78 };