Maxim Integrated / Mbed OS MAXREFDES155#

Dependencies:   MaximInterface

Revision:
13:6a6225690c2e
Parent:
10:71359af61af8
diff -r 46c5974a565f -r 6a6225690c2e Button.cpp
--- a/Button.cpp	Thu Jun 01 14:21:58 2017 -0500
+++ b/Button.cpp	Mon Nov 06 18:12:27 2017 -0600
@@ -32,46 +32,44 @@
 
 #include "Button.hpp"
 
-static const int deselectedBorderWidth = 1; // Border width when button is deselected.
-static const int selectedBorderWidth = 2; // Border width when button is selected.
-static const int borderPadding = selectedBorderWidth + 1; // Total width of the border region.
+// Border width when button is deselected.
+static const int deselectedBorderWidth = 1;
+// Border width when button is selected.
+static const int selectedBorderWidth = 2;
+// Total width of the border region.
+static const int borderPadding = selectedBorderWidth + 1;
 
-Button::Button()
-{
-    m_border.setParent(this);
-    m_border.setBorderWidth(deselectedBorderWidth);
-    m_label.setParent(this);
-}
-    
-int Button::preferredWidth() const
-{
-    return m_label.preferredWidth() + 2 * borderPadding;
+Button::Button() {
+  m_border.setParent(this);
+  m_border.setBorderWidth(deselectedBorderWidth);
+  m_label.setParent(this);
 }
 
-int Button::preferredHeight() const
-{
-    return m_label.preferredHeight() + 2 * borderPadding;
+int Button::preferredWidth() const {
+  return m_label.preferredWidth() + 2 * borderPadding;
+}
+
+int Button::preferredHeight() const {
+  return m_label.preferredHeight() + 2 * borderPadding;
 }
 
-void Button::focusChanged(bool focused)
-{
-    m_border.setBorderWidth(focused ? selectedBorderWidth : deselectedBorderWidth);
-    invalidate(); // Ensure border and text are redrawn together.
+void Button::focusChanged(bool focused) {
+  m_border.setBorderWidth(focused ? selectedBorderWidth
+                                  : deselectedBorderWidth);
+  invalidate(); // Ensure border and text are redrawn together.
 }
 
-void Button::resized()
-{
-    m_border.resize(width(), height());
-    m_label.move(borderPadding, borderPadding);
-    m_label.resize(m_border.width() - 2 * borderPadding, m_border.height() - 2 * borderPadding);
+void Button::resized() {
+  m_border.resize(width(), height());
+  m_label.move(borderPadding, borderPadding);
+  m_label.resize(m_border.width() - 2 * borderPadding,
+                 m_border.height() - 2 * borderPadding);
 }
 
-bool Button::doProcessKey(Key key)
-{
-    bool handled = (key == LeftClickKey);
-    if (handled && m_clickedHandler)
-    {
-        m_clickedHandler();
-    }
-    return handled;
+bool Button::doProcessKey(Key key) {
+  bool handled = (key == LeftClickKey);
+  if (handled && m_clickedHandler) {
+    m_clickedHandler(this);
+  }
+  return handled;
 }