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 GuiBase.hpp Source File

GuiBase.hpp

00001 //-----------------------------------------------------------
00002 //  GuiBase class (abstract base class) ---- Header
00003 //
00004 //      <インポートしたライブラリのリビジョン>
00005 //          Array_Matrix        2
00006 //          BSP_DISCO_F746NG    9
00007 //          LCD_DISCO_F746NG    0
00008 //          TS_DISCO_F746NG     0
00009 //      
00010 //  2018/03/12, Copyright (c) 2018 MIKAMI, Naoki
00011 //-----------------------------------------------------------
00012 
00013 #ifndef F746_GUI_BASE_HPP
00014 #define F746_GUI_BASE_HPP
00015 
00016 #include "mbed.h"
00017 #include <string>
00018 #include "TS_DISCO_F746NG.h"
00019 #include "LCD_DISCO_F746NG.h"
00020 
00021 namespace Mikami
00022 {
00023     class GuiBase
00024     {
00025     public:                    
00026         static LCD_DISCO_F746NG& GetLcd() { return lcd_; }
00027         static TS_DISCO_F746NG& GetTs() { return ts_; }
00028 
00029         // If panel touched, return true
00030         static bool PanelTouched();
00031         // Get touch panel state
00032         static TS_StateTypeDef GetTsState() { return state_; }
00033         
00034         // Clear the whole LCD
00035         static void Clear(uint32_t backColor = ENUM_BACK)
00036         { lcd_.Clear(backColor); }
00037 
00038         enum { ENUM_TEXT = 0xFFFFFFFF, ENUM_BACK = 0xFF003538,
00039                ENUM_CREATED = 0xFF0068B7, ENUM_TOUCHED = 0xFF7F7FFF,
00040                ENUM_INACTIVE = 0xD0003538, ENUM_INACTIVE_TEXT = 0xFF808080};
00041 
00042     protected:
00043         static LCD_DISCO_F746NG lcd_;  // for LCD display
00044         static TS_DISCO_F746NG ts_;    // for touch pannel
00045 
00046         static TS_StateTypeDef state_;
00047         static bool multiTouch_;
00048 
00049         const uint16_t X_, Y_;
00050         sFONT *const FONTS_;
00051 
00052         const uint32_t TEXT_COLOR_;
00053         const uint32_t BACK_COLOR_;
00054         const uint32_t CREATED_COLOR_;
00055         const uint32_t TOUCHED_COLOR_;
00056         const uint32_t INACTIVE_COLOR_;
00057         const uint32_t INACTIVE_TEXT_COLOR_;
00058 
00059         // Constructor
00060         GuiBase(uint16_t x =0, uint16_t y =0,
00061                 sFONT &fonts = Font12,
00062                 uint32_t textColor         = ENUM_TEXT,
00063                 uint32_t backColor         = ENUM_BACK,
00064                 uint32_t createdColor      = ENUM_CREATED,
00065                 uint32_t touchedColor      = ENUM_TOUCHED,
00066                 uint32_t inactiveColor     = ENUM_INACTIVE,
00067                 uint32_t inactiveTextColor = ENUM_INACTIVE_TEXT);
00068 
00069         void DrawString(uint16_t x, uint16_t y, const string str)
00070         { lcd_.DisplayStringAt(x, y, (uint8_t *)str.c_str(), LEFT_MODE); }
00071 
00072     private:
00073         static bool first_;
00074         
00075         // disallow copy constructor and assignment operator
00076         GuiBase(const GuiBase&);
00077         GuiBase& operator=(const GuiBase&);
00078     };
00079 }
00080 #endif  // F746_GUI_BASE_HPP