home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mavcl130.zip / MAVFRENT.HPP < prev    next >
Text File  |  1995-12-17  |  5KB  |  147 lines

  1. /*  File: MAVFRENT.HPP      Updated: Tue Aug 15 15:55:13 1995
  2. Copyright (c) Fabrizio Aversa
  3. ===========================================================*/
  4. #ifndef MAVFRENT_HPP
  5. #define MAVFRENT_HPP
  6.  
  7. #define INCL_DOSNLS        /* National Language Support values */
  8. #include <os2.h>
  9.  
  10. #include <ikeyevt.hpp>
  11. #include <ictlevt.hpp>
  12. #include <ikeyhdr.hpp>
  13. #include <ifocshdr.hpp>
  14. #include <idate.hpp>
  15. #include <itime.hpp>
  16. #include <istring.hpp>
  17. #include <ientryfd.hpp>
  18. #include <icmdevt.hpp>
  19. #include <icolor.hpp>
  20. #include <strstrea.h>
  21. #include <imsgbox.hpp>
  22.  
  23. class _Export FormEntryField: public IEntryField,
  24. public IKeyboardHandler,
  25. public IFocusHandler
  26. {
  27.    public:
  28.    FormEntryField(unsigned long, IWindow *);
  29.    FormEntryField(unsigned long, IWindow *, IWindow *, const IRectangle &);
  30.    FormEntryField(unsigned long id, IWindow * parent,
  31.    IWindow * owner, const IRectangle & rect, const IEntryField::Style & style);
  32.    virtual IWindow & setFocus();
  33.    COUNTRYINFO  CountryInfo; /* Buffer for country-specific information */
  34.  
  35.    private:
  36.    virtual Boolean characterKeyPress(IKeyboardEvent&)= 0;
  37.  
  38.    protected:
  39.    virtual Boolean gotFocus(IControlEvent&);
  40.    virtual Boolean lostFocus(IControlEvent&);
  41.    IWindow * piwParent;
  42. };
  43.  
  44. class _Export NumEntryField: public FormEntryField
  45. {
  46.    public:
  47.    NumEntryField(unsigned long id, IWindow * parent,
  48.    IWindow * owner, const IRectangle & rect, const IEntryField::Style & style);
  49.    NumEntryField(unsigned long, IWindow *, IWindow *,const IRectangle &,
  50.    Boolean= true, Boolean= false, double = 0.0, double  = 0.0);
  51.    NumEntryField(unsigned long, IWindow *, Boolean= true, Boolean= false,
  52.    double = 0.0, double = 0.0);
  53.    double getDouble();
  54.    NumEntryField & setDouble(double);
  55.  
  56.    Boolean isThousDisplayed() const  {return booThous;};
  57.    void thousDisplayed(Boolean booThousDisplayed) {booThous = booThousDisplayed;}
  58.    Boolean isShowZero() const  {return booShowZero;};
  59.    void showZero(Boolean showZero) {booShowZero = showZero;}
  60.    double minAllowed() const {return dblMin;}
  61.    void setMinAllowed (const double minAllowed) {dblMin = minAllowed;}
  62.    double maxAllowed() const {return dblMax;}
  63.    void setMaxAllowed (const double maxAllowed) {dblMax = maxAllowed;}
  64.  
  65.    private:
  66.  
  67.    double dblMin, dblMax;
  68.    IString strValidChars;
  69.    Boolean booThous; /* true if user wants thousands separators */
  70.    Boolean booShowZero; /* true if user wants to show '0' when field=0 */
  71.  
  72.    virtual Boolean characterKeyPress(IKeyboardEvent&);
  73.    virtual Boolean lostFocus(IControlEvent&);
  74.    virtual Boolean gotFocus(IControlEvent&);
  75.  
  76.    IString format(double, Boolean);
  77. };
  78.  
  79. class _Export AlphaEntryField: public FormEntryField
  80. {
  81.    public:
  82.    AlphaEntryField(unsigned long, IWindow *, IWindow *,
  83.    const IRectangle &, Boolean= false, Boolean= false, IString="", IString="");
  84.    AlphaEntryField(unsigned long, IWindow *,
  85.    Boolean= false, Boolean= false, IString="", IString="");
  86.    AlphaEntryField(unsigned long id, IWindow * parent,
  87.    IWindow * owner, const IRectangle & rect,
  88.    const IEntryField::Style & style);
  89.  
  90.    Boolean isNoNumberAllowed() const  {return booNoNum;};
  91.    void noNumberAllowed(Boolean noNumberAllowed) {booNoNum = noNumberAllowed;}
  92.    Boolean isCapsLock() const  {return booCaps;};
  93.    void capsLock(Boolean capsLock) {booCaps = capsLock;}
  94.    IString& allowedChars () const {return (IString&)strAllowed;}
  95.    void setAllowedChars (const IString& allowedChars) {strAllowed = allowedChars;}
  96.    IString& regex () const {return (IString&)strRegex;}
  97.    void setRegex (const IString& regex) {strRegex = regex;}
  98.  
  99.    private:
  100.    virtual Boolean characterKeyPress(IKeyboardEvent&);
  101.    virtual Boolean lostFocus(IControlEvent&);
  102.    Boolean booCaps, booNoNum;
  103.    IString strAllowed, strRegex;
  104.  
  105. };
  106.  
  107. class _Export DateEntryField: public FormEntryField
  108. {
  109.    public:
  110.    DateEntryField(unsigned long id, IWindow * parent,
  111.    IWindow * owner, const IRectangle & rect, const IEntryField::Style & style);
  112.    DateEntryField(unsigned long, IWindow *, IWindow *,
  113.    const IRectangle &, Boolean= false);
  114.    DateEntryField(unsigned long, IWindow *, Boolean= false);
  115.    IDate getDate();
  116.    DateEntryField & setDate(IDate &);
  117.    Boolean isNoYearDisplayed() const  {return booNoYear;};
  118.    void noYearDisplayed(Boolean noYearDisplayed) {booNoYear = noYearDisplayed;}
  119.    DateEntryField & setTextWithDefault(IString);
  120.    IString getTextWithDefault();
  121.  
  122.    private:
  123.    virtual Boolean characterKeyPress(IKeyboardEvent&);
  124.    virtual Boolean lostFocus(IControlEvent&);
  125.    Boolean booNoYear;
  126.  
  127. };
  128.  
  129. class _Export TimeEntryField: public FormEntryField
  130. {
  131.    public:
  132.    TimeEntryField(unsigned long id, IWindow * parent,
  133.    IWindow * owner, const IRectangle & rect, const IEntryField::Style & style);
  134.    TimeEntryField(unsigned long, IWindow *, IWindow *, const IRectangle &);
  135.    TimeEntryField(unsigned long, IWindow *);
  136.    ITime getTime();
  137.    TimeEntryField & setTime(ITime &);
  138.    IString getTextWithDefault();
  139.  
  140.    private:
  141.    virtual Boolean characterKeyPress(IKeyboardEvent&);
  142.    virtual Boolean lostFocus(IControlEvent&);
  143.  
  144. };
  145.  
  146. #endif
  147.