Automate écran capacitif
Dependencies: BSP_DISCO_F469NI LCD_DISCO_F469NI SeeedStudioTFTv2 TFT_fonts mbed
Fork of DISCO-F469NI_LCD_demo by
F469_GUI/SeekbarGroup.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 | // SeekbarGroup class -- Header |
SquirrelGod | 2:2182df2d7810 | 3 | // |
SquirrelGod | 2:2182df2d7810 | 4 | // 2016/07/12, Copyright (c) 2016 MIKAMI, Naoki |
SquirrelGod | 2:2182df2d7810 | 5 | //----------------------------------------------------------- |
SquirrelGod | 2:2182df2d7810 | 6 | |
SquirrelGod | 2:2182df2d7810 | 7 | #ifndef F746_SEEKBAR_GROUP_HPP |
SquirrelGod | 2:2182df2d7810 | 8 | #define F746_SEEKBAR_GROUP_HPP |
SquirrelGod | 2:2182df2d7810 | 9 | |
SquirrelGod | 2:2182df2d7810 | 10 | #include "SeekBar.hpp" |
SquirrelGod | 2:2182df2d7810 | 11 | |
SquirrelGod | 2:2182df2d7810 | 12 | namespace Mikami |
SquirrelGod | 2:2182df2d7810 | 13 | { |
SquirrelGod | 2:2182df2d7810 | 14 | class SeekbarGroup : public GuiBase |
SquirrelGod | 2:2182df2d7810 | 15 | { |
SquirrelGod | 2:2182df2d7810 | 16 | public: |
SquirrelGod | 2:2182df2d7810 | 17 | SeekbarGroup(uint16_t x0, uint16_t y0, uint16_t length, |
SquirrelGod | 2:2182df2d7810 | 18 | uint16_t number, uint16_t space, |
SquirrelGod | 2:2182df2d7810 | 19 | float min, float max, float initialValue, |
SquirrelGod | 2:2182df2d7810 | 20 | SeekBar::Orientation hv = SeekBar::Holizontal, |
SquirrelGod | 2:2182df2d7810 | 21 | uint32_t thumbColor = 0xFFB0B0FF, |
SquirrelGod | 2:2182df2d7810 | 22 | uint16_t thumbSize = 30, uint16_t width = 4, |
SquirrelGod | 2:2182df2d7810 | 23 | uint32_t colorL = LCD_COLOR_LIGHTGRAY, |
SquirrelGod | 2:2182df2d7810 | 24 | uint32_t colorH = 0xFFB0B0B0, |
SquirrelGod | 2:2182df2d7810 | 25 | uint32_t backColor = GuiBase::ENUM_BACK); |
SquirrelGod | 2:2182df2d7810 | 26 | |
SquirrelGod | 2:2182df2d7810 | 27 | virtual ~SeekbarGroup(); |
SquirrelGod | 2:2182df2d7810 | 28 | |
SquirrelGod | 2:2182df2d7810 | 29 | bool Slide(int num) { return seekBars_[num]->Slide(); } |
SquirrelGod | 2:2182df2d7810 | 30 | float GetValue(int num) { return seekBars_[num]->GetValue(); } |
SquirrelGod | 2:2182df2d7810 | 31 | int GetIntValue(int num) { return seekBars_[num]->GetIntValue(); } |
SquirrelGod | 2:2182df2d7810 | 32 | |
SquirrelGod | 2:2182df2d7810 | 33 | // Get slided number |
SquirrelGod | 2:2182df2d7810 | 34 | bool GetSlidedNumber(int &num); |
SquirrelGod | 2:2182df2d7810 | 35 | |
SquirrelGod | 2:2182df2d7810 | 36 | void Draw(int num, float value, bool fill = false) |
SquirrelGod | 2:2182df2d7810 | 37 | { seekBars_[num]->Draw(value, fill); } |
SquirrelGod | 2:2182df2d7810 | 38 | |
SquirrelGod | 2:2182df2d7810 | 39 | // Draw all thumbs with same value |
SquirrelGod | 2:2182df2d7810 | 40 | void DrawAll(float value, bool fill = false) |
SquirrelGod | 2:2182df2d7810 | 41 | { for (int n=0; n<numberOfSeekBar_; n++) Draw(n, value, fill); } |
SquirrelGod | 2:2182df2d7810 | 42 | |
SquirrelGod | 2:2182df2d7810 | 43 | void Redraw(int num, bool fill = false) |
SquirrelGod | 2:2182df2d7810 | 44 | { seekBars_[num]->Draw(seekBars_[num]->GetValue(), fill); } |
SquirrelGod | 2:2182df2d7810 | 45 | |
SquirrelGod | 2:2182df2d7810 | 46 | void RedrawAll(bool fill = false) |
SquirrelGod | 2:2182df2d7810 | 47 | { for (int n=0; n<numberOfSeekBar_; n++) Redraw(n, fill); } |
SquirrelGod | 2:2182df2d7810 | 48 | |
SquirrelGod | 2:2182df2d7810 | 49 | // Activate and inactivate |
SquirrelGod | 2:2182df2d7810 | 50 | void Activate(int num) { seekBars_[num]->Activate(); } |
SquirrelGod | 2:2182df2d7810 | 51 | void Inactivate(int num) { seekBars_[num]->Inactivate(); } |
SquirrelGod | 2:2182df2d7810 | 52 | void ActivateAll() |
SquirrelGod | 2:2182df2d7810 | 53 | { |
SquirrelGod | 2:2182df2d7810 | 54 | for (int n=0; n<numberOfSeekBar_; n++) |
SquirrelGod | 2:2182df2d7810 | 55 | seekBars_[n]->Activate(); |
SquirrelGod | 2:2182df2d7810 | 56 | } |
SquirrelGod | 2:2182df2d7810 | 57 | void InactivateAll() |
SquirrelGod | 2:2182df2d7810 | 58 | { |
SquirrelGod | 2:2182df2d7810 | 59 | for (int n=0; n<numberOfSeekBar_; n++) |
SquirrelGod | 2:2182df2d7810 | 60 | seekBars_[n]->Inactivate(); |
SquirrelGod | 2:2182df2d7810 | 61 | } |
SquirrelGod | 2:2182df2d7810 | 62 | |
SquirrelGod | 2:2182df2d7810 | 63 | private: |
SquirrelGod | 2:2182df2d7810 | 64 | SeekBar **seekBars_; |
SquirrelGod | 2:2182df2d7810 | 65 | int numberOfSeekBar_; |
SquirrelGod | 2:2182df2d7810 | 66 | |
SquirrelGod | 2:2182df2d7810 | 67 | // Check range of argument |
SquirrelGod | 2:2182df2d7810 | 68 | bool Range(int n) |
SquirrelGod | 2:2182df2d7810 | 69 | { return ((n >= 0) && (n < numberOfSeekBar_)); } |
SquirrelGod | 2:2182df2d7810 | 70 | |
SquirrelGod | 2:2182df2d7810 | 71 | // disallow copy constructor and assignment operator |
SquirrelGod | 2:2182df2d7810 | 72 | SeekbarGroup(const SeekbarGroup&); |
SquirrelGod | 2:2182df2d7810 | 73 | SeekbarGroup& operator=(const SeekbarGroup&); |
SquirrelGod | 2:2182df2d7810 | 74 | }; |
SquirrelGod | 2:2182df2d7810 | 75 | } |
SquirrelGod | 2:2182df2d7810 | 76 | #endif // F746_SEEKBAR_GROUP_HPP |