Repository for import to local machine
Dependencies: DMBasicGUI DMSupport
EthernetKeypadPageHandler.h@8:26e49e6955bd, 2017-07-31 (annotated)
- Committer:
- jmitc91516
- Date:
- Mon Jul 31 15:37:57 2017 +0000
- Revision:
- 8:26e49e6955bd
- Parent:
- 1:a5258871b33d
Method ramp scrolling improved, and more bitmaps moved to QSPI memory
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jmitc91516 | 1:a5258871b33d | 1 | #ifndef ETHERNETKEYPADHANDLER_H |
jmitc91516 | 1:a5258871b33d | 2 | #define ETHERNETKEYPADHANDLER_H |
jmitc91516 | 1:a5258871b33d | 3 | |
jmitc91516 | 1:a5258871b33d | 4 | #include "mbed.h" |
jmitc91516 | 1:a5258871b33d | 5 | #include "DMBoard.h" |
jmitc91516 | 1:a5258871b33d | 6 | |
jmitc91516 | 1:a5258871b33d | 7 | #include "USBHostGC.h" |
jmitc91516 | 1:a5258871b33d | 8 | |
jmitc91516 | 1:a5258871b33d | 9 | #include "GuiLib.h" |
jmitc91516 | 1:a5258871b33d | 10 | |
jmitc91516 | 1:a5258871b33d | 11 | typedef struct structActiveOctetOutline { unsigned int X1; unsigned int Y1; unsigned int X2; unsigned int Y2; } ActiveOctetOutline; |
jmitc91516 | 1:a5258871b33d | 12 | |
jmitc91516 | 1:a5258871b33d | 13 | /* |
jmitc91516 | 1:a5258871b33d | 14 | This class handles user interaction with the easyGUI "EthernetKeypadPage". |
jmitc91516 | 1:a5258871b33d | 15 | |
jmitc91516 | 1:a5258871b33d | 16 | Note that this class is a singleton - we do not need or want there to be more than one instance of it |
jmitc91516 | 1:a5258871b33d | 17 | (we will not show more than one "EthernetKeypadPage" to the user at the same time). |
jmitc91516 | 1:a5258871b33d | 18 | */ |
jmitc91516 | 1:a5258871b33d | 19 | class EthernetKeypadPageHandler { |
jmitc91516 | 1:a5258871b33d | 20 | public: |
jmitc91516 | 1:a5258871b33d | 21 | /** |
jmitc91516 | 1:a5258871b33d | 22 | * Static method to create (if necessary) and retrieve the single EthernetKeypadPageHandler instance |
jmitc91516 | 1:a5258871b33d | 23 | */ |
jmitc91516 | 1:a5258871b33d | 24 | static EthernetKeypadPageHandler * GetInstance(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); |
jmitc91516 | 1:a5258871b33d | 25 | |
jmitc91516 | 1:a5258871b33d | 26 | bool TouchAreaIsOnEthernetKeypadPage(int touchAreaIndex); |
jmitc91516 | 1:a5258871b33d | 27 | |
jmitc91516 | 1:a5258871b33d | 28 | bool DealWithTouch(int touchAreaIndex); |
jmitc91516 | 1:a5258871b33d | 29 | |
jmitc91516 | 1:a5258871b33d | 30 | // Three member functions for the caller to tell us what we are editing. |
jmitc91516 | 1:a5258871b33d | 31 | // All three of these must be called, and StartEditing must be last |
jmitc91516 | 1:a5258871b33d | 32 | void SetEasyGUIOctetVariablesToEdit(GuiConst_TEXT* easyGUIOctet1, GuiConst_TEXT* easyGUIOctet2, GuiConst_TEXT* easyGUIOctet3, GuiConst_TEXT* easyGUIOctet4); |
jmitc91516 | 1:a5258871b33d | 33 | void SetInternalOctetVariablesToEdit(unsigned int *internalOctet1, unsigned int *internalOctet2, unsigned int *internalOctet3, unsigned int *internalOctet4); |
jmitc91516 | 1:a5258871b33d | 34 | void StartEditing(char *title); |
jmitc91516 | 1:a5258871b33d | 35 | |
jmitc91516 | 1:a5258871b33d | 36 | private: |
jmitc91516 | 1:a5258871b33d | 37 | static EthernetKeypadPageHandler * theEthernetKeypadPageHandlerInstance; |
jmitc91516 | 1:a5258871b33d | 38 | |
jmitc91516 | 1:a5258871b33d | 39 | static const int minimumOctetValue; |
jmitc91516 | 1:a5258871b33d | 40 | static const int maximumOctetValue; |
jmitc91516 | 1:a5258871b33d | 41 | |
jmitc91516 | 1:a5258871b33d | 42 | static const GuiConst_INTCOLOR inactiveOctetBackgroundColour; |
jmitc91516 | 1:a5258871b33d | 43 | static const GuiConst_INTCOLOR activeOctetBackgroundColour; |
jmitc91516 | 1:a5258871b33d | 44 | |
jmitc91516 | 1:a5258871b33d | 45 | GuiConst_TEXT *callerEasyGUIOctetPtr[4]; |
jmitc91516 | 1:a5258871b33d | 46 | unsigned int *callerInternalOctetPtr[4]; |
jmitc91516 | 1:a5258871b33d | 47 | |
jmitc91516 | 1:a5258871b33d | 48 | ActiveOctetOutline activeOctetOutline[4]; |
jmitc91516 | 1:a5258871b33d | 49 | |
jmitc91516 | 1:a5258871b33d | 50 | int indexOfOctetBeingEdited; |
jmitc91516 | 1:a5258871b33d | 51 | unsigned int currentOctetValues[4]; |
jmitc91516 | 1:a5258871b33d | 52 | GuiConst_TEXT *easyGUIOctetValues[4]; |
jmitc91516 | 1:a5258871b33d | 53 | GuiConst_INTCOLOR *easyGUIOctetBackgroundColourVariables[4]; |
jmitc91516 | 1:a5258871b33d | 54 | |
jmitc91516 | 1:a5258871b33d | 55 | // singleton class -> constructor is private |
jmitc91516 | 1:a5258871b33d | 56 | EthernetKeypadPageHandler(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); |
jmitc91516 | 1:a5258871b33d | 57 | ~EthernetKeypadPageHandler(); |
jmitc91516 | 1:a5258871b33d | 58 | |
jmitc91516 | 1:a5258871b33d | 59 | USBDeviceConnected* usbDevice; |
jmitc91516 | 1:a5258871b33d | 60 | USBHostGC* usbHostGC; |
jmitc91516 | 1:a5258871b33d | 61 | |
jmitc91516 | 1:a5258871b33d | 62 | void DealWithDeleteKey(void); |
jmitc91516 | 1:a5258871b33d | 63 | |
jmitc91516 | 1:a5258871b33d | 64 | void DealWithNumberKey(int touchAreaIndex); |
jmitc91516 | 1:a5258871b33d | 65 | |
jmitc91516 | 1:a5258871b33d | 66 | void DealWithApplyKey(void); |
jmitc91516 | 1:a5258871b33d | 67 | |
jmitc91516 | 1:a5258871b33d | 68 | void DealWithCancelKey(void); |
jmitc91516 | 1:a5258871b33d | 69 | |
jmitc91516 | 1:a5258871b33d | 70 | void DealWithClearKey(void); |
jmitc91516 | 1:a5258871b33d | 71 | |
jmitc91516 | 1:a5258871b33d | 72 | void DealWithDotKey(void); |
jmitc91516 | 1:a5258871b33d | 73 | |
jmitc91516 | 1:a5258871b33d | 74 | void UpdateEasyGUIPage(void); |
jmitc91516 | 1:a5258871b33d | 75 | |
jmitc91516 | 1:a5258871b33d | 76 | void UpdateEasyGUIOctetValues(void); |
jmitc91516 | 1:a5258871b33d | 77 | |
jmitc91516 | 1:a5258871b33d | 78 | void UpdateEasyGUIBackgroundsForCurrentOctetSelection(void); |
jmitc91516 | 1:a5258871b33d | 79 | |
jmitc91516 | 1:a5258871b33d | 80 | void DrawOutlineAroundActiveOctet(void); |
jmitc91516 | 1:a5258871b33d | 81 | |
jmitc91516 | 1:a5258871b33d | 82 | int easyGUICallingPage; |
jmitc91516 | 1:a5258871b33d | 83 | }; |
jmitc91516 | 1:a5258871b33d | 84 | |
jmitc91516 | 1:a5258871b33d | 85 | #endif // ETHERNETKEYPADHANDLER_H |