core/vgui/internals/vgui_simple_field.h
Go to the documentation of this file.
00001 // This is core/vgui/internals/vgui_simple_field.h
00002 #ifndef vgui_simple_field_h_
00003 #define vgui_simple_field_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief  Templated fields for dialog boxes.
00010 // \author Philip C. Pritchett, Robotics Research Group, University of Oxford
00011 // \date   23 Oct 99
00012 //
00013 //  Contains class  vgui_simple_field
00014 //
00015 // \verbatim
00016 //  Modifications
00017 //   23-OCT-1999  P.Pritchett - Initial version.
00018 //   13-SEP-2002  K.Y.McGaul - Converted to doxygen style comments
00019 // \endverbatim
00020 
00021 #include <vcl_string.h>
00022 #include "vgui_dialog_field.h"
00023 
00024 //: Templated fields for dialog boxes.
00025 //
00026 // vgui_simple_field is templated over the type of variable it stores.
00027 // The given template instances are all for fundamental types, but the
00028 // template can be used for any data type that has the input and output
00029 // stream operators defined (<< and >>)
00030 template <class T>
00031 class vgui_simple_field : public vgui_dialog_field
00032 {
00033  public:
00034   vgui_simple_field(const char *text,T &variable_to_modify);
00035   ~vgui_simple_field();
00036 
00037   vcl_string current_value() const;
00038   bool update_value(const vcl_string &);
00039 
00040   T &var;
00041 };
00042 
00043 typedef vgui_simple_field<bool>   vgui_bool_field;
00044 typedef vgui_simple_field<int>    vgui_int_field;
00045 typedef vgui_simple_field<long>   vgui_long_field;
00046 typedef vgui_simple_field<float>  vgui_float_field;
00047 typedef vgui_simple_field<double> vgui_double_field;
00048 
00049 #endif // vgui_simple_field_h_