GUI parts for DISCO-F746NG. GuiBase, Button, ButtonGroup, ResetButton, Label, BlinkLabel, NumericLabel, SeekBar, SeekbarGroup, NumericUpDown

Dependencies:   Array_Matrix BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG

Dependents:   F746_AudioOutQSPI F746_AudioPlayerSD DISCO-F746NG_test001 F746_SD_WavPlayer ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ResetButton.hpp Source File

ResetButton.hpp

00001 //-----------------------------------------------------------
00002 //  ResetButton class -- derived class of Button class
00003 //
00004 //  2017/01/16, Copyright (c) 2017 MIKAMI, Naoki
00005 //-----------------------------------------------------------
00006 
00007 #ifndef F746_RESET_BUTTON_HPP
00008 #define F746_RESET_BUTTON_HPP
00009 
00010 #include "Button.hpp"
00011 
00012 namespace Mikami
00013 {
00014     class ResetButton : public Button
00015     {
00016     public:
00017         ResetButton(uint16_t x = 0, uint16_t y = 240,
00018                     uint16_t w = 32, uint16_t h = 32)
00019             : Button(x, y, w, h)
00020         {
00021             pt_[0] = (Point){x+0.2f*w, y+h/2};
00022             pt_[1] = (Point){x+0.75f*w, y+0.175f*h};
00023             pt_[2] = (Point){x+0.75f*w, y+0.825f*h};
00024             Draw();
00025         }
00026 
00027         void DoIfTouched()
00028         {
00029             if (!Touched()) return;
00030 
00031             wait(0.2f);
00032             NVIC_SystemReset();
00033         }
00034         
00035         void Draw()
00036         {
00037             Activate();
00038             lcd_.SetTextColor(LCD_COLOR_WHITE);
00039             lcd_.FillPolygon(pt_, 3);
00040         }
00041 
00042     private:
00043         Point pt_[3];
00044 
00045         // disallow copy constructor and assignment operator
00046         ResetButton(const ResetButton&);
00047         ResetButton& operator=(const ResetButton&);
00048     };
00049 }
00050 #endif  // F746_RESET_BUTTON_HPP