00001 #include "LCDText.h"
00002 #include <sstream>
00003 #include <string>
00004
00005 using namespace std;
00006
00007 LCDText::LCDText(LCDElement *parent, const string &id) : LCDWidget(id, parent, "string")
00008 {
00009 _text = "";
00010 }
00011
00012 LCDText::LCDText(const string &text, int x, int y, LCDElement *parent, const string &id) : LCDWidget(id, parent, "string")
00013 {
00014 set(text, x, y);
00015 }
00016
00017 void LCDText::notifyChanged()
00018 {
00019 ostringstream params;
00020
00021 params << _x
00022 << " "
00023 << _y
00024 << " \""
00025 << _text
00026 << '"';
00027
00028 setWidgetParameters(params.str());
00029 }
00030
00031 void LCDText::set(const string &text, int x, int y)
00032 {
00033 _x = x;
00034 _y = y;
00035 _text = text;
00036 notifyChanged();
00037 }
00038
00039 void LCDText::setText(const string &text)
00040 {
00041 _text = text;
00042 notifyChanged();
00043 }
00044
00045 string LCDText::getText() const
00046 {
00047 return _text;
00048 }
00049
00050 void LCDText::valueCallback(string value)
00051 {
00052 setText(value);
00053 }