mbed menu system
menuItem.cpp@2:5c4911aba273, 2013-02-28 (annotated)
- Committer:
- mbedDevLondon
- Date:
- Thu Feb 28 03:33:50 2013 +0000
- Revision:
- 2:5c4911aba273
- Parent:
- 0:a5ece7312edc
formatting in menuIDs.h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedDevLondon | 0:a5ece7312edc | 1 | // |
mbedDevLondon | 0:a5ece7312edc | 2 | // menuItem.cpp |
mbedDevLondon | 0:a5ece7312edc | 3 | // menuSystem |
mbedDevLondon | 0:a5ece7312edc | 4 | // |
mbedDevLondon | 0:a5ece7312edc | 5 | // Created by BradDSmith on 2013-02-26. |
mbedDevLondon | 0:a5ece7312edc | 6 | // Copyright (c) 2013 BradDSmith. All rights reserved. |
mbedDevLondon | 0:a5ece7312edc | 7 | // |
mbedDevLondon | 0:a5ece7312edc | 8 | |
mbedDevLondon | 0:a5ece7312edc | 9 | #include "menuItem.h" |
mbedDevLondon | 0:a5ece7312edc | 10 | #include "console.h" |
mbedDevLondon | 0:a5ece7312edc | 11 | |
mbedDevLondon | 0:a5ece7312edc | 12 | menuItem::menuItem():Text("EMPTY") |
mbedDevLondon | 0:a5ece7312edc | 13 | { |
mbedDevLondon | 0:a5ece7312edc | 14 | |
mbedDevLondon | 0:a5ece7312edc | 15 | |
mbedDevLondon | 0:a5ece7312edc | 16 | } |
mbedDevLondon | 0:a5ece7312edc | 17 | |
mbedDevLondon | 0:a5ece7312edc | 18 | void menuItem::initialize( int ID, const char * text, int x, int y) |
mbedDevLondon | 0:a5ece7312edc | 19 | { |
mbedDevLondon | 0:a5ece7312edc | 20 | menuID = ID; |
mbedDevLondon | 0:a5ece7312edc | 21 | setText( (char *) text); |
mbedDevLondon | 0:a5ece7312edc | 22 | setPosition(x,y); |
mbedDevLondon | 0:a5ece7312edc | 23 | } |
mbedDevLondon | 0:a5ece7312edc | 24 | |
mbedDevLondon | 0:a5ece7312edc | 25 | void menuItem::setText( char * menuText) |
mbedDevLondon | 0:a5ece7312edc | 26 | { |
mbedDevLondon | 0:a5ece7312edc | 27 | Text.assign(menuText); |
mbedDevLondon | 0:a5ece7312edc | 28 | } |
mbedDevLondon | 0:a5ece7312edc | 29 | |
mbedDevLondon | 0:a5ece7312edc | 30 | void menuItem::setPosition(int x, int y) |
mbedDevLondon | 0:a5ece7312edc | 31 | { |
mbedDevLondon | 0:a5ece7312edc | 32 | position.X = x; |
mbedDevLondon | 0:a5ece7312edc | 33 | position.Y = y; |
mbedDevLondon | 0:a5ece7312edc | 34 | } |
mbedDevLondon | 0:a5ece7312edc | 35 | |
mbedDevLondon | 0:a5ece7312edc | 36 | void menuItem::print() |
mbedDevLondon | 0:a5ece7312edc | 37 | { |
mbedDevLondon | 0:a5ece7312edc | 38 | const char * msg = Text.c_str(); |
mbedDevLondon | 0:a5ece7312edc | 39 | printXY( (char *)msg, position.X, position.Y); |
mbedDevLondon | 0:a5ece7312edc | 40 | |
mbedDevLondon | 0:a5ece7312edc | 41 | } |
mbedDevLondon | 0:a5ece7312edc | 42 | void menuItem::erase() |
mbedDevLondon | 0:a5ece7312edc | 43 | { |
mbedDevLondon | 0:a5ece7312edc | 44 | printXY (" ", position.X - 2, position.Y); |
mbedDevLondon | 0:a5ece7312edc | 45 | } |
mbedDevLondon | 0:a5ece7312edc | 46 | |
mbedDevLondon | 0:a5ece7312edc | 47 | void menuItem::highlight() |
mbedDevLondon | 0:a5ece7312edc | 48 | { |
mbedDevLondon | 0:a5ece7312edc | 49 | printXY ("X", position.X - 2, position.Y); |
mbedDevLondon | 0:a5ece7312edc | 50 | gotoxy( position.X - 2, position.Y); |
mbedDevLondon | 0:a5ece7312edc | 51 | } |
mbedDevLondon | 0:a5ece7312edc | 52 | |
mbedDevLondon | 0:a5ece7312edc | 53 | void menuItem::removeHighLight() |
mbedDevLondon | 0:a5ece7312edc | 54 | { |
mbedDevLondon | 0:a5ece7312edc | 55 | printXY (" ", position.X - 2, position.Y); |
mbedDevLondon | 0:a5ece7312edc | 56 | |
mbedDevLondon | 0:a5ece7312edc | 57 | } |
mbedDevLondon | 0:a5ece7312edc | 58 | |
mbedDevLondon | 0:a5ece7312edc | 59 | int menuItem::getMenuID() |
mbedDevLondon | 0:a5ece7312edc | 60 | { |
mbedDevLondon | 0:a5ece7312edc | 61 | return menuID; |
mbedDevLondon | 0:a5ece7312edc | 62 | } |
mbedDevLondon | 0:a5ece7312edc | 63 | |
mbedDevLondon | 0:a5ece7312edc | 64 |