GUI parts for DISCO-F469I a fork of DISCO-F746NG. GuiBase, Button, ButtonGroup, ResetButton, Label, BlinkLabel, NumericLabel, SeekBar, SeekbarGroup

Dependents:   DISCO-F469NI_LCDTS_GUI_demo DISCO-F469NI_LCDTS_GUI_demo projekt_PSW_v1 DISCO-F469NI_LCDTS_GUI_demoaaaaaaaaaxxxx ... more

Fork of F746_GUI by 不韋 呂

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Label.hpp Source File

Label.hpp

00001 //-----------------------------------------------------------
00002 //  Label class -- Header
00003 //
00004 //  2016/04/24, 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_("") {}
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