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@2:d2f882d98f0a, 2016-04-05 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Tue Apr 05 13:23:17 2016 +0000
- Revision:
- 2:d2f882d98f0a
- Parent:
- 1:d1655f3c8717
- Child:
- 4:cbf7ed9092a3
3
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 | 2:d2f882d98f0a | 4 | // 2016/04/05, 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 | 0:a2686ef737c2 | 17 | enum TextAlignMode { LEFT, CENTER }; |
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 | 1:d1655f3c8717 | 25 | void Draw() |
MikamiUitOpen | 2:d2f882d98f0a | 26 | { Draw(STR_, TEXT_COLOR_); } |
MikamiUitOpen | 2:d2f882d98f0a | 27 | |
MikamiUitOpen | 2:d2f882d98f0a | 28 | void Draw(const string str) |
MikamiUitOpen | 2:d2f882d98f0a | 29 | { Draw(str, TEXT_COLOR_); } |
MikamiUitOpen | 1:d1655f3c8717 | 30 | |
MikamiUitOpen | 1:d1655f3c8717 | 31 | void Draw(uint32_t textColor) |
MikamiUitOpen | 1:d1655f3c8717 | 32 | { Draw(STR_, textColor); } |
MikamiUitOpen | 1:d1655f3c8717 | 33 | |
MikamiUitOpen | 1:d1655f3c8717 | 34 | void Draw(const string str, |
MikamiUitOpen | 2:d2f882d98f0a | 35 | uint32_t textColor); |
MikamiUitOpen | 0:a2686ef737c2 | 36 | |
MikamiUitOpen | 0:a2686ef737c2 | 37 | private: |
MikamiUitOpen | 0:a2686ef737c2 | 38 | const TextAlignMode MODE_; |
MikamiUitOpen | 1:d1655f3c8717 | 39 | const string STR_; |
MikamiUitOpen | 1:d1655f3c8717 | 40 | |
MikamiUitOpen | 0:a2686ef737c2 | 41 | uint8_t length_; |
MikamiUitOpen | 0:a2686ef737c2 | 42 | |
MikamiUitOpen | 0:a2686ef737c2 | 43 | uint16_t PosX(uint16_t x) |
MikamiUitOpen | 0:a2686ef737c2 | 44 | { return (MODE_ == LEFT) ? |
MikamiUitOpen | 0:a2686ef737c2 | 45 | x : x - length_*FONTS_->Width/2; } |
MikamiUitOpen | 0:a2686ef737c2 | 46 | |
MikamiUitOpen | 0:a2686ef737c2 | 47 | // disallow copy constructor and assignment operator |
MikamiUitOpen | 0:a2686ef737c2 | 48 | Label(const Label&); |
MikamiUitOpen | 0:a2686ef737c2 | 49 | Label& operator=(const Label&); |
MikamiUitOpen | 0:a2686ef737c2 | 50 | }; |
MikamiUitOpen | 0:a2686ef737c2 | 51 | } |
MikamiUitOpen | 0:a2686ef737c2 | 52 | #endif // F746_LABEL_HPP |