Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

NCTextEntry.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013    File:       NCTextEntry.h
00014 
00015    Author:     Michael Andres <ma@suse.de>
00016    Maintainer: Michael Andres <ma@suse.de>
00017 
00018 /-*/
00019 #ifndef NCTextEntry_h
00020 #define NCTextEntry_h
00021 
00022 #include <iosfwd>
00023 
00024 #include "YTextEntry.h"
00025 #include "NCWidget.h"
00026 
00027 class NCTextEntry;
00028 
00030 //
00031 //      CLASS NAME : NCTextEntry
00032 //
00033 //      DESCRIPTION :
00034 //
00035 class NCTextEntry : public YTextEntry, public NCWidget {
00036 
00037   friend std::ostream & operator<<( std::ostream & STREAM, const NCTextEntry & OBJ );
00038 
00039   NCTextEntry & operator=( const NCTextEntry & );
00040   NCTextEntry            ( const NCTextEntry & );
00041 
00042   public:
00043 
00044     enum FTYPE {
00045       PLAIN,
00046       NUMBER
00047     };
00048 
00049   private:
00050     
00051     bool     mayedit;
00052     bool     passwd;
00053     NClabel  label;
00054     wstring   buffer;
00055 
00056     NCursesWindow * lwin;
00057     NCursesWindow * twin;
00058 
00059     unsigned maxFldLength;
00060     unsigned maxInputLength;
00061 
00062     unsigned fldstart;
00063     unsigned fldlength;
00064     unsigned curpos;
00065 
00066     FTYPE    fldtype;
00067     NCstring validChars;
00068 
00069     bool     returnOnReturn_b;
00070 
00071     void setDefsze();
00072     void tUpdate();
00073 
00074     bool     bufferFull() const;
00075     unsigned maxCursor() const;
00076 
00077     // specifies how much characters can be inserted. -1 for unlimited input
00078     int InputMaxLength;
00079 
00080   protected:
00081 
00082     virtual const char * location() const { return "NCTextEntry"; }
00083 
00084     virtual void wCreate( const wrect & newrect );
00085     virtual void wDelete();
00086 
00087     virtual void wRedraw();
00088 
00089     bool validKey( wint_t key ) const;
00090 
00091   public:
00092 
00093     NCTextEntry( NCWidget * parent, const YWidgetOpt & opt,
00094                  const YCPString & label,
00095                  const YCPString & text,
00096                  unsigned maxInput = 0,
00097                  unsigned maxFld   = 0 );
00098     virtual ~NCTextEntry();
00099 
00100     void setFldtype( FTYPE t )           { fldtype = t; }
00101     void setReturnOnReturn( bool on_br ) { returnOnReturn_b = on_br; }
00102 
00103     virtual long nicesize( YUIDimension dim );
00104     virtual void setSize( long newwidth, long newheight );
00105 
00106     virtual void setLabel( const YCPString & nlabel );
00107 
00108     virtual void setText( const YCPString & ntext );
00109     virtual YCPString getText();
00110 
00111     virtual void setValidChars( const YCPString & validchars );
00112 
00113     virtual NCursesEvent wHandleInput( wint_t key );
00114 
00115     virtual void setEnabling( bool do_bv ) { NCWidget::setEnabling( enabled=do_bv ); }
00116 
00117     virtual bool setKeyboardFocus() {
00118       if ( !grabFocus() )
00119         return YWidget::setKeyboardFocus();
00120       return true;
00121     }
00122 
00123     // limits  the input to numberOfChars characters and truncates the text
00124     // if appropriate
00125     void setInputMaxLength( const YCPInteger & numberOfChars);
00126 
00127 };
00128 
00130 
00131 #endif // NCTextEntry_h

Generated on Wed Sep 14 10:52:54 2005 for yast2-ncurses by  doxygen 1.4.4