libyui
3.10.0
|
Text formatted with simple HTML-like tags, with "links" generating events. More...
#include <YRichText.h>
Public Member Functions | |
YRichText (YWidget *parent, const std::string &text, bool plainTextMode=false) | |
Constructor. More... | |
virtual | ~YRichText () |
Destructor. | |
virtual const char * | widgetClass () const |
Returns a descriptive name of this widget class for logging, debugging etc. | |
virtual void | setValue (const std::string &newValue) |
Change the text content of the RichText widget. More... | |
std::string | value () const |
Return the text content of the RichText widget. | |
void | setText (const std::string &newText) |
Alias for setValue(). | |
std::string | text () const |
Alias for value(). | |
bool | plainTextMode () const |
Return 'true' if this RichText widget is in "plain text" mode, i.e. More... | |
virtual void | setPlainTextMode (bool on=true) |
Set this RichText widget's "plain text" mode on or off. More... | |
bool | autoScrollDown () const |
Return 'true' if this RichText widget should automatically scroll down when the text content is changed. More... | |
virtual void | setAutoScrollDown (bool on=true) |
Set this RichText widget's "auto scroll down" mode on or off. More... | |
bool | shrinkable () const |
Returns 'true' if this widget is "shrinkable", i.e. More... | |
void | setShrinkable (bool shrinkable=true) |
Make this widget shrinkable, i.e. More... | |
virtual bool | setProperty (const std::string &propertyName, const YPropertyValue &val) |
Set a property. More... | |
virtual YPropertyValue | getProperty (const std::string &propertyName) |
Get a property. More... | |
virtual const YPropertySet & | propertySet () |
Return this class's property set. More... | |
virtual std::string | vScrollValue () const |
Get the position value of the vertical scrollbar. More... | |
virtual void | setVScrollValue (const std::string &newValue) |
Set the position value of the vertical scrollbar. More... | |
virtual std::string | hScrollValue () const |
Get the position value of the horizontal scrollbar. More... | |
virtual void | setHScrollValue (const std::string &newValue) |
Set the position value of the horizontal scrollbar. More... | |
virtual void | activateLink (const std::string &url)=0 |
Derived classes should implement this, method is used to trigger event like user has pressed the link in the RichText. | |
![]() | |
virtual | ~YWidget () |
Destructor. | |
virtual std::string | debugLabel () const |
Returns a descriptive label of this widget instance. More... | |
std::string | helpText () const |
Return the help text for this widget. | |
void | setHelpText (const std::string &helpText) |
Set a help text for this widget. More... | |
bool | hasChildren () const |
Returns 'true' if this widget has any children. | |
YWidget * | firstChild () const |
Returns the first child or 0 if there is none. More... | |
YWidget * | lastChild () const |
Returns the last child or 0 if there is none. | |
YWidgetListIterator | childrenBegin () const |
Return an iterator that points to the first child or to childrenEnd() if there are no children. | |
YWidgetListIterator | childrenEnd () const |
Return an interator that points after the last child. | |
YWidgetListConstIterator | childrenConstBegin () const |
Return a const iterator that points to the first child or to childrenEnd() if there are no children. | |
YWidgetListConstIterator | childrenConstEnd () const |
Return a const interator that points after the last child. | |
YWidgetListIterator | begin () |
A helper for the range-based "for" loop. More... | |
YWidgetListIterator | end () |
A helper for the range-based "for" loop. More... | |
int | childrenCount () const |
Returns the current number of children. | |
bool | contains (YWidget *child) const |
Checks if 'child' is a (direct!) child of this widget. | |
virtual void | addChild (YWidget *child) |
Add a new child. More... | |
virtual void | removeChild (YWidget *child) |
Remove a child. More... | |
void | deleteChildren () |
Delete all children and remove them from the children manager's list. | |
YWidget * | parent () const |
Return this widget's parent or 0 if it doesn't have a parent. | |
bool | hasParent () const |
Return 'true' if this widget has a parent, 'false' if not. | |
void | setParent (YWidget *newParent) |
Set this widget's parent. | |
YDialog * | findDialog () |
Traverse up the widget hierarchy and find the dialog this widget belongs to. More... | |
YWidget * | findWidget (YWidgetID *id, bool doThrow=true) const |
Recursively find a widget by its ID. More... | |
virtual int | preferredWidth ()=0 |
Preferred width of the widget. More... | |
virtual int | preferredHeight ()=0 |
Preferred height of the widget. More... | |
virtual int | preferredSize (YUIDimension dim) |
Preferred size of the widget in the specified dimension. More... | |
virtual void | setSize (int newWidth, int newHeight)=0 |
Set the new size of the widget. More... | |
bool | isValid () const |
Checks whether or not this object is valid. More... | |
bool | beingDestroyed () const |
Check if this widget is in the process of being destroyed. | |
void * | widgetRep () const |
Return a pointer to the underlying toolkit's (Qt, ...) widget representing this abstract UI widget. | |
void | setWidgetRep (void *toolkitWidgetRep) |
Set the pointer to the underlying toolkit's (Qt, ...) widget representing this abstract UI widget. More... | |
bool | hasId () const |
Returns 'true' if this widget has an ID. | |
YWidgetID * | id () const |
Returns this widget's ID. | |
void | setId (YWidgetID *newId_disown) |
Set this widget's ID. More... | |
virtual void | setEnabled (bool enabled=true) |
Enable or disable this widget, i.e. More... | |
void | setDisabled () |
Disable this widget (overloaded for better readability). | |
virtual bool | isEnabled () const |
Returns 'true' if this widget is enabled. | |
virtual bool | stretchable (YUIDimension dim) const |
This is a boolean value that determines whether the widget is resizable beyond its preferred size in the specified dimension. More... | |
void | setStretchable (YUIDimension dim, bool newStretch) |
Set the stretchable state to "newStretch" regardless of any hstretch or vstretch options. | |
void | setDefaultStretchable (YUIDimension dim, bool newStretch) |
Set the stretchable state to "newStretch". More... | |
virtual int | weight (YUIDimension dim) |
The weight is used in situations where all widgets can get their preferred size and yet space is available. More... | |
bool | hasWeight (YUIDimension dim) |
Return whether or not the widget has a weight in the specified dimension. | |
void | setWeight (YUIDimension dim, int weight) |
Set a weight in the specified dimension. | |
void | setNotify (bool notify=true) |
Sets the Notify property. | |
bool | notify () const |
Returns whether the widget will notify, i.e. More... | |
void | setNotifyContextMenu (bool notifyContextMenu=true) |
Sets the notifyContextMenu property. | |
bool | notifyContextMenu () const |
Returns whether the widget will send an event when the user clicks selects the context menu e.g. More... | |
bool | sendKeyEvents () const |
Returns 'true' if this widget should send key events, i.e. More... | |
void | setSendKeyEvents (bool doSend) |
Specify whether or not this widget should send key events. | |
bool | autoShortcut () const |
Returns 'true' if a keyboard shortcut should automatically be assigned to this widget - without complaints in the log file. | |
void | setAutoShortcut (bool _newAutoShortcut) |
Sets the 'autoShortcut' flag. | |
int | functionKey () const |
Return a function key number that is assigned to this widget. More... | |
bool | hasFunctionKey () const |
Check if a function key is assigned to this widget. | |
virtual void | setFunctionKey (int fkey_no) |
Assign a function key to this widget (1 for F1, 2 for F2, etc. More... | |
virtual bool | setKeyboardFocus () |
Set the keyboard focus to this widget. More... | |
virtual std::string | shortcutString () const |
Get the string of this widget that holds the keyboard shortcut, if any. More... | |
virtual void | setShortcutString (const std::string &str) |
Set the string of this widget that holds the keyboard shortcut, if any. More... | |
virtual const char * | userInputProperty () |
The name of the widget property that will return user input, if there is any. More... | |
void | dumpWidgetTree (int indentationLevel=0) |
Debugging function: Dump the widget tree from here on to the log file. | |
void | dumpDialogWidgetTree () |
Debugging function: Dump the widget tree from this widget's dialog parent. More... | |
void | setChildrenEnabled (bool enabled) |
Enable or disable all widgets in this widget tree. | |
virtual void | saveUserInput (YMacroRecorder *macroRecorder) |
Recursively save the user input of all child widgets to a macro recorder: More... | |
void * | operator new (size_t size) |
Overloaded operator new to ensure widgets are always created on the heap, never on the stack. More... | |
virtual void | startMultipleChanges () |
In some UIs updating the screen content is an expensive operation. More... | |
virtual void | doneMultipleChanges () |
Protected Attributes | |
ImplPtr< YRichTextPrivate > | priv |
Additional Inherited Members | |
![]() | |
YWidget (YWidget *parent) | |
Constructor. | |
YWidgetChildrenManager * | childrenManager () const |
Returns this widget's children manager. | |
void | setChildrenManager (YWidgetChildrenManager *manager) |
Sets a new children manager for this widget. More... | |
void | setBeingDestroyed () |
Set the "being destroyed" flag, i.e. More... | |
void | dumpWidget (YWidget *w, int indentationLevel) |
Helper function for dumpWidgetTree(): Dump one widget to the log file. | |
Text formatted with simple HTML-like tags, with "links" generating events.
Definition at line 40 of file YRichText.h.
YRichText::YRichText | ( | YWidget * | parent, |
const std::string & | text, | ||
bool | plainTextMode = false |
||
) |
Constructor.
'plainTextMode' indicates that the text should be treated as plain text, i.e. any HTML-like tags in the text should not be interpreted in any way.
Definition at line 57 of file YRichText.cc.
bool YRichText::autoScrollDown | ( | ) | const |
Return 'true' if this RichText widget should automatically scroll down when the text content is changed.
This is useful for progress displays and log files.
Definition at line 98 of file YRichText.cc.
|
virtual |
Get a property.
Reimplemented from YWidget.
This method may throw YUIPropertyExceptions.
Reimplemented from YWidget.
Definition at line 165 of file YRichText.cc.
|
virtual |
Get the position value of the horizontal scrollbar.
Might not be available in all frontends.
Definition at line 191 of file YRichText.cc.
bool YRichText::plainTextMode | ( | ) | const |
Return 'true' if this RichText widget is in "plain text" mode, i.e.
does not try to interpret RichText/HTML tags.
Definition at line 86 of file YRichText.cc.
|
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 123 of file YRichText.cc.
|
virtual |
Set this RichText widget's "auto scroll down" mode on or off.
Derived classes may want to reimplement this, but they should call this base class function in the new function.
Definition at line 104 of file YRichText.cc.
|
virtual |
Set the position value of the horizontal scrollbar.
Only values previously obtained using hScrollValue() and some special values are allowed.
The special values are:
"minimum" Moves the scrollbar to the start.
"maximum" Moves the scrollbar to the end.
The meaning of start and end can depend on the text direction (LTR or RTL).
Might not be available in all frontends.
Definition at line 197 of file YRichText.cc.
|
virtual |
Set this RichText widget's "plain text" mode on or off.
Derived classes may want to reimplement this, but they should call this base class function in the new function.
Definition at line 92 of file YRichText.cc.
|
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 147 of file YRichText.cc.
void YRichText::setShrinkable | ( | bool | shrinkable = true | ) |
Make this widget shrinkable, i.e.
very small in layouts.
This method is intentionally not virtual because it doesn't have any immediate effect; it is only needed in preferredWidth() / preferredHeight().
Definition at line 116 of file YRichText.cc.
|
virtual |
Change the text content of the RichText widget.
Derived classes should overwrite this function, but call this base class function in the new function.
Definition at line 74 of file YRichText.cc.
|
virtual |
Set the position value of the vertical scrollbar.
Only values previously obtained using vScrollValue() and some special values are allowed.
The special values are:
"minimum" Moves the scrollbar to the start.
"maximum" Moves the scrollbar to the end.
Might not be available in all frontends.
Definition at line 186 of file YRichText.cc.
bool YRichText::shrinkable | ( | ) | const |
Returns 'true' if this widget is "shrinkable", i.e.
it should be very small by default.
Definition at line 110 of file YRichText.cc.
|
virtual |
Get the position value of the vertical scrollbar.
Might not be available in all frontends.
Definition at line 180 of file YRichText.cc.