libyui  3.0.10
YLogView Class Reference

#include <YLogView.h>

Inheritance diagram for YLogView:
Collaboration diagram for YLogView:

List of all members.

Public Member Functions

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

Protected Member Functions

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

Detailed Description

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

Definition at line 37 of file YLogView.h.


Constructor & Destructor Documentation

YLogView::YLogView ( YWidget parent,
const std::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".

Definition at line 58 of file YLogView.cc.

Here is the call graph for this function:

YLogView::~YLogView ( ) [virtual]

Destructor.

Definition at line 69 of file YLogView.cc.


Member Function Documentation

void YLogView::appendLines ( const std::string &  text)

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

Definition at line 161 of file YLogView.cc.

Clear the log text and trigger a display update.

Definition at line 206 of file YLogView.cc.

virtual void YLogView::displayLogText ( const std::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 std::string &  propertyName) [virtual]

Get a property. Reimplemented from YWidget.

This method may throw YUIPropertyExceptions.

Reimplemented from YWidget.

Definition at line 273 of file YLogView.cc.

Here is the call graph for this function:

std::string YLogView::label ( ) const

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

Definition at line 76 of file YLogView.cc.

std::string YLogView::lastLine ( ) const

Return the last log line.

Definition at line 151 of file YLogView.cc.

int YLogView::lines ( ) const

Return the current number of lines.

Definition at line 213 of file YLogView.cc.

std::string YLogView::logText ( ) const

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

Definition at line 125 of file YLogView.cc.

int YLogView::maxLines ( ) const

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

Definition at line 104 of file YLogView.cc.

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.

Definition at line 228 of file YLogView.cc.

Here is the call graph for this function:

void YLogView::setLabel ( const std::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.

Definition at line 83 of file YLogView.cc.

Here is the call graph for this function:

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

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

Definition at line 122 of file YLogView.h.

Here is the call graph for this function:

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.

Definition at line 111 of file YLogView.cc.

bool YLogView::setProperty ( const std::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.

Definition at line 254 of file YLogView.cc.

Here is the call graph for this function:

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

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

Reimplemented from YWidget.

Reimplemented from YWidget.

Definition at line 186 of file YLogView.h.

Here is the call graph for this function:

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.

Definition at line 97 of file YLogView.cc.

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

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

Reimplemented from YWidget.

Reimplemented from YWidget.

Definition at line 179 of file YLogView.h.

Here is the call graph for this function:

int YLogView::visibleLines ( ) const

Return the number of visible lines.

Definition at line 90 of file YLogView.cc.

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

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

Reimplemented from YWidget.

Definition at line 64 of file YLogView.h.


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