Maxim Integrated / Mbed OS MAXREFDES155#

Dependencies:   MaximInterface

Revision:
8:a0d75dff3c9b
Parent:
7:66c5dedc750b
Child:
10:71359af61af8
diff -r 66c5dedc750b -r a0d75dff3c9b InitWindow.cpp
--- a/InitWindow.cpp	Thu Mar 09 11:38:33 2017 -0600
+++ b/InitWindow.cpp	Thu Apr 06 15:16:30 2017 -0500
@@ -54,8 +54,8 @@
 extern SensorNode sensorNode;
 extern std::string webId;
 
-static const unsigned int maximLogoWidth = 128;
-static const unsigned int maximLogoHeight = 39;
+static const int maximLogoWidth = 128;
+static const int maximLogoHeight = 39;
 static const uint8_t maximLogoData[] = {
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
     ,0x00,0x01,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -98,36 +98,34 @@
     ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
 };
 
-InitWindow::InitWindow(Graphic * parent) : Window(parent), m_state(NotStarted)
+InitWindow::InitWindow() : m_state(NotStarted)
 {
     setFocused();
 }
 
-Bitmap InitWindow::render() const
+void InitWindow::doRender(Bitmap & bitmap) const
 {       
     Bitmap maximLogo(maximLogoWidth, maximLogoHeight, maximLogoData, Bitmap::ScanLineFormat);
-    Text title("MAXREFDES155#");
-    title.setX(0);
-    title.setY(maximLogo.height() + 5);
-    title.update();
-    Text description(m_state == Completed ? "Any key to begin" : "Initializing...");
-    description.setX(0);
-    description.setY(title.y() + title.height() + 5);
-    description.update();
-    Bitmap bitmap(width(), height());
+    Text title;
+    title.setText("MAXREFDES155#");
+    title.resize(title.preferredWidth(), title.preferredHeight());
+    title.move(0, maximLogo.height() + 5);
+    Text description;
+    description.setText(m_state == Completed ? "Any key to begin" : "Initializing...");
+    description.resize(description.preferredWidth(), description.preferredHeight());
+    description.move(0, title.y() + title.height() + 5);
     bitmap.overlay(maximLogo, 0, 0);
     bitmap.overlay(title.render(), title.x(), title.y());
     bitmap.overlay(description.render(), description.x(), description.y());
-    return bitmap;
 }
 
-void InitWindow::doPostLayout()
+void InitWindow::updated()
 {       
     switch (m_state)
     {
     case NotStarted:
         m_state = Running;
-        invalidateRegion();
+        invalidate();
         break;
         
     case Running:
@@ -246,7 +244,7 @@
         }
         
         m_state = Completed;
-        invalidateRegion();
+        invalidate();
         break;
         
     case Completed: