![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
2018年3月16日に開催されるCQ出版社インターフェース誌オフ会で紹介するプログラム
Dependencies: mbed Array_Matrix BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG
Diff: F746_Gui_New/Button.hpp
- Revision:
- 1:c27b3361dbbb
- Parent:
- 0:f00cf31ae154
--- a/F746_Gui_New/Button.hpp Sat Mar 10 11:37:33 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -//----------------------------------------------------------- -// Button class handling multi-touch -- Header -// Multi-touch: Enabled (default) -// -// 2016/03/29, Copyright (c) 2016 MIKAMI, Naoki -//----------------------------------------------------------- - -#ifndef F746_BUTTON_HPP -#define F746_BUTTON_HPP - -#include "GuiBase.hpp" - -namespace Mikami -{ - class Button : public GuiBase - { - public: - // Constructor - Button(uint16_t x, uint16_t y, - uint16_t width, uint16_t height, - const string str = "", sFONT &fonts = Font12, - uint32_t textColor = GuiBase::ENUM_TEXT, - uint32_t backColor = GuiBase::ENUM_BACK, - uint32_t createdColor = GuiBase::ENUM_CREATED, - uint32_t touchedColor = GuiBase::ENUM_TOUCHED, - uint32_t inactiveColor = GuiBase::ENUM_INACTIVE, - uint32_t inactiveTextColor = GuiBase::ENUM_INACTIVE_TEXT) - : GuiBase(x, y, fonts, - textColor, backColor, createdColor, - touchedColor, inactiveColor, - inactiveTextColor), - W_(width), H_(height), STR_(str), active_(true) - { Draw(); } - - // Draw button - void Draw(uint32_t color, uint32_t textColor); - void Draw(uint32_t color) { Draw(color, TEXT_COLOR_); } - void Draw() { Draw(CREATED_COLOR_, TEXT_COLOR_); } - - // Erase button - void Erase() { Draw(BACK_COLOR_, BACK_COLOR_); } - - // Check touch detected and redraw button - bool Touched(); - - bool IsOnButton(); - - void Activate(); - void Inactivate(); - bool IsActive() { return active_; } - - // Set or reset multi-touch - static void SetMultiTouch(bool tf) { multiTouch_ = tf; } - - private: - const uint16_t W_, H_; - const string STR_; - bool active_; - - // disallow copy constructor and assignment operator - Button(const Button&); - Button& operator=(const Button&); - }; -} -#endif // F746_BUTTON_HPP