ArduinoLibs
BoolField.h
00001 /*
00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a
00005  * copy of this software and associated documentation files (the "Software"),
00006  * to deal in the Software without restriction, including without limitation
00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008  * and/or sell copies of the Software, and to permit persons to whom the
00009  * Software is furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included
00012  * in all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00020  * DEALINGS IN THE SOFTWARE.
00021  */
00022 
00023 #ifndef BoolField_h
00024 #define BoolField_h
00025 
00026 #include "Field.h"
00027 
00028 class BoolField : public Field {
00029 public:
00030     explicit BoolField(const String &label);
00031     BoolField(Form &form, const String &label, const String &trueLabel, const String &falseLabel, bool value);
00032 
00033     int dispatch(int event);
00034 
00035     void enterField(bool reverse);
00036 
00037     bool value() const { return _value; }
00038     void setValue(bool value);
00039 
00040     const String &trueLabel() const { return _trueLabel; }
00041     void setTrueLabel(const String &trueLabel);
00042 
00043     const String &falseLabel() const { return _falseLabel; }
00044     void setFalseLabel(const String &falseLabel);
00045 
00046 private:
00047     String _trueLabel;
00048     String _falseLabel;
00049     int _printLen;
00050     bool _value;
00051 
00052     void printValue();
00053 };
00054 
00055 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator