Motoo Tanaka / Mbed 2 deprecated oscilloscope Featured

Dependencies:   SPI_STMPE610 UniGraphic mbed vt100

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TFTMenu.h Source File

TFTMenu.h

00001 /** mbed oscilloscope my implementation of a oscillo scope
00002  * Copyright (c) 2014, 2015 Motoo Tanaka @ Design Methodology Lab
00003  *
00004  * TFTMenu.h
00005  *
00006  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00007  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00008  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00009  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00010  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00011  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00012  * THE SOFTWARE.
00013  */
00014 #ifndef _TFT_MENU_H_
00015 #define _TFT_MENU_H_ defined
00016 
00017 typedef void (*FuncPtr)(void) ;
00018 
00019 class TFTMenuItem {
00020 public:
00021 TFTMenuItem(int x1, int y1, int x2, int y2, FuncPtr fnc, 
00022     char *name, uint16_t mc, uint16_t fc) ;
00023 ~TFTMenuItem() ;
00024 virtual bool hit(int x, int y) ;
00025 virtual void draw(int offset_x = 0, int offset_y = 0) ;
00026 void highlight(int offset_x = 0, int offset_y = 0) ;
00027 uint16_t getColor(void) ;
00028 void doIt(void) ;
00029 
00030 protected:
00031 char *label ;
00032 uint16_t font_color ;
00033 uint16_t menu_color ;
00034 int top ; 
00035 int bottom ;
00036 int left ;
00037 int right ;
00038 int left_margin ;
00039 int top_margin ;
00040 FuncPtr func ;
00041 private:
00042 } ;
00043 
00044 class TFTRadioButton : public TFTMenuItem {
00045 public:
00046 TFTRadioButton(int x1, int y1, int x2, int y2, FuncPtr fnc, 
00047     char *name, uint16_t mc, uint16_t fc,
00048     char *altname = 0, uint16_t altmc = 0, uint16_t altfc = 0, 
00049     bool sel = false) ;
00050 ~TFTRadioButton() ;
00051 
00052 virtual bool hit(int x, int y) ;
00053 virtual void draw(int offset_x = 0, int offset_y = 0) ;
00054 
00055 void select(bool value) ;
00056 
00057 protected:
00058 bool selected ;
00059 char *alt_label ;
00060 uint16_t alt_font_color ;
00061 uint16_t alt_menu_color ;
00062 // FuncPtr alt_func ;
00063 private:
00064 } ;
00065 
00066 class TFTMenu {
00067 public:
00068 TFTMenu() ; // constructor
00069 ~TFTMenu() ; // destructor 
00070 private:
00071 } ;
00072 
00073 #endif /* _TFT_MENU_H_ */