GUI parts for DISCO-F746NG. GuiBase, Button, ButtonGroup, ResetButton, Label, BlinkLabel, NumericLabel, SeekBar, SeekbarGroup
Dependencies: Array_Matrix BSP_DISCO_F746NG
Fork of F746_GUI by
Label.hpp@9:c379410bda15, 2016-04-24 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Sun Apr 24 11:49:42 2016 +0000
- Revision:
- 9:c379410bda15
- Parent:
- 4:cbf7ed9092a3
- Child:
- 23:2078556088a6
10
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:a2686ef737c2 | 1 | //----------------------------------------------------------- |
MikamiUitOpen | 0:a2686ef737c2 | 2 | // Label class -- Header |
MikamiUitOpen | 0:a2686ef737c2 | 3 | // |
MikamiUitOpen | 9:c379410bda15 | 4 | // 2016/04/24, Copyright (c) 2016 MIKAMI, Naoki |
MikamiUitOpen | 0:a2686ef737c2 | 5 | //----------------------------------------------------------- |
MikamiUitOpen | 0:a2686ef737c2 | 6 | |
MikamiUitOpen | 0:a2686ef737c2 | 7 | #ifndef F746_LABEL_HPP |
MikamiUitOpen | 0:a2686ef737c2 | 8 | #define F746_LABEL_HPP |
MikamiUitOpen | 0:a2686ef737c2 | 9 | |
MikamiUitOpen | 0:a2686ef737c2 | 10 | #include "GuiBase.hpp" |
MikamiUitOpen | 0:a2686ef737c2 | 11 | |
MikamiUitOpen | 0:a2686ef737c2 | 12 | namespace Mikami |
MikamiUitOpen | 0:a2686ef737c2 | 13 | { |
MikamiUitOpen | 0:a2686ef737c2 | 14 | class Label : public GuiBase |
MikamiUitOpen | 0:a2686ef737c2 | 15 | { |
MikamiUitOpen | 0:a2686ef737c2 | 16 | public: |
MikamiUitOpen | 9:c379410bda15 | 17 | enum TextAlignMode { LEFT, CENTER, RIGHT }; |
MikamiUitOpen | 0:a2686ef737c2 | 18 | // Constructor |
MikamiUitOpen | 0:a2686ef737c2 | 19 | Label(uint16_t x, uint16_t y, const string str, |
MikamiUitOpen | 0:a2686ef737c2 | 20 | TextAlignMode mode = LEFT, |
MikamiUitOpen | 0:a2686ef737c2 | 21 | sFONT &fonts = Font12, |
MikamiUitOpen | 0:a2686ef737c2 | 22 | uint32_t textColor = GuiBase::ENUM_TEXT, |
MikamiUitOpen | 0:a2686ef737c2 | 23 | uint32_t backColor = GuiBase::ENUM_BACK); |
MikamiUitOpen | 0:a2686ef737c2 | 24 | |
MikamiUitOpen | 4:cbf7ed9092a3 | 25 | // Constructor without string |
MikamiUitOpen | 4:cbf7ed9092a3 | 26 | Label(uint16_t x, uint16_t y, |
MikamiUitOpen | 4:cbf7ed9092a3 | 27 | TextAlignMode mode = LEFT, |
MikamiUitOpen | 4:cbf7ed9092a3 | 28 | sFONT &fonts = Font12, |
MikamiUitOpen | 4:cbf7ed9092a3 | 29 | uint32_t textColor = GuiBase::ENUM_TEXT, |
MikamiUitOpen | 4:cbf7ed9092a3 | 30 | uint32_t backColor = GuiBase::ENUM_BACK) |
MikamiUitOpen | 4:cbf7ed9092a3 | 31 | : GuiBase(x, y, fonts, textColor, backColor), |
MikamiUitOpen | 4:cbf7ed9092a3 | 32 | MODE_(mode), STR_("") {} |
MikamiUitOpen | 4:cbf7ed9092a3 | 33 | |
MikamiUitOpen | 1:d1655f3c8717 | 34 | void Draw() |
MikamiUitOpen | 2:d2f882d98f0a | 35 | { Draw(STR_, TEXT_COLOR_); } |
MikamiUitOpen | 2:d2f882d98f0a | 36 | |
MikamiUitOpen | 2:d2f882d98f0a | 37 | void Draw(const string str) |
MikamiUitOpen | 2:d2f882d98f0a | 38 | { Draw(str, TEXT_COLOR_); } |
MikamiUitOpen | 1:d1655f3c8717 | 39 | |
MikamiUitOpen | 1:d1655f3c8717 | 40 | void Draw(uint32_t textColor) |
MikamiUitOpen | 1:d1655f3c8717 | 41 | { Draw(STR_, textColor); } |
MikamiUitOpen | 1:d1655f3c8717 | 42 | |
MikamiUitOpen | 1:d1655f3c8717 | 43 | void Draw(const string str, |
MikamiUitOpen | 2:d2f882d98f0a | 44 | uint32_t textColor); |
MikamiUitOpen | 4:cbf7ed9092a3 | 45 | |
MikamiUitOpen | 0:a2686ef737c2 | 46 | private: |
MikamiUitOpen | 0:a2686ef737c2 | 47 | const TextAlignMode MODE_; |
MikamiUitOpen | 1:d1655f3c8717 | 48 | const string STR_; |
MikamiUitOpen | 1:d1655f3c8717 | 49 | |
MikamiUitOpen | 0:a2686ef737c2 | 50 | uint8_t length_; |
MikamiUitOpen | 9:c379410bda15 | 51 | uint16_t PosX(uint16_t x); |
MikamiUitOpen | 9:c379410bda15 | 52 | |
MikamiUitOpen | 0:a2686ef737c2 | 53 | // disallow copy constructor and assignment operator |
MikamiUitOpen | 0:a2686ef737c2 | 54 | Label(const Label&); |
MikamiUitOpen | 0:a2686ef737c2 | 55 | Label& operator=(const Label&); |
MikamiUitOpen | 0:a2686ef737c2 | 56 | }; |
MikamiUitOpen | 0:a2686ef737c2 | 57 | } |
MikamiUitOpen | 0:a2686ef737c2 | 58 | #endif // F746_LABEL_HPP |