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

NCTextPad.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:       NCTextPad.h
00014 
00015    Author:     Michael Andres <ma@suse.de>
00016    Maintainer: Michael Andres <ma@suse.de>
00017 
00018 /-*/
00019 #ifndef NCTextPad_h
00020 #define NCTextPad_h
00021 
00022 #include <iosfwd>
00023 
00024 #include <list>
00025 using namespace std;
00026 
00027 #include "NCPad.h"
00028 #include "NCtext.h"
00029 
00030 
00032 //
00033 //      CLASS NAME : NCTextPad
00034 //
00035 //      DESCRIPTION :
00036 //
00037 class NCTextPad : public NCPad {
00038 
00039   friend std::ostream & operator<<( std::ostream & STREAM, const NCTextPad & OBJ );
00040 
00041   NCTextPad & operator=( const NCTextPad & );
00042   NCTextPad            ( const NCTextPad & );
00043 
00044   private:
00045 
00046     list<unsigned>           lines;
00047     list<unsigned>::iterator cline;
00048 
00049     wpos curs;
00050     bool curson;
00051 
00052     void cursor( bool on );
00053     void cursorOn()  { cursor( true ); }
00054     void cursorOff() { cursor( false ); }
00055 
00056     bool insert( wint_t key );
00057     bool delch( bool previous = false );
00058     bool openLine();
00059 
00060     void assertSze( wsze minsze );
00061     void assertWidht ( unsigned minw );
00062     void assertHeight( unsigned minh );
00063 
00064     // specifies how much characters can be inserted. -1 for unlimited input
00065     int InputMaxLength;
00066 
00067   protected:
00068 
00069     virtual int setpos( const wpos & newpos );
00070 
00071   public:
00072 
00073     NCTextPad( int lines, int cols, const NCWidget & p );
00074     virtual ~NCTextPad();
00075 
00076   public:
00077 
00078     virtual void resize( wsze nsze );
00079     virtual int setpos();
00080     virtual wpos CurPos() const;
00081     virtual bool handleInput( wint_t key );
00082 
00083     void setText( const NCtext & ntext );
00084     wstring getText() const;
00085 
00086     // limits  the input to numberOfChars characters and truncates the text
00087     // if appropriate
00088     void setInputMaxLength( int nr );
00089 };
00090 
00092 
00093 #endif // NCTextPad_h

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