Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MaximInterface
Diff: DisplayIdWindow.cpp
- Revision:
- 8:a0d75dff3c9b
- Parent:
- 7:66c5dedc750b
- Child:
- 10:71359af61af8
diff -r 66c5dedc750b -r a0d75dff3c9b DisplayIdWindow.cpp
--- a/DisplayIdWindow.cpp Thu Mar 09 11:38:33 2017 -0600
+++ b/DisplayIdWindow.cpp Thu Apr 06 15:16:30 2017 -0500
@@ -38,9 +38,9 @@
extern std::string webId;
-DisplayIdWindow::DisplayIdWindow(Mode mode, Graphic * parent) :
- Window(parent), m_mode(mode), m_continueButton("", this)
+DisplayIdWindow::DisplayIdWindow(Mode mode) : m_mode(mode)
{
+ m_continueButton.setParent(this);
switch (m_mode)
{
case PreConnectMode:
@@ -54,38 +54,25 @@
}
m_continueButton.setClickedHandler(Button::EventHandler(this, &DisplayIdWindow::continueButtonClicked));
m_continueButton.setFocused();
- m_continueButton.update();
-}
-
-Bitmap DisplayIdWindow::render() const
-{
- Bitmap bitmap(width(), height());
- Text description("Web ID: " + webId);
- description.setWordWrap(true);
- description.setWidth(width());
- description.setHeight(height());
- description.update();
- bitmap.overlay(description.render(), description.x(), description.y());
- bitmap.overlay(m_continueButton.render(), m_continueButton.x(), m_continueButton.y());
- return bitmap;
}
-void DisplayIdWindow::doLayout()
+void DisplayIdWindow::doRender(Bitmap & bitmap) const
+{
+ Text description;
+ description.setText("Web ID: " + webId);
+ description.setWordWrap(true);
+ description.resize(width(), height());
+ bitmap.overlay(description.render(), description.x(), description.y());
+ bitmap.overlay(m_continueButton.render(), m_continueButton.x(), m_continueButton.y());
+}
+
+void DisplayIdWindow::resized()
{
- m_continueButton.setWidth(m_continueButton.preferredWidth());
- m_continueButton.setHeight(m_continueButton.preferredHeight());
- switch (m_mode)
- {
- case PreConnectMode:
- m_continueButton.setX(width() - m_continueButton.width());
- break;
-
- case PopupMode:
- default:
- m_continueButton.setX(0);
- break;
- }
- m_continueButton.setY(height() - m_continueButton.height());
+ m_continueButton.resize(m_continueButton.preferredWidth(), m_continueButton.preferredHeight());
+ m_continueButton.move(
+ (m_mode == PreConnectMode) ? (width() - m_continueButton.width()) : 0,
+ height() - m_continueButton.height()
+ );
}
void DisplayIdWindow::continueButtonClicked()