home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 035 / kwclass.zip / KVALMASK.HPP < prev    next >
C/C++ Source or Header  |  1994-04-18  |  2KB  |  71 lines

  1. #ifndef _KVALMASK_
  2. #define _KVALMASK_
  3.  
  4. #ifndef _KVALID_
  5.    #include <kvalid.hpp>
  6. #endif
  7.  
  8. #ifndef _I0STRING_
  9.    #include <i0string.hpp>
  10. #endif
  11.  
  12. #ifndef _IPOINT_
  13.    #include <ipoint.hpp>
  14. #endif
  15.  
  16. #ifndef _IHANDLER_
  17.    #include <ihandler.hpp>
  18. #endif
  19.  
  20. #ifndef _IMCHDR_
  21.    #include <imchdr.hpp>
  22. #endif
  23.  
  24.  
  25. class KEntryField;
  26.  
  27.  
  28. class KMaskFocusHandler : public IHandler
  29. {
  30.   protected:
  31.     virtual Boolean dispatchHandlerEvent(IEvent& event);
  32.     virtual Boolean setFocus(IEvent& event);
  33. };
  34.  
  35. class KMaskClickHandler : public IMouseClickHandler
  36. {
  37.   protected:
  38.     virtual Boolean mouseClicked(IMouseClickEvent& event);
  39. };
  40.  
  41. class _Export KMaskValidator : public KValidator
  42. {
  43.    typedef KValidator Inherited;
  44.    static const int right, 
  45.                     left;
  46.  
  47.    public: 
  48.       KMaskValidator(const char *pattern);
  49.       virtual IHandler& handleEventsFor(IWindow *window);
  50.       virtual IString &fill(IString &strText);
  51.       virtual IString &strip(IString &strText);
  52.  
  53.    protected:
  54.       virtual Boolean characterKeyPress(IKeyboardEvent& event);
  55.       virtual Boolean virtualKeyPress(IKeyboardEvent& event);
  56.       virtual Boolean isValid(const char *text, 
  57.                               Boolean fill=false) const;
  58.  
  59.    private:
  60.       Boolean adjustPosition(KEntryField* field, int dir);
  61.       void fillMasks();
  62.       IRange selected;
  63.       I0String emptyMask;
  64.       I0String controlMask;
  65.       I0String originalMask;
  66.       KMaskFocusHandler focusHandler;
  67.       KMaskClickHandler clickHandler;
  68. };
  69.  
  70. #endif
  71.