yast2-ncurses: NCIntField.h Source File

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

# NCIntField.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:       NCIntField.h
    00014
    00015    Author:     Michael Andres <ma@suse.de>
    00016    Maintainer: Michael Andres <ma@suse.de>
    00017
    00018 /-*/
    00019 #ifndef NCIntField_h
    00020 #define NCIntField_h
    00021
    00022 #include <iosfwd>
    00023
    00024 #include "YIntField.h"
    00025 #include "NCWidget.h"
    00026
    00027 class NCIntField;
    00028
    00030 //
    00031 //      CLASS NAME : NCIntField
    00032 //
    00033 //      DESCRIPTION :
    00034 //
    00035 class NCIntField : public YIntField, public NCWidget {
    00036
    00037   friend std::ostream & operator<<( std::ostream & STREAM, const NCIntField & OBJ );
    00038
    00039   NCIntField & operator=( const NCIntField & );
    00040   NCIntField            ( const NCIntField & );
    00041
    00042   private:
    00043
    00044     static const unsigned taglen;
    00045
    00046     NClabel label;
    00047     NCursesWindow * lwin;
    00048     NCursesWindow * twin;
    00049
    00050     int      cvalue;
    00051     unsigned vlen;
    00052     unsigned vstart;
    00053
    00054     void setDefsze();
    00055     void tUpdate();
    00056
    00057   protected:
    00058
    00059     virtual const char * location() const { return "NCIntField"; }
    00060
    00061     virtual void wCreate( const wrect & newrect );
    00062     virtual void wDelete();
    00063
    00064     virtual void wRedraw();
    00065
    00066     bool Increment( const bool bigstep = false );
    00067     bool Decrement( const bool bigstep = false );
    00068
    00069     int enterPopup( wchar_t first = L'\0' );
    00070
    00071   public:
    00072
    00073     NCIntField( NCWidget * parent, const YWidgetOpt & opt,
    00074                 const YCPString & label,
    00075                 int minValue, int maxValue,
    00076                 int initialValue );
    00077     virtual ~NCIntField();
    00078
    00079     virtual long nicesize( YUIDimension dim );
    00080     virtual void setSize( long newwidth, long newheight );
    00081
    00082     virtual void setLabel( const YCPString & nlabel );
    00083
    00084     virtual void setValue( int newValue );
    00085
    00086     virtual NCursesEvent wHandleInput( wint_t key );
    00087
    00088     virtual bool setKeyboardFocus() {
    00089       if ( !grabFocus() )
    00090         return YWidget::setKeyboardFocus();
    00091       return true;
    00092     }
    00093     virtual void setEnabling( bool do_bv ) { NCWidget::setEnabling( enabled=do_bv ); }
    00094 };
    00095
    00097
    00098 #endif // NCIntField_h