Automate écran capacitif
Dependencies: BSP_DISCO_F469NI LCD_DISCO_F469NI SeeedStudioTFTv2 TFT_fonts mbed
Fork of DISCO-F469NI_LCD_demo by
F469_GUI/Label.hpp@2:2182df2d7810, 2017-03-31 (annotated)
- Committer:
- SquirrelGod
- Date:
- Fri Mar 31 15:36:26 2017 +0000
- Revision:
- 2:2182df2d7810
Programme ?cran capacitif
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
SquirrelGod | 2:2182df2d7810 | 1 | //----------------------------------------------------------- |
SquirrelGod | 2:2182df2d7810 | 2 | // Label class -- Header |
SquirrelGod | 2:2182df2d7810 | 3 | // |
SquirrelGod | 2:2182df2d7810 | 4 | // 2016/04/24, Copyright (c) 2016 MIKAMI, Naoki |
SquirrelGod | 2:2182df2d7810 | 5 | //----------------------------------------------------------- |
SquirrelGod | 2:2182df2d7810 | 6 | |
SquirrelGod | 2:2182df2d7810 | 7 | #ifndef F746_LABEL_HPP |
SquirrelGod | 2:2182df2d7810 | 8 | #define F746_LABEL_HPP |
SquirrelGod | 2:2182df2d7810 | 9 | |
SquirrelGod | 2:2182df2d7810 | 10 | #include "GuiBase.hpp" |
SquirrelGod | 2:2182df2d7810 | 11 | |
SquirrelGod | 2:2182df2d7810 | 12 | namespace Mikami |
SquirrelGod | 2:2182df2d7810 | 13 | { |
SquirrelGod | 2:2182df2d7810 | 14 | class Label : public GuiBase |
SquirrelGod | 2:2182df2d7810 | 15 | { |
SquirrelGod | 2:2182df2d7810 | 16 | public: |
SquirrelGod | 2:2182df2d7810 | 17 | enum TextAlignMode { LEFT, CENTER, RIGHT }; |
SquirrelGod | 2:2182df2d7810 | 18 | // Constructor |
SquirrelGod | 2:2182df2d7810 | 19 | Label(uint16_t x, uint16_t y, const string str, |
SquirrelGod | 2:2182df2d7810 | 20 | TextAlignMode mode = LEFT, |
SquirrelGod | 2:2182df2d7810 | 21 | sFONT &fonts = Font12, |
SquirrelGod | 2:2182df2d7810 | 22 | uint32_t textColor = GuiBase::ENUM_TEXT, |
SquirrelGod | 2:2182df2d7810 | 23 | uint32_t backColor = GuiBase::ENUM_BACK); |
SquirrelGod | 2:2182df2d7810 | 24 | |
SquirrelGod | 2:2182df2d7810 | 25 | // Constructor without string |
SquirrelGod | 2:2182df2d7810 | 26 | Label(uint16_t x, uint16_t y, |
SquirrelGod | 2:2182df2d7810 | 27 | TextAlignMode mode = LEFT, |
SquirrelGod | 2:2182df2d7810 | 28 | sFONT &fonts = Font12, |
SquirrelGod | 2:2182df2d7810 | 29 | uint32_t textColor = GuiBase::ENUM_TEXT, |
SquirrelGod | 2:2182df2d7810 | 30 | uint32_t backColor = GuiBase::ENUM_BACK) |
SquirrelGod | 2:2182df2d7810 | 31 | : GuiBase(x, y, fonts, textColor, backColor), |
SquirrelGod | 2:2182df2d7810 | 32 | MODE_(mode), STR_("") {} |
SquirrelGod | 2:2182df2d7810 | 33 | |
SquirrelGod | 2:2182df2d7810 | 34 | void Draw() |
SquirrelGod | 2:2182df2d7810 | 35 | { Draw(STR_, TEXT_COLOR_); } |
SquirrelGod | 2:2182df2d7810 | 36 | |
SquirrelGod | 2:2182df2d7810 | 37 | void Draw(const string str) |
SquirrelGod | 2:2182df2d7810 | 38 | { Draw(str, TEXT_COLOR_); } |
SquirrelGod | 2:2182df2d7810 | 39 | |
SquirrelGod | 2:2182df2d7810 | 40 | void Draw(uint32_t textColor) |
SquirrelGod | 2:2182df2d7810 | 41 | { Draw(STR_, textColor); } |
SquirrelGod | 2:2182df2d7810 | 42 | |
SquirrelGod | 2:2182df2d7810 | 43 | void Draw(const string str, |
SquirrelGod | 2:2182df2d7810 | 44 | uint32_t textColor); |
SquirrelGod | 2:2182df2d7810 | 45 | |
SquirrelGod | 2:2182df2d7810 | 46 | private: |
SquirrelGod | 2:2182df2d7810 | 47 | const TextAlignMode MODE_; |
SquirrelGod | 2:2182df2d7810 | 48 | const string STR_; |
SquirrelGod | 2:2182df2d7810 | 49 | |
SquirrelGod | 2:2182df2d7810 | 50 | uint8_t length_; |
SquirrelGod | 2:2182df2d7810 | 51 | uint16_t PosX(uint16_t x); |
SquirrelGod | 2:2182df2d7810 | 52 | |
SquirrelGod | 2:2182df2d7810 | 53 | // disallow copy constructor and assignment operator |
SquirrelGod | 2:2182df2d7810 | 54 | Label(const Label&); |
SquirrelGod | 2:2182df2d7810 | 55 | Label& operator=(const Label&); |
SquirrelGod | 2:2182df2d7810 | 56 | }; |
SquirrelGod | 2:2182df2d7810 | 57 | } |
SquirrelGod | 2:2182df2d7810 | 58 | #endif // F746_LABEL_HPP |