00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: NCTree.h 00014 00015 Author: Michael Andres <ma@suse.de> 00016 Maintainer: Michael Andres <ma@suse.de> 00017 00018 /-*/ 00019 #ifndef NCTree_h 00020 #define NCTree_h 00021 00022 #include <iosfwd> 00023 00024 #include "YTree.h" 00025 #include "NCPadWidget.h" 00026 #include "NCTreePad.h" 00027 00028 class NCTreeLine; 00029 00031 // 00032 // CLASS NAME : NCTree 00033 // 00034 // DESCRIPTION : 00035 // 00036 class NCTree : public YTree, public NCPadWidget { 00037 00038 friend std::ostream & operator<<( std::ostream & STREAM, const NCTree & OBJ ); 00039 00040 NCTree & operator=( const NCTree & ); 00041 NCTree ( const NCTree & ); 00042 00043 protected: 00044 00045 NCTreePad *& pad; 00046 00047 const NCTreeLine * getTreeLine( unsigned idx ) const; 00048 NCTreeLine * modifyTreeLine( unsigned idx ); 00049 00050 protected: 00051 00052 virtual const char * location() const { return "NCTree"; } 00053 00054 virtual NCPad * CreatePad(); 00055 virtual void DrawPad(); 00056 00057 protected: 00058 00059 virtual void startMultipleChanges() { startMultidraw(); } 00060 virtual void doneMultipleChanges() { stopMultidraw(); } 00061 00062 public: 00063 00064 NCTree( NCWidget * parent, const YWidgetOpt & opt, 00065 const YCPString & label ); 00066 virtual ~NCTree(); 00067 00068 virtual long nicesize( YUIDimension dim ); 00069 virtual void setSize( long newwidth, long newheight ); 00070 00071 virtual void setLabel( const YCPString & nlabel ); 00072 virtual void rebuildTree(); 00073 00074 virtual const YTreeItem * getCurrentItem() const; 00075 virtual void setCurrentItem( YTreeItem * it ); 00076 00077 virtual NCursesEvent wHandleInput( wint_t key ); 00078 00079 virtual void setEnabling( bool do_bv ) { NCWidget::setEnabling( enabled=do_bv ); } 00080 00081 virtual bool setKeyboardFocus() { 00082 if ( !grabFocus() ) 00083 return YWidget::setKeyboardFocus(); 00084 return true; 00085 } 00086 00087 void deleteAllItems(); 00088 }; 00089 00091 00092 #endif // NCTree_h