Menu system broken
Dependencies: ANSITermMenuSystem
Fork of menuSystemMbed by
menuItem.cpp@5:92389cf2106d, 2013-04-21 (annotated)
- Committer:
- Rybowonder
- Date:
- Sun Apr 21 20:15:31 2013 +0000
- Revision:
- 5:92389cf2106d
- Parent:
- 4:1178a1905490
Error off the hop
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 | { |
Rybowonder | 5:92389cf2106d | 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 | { |
Rybowonder | 4:1178a1905490 | 49 | // char check[] = "x"; |
Rybowonder | 4:1178a1905490 | 50 | // check[0] = 177; |
Rybowonder | 4:1178a1905490 | 51 | // printXY (check, position.X - 2, position.Y); |
mbedDevLondon | 0:a5ece7312edc | 52 | printXY ("X", position.X - 2, position.Y); |
mbedDevLondon | 0:a5ece7312edc | 53 | gotoxy( position.X - 2, position.Y); |
mbedDevLondon | 0:a5ece7312edc | 54 | } |
mbedDevLondon | 0:a5ece7312edc | 55 | |
mbedDevLondon | 0:a5ece7312edc | 56 | void menuItem::removeHighLight() |
mbedDevLondon | 0:a5ece7312edc | 57 | { |
mbedDevLondon | 0:a5ece7312edc | 58 | printXY (" ", position.X - 2, position.Y); |
Rybowonder | 4:1178a1905490 | 59 | } |
mbedDevLondon | 0:a5ece7312edc | 60 | |
Rybowonder | 4:1178a1905490 | 61 | void menuItem::showselect() |
Rybowonder | 4:1178a1905490 | 62 | { |
Rybowonder | 4:1178a1905490 | 63 | printXY (">", position.X - 1, position.Y); |
Rybowonder | 4:1178a1905490 | 64 | gotoxy( position.X, position.Y); |
Rybowonder | 4:1178a1905490 | 65 | } |
Rybowonder | 4:1178a1905490 | 66 | |
Rybowonder | 4:1178a1905490 | 67 | void menuItem::removeselect() |
Rybowonder | 4:1178a1905490 | 68 | { |
Rybowonder | 4:1178a1905490 | 69 | printXY (" ", position.X - 1, position.Y); |
mbedDevLondon | 0:a5ece7312edc | 70 | } |
mbedDevLondon | 0:a5ece7312edc | 71 | |
mbedDevLondon | 0:a5ece7312edc | 72 | int menuItem::getMenuID() |
mbedDevLondon | 0:a5ece7312edc | 73 | { |
mbedDevLondon | 0:a5ece7312edc | 74 | return menuID; |
mbedDevLondon | 0:a5ece7312edc | 75 | } |
mbedDevLondon | 0:a5ece7312edc | 76 | |
mbedDevLondon | 0:a5ece7312edc | 77 |