Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DMBasicGUI DMSupport
NumericKeypadPageHandler.h
00001 #ifndef NUMERICKEYPADHANDLER_H 00002 #define NUMERICKEYPADHANDLER_H 00003 00004 #include "mbed.h" 00005 #include "DMBoard.h" 00006 00007 #include "USBHostGC.h" 00008 00009 #include "GuiLib.h" 00010 00011 typedef void (*ApplyFunctionPtr)(USBDeviceConnected* usbDevice, USBHostGC* usbHostGC); 00012 00013 /* 00014 This class handles user interaction with the easyGUI "NumericKeypadPage". 00015 00016 Note that this class is a singleton - we do not need or want there to be more than one instance of it 00017 (we will not show more than one "NumericKeypadPage" to the user at the same time). 00018 */ 00019 class NumericKeypadPageHandler { 00020 public: 00021 /** 00022 * Static method to create (if necessary) and retrieve the single NumericKeypadPageHandler instance 00023 */ 00024 static NumericKeypadPageHandler * GetInstance(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); 00025 00026 bool TouchAreaIsOnNumericKeypadPage(int touchAreaIndex); 00027 00028 bool DealWithTouch(int touchAreaIndex); 00029 00030 void StartEditing(int initialValue, unsigned int placesOfDecimals = 0, bool wantNegative = false); 00031 void StartEditing(char* initialValue, unsigned int placesOfDecimals = 0, bool wantNegative = false); 00032 00033 void StartEditingInLockMode(unsigned int newValidLockCode, int newPageToDisplayIfLockCodeValid, 00034 GuiConst_TEXT* newEasyGUIVariableForInvalidLockCodeMessage, 00035 char *newInvalidLockCodeMessage); 00036 00037 void SetEasyGUIVariableToEdit(GuiConst_TEXT* easyGUIVariable); 00038 void SetInternalVariableToEdit(unsigned int* internalVariable); 00039 00040 void SetEasyGUICallingPage(int newCallingPage); 00041 00042 void SetEditVariableRange(int min, int max); 00043 00044 void SetEditVariableName(char *name); 00045 00046 void SetEditVariableUnits(const char *units); 00047 00048 void SetApplyFunctionPtr(ApplyFunctionPtr newApplyFunctionPtr); 00049 00050 void DisplayEasyGUIPage(void); 00051 00052 00053 private: 00054 static NumericKeypadPageHandler * theNumericKeypadPageHandlerInstance; 00055 00056 // singleton class -> constructor is private 00057 NumericKeypadPageHandler(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); 00058 ~NumericKeypadPageHandler(); 00059 00060 USBDeviceConnected* usbDevice; 00061 USBHostGC* usbHostGC; 00062 00063 ApplyFunctionPtr applyFunctionPtr; 00064 00065 void DealWithDeleteKey(void); 00066 00067 void DealWithNumberKey(int touchAreaIndex); 00068 00069 void DealWithDotKey(void); 00070 00071 void DealWithPlusMinusKey(void); 00072 00073 void DealWithApplyKey(void); 00074 00075 void DealWithCancelKey(void); 00076 00077 void DealWithClearKey(void); 00078 00079 GuiConst_TEXT* easyGUIVariableToEdit; 00080 unsigned int* internalVariableToEdit; 00081 char editVariableUnits[40]; 00082 00083 int easyGUICallingPage; 00084 00085 int minimumValue; 00086 int maximumValue; 00087 00088 unsigned int allowedDecimalPlaces; 00089 bool editingFractionalPart; 00090 unsigned int LengthOfFractionalPart(void); 00091 void PadFractionalPartWithZeroesIfNecessary(void); 00092 00093 bool allowNegativeNumbers; 00094 00095 bool inLockMode; 00096 unsigned int validLockCode; 00097 GuiConst_TEXT* easyGUIVariableForInvalidLockCodeMessage; 00098 char invalidLockCodeMessage[50]; 00099 int pageToDisplayIfLockCodeValid; 00100 }; 00101 00102 #endif // NUMERICKEYPADHANDLER_H
Generated on Tue Jul 19 2022 00:31:07 by
 1.7.2