00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YLogView.h 00014 00015 Author: Stefan Hundhammer <sh@suse.de> 00016 00017 /-*/ 00018 00019 #ifndef YLogView_h 00020 #define YLogView_h 00021 00022 #include "YWidget.h" 00023 #include <ycp/YCPString.h> 00024 #include <deque> 00025 00026 using std::deque; 00027 00031 class YLogView : public YWidget 00032 { 00033 public: 00037 YLogView( const YWidgetOpt & opt, 00038 const YCPString & label, 00039 int visibleLines, 00040 int maxLines ); 00041 00046 virtual char *widgetClass() { return "YLogView"; } 00047 00048 00053 YCPValue changeWidget( const YCPSymbol & property, const YCPValue & newvalue ); 00054 00058 YCPValue queryWidget( const YCPSymbol & property ); 00059 00060 00064 virtual void setLogText( const YCPString & text ) = 0; 00065 00069 YCPString label() const { return _label; } 00070 00074 int visibleLines() const { return _visibleLines; } 00075 00079 int maxLines() const { return _maxLines; } 00080 00085 virtual void setLabel( const YCPString & newLabel ); 00086 00091 string logText(); 00092 00096 void appendText( const YCPString & text ); 00097 00098 00102 void appendLine( const string & line ); 00103 00107 void clearText(); 00108 00112 int lines() const { return _logText.size(); } 00113 00118 const char *shortcutProperty() { return YUIProperty_Label; } 00119 00120 00121 private: 00122 00123 // Data members 00124 00125 YCPString _label; 00126 int _visibleLines; 00127 int _maxLines; 00128 00129 deque<string> _logText; 00130 }; 00131 00132 00133 #endif // YLogView_h