libyui
Public Member Functions | Protected Member Functions

YLogView Class Reference

#include <YLogView.h>

Inheritance diagram for YLogView:
YWidget

List of all members.

Public Member Functions

virtual ~YLogView ()
virtual const char * widgetClass () const
string label () const
virtual void setLabel (const string &label)
int visibleLines () const
void setVisibleLines (int newVisibleLines)
int maxLines () const
void setMaxLines (int newMaxLines)
string logText () const
void setLogText (const string &text)
string lastLine () const
void appendLines (const string &text)
void clearText ()
int lines () const
virtual bool setProperty (const string &propertyName, const YPropertyValue &val)
virtual YPropertyValue getProperty (const string &propertyName)
virtual const YPropertySetpropertySet ()
virtual string shortcutString () const
virtual void setShortcutString (const string &str)

Protected Member Functions

 YLogView (YWidget *parent, const string &label, int visibleLines, int maxLines)
virtual void displayLogText (const string &text)=0

Detailed Description

LogView: A scrollable (output-only) text to display a growing log, very much like the "tail -f" shell command.


Constructor & Destructor Documentation

YLogView::YLogView ( YWidget parent,
const string &  label,
int  visibleLines,
int  maxLines 
) [protected]

Constructor.

'label' is the caption above the log. 'visibleLines' indicates how many lines should be visible by default (unless changed by other layout constraints), 'maxLines' specifies how many lines (always the last ones) to keep in the log. 0 for 'maxLines' means "keep all lines".

YLogView::~YLogView ( ) [virtual]

Destructor.


Member Function Documentation

void YLogView::appendLines ( const string &  text)

Append one or more lines to the log text and trigger a display update.

void YLogView::clearText ( )

Clear the log text and trigger a display update.

virtual void YLogView::displayLogText ( const string &  text) [protected, pure virtual]

Display the part of the log text that should be displayed. 'text' contains the last 'visibleLines()' lines. This is called whenever the log text changes. Note that the text might also be empty, in which case the displayed log text should be cleared.

Derived classes are required to implement this.

YPropertyValue YLogView::getProperty ( const string &  propertyName) [virtual]

Get a property. Reimplemented from YWidget.

This method may throw YUIPropertyExceptions.

Reimplemented from YWidget.

string YLogView::label ( ) const

Return the label (the caption above the log text).

string YLogView::lastLine ( ) const

Return the last log line.

int YLogView::lines ( ) const

Return the current number of lines.

string YLogView::logText ( ) const

Return the entire log text as one large string of concatenated lines delimited with newlines.

int YLogView::maxLines ( ) const

Return the maximum number of lines to store. The last maxLines() lines of the log text will be kept.

const YPropertySet & YLogView::propertySet ( ) [virtual]

Return this class's property set. This also initializes the property upon the first call.

Reimplemented from YWidget.

Reimplemented from YWidget.

void YLogView::setLabel ( const string &  label) [virtual]

Set the label (the caption above the log text).

Derived classes are free to reimplement this, but they should call this base class method at the end of the overloaded function.

void YLogView::setLogText ( const string &  text) [inline]

Set (replace) the entire log text and trigger a display update.

void YLogView::setMaxLines ( int  newMaxLines)

Set the maximum number of lines to store. "0" means "keep all lines" (beware of memory overflow!).

If the new value is lower than the old value, any (now) excess lines before the last 'newMaxLines' lines of the log text is cut off and a display update is triggered.

This method is intentionally not virtual since a display update is triggered when appropriate.

bool YLogView::setProperty ( const string &  propertyName,
const YPropertyValue val 
) [virtual]

Set a property. Reimplemented from YWidget.

This function may throw YUIPropertyExceptions.

This function returns 'true' if the value was successfully set and 'false' if that value requires special handling (not in error cases: those are covered by exceptions).

Reimplemented from YWidget.

virtual void YLogView::setShortcutString ( const string &  str) [inline, virtual]

Set the string of this widget that holds the keyboard shortcut.

Reimplemented from YWidget.

Reimplemented from YWidget.

void YLogView::setVisibleLines ( int  newVisibleLines)

Set the number of visible lines. Changing this has only effect upon the next geometry call, so applications calling this function might want to trigger a re-layout afterwards.

This method is intentionally not virtual: visibleLines() should be queried in the preferredHeight() implementation.

virtual string YLogView::shortcutString ( ) const [inline, virtual]

Get the string of this widget that holds the keyboard shortcut.

Reimplemented from YWidget.

Reimplemented from YWidget.

int YLogView::visibleLines ( ) const

Return the number of visible lines.

virtual const char* YLogView::widgetClass ( ) const [inline, virtual]

Returns a descriptive name of this widget class for logging, debugging etc.

Reimplemented from YWidget.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations Friends