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 00061 protected: 00062 00063 virtual void startMultipleChanges() { startMultidraw(); } 00064 virtual void doneMultipleChanges() { stopMultidraw(); } 00065 00066 public: 00067 00068 NCTable( NCWidget * parent, const YWidgetOpt & opt, 00069 vector<string> header ); 00070 virtual ~NCTable(); 00071 00072 bool bigList() const { return biglist; } 00073 00074 bool isImmediate() const { return immediate; } // addey by gs 00075 void setHeader( const vector<string> & head ); // added by gs 00076 virtual void itemsCleared(); 00077 00078 void setBigList( const bool big ) { biglist = big; } 00079 void SetSepChar( const chtype colSepchar ) { pad->SetSepChar( colSepchar ); } 00080 void SetSepWidht( const unsigned sepwidth ) { pad->SetSepWidht( sepwidth ); } 00081 void SetHotCol( const int hcol ) { pad->SetHotCol( hcol ); } 00082 00083 virtual void itemAdded( vector<string> elements, int index ); 00084 00085 virtual long nicesize( YUIDimension dim ); 00086 virtual void setSize( long newwidth, long newheight ); 00087 00088 virtual void setLabel( const YCPString & nlabel ); 00089 00090 virtual int getCurrentItem(); 00091 virtual void setCurrentItem( int index ); 00092 00093 bool setItemByKey( int key ); 00094 00095 virtual NCursesEvent wHandleInput( wint_t key ); 00096 00097 virtual void setEnabling( bool do_bv ) { NCWidget::setEnabling( enabled=do_bv ); } 00098 00099 virtual bool setKeyboardFocus() { 00100 if ( !grabFocus() ) 00101 return YWidget::setKeyboardFocus(); 00102 return true; 00103 } 00104 00105 void stripHotkeys() { pad->stripHotkeys(); } 00106 }; 00107 00109 00110 #endif // NCTable_h