valNum.h
gehe zur Dokumentation dieser Datei
00001 
00023 
00024 // Name:        valtext.h
00025 // Purpose:     wxTextValidator class
00026 // Author:      Julian Smart
00027 // Modified by:
00028 // Created:     29/01/98
00029 // RCS-ID:      $Id: valNum.h,v 1.8 2011-02-20 22:35:59 keinstein Exp $
00030 // Copyright:   (c) 1998 Julian Smart
00031 // Licence:     wxWindows license
00033 
00034 #ifndef _WX_VALNUMH__
00035 #define _WX_VALNUMH__
00036 
00037 /*
00038 #if defined(__GNUG__) && !defined(__APPLE__)
00039 #pragma interface "valNum.h"
00040 #endif
00041 */
00042 
00043 #include "wx/defs.h"
00044 
00045 #if wxUSE_VALIDATORS
00046 
00047 #include "wx/valtext.h"
00048 #include "wx/checkbox.h"
00049 #include "wx/string.h"
00050 
00051 #define NV_MIN 1
00052 #define NV_MAX 2
00053 #define NV_BOTH 3
00054 #define NV_NNEG 1, 0
00055 
00056 class wxNumValidator: public wxTextValidator
00057 {
00058         DECLARE_DYNAMIC_CLASS(wxNumValidator)
00059 
00060 protected:
00061         int Style;
00062         long *m_intValue;
00063         wxString bufferString;
00064         int Min, Max;
00065         wxCheckBox* Enabler;
00066 
00067 public:
00068 
00069         wxNumValidator(long *val = 0, int style = 0, int min = 0, int max = 12, wxCheckBox* enabler = 0);
00070 
00071         wxNumValidator(const wxNumValidator& val);
00072 
00073         ~wxNumValidator();
00074 
00075         // Make a clone of this validator (or return NULL) - currently necessary
00076         // if you're passing a reference to a validator.
00077         // Another possibility is to always pass a pointer to a new validator
00078         // (so the calling code can use a copy constructor of the relevant class).
00079         virtual wxObject *Clone() const
00080         {
00081                 return new wxNumValidator(*this);
00082         }
00083 
00084         bool Copy(const wxNumValidator& val);
00085 
00086         // Called when the value in the window must be validated.
00087         // This function can pop up an error message.
00088         virtual bool Validate(wxWindow *parent);
00089 
00090         // Called to transfer data to the window
00091         virtual bool TransferToWindow();
00092 
00093         // Called to transfer data to the window
00094         virtual bool TransferFromWindow();
00095 
00096         /*    // ACCESSORS
00097             inline long GetStyle() const { return m_validatorStyle; }
00098             inline void SetStyle(long style) { m_validatorStyle = style; }
00099 
00100             void SetIncludeList(const wxStringList& list);
00101             inline wxStringList& GetIncludeList() { return m_includeList; }
00102 
00103             void SetExcludeList(const wxStringList& list);
00104             inline wxStringList& GetExcludeList() { return m_excludeList; }
00105 
00106             // Filter keystrokes
00107             void OnChar(wxKeyEvent& event);
00108 
00109             bool IsInCharIncludeList(const wxString& val);
00110             bool IsNotInCharExcludeList(const wxString& val);
00111 
00112         DECLARE_EVENT_TABLE()
00113         */
00114 
00115 protected:
00116 
00117             bool CheckValidator() const
00118             {
00119                 wxCHECK_MSG( m_validatorWindow, FALSE,
00120                              _T("No window associated with validator") );
00121                 wxCHECK_MSG( m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)), FALSE,
00122                              _T("wxTextValidator is only for wxTextCtrl's") );
00123                 wxCHECK_MSG( m_stringValue, FALSE,
00124                              _T("No variable storage for validator") );
00125 
00126                 return TRUE;
00127             }
00128 };
00129 
00130 #endif
00131 // wxUSE_VALIDATORS
00132 
00133 #endif
00134 // _WX_VALTEXTH__
00135 
00136 
00137 

Erzeugt am Sun Aug 21 2011 10:51:56 für Mutabor von doxygen 1.7.4