Class library: Button class and ButtonGroup class for DISCO-F746NG. クラスライブラリ: DISCO-F746NG 用の,Button クラス,ButtonGroup クラス.
Dependents: F746_SpectralAnalysis_NoPhoto F746_Fourier_series_of_square_wave_01 F746_ButtonGroup_Demo F746_Mandelbrot ... more
Diff: button.hpp
- Revision:
- 13:af578b53ff0e
- Parent:
- 12:710078d50d9b
--- a/button.hpp Thu Feb 18 10:04:20 2016 +0000 +++ b/button.hpp Mon Feb 22 13:39:32 2016 +0000 @@ -1,7 +1,8 @@ //----------------------------------------------------------- -// Button class coping with multi-touch -- Header +// Button class handling multi-touch -- Header +// Multi-touch: Enabled (default) // -// 2016/02/18, Copyright (c) 2016 MIKAMI, Naoki +// 2016/02/22, Copyright (c) 2016 MIKAMI, Naoki //----------------------------------------------------------- #ifndef F746_BUTTON_HPP @@ -36,7 +37,7 @@ void Redraw(uint32_t textColor = LCD_COLOR_WHITE) { Draw(ORIGINAL_COLOR_, textColor); } - // Erase button with selected color + // Erase button void Erase() { Draw(BACK_COLOR_, BACK_COLOR_); } @@ -48,10 +49,21 @@ // Get original color uint32_t GetOriginalColor() { return ORIGINAL_COLOR_; } + + bool PanelTouched(); + bool IsOnButton(); + + // Get previously got state + static TS_StateTypeDef GottenState() + { return state_; } + + // Set or reset multi-touch + static void SetMultiTouch(bool tf) { multiTouch = tf; } private: LCD_DISCO_F746NG &lcd_; TS_DISCO_F746NG &ts_; + const uint16_t X_, Y_, W_, H_; const uint32_t ORIGINAL_COLOR_; // original color const uint32_t BACK_COLOR_; // back color of screen @@ -60,6 +72,9 @@ const uint16_t FONT_WIDTH_; const uint16_t FONT_HEIGHT_; + static TS_StateTypeDef state_; + static bool multiTouch; + // disallow copy constructor and assignment operator Button(const Button&); Button& operator=(const Button&);