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.
Label.hpp
00001 //----------------------------------------------------------- 00002 // Label class -- Header 00003 // 00004 // 2016/10/02, Copyright (c) 2016 MIKAMI, Naoki 00005 //----------------------------------------------------------- 00006 00007 #ifndef F746_LABEL_HPP 00008 #define F746_LABEL_HPP 00009 00010 #include "GuiBase.hpp" 00011 00012 namespace Mikami 00013 { 00014 class Label : public GuiBase 00015 { 00016 public: 00017 enum TextAlignMode { LEFT, CENTER, RIGHT }; 00018 // Constructor 00019 Label(uint16_t x, uint16_t y, const string str, 00020 TextAlignMode mode = LEFT, 00021 sFONT &fonts = Font12, 00022 uint32_t textColor = GuiBase::ENUM_TEXT, 00023 uint32_t backColor = GuiBase::ENUM_BACK); 00024 00025 // Constructor without string 00026 Label(uint16_t x, uint16_t y, 00027 TextAlignMode mode = LEFT, 00028 sFONT &fonts = Font12, 00029 uint32_t textColor = GuiBase::ENUM_TEXT, 00030 uint32_t backColor = GuiBase::ENUM_BACK) 00031 : GuiBase(x, y, fonts, textColor, backColor), 00032 MODE_(mode), STR_(""), length_(0) {} 00033 00034 void Draw() 00035 { Draw(STR_, TEXT_COLOR_); } 00036 00037 void Draw(const string str) 00038 { Draw(str, TEXT_COLOR_); } 00039 00040 void Draw(uint32_t textColor) 00041 { Draw(STR_, textColor); } 00042 00043 void Draw(const string str, 00044 uint32_t textColor); 00045 00046 private: 00047 const TextAlignMode MODE_; 00048 const string STR_; 00049 00050 uint8_t length_; 00051 uint16_t PosX(uint16_t x); 00052 00053 // disallow copy constructor and assignment operator 00054 Label(const Label&); 00055 Label& operator=(const Label&); 00056 }; 00057 } 00058 #endif // F746_LABEL_HPP
Generated on Tue Jul 12 2022 15:39:21 by
1.7.2