Richard Parker / EALCD
Revision:
3:24fbf4dbd7e5
Child:
4:f8f7f4f9c58d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/EASettings.h	Wed Mar 31 22:22:21 2010 +0000
@@ -0,0 +1,77 @@
+// Copyright 2010 Richard Parker
+
+#ifndef MBED_EASETTINGS_H
+#define MBED_EASETTINGS_H
+
+#include "mbed.h"
+
+#include "../manager/EAHitHandler.h"
+
+class EALCD;
+class EATouchManager;
+class EAButton;
+class EATouch;
+
+/**
+ * Class to handle setting up the peripherals on the EA star gazer board.
+ * @author Richard Parker
+ */
+class EASettings: public EAHitHandler
+{
+public:
+    enum State {
+        STATE_IDLE,
+        STATE_ENDED,
+        STATE_PORTAL,
+        STATE_DATE_DAY,
+        STATE_DATE_MONTH,
+        STATE_DATE_YEAR,
+        STATE_DATE_HOUR,
+        STATE_DATE_MINUTE,
+        STATE_DATE_SECOND
+    };
+
+    EASettings(EALCD& lcd, EATouch& touch, EATouchManager& manager);
+    ~EASettings();
+    
+    void start();
+    
+    inline unsigned short size() { return 40; }
+
+    virtual void actionHandler(EAHitBox* box, short x, short y);
+    
+    inline EASettings::State state() { return _state; }
+    
+private:
+    EALCD& _lcd;
+    EATouch& _touch;
+    EATouchManager& _manager;
+    struct tm* _time;
+    
+    EAButton* _launchBox;
+    EAButton* _returnBox;  
+    EAButton* _touchBox;
+    EAButton* _dateBox;
+    EAButton* _compassBox;
+    EAButton* _nextBox;
+    EAButton* _prevBox;
+    EAButton* _incBox;   
+    EAButton* _decBox;
+    
+    EASettings::State _state;
+    
+    void _disableHitBoxs();
+    
+    void _drawLaunchButton();
+    void _drawPortal();
+    void _drawDate();
+        
+    EASettings::State _incDate();
+    EASettings::State _decDate();
+    EASettings::State _nextDate();
+    EASettings::State _prevDate();
+    void _enableDateButtons();
+    
+};
+
+#endif