Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

NCTreePad.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013    File:       NCTreePad.h
00014 
00015    Author:     Michael Andres <ma@suse.de>
00016    Maintainer: Michael Andres <ma@suse.de>
00017 
00018 /-*/
00019 #ifndef NCTreePad_h
00020 #define NCTreePad_h
00021 
00022 #include <iosfwd>
00023 
00024 #include <vector>
00025 using namespace std;
00026 
00027 #include "NCTableItem.h"
00028 #include "NCPad.h"
00029 #include "NCstring.h"
00030 
00031 class NCTableLine;
00032 class NCTableCol;
00033 
00035 //
00036 //      CLASS NAME : NCTreePad
00037 //
00038 //      DESCRIPTION :
00039 //
00040 class NCTreePad : public NCPad {
00041 
00042   friend std::ostream & operator<<( std::ostream & STREAM, const NCTreePad & OBJ );
00043 
00044   NCTreePad & operator=( const NCTreePad & );
00045   NCTreePad            ( const NCTreePad & );
00046 
00047   private:
00048 
00049     NCursesPad  Headpad;
00050     bool        dirtyHead;
00051     bool        dirtyFormat;
00052 
00053     NCTableStyle         ItemStyle;
00054     NCTableLine          Headline;
00055     vector<NCTableLine*> Items;
00056     vector<NCTableLine*> visItems;
00057     wpos                 citem;
00058 
00059     void assertLine( unsigned idx );
00060 
00061   protected:
00062 
00063     void         DirtyFormat() { dirty = dirtyFormat = true; }
00064     virtual wsze UpdateFormat();
00065 
00066     virtual int  dirtyPad() { return setpos( CurPos() ); }
00067     virtual int  setpos( const wpos & newpos );
00068     virtual int  DoRedraw();
00069     virtual void updateScrollHint();
00070 
00071   public:
00072 
00073     NCTreePad( int lines, int cols, const NCWidget & p );
00074     virtual ~NCTreePad();
00075 
00076   public:
00077 
00078     NCursesWindow * Destwin() { return NCPad::Destwin(); }
00079     virtual void Destwin( NCursesWindow * dwin );
00080 
00081     virtual void wRecoded();
00082 
00083     virtual wpos CurPos() const;
00084     virtual bool handleInput( wint_t key );
00085 
00086   public:
00087 
00088     bool SetHeadline( const vector<NCstring> & head );
00089     virtual void SendHead() {
00090       SetHead( Headpad, srect.Pos.C );
00091       dirtyHead = false;
00092     }
00093 
00094     unsigned Cols()     const { return ItemStyle.Cols(); }
00095     unsigned Lines()    const { return Items.size(); }
00096     unsigned visLines() const { return visItems.size(); }
00097 
00098     void     SetLines( unsigned idx );
00099     void     SetLines( vector<NCTableLine*> & nItems );
00100     void     ClearTable()  { SetLines( 0 ); }
00101 
00102     void Append( NCTableLine * item )           { AddLine( Lines(), item ); }
00103     void Append( vector<NCTableCol*> & nItems ) { AddLine( Lines(), new NCTableLine( nItems ) ); }
00104     void AddLine( unsigned idx, NCTableLine * item );
00105     void DelLine( unsigned idx );
00106 
00107     const NCTableLine * GetCurrentLine() const ;
00108     const NCTableLine * GetLine( unsigned idx ) const;
00109 
00110     NCTableLine *       ModifyLine( unsigned idx );
00111 
00112     void ShowItem( const NCTableLine * item );
00113 };
00114 
00116 
00117 #endif // NCTreePad_h

Generated on Wed Sep 5 17:18:55 2007 for yast2-ncurses by doxygen 1.3.6