libyui

/data/gitorious.org/libyui/libyui-master/src/YLogView.h

00001 /**************************************************************************
00002 Copyright (C) 2000 - 2010 Novell, Inc.
00003 All Rights Reserved.
00004 
00005 This program is free software; you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation; either version 2 of the License, or
00008 (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License along
00016 with this program; if not, write to the Free Software Foundation, Inc.,
00017 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018 
00019 **************************************************************************/
00020 
00021 
00022 /*---------------------------------------------------------------------\
00023 |                                                                      |
00024 |                      __   __    ____ _____ ____                      |
00025 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00026 |                       \ V / _` \___ \ | |   __) |                    |
00027 |                        | | (_| |___) || |  / __/                     |
00028 |                        |_|\__,_|____/ |_| |_____|                    |
00029 |                                                                      |
00030 |                               core system                            |
00031 |                                                        (C) SuSE GmbH |
00032 \----------------------------------------------------------------------/
00033 
00034   File:         YLogView.h
00035 
00036   Author:       Stefan Hundhammer <sh@suse.de>
00037 
00038 /-*/
00039 
00040 #ifndef YLogView_h
00041 #define YLogView_h
00042 
00043 #include "YWidget.h"
00044 
00045 class YLogViewPrivate;
00046 
00047 
00052 class YLogView : public YWidget
00053 {
00054 protected:
00063     YLogView( YWidget *         parent,
00064               const string &    label,
00065               int               visibleLines,
00066               int               maxLines );
00067 
00068 public:
00069 
00073     virtual ~YLogView();
00074     
00079     virtual const char * widgetClass() const { return "YLogView"; }
00080 
00084     string label() const;
00085 
00092     virtual void setLabel( const string & label );
00093 
00097     int visibleLines() const;
00098 
00107     void setVisibleLines( int newVisibleLines );
00108 
00113     int maxLines() const;
00114 
00126     void setMaxLines( int newMaxLines );
00127 
00132     string logText() const;
00133 
00137     void setLogText( const string & text )
00138         { clearText(); appendLines( text ); }
00139 
00143     string lastLine() const;
00144 
00148     void appendLines( const string & text );
00149 
00153     void clearText();
00154 
00158     int lines() const;
00159 
00170     virtual bool setProperty( const string & propertyName,
00171                               const YPropertyValue & val );
00172 
00179     virtual YPropertyValue getProperty( const string & propertyName );
00180 
00187     virtual const YPropertySet & propertySet();
00188 
00194     virtual string shortcutString() const { return label(); }
00195 
00201     virtual void setShortcutString( const string & str )
00202         { setLabel( str ); }
00203 
00204 
00205 protected:
00206 
00215     virtual void displayLogText( const string & text ) = 0;
00216 
00217     
00218 private:
00219 
00223     void appendLine( const string & line );
00224 
00228     void updateDisplay();
00229 
00230 
00231     // Data members
00232 
00233     ImplPtr<YLogViewPrivate> priv;
00234 
00235 };
00236 
00237 
00238 #endif // YLogView_h
 All Classes Functions Variables Enumerations Friends