Repository for import to local machine

Dependencies:   DMBasicGUI DMSupport

Committer:
jmitc91516
Date:
Mon Jul 31 15:37:57 2017 +0000
Revision:
8:26e49e6955bd
Parent:
5:aceac1035d71
Method ramp scrolling improved, and more bitmaps moved to QSPI memory

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jmitc91516 0:47c880c1463d 1 #ifndef TOUCHPANELPAGESELECTOR_H
jmitc91516 0:47c880c1463d 2 #define TOUCHPANELPAGESELECTOR_H
jmitc91516 0:47c880c1463d 3
jmitc91516 0:47c880c1463d 4 #include "mbed.h"
jmitc91516 0:47c880c1463d 5 #include "DMBoard.h"
jmitc91516 0:47c880c1463d 6
jmitc91516 0:47c880c1463d 7 #include "GuiLib.h"
jmitc91516 0:47c880c1463d 8 #include "GuiDisplay.h"
jmitc91516 0:47c880c1463d 9
jmitc91516 1:a5258871b33d 10 #include "USBHostGC.h"
jmitc91516 1:a5258871b33d 11
jmitc91516 1:a5258871b33d 12 #include "GCComponentTypeEnums.h"
jmitc91516 1:a5258871b33d 13 #include "GCIgnitionStateEnum.h"
jmitc91516 1:a5258871b33d 14
jmitc91516 1:a5258871b33d 15
jmitc91516 1:a5258871b33d 16 /*
jmitc91516 1:a5258871b33d 17 A number of touch areas in our easyGUI user interface are used to select pages - i.e. if you press touch area index 'n',
jmitc91516 1:a5258871b33d 18 you expect easyGUI page (or "structure") index 'p' to appear.
jmitc91516 1:a5258871b33d 19
jmitc91516 1:a5258871b33d 20 This class encapsulates the relationship between 'n' and 'p'.
jmitc91516 1:a5258871b33d 21 */
jmitc91516 0:47c880c1463d 22
jmitc91516 0:47c880c1463d 23 class TouchPanelPageSelector
jmitc91516 0:47c880c1463d 24 {
jmitc91516 0:47c880c1463d 25 public:
jmitc91516 0:47c880c1463d 26 TouchPanelPageSelector();
jmitc91516 0:47c880c1463d 27
jmitc91516 0:47c880c1463d 28 TouchPanelPageSelector(int index, int page);
jmitc91516 0:47c880c1463d 29
jmitc91516 0:47c880c1463d 30 int GetIndex(void) { return panelIndex; }
jmitc91516 0:47c880c1463d 31
jmitc91516 1:a5258871b33d 32 // Parameters are not used in the base class, but may be required in derived classes
jmitc91516 1:a5258871b33d 33 virtual int GetPageNumber(USBDeviceConnected* usbDevice, USBHostGC* usbHostGC) { return pageNumber; }
jmitc91516 1:a5258871b33d 34
jmitc91516 1:a5258871b33d 35 bool CanChangePage(void) { return pageChangeEnabled; }
jmitc91516 1:a5258871b33d 36
jmitc91516 1:a5258871b33d 37 static void SetPageChangeEnabled(bool enabled) { pageChangeEnabled = enabled; }
jmitc91516 0:47c880c1463d 38
jmitc91516 0:47c880c1463d 39 private:
jmitc91516 0:47c880c1463d 40 int panelIndex;
jmitc91516 0:47c880c1463d 41
jmitc91516 0:47c880c1463d 42 int pageNumber;
jmitc91516 1:a5258871b33d 43
jmitc91516 1:a5258871b33d 44 static bool pageChangeEnabled;
jmitc91516 1:a5258871b33d 45
jmitc91516 1:a5258871b33d 46 protected:
jmitc91516 1:a5258871b33d 47 int GetBasePageNumber(void) { return pageNumber; }
jmitc91516 1:a5258871b33d 48 };
jmitc91516 1:a5258871b33d 49
jmitc91516 1:a5258871b33d 50
jmitc91516 1:a5258871b33d 51 /*
jmitc91516 1:a5258871b33d 52 TouchPanelPageSelector always returns the same page for the same index.
jmitc91516 1:a5258871b33d 53 For the detector page(s), this is not what we want -
jmitc91516 1:a5258871b33d 54 we display a different detector page depending on the detector type.
jmitc91516 1:a5258871b33d 55 This class allows for this, and its 'GetPageNumber' function
jmitc91516 1:a5258871b33d 56 returns the appropriate page number for the type
jmitc91516 1:a5258871b33d 57 */
jmitc91516 1:a5258871b33d 58 class TouchPanelDetectorPageSelector : public TouchPanelPageSelector
jmitc91516 1:a5258871b33d 59 {
jmitc91516 1:a5258871b33d 60 public:
jmitc91516 1:a5258871b33d 61 TouchPanelDetectorPageSelector();
jmitc91516 1:a5258871b33d 62
jmitc91516 1:a5258871b33d 63 TouchPanelDetectorPageSelector(int index);
jmitc91516 1:a5258871b33d 64
jmitc91516 1:a5258871b33d 65 virtual int GetPageNumber(USBDeviceConnected* usbDevice, USBHostGC* usbHostGC);
jmitc91516 1:a5258871b33d 66
jmitc91516 1:a5258871b33d 67 private:
jmitc91516 1:a5258871b33d 68 DetectorType GetDetectorType(USBDeviceConnected* usbDevice, USBHostGC* usbHostGC);
jmitc91516 1:a5258871b33d 69 };
jmitc91516 1:a5258871b33d 70
jmitc91516 1:a5258871b33d 71
jmitc91516 1:a5258871b33d 72 /*
jmitc91516 1:a5258871b33d 73 TouchPanelPageSelector always returns the same page for the same index.
jmitc91516 1:a5258871b33d 74 When the user aborts a run, however, this is not (necessarily) what we want -
jmitc91516 1:a5258871b33d 75 we usually display the Home page, but if any components now require servicing
jmitc91516 1:a5258871b33d 76 (since even an aborted run counts as a 'cycle'), we want to display
jmitc91516 1:a5258871b33d 77 the "Servicing Required" page instead.
jmitc91516 1:a5258871b33d 78
jmitc91516 1:a5258871b33d 79 This class allows for this, and its 'GetPageNumber' function
jmitc91516 1:a5258871b33d 80 returns the appropriate page number.
jmitc91516 1:a5258871b33d 81 */
jmitc91516 1:a5258871b33d 82 class TouchPanelAbortRunPageSelector : public TouchPanelPageSelector
jmitc91516 1:a5258871b33d 83 {
jmitc91516 1:a5258871b33d 84 public:
jmitc91516 1:a5258871b33d 85 TouchPanelAbortRunPageSelector();
jmitc91516 1:a5258871b33d 86
jmitc91516 1:a5258871b33d 87 TouchPanelAbortRunPageSelector(int index);
jmitc91516 1:a5258871b33d 88
jmitc91516 1:a5258871b33d 89 virtual int GetPageNumber(USBDeviceConnected* usbDevice, USBHostGC* usbHostGC);
jmitc91516 1:a5258871b33d 90 };
jmitc91516 1:a5258871b33d 91
jmitc91516 1:a5258871b33d 92
jmitc91516 1:a5258871b33d 93 /*
jmitc91516 1:a5258871b33d 94 TouchPanelPageSelector always returns the same page for the same index.
jmitc91516 1:a5258871b33d 95 For the 'Running Settings' page, this is not what we want - we want the 'Return' button
jmitc91516 1:a5258871b33d 96 on this page to return the user to the page from which he invoked the Running Settings page.
jmitc91516 1:a5258871b33d 97 A similar situation exists for the 'Abort Run' page - if the user presses 'No' on that page,
jmitc91516 1:a5258871b33d 98 he will expect to return to the page from which he invoked the 'Abort Run' page.
jmitc91516 1:a5258871b33d 99
jmitc91516 1:a5258871b33d 100 This class is intended to deal with situations like these. It includes a static variable that contains
jmitc91516 1:a5258871b33d 101 the number of the page to be returned to. If 'thisIsTheReturnInstance' is true, the 'GetPageNumber' function
jmitc91516 1:a5258871b33d 102 returns that page number, otherwise it sets that variable to the page to be returned to,
jmitc91516 1:a5258871b33d 103 and returns the number of the page to be displayed now.
jmitc91516 1:a5258871b33d 104 */
jmitc91516 1:a5258871b33d 105 class TouchPanelReturnPageSelector : public TouchPanelPageSelector
jmitc91516 1:a5258871b33d 106 {
jmitc91516 1:a5258871b33d 107 public:
jmitc91516 1:a5258871b33d 108 TouchPanelReturnPageSelector();
jmitc91516 1:a5258871b33d 109
jmitc91516 1:a5258871b33d 110 TouchPanelReturnPageSelector(int index, int pageToReturnTo, int pageToDisplayNow, bool thisWillBeTheReturnInstance);
jmitc91516 1:a5258871b33d 111
jmitc91516 1:a5258871b33d 112 virtual int GetPageNumber(USBDeviceConnected* usbDevice, USBHostGC* usbHostGC);
jmitc91516 1:a5258871b33d 113
jmitc91516 1:a5258871b33d 114 private:
jmitc91516 1:a5258871b33d 115 bool thisIsTheReturnInstance;
jmitc91516 1:a5258871b33d 116 int thisReturnPage;
jmitc91516 1:a5258871b33d 117
jmitc91516 1:a5258871b33d 118 static int theReturnPage;
jmitc91516 1:a5258871b33d 119 };
jmitc91516 1:a5258871b33d 120
jmitc91516 1:a5258871b33d 121
jmitc91516 1:a5258871b33d 122 /*
jmitc91516 1:a5258871b33d 123 A class to encapsulate an array of (pointers to) page selectors.
jmitc91516 1:a5258871b33d 124 */
jmitc91516 0:47c880c1463d 125 class TouchPanelPageSelectors
jmitc91516 0:47c880c1463d 126 {
jmitc91516 0:47c880c1463d 127 public:
jmitc91516 0:47c880c1463d 128 TouchPanelPageSelectors();
jmitc91516 1:a5258871b33d 129
jmitc91516 1:a5258871b33d 130 ~TouchPanelPageSelectors();
jmitc91516 0:47c880c1463d 131
jmitc91516 0:47c880c1463d 132 TouchPanelPageSelector* GetTouchPanelPageSelector(int touchAreaIndex);
jmitc91516 0:47c880c1463d 133
jmitc91516 1:a5258871b33d 134 int GetTouchPanelPageSelectorIndex(TouchPanelPageSelector *tppsptr);
jmitc91516 1:a5258871b33d 135
jmitc91516 0:47c880c1463d 136 private:
jmitc91516 5:aceac1035d71 137 enum SelectorCount { SELECTOR_COUNT = 87 };
jmitc91516 0:47c880c1463d 138
jmitc91516 1:a5258871b33d 139 TouchPanelPageSelector *tppsArray[SELECTOR_COUNT];
jmitc91516 0:47c880c1463d 140 };
jmitc91516 0:47c880c1463d 141
jmitc91516 0:47c880c1463d 142 #endif //TOUCHPANELPAGESELECTOR_H