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: Array_Matrix TS_DISCO_F746NG LCD_DISCO_F746NG BSP_DISCO_F746NG
Revision 1:d1655f3c8717, committed 2016-04-03
- Comitter:
- MikamiUitOpen
- Date:
- Sun Apr 03 10:36:27 2016 +0000
- Parent:
- 0:a2686ef737c2
- Child:
- 2:d2f882d98f0a
- Commit message:
- 2
Changed in this revision
| Label.cpp | Show annotated file Show diff for this revision Revisions of this file |
| Label.hpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Label.cpp Thu Mar 31 07:28:42 2016 +0000
+++ b/Label.cpp Sun Apr 03 10:36:27 2016 +0000
@@ -1,7 +1,7 @@
//-----------------------------------------------------------
// Label class
//
-// 2016/03/29, Copyright (c) 2016 MIKAMI, Naoki
+// 2016/04/03, Copyright (c) 2016 MIKAMI, Naoki
//-----------------------------------------------------------
#include "Label.hpp"
@@ -13,7 +13,7 @@
const string str, TextAlignMode mode, sFONT &fonts,
uint32_t textColor, uint32_t backColor)
: GuiBase(x, y, fonts, textColor, backColor),
- MODE_(mode)
+ MODE_(mode), STR_(str)
{
length_ = str.length();
lcd_.SetBackColor(backColor);
@@ -22,17 +22,17 @@
DrawString(PosX(x), y, str);
}
- void Label::Draw(const string str)
+ void Label::Draw(const string str, uint32_t textColor)
{
// Erase previously-drawn string
lcd_.SetTextColor(BACK_COLOR_);
length_ = (length_ > str.length()) ? length_ : str.length();
lcd_.FillRect(PosX(X_), Y_, FONTS_->Width*length_+1, FONTS_->Height);
- lcd_.SetTextColor(TEXT_COLOR_);
// Draw new string
length_ = str.length();
lcd_.SetFont(FONTS_);
+ lcd_.SetTextColor(textColor);
DrawString(PosX(X_), Y_, str);
}
}
--- a/Label.hpp Thu Mar 31 07:28:42 2016 +0000
+++ b/Label.hpp Sun Apr 03 10:36:27 2016 +0000
@@ -1,7 +1,7 @@
//-----------------------------------------------------------
// Label class -- Header
//
-// 2016/03/28, Copyright (c) 2016 MIKAMI, Naoki
+// 2016/04/03, Copyright (c) 2016 MIKAMI, Naoki
//-----------------------------------------------------------
#ifndef F746_LABEL_HPP
@@ -22,11 +22,19 @@
uint32_t textColor = GuiBase::ENUM_TEXT,
uint32_t backColor = GuiBase::ENUM_BACK);
- void Draw(const string str);
+ void Draw()
+ { Draw(STR_, GuiBase::ENUM_TEXT); }
+
+ void Draw(uint32_t textColor)
+ { Draw(STR_, textColor); }
+
+ void Draw(const string str,
+ uint32_t textColor = GuiBase::ENUM_TEXT);
private:
const TextAlignMode MODE_;
-
+ const string STR_;
+
uint8_t length_;
uint16_t PosX(uint16_t x)