Ryan Scott / menuSystemMbed

Fork of menuSystemMbed by Brad Smith

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers menuItem.cpp Source File

menuItem.cpp

00001 //
00002 //  menuItem.cpp
00003 //  menuSystem
00004 //
00005 //  Created by BradDSmith on 2013-02-26.
00006 //  Copyright (c) 2013 BradDSmith. All rights reserved.
00007 //
00008 
00009 #include "menuItem.h"
00010 #include "console.h"
00011 
00012 menuItem::menuItem():Text("EMPTY")
00013 {
00014     
00015     
00016 }
00017 
00018 void menuItem::initialize( int ID, const char * text, int x, int y)
00019 {
00020     menuID = ID;
00021     setText( (char *) text);
00022     setPosition(x,y);
00023 }
00024 
00025 void menuItem::setText( char * menuText)
00026 {
00027     Text.assign(menuText);
00028 }
00029 
00030 void menuItem::setPosition(int x, int y)
00031 {
00032     position.X =  x;
00033     position.Y  = y;
00034 }
00035 
00036 void menuItem::print()
00037 {
00038     const char * msg = Text.c_str();
00039     printXY( (char *)msg, position.X, position.Y);
00040  
00041 }
00042 void menuItem::erase()
00043 {
00044     printXY ("                                           ", position.X - 2, position.Y);
00045 }
00046 
00047 void menuItem::highlight()
00048 {
00049     printXY ("X", position.X - 2, position.Y);
00050     gotoxy( position.X - 2, position.Y);
00051 }
00052 
00053 void menuItem::removeHighLight()
00054 {
00055     printXY (" ", position.X - 2, position.Y);
00056 
00057 }
00058 
00059 int menuItem::getMenuID()
00060 {
00061     return menuID;
00062 }
00063 
00064