include/variantutils/valgenvariant.h

Go to the documentation of this file.
00001 
00002 // Name:        valgenvariant.h
00003 // Purpose:     wxGenericVariantValidator class
00004 // Author:      Julian Smart
00005 // Modified by:
00006 // Created:     July 27th 2007
00007 // RCS-ID:      $Id: valgenvariant.h,v 1.1 2007/07/31 21:24:53 anthemion Exp $
00008 // Copyright:   (c) Julian Smart
00009 // Licence:     New BSD License
00011 
00012 #ifndef _WX_VALGENVARIANTH__
00013 #define _WX_VALGENVARIANTH__
00014 
00015 #include "wx/valgen.h"
00016 #include "wx/variant.h"
00017 
00018 #if wxUSE_VALIDATORS
00019 
00020 class WXDLLEXPORT wxGenericVariantValidator: public wxGenericValidator
00021 {
00022     DECLARE_CLASS(wxGenericVariantValidator)
00023 public:
00024     wxGenericVariantValidator(wxVariant* val = NULL);
00025     wxGenericVariantValidator(const wxGenericVariantValidator& copyFrom);
00026     
00027     virtual ~wxGenericVariantValidator(){}
00028     
00029     // Make a clone of this validator (or return NULL) - currently necessary
00030     // if you're passing a reference to a validator.
00031     // Another possibility is to always pass a pointer to a new validator
00032     // (so the calling code can use a copy constructor of the relevant class).
00033     virtual wxObject *Clone() const { return new wxGenericVariantValidator(*this); }
00034     bool Copy(const wxGenericVariantValidator& val);
00035     
00036     // Called when the value in the window must be validated.
00037     // This function can pop up an error message.
00038     virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; }
00039     
00040     // Called to transfer data to the window
00041     virtual bool TransferToWindow();
00042     
00043     // Called to transfer data to the window
00044     virtual bool TransferFromWindow();
00045     
00046 protected:
00047     
00048     // Initialize
00049     void Init();
00050     
00051     // Initialize the actual data variables from the variant type
00052     virtual bool InitializeFromVariant();
00053     
00054     wxVariant*    m_variant;
00055     
00056     int           m_int;
00057     bool          m_bool;
00058     wxString      m_string;
00059     
00060 private:
00061     // Cannot use
00062     //  DECLARE_NO_COPY_CLASS(wxGenericVariantValidator)
00063     // because copy constructor is explicitly declared above;
00064     // but no copy assignment operator is defined, so declare
00065     // it private to prevent the compiler from defining it:
00066     wxGenericVariantValidator& operator=(const wxGenericVariantValidator&);
00067 };
00068 
00069 #endif
00070   // wxUSE_VALIDATORS
00071 
00072 #endif
00073   // _WX_VALGENVARIANT_

Generated on Wed May 6 19:20:19 2009 for AxTk by  doxygen 1.5.1