Ryan Scott / menuSystemMbedBroken

Dependencies:   ANSITermMenuSystem

Fork of menuSystemMbed by Ryan Scott

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  //   char check[] = "x";
00050  //   check[0] = 177;
00051  //   printXY (check, position.X - 2, position.Y);
00052     printXY ("X", position.X - 2, position.Y);
00053     gotoxy( position.X - 2, position.Y);
00054 }
00055 
00056 void menuItem::removeHighLight()
00057 {
00058     printXY (" ", position.X - 2, position.Y);
00059 }
00060 
00061 void menuItem::showselect()
00062 {
00063 printXY (">", position.X - 1, position.Y);
00064     gotoxy( position.X, position.Y);
00065 }
00066 
00067 void menuItem::removeselect()
00068 {
00069     printXY (" ", position.X - 1, position.Y);
00070 }
00071 
00072 int menuItem::getMenuID()
00073 {
00074     return menuID;
00075 }
00076 
00077