F746 GUI over lapping class.
Dependents: DISCO-F746NG_test001
NumericLabelOL.hpp@2:d7dc710446a8, 2016-07-02 (annotated)
- Committer:
- InoueTakashi
- Date:
- Sat Jul 02 05:38:23 2016 +0000
- Revision:
- 2:d7dc710446a8
- Parent:
- 1:36e616bde4b8
Add Destructer
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
InoueTakashi | 1:36e616bde4b8 | 1 | #ifndef F746_NUMERIC_LABEL_OL_HPP |
InoueTakashi | 1:36e616bde4b8 | 2 | #define F746_NUMERIC_LABEL_OL_HPP |
InoueTakashi | 1:36e616bde4b8 | 3 | |
InoueTakashi | 1:36e616bde4b8 | 4 | #include "NumericLabel.hpp" |
InoueTakashi | 1:36e616bde4b8 | 5 | |
InoueTakashi | 1:36e616bde4b8 | 6 | using namespace Mikami; |
InoueTakashi | 1:36e616bde4b8 | 7 | |
InoueTakashi | 1:36e616bde4b8 | 8 | namespace TakaIno |
InoueTakashi | 1:36e616bde4b8 | 9 | { |
InoueTakashi | 1:36e616bde4b8 | 10 | template <typename T> class NumericLabelOL : public Label |
InoueTakashi | 1:36e616bde4b8 | 11 | { |
InoueTakashi | 1:36e616bde4b8 | 12 | public: |
InoueTakashi | 1:36e616bde4b8 | 13 | // Constructor with drawing value |
InoueTakashi | 1:36e616bde4b8 | 14 | NumericLabelOL(uint16_t x, uint16_t y, |
InoueTakashi | 1:36e616bde4b8 | 15 | const char fmt[], T val, |
InoueTakashi | 1:36e616bde4b8 | 16 | Label::TextAlignMode mode, |
InoueTakashi | 1:36e616bde4b8 | 17 | sFONT &fonts, |
InoueTakashi | 1:36e616bde4b8 | 18 | uint32_t textColor, |
InoueTakashi | 1:36e616bde4b8 | 19 | uint32_t backColor) |
InoueTakashi | 1:36e616bde4b8 | 20 | : Label(x, y, "", mode, fonts, textColor, backColor) |
InoueTakashi | 1:36e616bde4b8 | 21 | |
InoueTakashi | 1:36e616bde4b8 | 22 | |
InoueTakashi | 1:36e616bde4b8 | 23 | { Draw(fmt, val, textColor, backColor); } |
InoueTakashi | 2:d7dc710446a8 | 24 | |
InoueTakashi | 2:d7dc710446a8 | 25 | |
InoueTakashi | 1:36e616bde4b8 | 26 | |
InoueTakashi | 1:36e616bde4b8 | 27 | // Draw value |
InoueTakashi | 1:36e616bde4b8 | 28 | void Draw(const char fmt[], T val, uint32_t txt_color, uint32_t bak_color) |
InoueTakashi | 1:36e616bde4b8 | 29 | { |
InoueTakashi | 1:36e616bde4b8 | 30 | sprintf(pri_str, fmt, val); |
InoueTakashi | 1:36e616bde4b8 | 31 | Label::GetLcdPtr()->SetBackColor(bak_color); |
InoueTakashi | 1:36e616bde4b8 | 32 | Label::Draw(pri_str, txt_color); |
InoueTakashi | 1:36e616bde4b8 | 33 | |
InoueTakashi | 1:36e616bde4b8 | 34 | } |
InoueTakashi | 1:36e616bde4b8 | 35 | |
InoueTakashi | 1:36e616bde4b8 | 36 | |
InoueTakashi | 1:36e616bde4b8 | 37 | |
InoueTakashi | 1:36e616bde4b8 | 38 | private: |
InoueTakashi | 1:36e616bde4b8 | 39 | char pri_str[81]; |
InoueTakashi | 1:36e616bde4b8 | 40 | |
InoueTakashi | 1:36e616bde4b8 | 41 | // disallow copy constructor and assignment operator |
InoueTakashi | 1:36e616bde4b8 | 42 | NumericLabelOL(const NumericLabelOL&); |
InoueTakashi | 1:36e616bde4b8 | 43 | NumericLabelOL& operator=(const NumericLabelOL&); |
InoueTakashi | 1:36e616bde4b8 | 44 | }; |
InoueTakashi | 1:36e616bde4b8 | 45 | } |
InoueTakashi | 1:36e616bde4b8 | 46 | #endif // F746_NUMERIC_LABEL_OL_HPP |