Author: gs
Date: Tue Oct 30 11:24:13 2007
New Revision: 41631
URL: http://svn.opensuse.org/viewcvs/yast?rev=41631&view=rev
Log:
adapt to new YTable API
Modified:
branches/tmp/sh/mod-ui/ncurses/src/NCTable.cc
branches/tmp/sh/mod-ui/ncurses/src/NCTable.h
branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc
branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.h
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCTable.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCTable.cc?rev=41631&r1=41630&r2=41631&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCTable.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCTable.cc Tue Oct 30 11:24:13 2007
@@ -20,6 +20,7 @@
#include "NCTable.h"
#include "NCPopupMenu.h"
#include
+#include "YTypes.h"
#if 0
#undef DBG_CLASS
@@ -34,8 +35,8 @@
//
// DESCRIPTION :
//
-NCTable::NCTable( YWidget * parent, int columns )
- : YTable( parent, columns )
+NCTable::NCTable( YWidget * parent, YTableHeader *tableHeader )
+ : YTable( parent, tableHeader )
, NCPadWidget( parent )
, biglist( false )
{
@@ -43,8 +44,17 @@
immediate = immediateMode();
InitPad();
- // !!! head is UTF8 encoded, thus should be vector<YCPstring>
- header.assign( columns, NCstring("") );
+ // !!! head is UTF8 encoded, thus should be vector<NCstring>
+ _header.assign( columns(), NCstring("") );
+
+ for ( int col = 0; col < columns(); col++ )
+ {
+ if ( hasColumn( col ) )
+ {
+ _header[ col ] += NCstring( header( col ) ) ;
+ }
+ }
+ hasHeadline = myPad()->SetHeadline( _header );
}
/////////////////////////////////////////////////////////////////
@@ -130,13 +140,13 @@
void NCTable::setHeader( int col, const string & text )
{
- YTable::setHeader( col, text );
+ //YTable::setHeader( col, text );
if ( hasColumn( col ))
{
- header[ col ] += NCstring( text ) ;
+ _header[ col ] += NCstring( text ) ;
}
- hasHeadline = myPad()->SetHeadline( header );
+ hasHeadline = myPad()->SetHeadline( _header );
}
///////////////////////////////////////////////////////////////////
@@ -167,18 +177,18 @@
// letter - setHeader will append the rest
//
-void NCTable::setAlignment ( int col, YTable::Alignment al )
+void NCTable::setAlignment ( int col, YAlignmentType al )
{
string s;
switch ( al )
{
- case YTable::Left: s = 'L' ; break;
- case YTable::Center: s = 'C' ; break;
- case YTable::Right: s = 'R' ; break;
+ case YAlignBegin: s = 'L' ; break;
+ case YAlignCenter: s = 'C' ; break;
+ case YAlignEnd: s = 'R' ; break;
}
- header[ col ] = NCstring( s );
- YTable::setAlignment( col, al );
+ _header[ col ] = NCstring( s );
+ //YTable::setAlignment( col, al );
}
///////////////////////////////////////////////////////////////////
@@ -264,6 +274,21 @@
///////////////////////////////////////////////////////////////////
//
//
+// METHOD NAME : NCTable::getCurrentItemPointer
+// METHOD TYPE : YItem *
+//
+// DESCRIPTION : Return origin pointer of currently selected table item
+//
+
+YItem * NCTable::getCurrentItemPointer()
+{
+ const NCTableLine *cline = myPad()->GetLine( myPad()->CurPos().L );
+ return cline->origItem();
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
// METHOD NAME : NCTable::setCurrentItem
// METHOD TYPE : void
//
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCTable.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCTable.h?rev=41631&r1=41630&r2=41631&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCTable.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCTable.h Tue Oct 30 11:24:13 2007
@@ -46,7 +46,7 @@
bool immediate;
bool sortable;
- vector<NCstring> header;
+ vector<NCstring> _header;
protected:
@@ -74,7 +74,7 @@
public:
- NCTable( YWidget * parent, int columns );
+ NCTable( YWidget * parent, YTableHeader *header );
virtual ~NCTable();
@@ -85,7 +85,7 @@
void setHeader( int col, const string & text ); // added by gs
void setHeader ( vector<string> header );
- virtual void setAlignment ( int col, YTable::Alignment al );
+ virtual void setAlignment ( int col, YAlignmentType al );
void setBigList( const bool big ) { biglist = big; }
void SetSepChar( const chtype colSepchar ) { myPad()->SetSepChar( colSepchar ); }
@@ -96,6 +96,8 @@
virtual void deleteAllItems( );
virtual int getCurrentItem();
+ YItem * getCurrentItemPointer();
+
virtual void setCurrentItem( int index );
virtual void selectItem( YItem *yitem, bool selected );
void selectCurrentItem();
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc?rev=41631&r1=41630&r2=41631&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc Tue Oct 30 11:24:13 2007
@@ -165,9 +165,9 @@
NCTable *
-NCWidgetFactory::createTable( YWidget * parent, int columns )
+NCWidgetFactory::createTable( YWidget * parent, YTableHeader * tableHeader )
{
- NCTable *table = new NCTable( parent, columns );
+ NCTable *table = new NCTable( parent, tableHeader );
YUI_CHECK_NEW( table );
return table;
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.h?rev=41631&r1=41630&r2=41631&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.h Tue Oct 30 11:24:13 2007
@@ -117,7 +117,7 @@
const string & label );
virtual NCTable * createTable ( YWidget * parent,
- int columns );
+ YTableHeader * tableHeader );
virtual NCProgressBar * createProgressBar ( YWidget * parent,
const string & label,
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org