C:/MinGW/include/wx/wxEdit/wxMaskEdit.h

Aller à la documentation de ce fichier.
00001 //wxMaskedEdit Control - wxext library -
00002 //(c) 2005 RSAISP Inc.
00003 
00004 // This source code may be distributed and modified
00005 // in any way that you see fit, free of charge.
00006 // However, RSAISP Inc. asks that you please keep
00007 // http://dev.rsaisp.com/
00008 // this notice on any modified or copied source files
00009 
00010 // Jean-Pierre Laroche
00011 // I changed and brought some modification to make simpler
00012 // the type and the most corresponding possible has a type 5250
00013 // J'ai changé et apporté quelque modification pour rendre plus simple
00014 // la saisie et le plus conforme possible à un type 5250
00016 
00017 #ifndef WXMASKEDIT_H
00018 #define WXMASKEDIT_H
00019 
00020 #include <wx/wxprec.h>
00021 #ifdef __BORLANDC__
00022         #pragma hdrstop
00023 #endif
00024 #ifndef WX_PRECOMP
00025         #include <wx/wx.h>
00026 #endif
00027 #include <wx/textctrl.h>
00028 #include <wx/string.h>
00029 
00030 
00031 class wxWindow;
00032 class wxPoint;
00033 class wxSize;
00034 
00035 class TextPart {
00036 public:
00037   TextPart(size_t ord);
00038   virtual ~TextPart();
00039 
00040   virtual wxString getValue() const;
00041   virtual void setValue(const wxString& val);
00042 
00043   virtual size_t getOrder() const;
00044   virtual size_t getSize() const;
00045 
00046   virtual void append(char c);
00047 
00048   virtual bool isStatic() const;
00049 
00050   virtual int OnKeyDown(wxKeyEvent& evt, size_t pos);
00051 
00052   virtual void normalize();
00053 
00054   virtual wxString getTransform() const;
00055 
00056   virtual void setStyle(size_t style) ;
00057 
00058   virtual size_t getStyle() const;
00059 
00060 private:
00061   wxString m_val;
00062   size_t m_ord;
00063   size_t m_style;
00064 
00065 };
00066 
00067 class NumberGroup : public TextPart {
00068 public:
00069 
00070   enum NGBehaviour {
00071     NZEROS,
00072     NBLANKS
00073   } m_beh;
00074 
00075 public:
00076   NumberGroup(size_t ord, NGBehaviour beh);
00077   virtual ~NumberGroup();
00078 
00079   virtual wxString getValue() const;
00080 
00081   virtual bool isStatic() const;
00082 
00083   virtual int OnKeyDown(wxKeyEvent& evt, size_t pos);
00084 
00085   virtual void normalize();
00086 
00087   virtual wxString getTransform() const;
00088 
00089 
00090 
00091 private:
00092   void goNormBlank();
00093   void goNormZero();
00094 
00095 };
00096 
00097 class LetterGroup : public TextPart {
00098 public:
00099   LetterGroup(size_t ord);
00100   virtual ~LetterGroup();
00101 
00102   virtual wxString getValue() const;
00103 
00104   virtual bool isStatic() const;
00105 
00106   virtual int OnKeyDown(wxKeyEvent& evt, size_t pos );
00107 
00108   virtual void normalize();
00109 
00110   virtual wxString getTransform() const;
00111 
00112 
00113 };
00114 
00115 
00116 WX_DEFINE_ARRAY(TextPart*, TextPartArray);
00117 #define  ME_LTRNUM   0  // A-z 0-9
00118 #define  ME_CAPITAL  1
00119 #define  ME_LIBRE    2  // ALL
00120 #define  ME_CAPBLK   3
00121 #define  ME_LTRBLK   4
00122 #define  ME_CAPLBR   5
00123 #define  ME_SIGNED   6
00124 #define  ME_ALPHA    7  // A-z *blank
00125 #define  ME_NUM      8  // 0-9
00126 #define  ME_NDEC     9  // 0-9 decimal
00127 #define  ME_NDECS    10 // 0-9 decimal signed
00128 #define  ME_DATE     11 // 0-9
00129 #define  GZEROS      false
00130 #define  GBLANKS     true
00131 
00132 class wxMaskEdit : public wxTextCtrl
00133 {
00134 
00135 public:
00136 
00137 wxMaskEdit();
00138 wxMaskEdit(wxWindow *parent, wxWindowID id,
00139                const wxString &wxT ="",
00140                const wxPoint &pos = wxDefaultPosition,
00141                const wxSize &size = wxDefaultSize,
00142                long  style = 0,
00143                const wxValidator &validator = wxDefaultValidator ,
00144                const wxString &name = wxTextCtrlNameStr,
00145                const wxString &mask ="",
00146                unsigned int MskStyle = ME_LIBRE,
00147                            bool  GroupStyle = GBLANKS
00148  );
00149 
00150 
00151   virtual ~wxMaskEdit();
00152 
00153   wxString getGroupText(size_t idx) const;
00154 
00155   wxString getTextValue() const;
00156 
00157   wxString getAbsValue() const;
00158 
00159  char *   ToChar() const;
00160 
00161 
00162 
00163   void     SetDisplay(const wxString& value);
00164   void     SetClear();
00165   static bool IsControl(char c) ;
00166 
00167   void  wxMaskSet( const wxString &mask ,
00168                    unsigned int MskStyle = ME_LIBRE,   bool  GroupStyle = GBLANKS);
00169 
00170  private:
00171   long SzToL(size_t size_value = 0);            // conversion size_t to long
00172 
00173   void OnKeyPress(wxKeyEvent& evt);
00174   void OnSetFocus(wxFocusEvent& evt);
00175   void OnLostFocus(wxFocusEvent& evt);
00176 
00177 
00178 
00179 
00180   void ParseMask(const wxString& mask ,int style = 0);
00181  wxString m_Text;
00182  wxString GenMaskText();
00183   wxString m_mask;
00184   size_t  NbrIdx ;
00185  size_t   Msk_Style ;
00186   void DrawMask();
00187 
00188   void FixInsPt(size_t pos, int dir);
00189 
00190 
00191   TextPart* FindPart();
00192   size_t    FindItem();
00193   size_t    FindIdx();
00194   size_t    ItemPos(size_t item);
00195   static const wxString m_control;
00196   TextPartArray m_parts;
00197 
00198   NumberGroup::NGBehaviour m_behav;
00199   bool m_firstfocus;
00200 
00201 
00202 
00203 
00204 bool wxMaskEdit::CtrlKey(wxKeyEvent& evt);
00205 
00206 
00207   DECLARE_EVENT_TABLE()
00208   DECLARE_DYNAMIC_CLASS(wxMaskEdit)
00209 };
00210 
00211 #endif

Généré le Fri Oct 27 13:01:34 2006 pour wxMaskEdit par  doxygen 1.4.6-NO