core/vgui/internals/vgui_string_field.h
Go to the documentation of this file.
00001 // This is core/vgui/internals/vgui_string_field.h
00002 #ifndef vgui_string_field_h_
00003 #define vgui_string_field_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \author Philip C. Pritchett, Robotics Research Group, University of Oxford
00010 // \date   24 Oct 99
00011 // \brief  A dialog field implementation that holds a vcl_string.
00012 //
00013 // \verbatim
00014 //  Modifications
00015 //   24-OCT-1999 P.Pritchett - Initial version.
00016 //   11-SEP-2002 K.Y.McGaul - Changed to Doxygen style comments.
00017 //   10-SEP-2004 Peter Vanroose  Inlined all 1-line methods in class decl
00018 // \endverbatim
00019 
00020 #include <vcl_string.h>
00021 #include "vgui_dialog_field.h"
00022 
00023 //: A dialog field implementation that holds a vcl_string.
00024 class vgui_string_field : public vgui_dialog_field
00025 {
00026   vcl_string &var_;
00027 
00028  public:
00029   //: Constructor - creates a string field with the given text as label.
00030   vgui_string_field(const char* txt, vcl_string& var_to_modify)
00031   : vgui_dialog_field(txt) , var_(var_to_modify) {}
00032 
00033   //: Destructor.
00034   ~vgui_string_field() {}
00035 
00036   //: Returns the current value of the string field.
00037   vcl_string current_value() const { return var_; }
00038 
00039   //: Set the given string to be the value of the string field.
00040   bool update_value(vcl_string const& s) { var_ = s; return true; }
00041 };
00042 
00043 #endif // vgui_string_field_h_