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

NumericUpDown.hpp

00001 //-----------------------------------------------------------
00002 //  NumericUpDown class
00003 //      指定された桁を up/down する GUI 部品
00004 //      6 桁まで可能
00005 //
00006 //  2018/03/12, Copyright (c) 2018 MIKAMI, Naoki
00007 //-----------------------------------------------------------
00008 
00009 #ifndef NUMERIC_UPDOWN_HPP
00010 #define NUMERIC_UPDOWN_HPP
00011 
00012 #include "F746_GUI.hpp"
00013 #include "DelayedEnabler.hpp"
00014 
00015 namespace Mikami
00016 {
00017     class NumericUpDown
00018     {
00019     public:
00020         // digit    表示する桁数
00021         // initVal  最初に表示する数値
00022         NumericUpDown(uint16_t digit, uint16_t x0, uint16_t y0,
00023                       uint32_t initVal, uint32_t max, uint32_t min,
00024                       string unit = "", float delay = 0.2f);
00025 
00026         // Up, Down をタッチした場合は対応する数値を +1 または -1 する
00027         bool Touched();
00028 
00029         // 引数の数値を Label に表示する
00030         void Set(uint32_t frq);
00031 
00032         // Label に表示されている値を数値データとして取り出す
00033         uint32_t Get() { return value_; }
00034 
00035     private:
00036         const int DIGIT_;       // 桁数
00037         const int X0_, Y0_;
00038         const uint32_t MAX_;    // 最大値
00039         const uint32_t MIN_;    // 最小値
00040         const Array<uint32_t> POW10_;
00041         const static uint16_t XW_ = 45;
00042         const static int16_t SIZE_ = 6;
00043 
00044         static Point ptU_[3], ptD_[3];
00045      
00046         char fmt_[5];
00047         int numUd_;     // 一つ前にタッチしたボタンの番号
00048         uint32_t value_;
00049 
00050         DelayedEnabler delay_;
00051         Array<Label *> labels_;
00052         ButtonGroup *ud_;
00053         LCD_DISCO_F746NG &lcd_;
00054 
00055         // 数値の up, down に使う三角形の描画
00056         void UpDownSymbol(uint16_t x, uint16_t y, int k);
00057 
00058         // disallow copy constructor and assignment operator
00059         NumericUpDown(const NumericUpDown&);
00060         NumericUpDown& operator=(const NumericUpDown&);      
00061     };
00062 }
00063 #endif  // NUMERIC_UPDOWN_HPP