Author: gs
Date: Thu Jun 28 14:32:34 2007
New Revision: 39081
URL: http://svn.opensuse.org/viewcvs/yast?rev=39081&view=rev
Log:
adapt NCInputField, delete NCTextEntry
Removed:
branches/tmp/sh/mod-ui/ncurses/src/NCTextEntry.cc
branches/tmp/sh/mod-ui/ncurses/src/NCTextEntry.h
Modified:
branches/tmp/sh/mod-ui/ncurses/src/NCInputField.cc
branches/tmp/sh/mod-ui/ncurses/src/NCInputField.h
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCInputField.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCInputField.cc?rev=39081&r1=39080&r2=39081&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCInputField.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCInputField.cc Thu Jun 28 14:32:34 2007
@@ -10,7 +10,7 @@
| (C) SuSE GmbH |
\----------------------------------------------------------------------/
- File: NCTextEntry.cc
+ File: NCInputField.cc
Author: Michael Andres
Maintainer: Michael Andres
@@ -20,36 +20,34 @@
#include "Y2Log.h"
#include "NCurses.h"
-#include "NCTextEntry.h"
+#include "NCInputField.h"
#include // iswalnum()
#if 0
#undef DBG_CLASS
-#define DBG_CLASS "_NCTextEntry_"
+#define DBG_CLASS "_NCInputField_"
#endif
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::NCTextEntry
+// METHOD NAME : NCInputField::NCInputField
// METHOD TYPE : Constructor
//
// DESCRIPTION :
//
-NCTextEntry::NCTextEntry( NCWidget * parent,
+NCInputField::NCInputField( NCWidget * parent,
const string & nlabel,
- bool passwordMode,
- unsigned maxInput,
- unsigned maxFld )
- : YTextEntry( dynamic_cast(parent), nlabel, passwordMode )
+ bool passwordMode )
+ : YInputField( dynamic_cast(parent), nlabel, passwordMode )
, NCWidget( parent )
, mayedit( true )
, passwd( passwordMode )
, lwin( 0 )
, twin( 0 )
- , maxFldLength ( maxFld )
- , maxInputLength( maxInput )
+ , maxFldLength ( 0 )
+ , maxInputLength( 0 )
, fldstart ( 0 )
, fldlength( 0 )
, curpos ( 0 )
@@ -62,9 +60,10 @@
( !maxFldLength || maxFldLength > maxInputLength ) ) {
maxFldLength = maxInputLength;
}
+#if 0
if ( opt.isEditable.defined() )
mayedit = opt.isEditable.value();
-
+#endif
setLabel( nlabel );
hotlabel = &label;
// not longer on params
@@ -75,12 +74,12 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::~NCTextEntry
+// METHOD NAME : NCInputField::~NCInputField
// METHOD TYPE : Destructor
//
// DESCRIPTION :
//
-NCTextEntry::~NCTextEntry()
+NCInputField::~NCInputField()
{
delete lwin;
delete twin;
@@ -90,22 +89,22 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::nicesize
+// METHOD NAME : NCInputField::nicesize
// METHOD TYPE : long
//
// DESCRIPTION :
//
-long NCTextEntry::nicesize( YUIDimension dim )
+long NCInputField::nicesize( YUIDimension dim )
{
return dim == YD_HORIZ ? wGetDefsze().W : wGetDefsze().H;
}
-int NCTextEntry::preferredWidth()
+int NCInputField::preferredWidth()
{
return wGetDefsze().W;
}
-int NCTextEntry::preferredHeight()
+int NCInputField::preferredHeight()
{
return wGetDefsze().H;
}
@@ -113,26 +112,26 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::setSize
+// METHOD NAME : NCInputField::setSize
// METHOD TYPE : void
//
// DESCRIPTION :
//
-void NCTextEntry::setSize( int newwidth, int newheight )
+void NCInputField::setSize( int newwidth, int newheight )
{
wRelocate( wpos( 0 ), wsze( newheight, newwidth ) );
- YTextEntry::setSize( newwidth, newheight );
+ YInputField::setSize( newwidth, newheight );
}
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::setDefsze
+// METHOD NAME : NCInputField::setDefsze
// METHOD TYPE : void
//
// DESCRIPTION :
//
-void NCTextEntry::setDefsze()
+void NCInputField::setDefsze()
{
unsigned defwidth = maxFldLength ? maxFldLength : 5;
if ( label.width() > defwidth )
@@ -143,12 +142,12 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::wCreate
+// METHOD NAME : NCInputField::wCreate
// METHOD TYPE : void
//
// DESCRIPTION :
//
-void NCTextEntry::wCreate( const wrect & newrect )
+void NCInputField::wCreate( const wrect & newrect )
{
NCWidget::wCreate( newrect );
@@ -179,12 +178,12 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::wDelete
+// METHOD NAME : NCInputField::wDelete
// METHOD TYPE : void
//
// DESCRIPTION :
//
-void NCTextEntry::wDelete()
+void NCInputField::wDelete()
{
delete lwin;
delete twin;
@@ -196,16 +195,16 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::setLabel
+// METHOD NAME : NCInputField::setLabel
// METHOD TYPE : void
//
// DESCRIPTION :
//
-void NCTextEntry::setLabel( const string & nlabel )
+void NCInputField::setLabel( const string & nlabel )
{
label = NCstring( nlabel );
label.stripHotkey();
- YTextEntry::setLabel( nlabel );
+ YInputField::setLabel( nlabel );
setDefsze();
Redraw();
}
@@ -213,12 +212,12 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::setText
+// METHOD NAME : NCInputField::setText
// METHOD TYPE : void
//
// DESCRIPTION :
//
-void NCTextEntry::setText( const YCPString & ntext )
+void NCInputField::setText( const YCPString & ntext )
{
buffer = NCstring( ntext ).str();
if ( maxInputLength && buffer.length() > maxInputLength ) {
@@ -232,12 +231,12 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::setValue
+// METHOD NAME : NCInputField::setValue
// METHOD TYPE : void
//
// DESCRIPTION :
//
-void NCTextEntry::setValue( const std::string & ntext )
+void NCInputField::setValue( const std::string & ntext )
{
buffer = NCstring( ntext ).str();
if ( maxInputLength && buffer.length() > maxInputLength ) {
@@ -251,12 +250,12 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::value
+// METHOD NAME : NCInputField::value
// METHOD TYPE : void
//
// DESCRIPTION :
//
-string NCTextEntry::value( )
+string NCInputField::value( )
{
NCstring text ( buffer );
@@ -266,12 +265,12 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::getText
+// METHOD NAME : NCInputField::getText
// METHOD TYPE : YCPString
//
// DESCRIPTION :
//
-YCPString NCTextEntry::getText()
+YCPString NCInputField::getText()
{
NCstring text( buffer );
@@ -282,26 +281,26 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::setValidChars
+// METHOD NAME : NCInputField::setValidChars
// METHOD TYPE : void
//
// DESCRIPTION :
//
-void NCTextEntry::setValidChars( const YCPString & validchars )
+void NCInputField::setValidChars( const string & validchars )
{
- validChars = validchars;
- YTextEntry::setValidChars( validchars );
+ validChars = NCstring( validchars );
+ YInputField::setValidChars( validchars );
}
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::validKey
+// METHOD NAME : NCInputField::validKey
// METHOD TYPE : bool
//
// DESCRIPTION :
//
-bool NCTextEntry::validKey( wint_t key ) const
+bool NCInputField::validKey( wint_t key ) const
{
// private: NCstring validChars;
const wstring vwch( validChars.str() );
@@ -318,12 +317,12 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::wRedraw
+// METHOD NAME : NCInputField::wRedraw
// METHOD TYPE : void
//
// DESCRIPTION :
//
-void NCTextEntry::wRedraw()
+void NCInputField::wRedraw()
{
if ( !win )
return;
@@ -339,12 +338,12 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::bufferFull
+// METHOD NAME : NCInputField::bufferFull
// METHOD TYPE : bool
//
// DESCRIPTION :
//
-inline bool NCTextEntry::bufferFull() const
+inline bool NCInputField::bufferFull() const
{
return( maxInputLength && buffer.length() == maxInputLength );
}
@@ -352,12 +351,12 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::maxCursor
+// METHOD NAME : NCInputField::maxCursor
// METHOD TYPE : unsigned
//
// DESCRIPTION :
//
-inline unsigned NCTextEntry::maxCursor() const
+inline unsigned NCInputField::maxCursor() const
{
return( bufferFull() ? buffer.length() - 1 : buffer.length() );
}
@@ -365,12 +364,12 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::tUpdate
+// METHOD NAME : NCInputField::tUpdate
// METHOD TYPE : void
//
// DESCRIPTION :
//
-void NCTextEntry::tUpdate()
+void NCInputField::tUpdate()
{
if ( !win )
return;
@@ -457,12 +456,12 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : NCTextEntry::wHandleInput
+// METHOD NAME : NCInputField::wHandleInput
// METHOD TYPE : NCursesEvent
//
// DESCRIPTION :
//
-NCursesEvent NCTextEntry::wHandleInput( wint_t key )
+NCursesEvent NCInputField::wHandleInput( wint_t key )
{
NCursesEvent ret;
bool beep = false;
@@ -648,9 +647,9 @@
}
-void NCTextEntry::setInputMaxLength( const YCPInteger & numberOfChars)
+void NCInputField::setInputMaxLength( int numberOfChars)
{
- int nr = numberOfChars->asInteger()->value();
+ int nr = numberOfChars;
// if there is more text then the maximum number of chars,
// truncate the text and update the buffer
@@ -661,4 +660,6 @@
}
InputMaxLength = nr;
+
+ YInputField::setInputMaxLength( numberOfChars );
}
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCInputField.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCInputField.h?rev=39081&r1=39080&r2=39081&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCInputField.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCInputField.h Thu Jun 28 14:32:34 2007
@@ -10,34 +10,34 @@
| (C) SuSE GmbH |
\----------------------------------------------------------------------/
- File: NCTextEntry.h
+ File: NCInputField.h
Author: Michael Andres
Maintainer: Michael Andres
/-*/
-#ifndef NCTextEntry_h
-#define NCTextEntry_h
+#ifndef NCInputField_h
+#define NCInputField_h
#include <iosfwd>
-#include "YTextEntry.h"
+#include "YInputField.h"
#include "NCWidget.h"
-class NCTextEntry;
+class NCInputField;
///////////////////////////////////////////////////////////////////
//
-// CLASS NAME : NCTextEntry
+// CLASS NAME : NCInputField
//
// DESCRIPTION :
//
-class NCTextEntry : public YTextEntry, public NCWidget {
+class NCInputField : public YInputField, public NCWidget {
- friend std::ostream & operator<<( std::ostream & STREAM, const NCTextEntry & OBJ );
+ friend std::ostream & operator<<( std::ostream & STREAM, const NCInputField & OBJ );
- NCTextEntry & operator=( const NCTextEntry & );
- NCTextEntry ( const NCTextEntry & );
+ NCInputField & operator=( const NCInputField & );
+ NCInputField ( const NCInputField & );
public:
@@ -79,7 +79,7 @@
protected:
- virtual const char * location() const { return "NCTextEntry"; }
+ virtual const char * location() const { return "NCInputField"; }
virtual void wCreate( const wrect & newrect );
virtual void wDelete();
@@ -90,12 +90,10 @@
public:
- NCTextEntry( NCWidget * parent,
+ NCInputField( NCWidget * parent,
const string & label,
- bool passwordMode,
- unsigned maxInput = 0,
- unsigned maxFld = 0 );
- virtual ~NCTextEntry();
+ bool passwordMode );
+ virtual ~NCInputField();
void setFldtype( FTYPE t ) { fldtype = t; }
void setReturnOnReturn( bool on_br ) { returnOnReturn_b = on_br; }
@@ -134,11 +132,11 @@
// limits the input to numberOfChars characters and truncates the text
// if appropriate
- void setInputMaxLength( const YCPInteger & numberOfChars);
+ void setInputMaxLength( int numberOfChars );
void setCurPos( unsigned pos ) { curpos = pos; }
};
///////////////////////////////////////////////////////////////////
-#endif // NCTextEntry_h
+#endif // NCInputField_h
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org