00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: NCPadWidget.h 00014 00015 Author: Michael Andres <ma@suse.de> 00016 Maintainer: Michael Andres <ma@suse.de> 00017 00018 /-*/ 00019 #ifndef NCPadWidget_h 00020 #define NCPadWidget_h 00021 00022 #include <iosfwd> 00023 00024 #include "NCWidget.h" 00025 #include "NCPad.h" 00026 00027 class NCPadWidget; 00028 class NCScrollbar; 00029 00031 // 00032 // CLASS NAME : NCPadWidget 00033 // 00034 // DESCRIPTION : 00035 // 00036 class NCPadWidget : public NCWidget, protected NCSchrollCB { 00037 00038 friend std::ostream & operator<<( std::ostream & STREAM, const NCPadWidget & OBJ ); 00039 00040 NCPadWidget & operator=( const NCPadWidget & ); 00041 NCPadWidget ( const NCPadWidget & ); 00042 00043 private: 00044 00045 NClabel label; 00046 NCursesWindow * padwin; 00047 NCScrollbar * hsb; 00048 NCScrollbar * vsb; 00049 00050 wsze minPadSze; 00051 bool multidraw; 00052 00053 protected: 00054 00055 NCPad * pad; 00056 bool hasHeadline; 00057 bool activeLabelOnly; 00058 00059 void startMultidraw() { multidraw = true; } 00060 void stopMultidraw() { multidraw = false; DrawPad(); } 00061 bool inMultidraw() const { return multidraw; } 00062 00063 protected: 00064 00065 virtual const char * location() const { return "NCPadWidget"; } 00066 00067 // widget stuff 00068 unsigned labelWidht() const { return label.width(); } 00069 00070 virtual void wCreate( const wrect & newrect ); 00071 virtual void wDelete(); 00072 virtual void wRedraw(); 00073 virtual void wRecoded(); 00074 00075 // pad stuff 00076 wsze defPadSze() const { 00077 if ( !padwin ) 00078 return 0; 00079 return wsze( padwin->height(), padwin->width() ); 00080 } 00081 virtual NCPad * CreatePad(); 00082 virtual void DrawPad(); 00083 00084 void InitPad(); 00085 void AdjustPad( wsze nsze ); 00086 void DelPad(); 00087 00088 // scroll hints 00089 virtual void HScroll( unsigned total, unsigned visible, unsigned start ); 00090 virtual void VScroll( unsigned total, unsigned visible, unsigned start ); 00091 virtual void ScrollHead( NCursesWindow & w, unsigned ccol ); 00092 00093 // resize hints 00094 virtual void AdjustPadSize( wsze & minsze ); 00095 00096 // input 00097 virtual bool handleInput( wint_t key ); 00098 00099 public: 00100 00101 NCPadWidget( NCWidget * myparent = 0 ); 00102 virtual ~NCPadWidget(); 00103 00104 size_t Columns( ) { return minPadSze.W; } 00105 void setLabel( const NClabel & nlabel ); 00106 00107 virtual void setEnabling( bool do_bv ) { NCWidget::setEnabling( do_bv ); } 00108 }; 00109 00111 00112 #endif // NCPadWidget_h