GUI parts for DISCO-F746NG. GuiBase, Button, ButtonGroup, Label, BlinkLabel, NumericLabel, SeekBar, SeekbarGroup
Dependents: F746_SD_GraphicEqualizer_ren0620
Fork of F746_GUI by
NumericLabel.hpp
00001 //----------------------------------------------------------- 00002 // NumericLabel class -- derived class of Label class 00003 // 00004 // 2016/04/12, Copyright (c) 2016 MIKAMI, Naoki 00005 //----------------------------------------------------------- 00006 00007 #ifndef F746_NUMERIC_LABEL_HPP 00008 #define F746_NUMERIC_LABEL_HPP 00009 00010 #include "Label.hpp" 00011 00012 namespace Mikami 00013 { 00014 template <typename T> class NumericLabel : public Label 00015 { 00016 public: 00017 // Constructor without drawing value 00018 NumericLabel(uint16_t x, uint16_t y, 00019 TextAlignMode mode = LEFT, 00020 sFONT &fonts = Font12, 00021 uint32_t textColor = GuiBase::ENUM_TEXT, 00022 uint32_t backColor = GuiBase::ENUM_BACK) 00023 : Label(x, y, "", mode, fonts, textColor, backColor) {} 00024 00025 // Constructor with drawing value 00026 NumericLabel(uint16_t x, uint16_t y, 00027 const char fmt[], T val, 00028 TextAlignMode mode = LEFT, 00029 sFONT &fonts = Font12, 00030 uint32_t textColor = GuiBase::ENUM_TEXT, 00031 uint32_t backColor = GuiBase::ENUM_BACK) 00032 : Label(x, y, "", mode, fonts, textColor, backColor) 00033 { Draw(fmt, val); } 00034 00035 // Draw value 00036 void Draw(const char fmt[], T val) 00037 { 00038 sprintf(str_, fmt, val); 00039 Label::Draw(str_); 00040 } 00041 00042 // Draw previous value with specified color 00043 void Draw(uint32_t color) 00044 { Label::Draw(str_, color); } 00045 00046 private: 00047 char str_[81]; 00048 00049 // disallow copy constructor and assignment operator 00050 NumericLabel(const NumericLabel&); 00051 NumericLabel& operator=(const NumericLabel&); 00052 }; 00053 } 00054 #endif // F746_NUMERIC_LABEL_HPP
Generated on Fri Jul 22 2022 12:03:18 by 1.7.2