00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: NCTable.h 00014 00015 Author: Michael Andres <ma@suse.de> 00016 Maintainer: Michael Andres <ma@suse.de> 00017 00018 /-*/ 00019 #ifndef NCTable_h 00020 #define NCTable_h 00021 00022 #include <iosfwd> 00023 00024 #include "YTable.h" 00025 #include "NCPadWidget.h" 00026 #include "NCTablePad.h" 00027 00028 class NCTable; 00029 00031 // 00032 // CLASS NAME : NCTable 00033 // 00034 // DESCRIPTION : 00035 // 00036 class NCTable : public YTable, public NCPadWidget { 00037 00038 friend std::ostream & operator<<( std::ostream & STREAM, const NCTable & OBJ ); 00039 00040 NCTable & operator=( const NCTable & ); 00041 NCTable ( const NCTable & ); 00042 00043 private: 00044 00045 bool immediate; 00046 00047 protected: 00048 00049 NCTablePad *& pad; 00050 bool biglist; 00051 00052 protected: 00053 00054 virtual const char * location() const { return "NCTable"; } 00055 00056 virtual NCPad * CreatePad(); 00057 00058 virtual void cellChanged( int index, int colnum, const YCPString & newtext ); 00059 00060 protected: 00061 00062 virtual void startMultipleChanges() { startMultidraw(); } 00063 virtual void doneMultipleChanges() { stopMultidraw(); } 00064 00065 public: 00066 00067 NCTable( NCWidget * parent, const YWidgetOpt & opt, 00068 vector<string> header ); 00069 virtual ~NCTable(); 00070 00071 bool bigList() const { return biglist; } 00072 00073 bool isImmediate() const { return immediate; } // addey by gs 00074 void setHeader( const vector<string> & head ); // added by gs 00075 virtual void itemsCleared(); 00076 00077 void setBigList( const bool big ) { biglist = big; } 00078 void SetSepChar( const chtype colSepchar ) { pad->SetSepChar( colSepchar ); } 00079 void SetSepWidht( const unsigned sepwidth ) { pad->SetSepWidht( sepwidth ); } 00080 void SetHotCol( const int hcol ) { pad->SetHotCol( hcol ); } 00081 00082 virtual void itemAdded( vector<string> elements, int index ); 00083 00084 virtual long nicesize( YUIDimension dim ); 00085 virtual void setSize( long newwidth, long newheight ); 00086 00087 virtual void setLabel( const YCPString & nlabel ); 00088 00089 virtual int getCurrentItem(); 00090 virtual void setCurrentItem( int index ); 00091 00092 bool setItemByKey( int key ); 00093 00094 virtual NCursesEvent wHandleInput( wint_t key ); 00095 00096 virtual void setEnabling( bool do_bv ) { NCWidget::setEnabling( enabled=do_bv ); } 00097 00098 virtual bool setKeyboardFocus() { 00099 if ( !grabFocus() ) 00100 return YWidget::setKeyboardFocus(); 00101 return true; 00102 } 00103 }; 00104 00106 00107 #endif // NCTable_h