00001 #ifndef MaskTextCtrl_H
00002 #define MaskTextCtrl_H
00003
00004 #include <wx/textctrl.h>
00005 #include <wx/regex.h>
00006 #include <wx/string.h>
00007
00008 #define Mask_ALPHANUMERIC 0 // (A-z 0-9 esp )
00009 #define Mask_ALPHA 1 // (A-z 0-9 esp )
00010 #define Mask_UDIGIT 2 // 1-0
00011 #define Mask_DIGIT 3 // + - (1-0)
00012 #define Mask_UDECIMAL 4 // 1-0 .
00013 #define Mask_DECIMAL 5 // + - . (1-0)
00014 #define Mask_NUMERIC 6 // 1-0
00015 #define Mask_NONE 99 // 0-9 espace
00016
00017
00018
00019
00020
00021
00022
00023 class MaskTextCtrl : public wxTextCtrl
00024 {
00025
00026 public:
00027 MaskTextCtrl(wxWindow* parent,
00028 wxWindowID id,
00029 const wxString &value =wxEmptyString,
00030 const wxPoint &pos = wxDefaultPosition,
00031 const wxSize &size = wxDefaultSize,
00032 long style = 0,
00033 const wxValidator &validator = wxDefaultValidator,
00034 const wxString &name = wxTextCtrlNameStr);
00035
00036 ~MaskTextCtrl();
00037
00038 void MaskEditWord(unsigned int MskFILTER, wxString MskEdtWord = wxEmptyString);
00039
00040
00041 void MaskSetValue(wxString MskValue = wxEmptyString) ;
00042 wxString MaskGetValue() ;
00043 wxString MaskGetText() ;
00044 char * ToChar();
00045
00046 void MaskLast(bool MskLast = false);
00047 void MaskClear();
00048 private:
00049
00050 unsigned int MaskFILTER ;
00051 wxString MaskEdtWord;
00052 wxString MaskValue;
00053 bool MaskNextField;
00054
00055 static bool MaskIsDigit(const int Mskkey);
00056 static bool MaskIsUDigit(const int Mskkey);
00057 static bool MaskIsDecimal(const int Mskkey);
00058 static bool MaskIsUDecimal(const int Mskkey);
00059 static bool MaskIsAlphaNumeric(const int Mskkey);
00060 static bool MaskIsAlpha(const int Mskkey);
00061 static bool MaskIsNumeric(const int Mskkey);
00062
00063 void MaskOnChar(wxKeyEvent &event);
00064 void MaskWriteChar(wxChar val);
00065 void MaskEvtEnter( wxKeyEvent & event );
00066
00067 wxString MaskCodeEdit(wxString MskValue = wxT("0")) ;
00068 };
00069
00070 #endif // MASK_H_INCLUDED