#include <YWidget.h>
Inheritance diagram for YWidget:

Public Member Functions | |
| YWidget (const YWidgetOpt &opt) | |
| virtual | ~YWidget () |
| virtual char * | widgetClass () |
| virtual std::string | debugLabel () |
| bool | isValid () const |
| int | internalId () const |
| void | setId (const YCPValue &id) |
| bool | hasId () const |
| YCPValue | id () const |
| void | setParent (YWidget *parent) |
| YWidget * | yParent () const |
| YWidget * | yDialog () |
| virtual void | childDeleted (YWidget *child) |
| virtual bool | isDialog () const |
| virtual bool | isContainer () const |
| virtual bool | isReplacePoint () const |
| virtual bool | isRadioButtonGroup () const |
| virtual bool | isLayoutStretch (YUIDimension dim) const |
| virtual long | nicesize (YUIDimension dim)=0 |
| virtual bool | stretchable (YUIDimension dim) const |
| void | setStretchable (YUIDimension dim, bool newStretch) |
| void | setDefaultStretchable (YUIDimension dim, bool newStretch) |
| virtual long | weight (YUIDimension dim) |
| virtual bool | hasWeight (YUIDimension dim) |
| virtual void | setSize (long newwidth, long newheight) |
| virtual void | setEnabling (bool enabled) |
| bool | getEnabling () const |
| void | setNotify (bool notify) |
| bool | getNotify () const |
| bool | sendKeyEvents () const |
| void | setSendKeyEvents (bool doSend) |
| bool | autoShortcut () const |
| void | setAutoShortcut (bool _newAutoShortcut) |
| virtual YCPValue | changeWidget (const YCPSymbol &property, const YCPValue &newvalue) |
| virtual YCPValue | changeWidgetTerm (const YCPTerm &property, const YCPValue &newvalue) |
| virtual YCPValue | queryWidget (const YCPSymbol &property) |
| virtual YCPValue | queryWidgetTerm (const YCPTerm &property) |
| void * | widgetRep () |
| void | setWidgetRep (void *) |
| virtual bool | setKeyboardFocus () |
| virtual void | saveUserInput (YMacroRecorder *macroRecorder) |
| virtual const char * | shortcutProperty () |
| virtual const char * | userInputProperty () |
| virtual void | startMultipleChanges () |
| virtual void | doneMultipleChanges () |
Protected Attributes | |
| YCPValue | user_widget_id |
| int | internal_widget_id |
| YWidget * | yparent |
| bool | enabled |
| bool | notify |
| bool | _sendKeyEvents |
| bool | _autoShortcut |
| void * | rep |
| bool | _stretch [YUIAllDimensions] |
| long | _weight [YUIAllDimensions] |
| long | windowID |
Static Protected Attributes | |
| static int | next_internal_widget_id |
Private Member Functions | |
| void | invalidate () |
Private Attributes | |
| int | magic |
Classes | |
| class | OptimizeChanges |
The true core of the UI interpreter: Recursively create a widget tree from the contents of "term". Most create???() functions that create container widgets will recurse to this function.
Note: There is also an overloaded version without YWidgetOpt - see below.
| YWidget::YWidget | ( | const YWidgetOpt & | opt | ) |
Constructor
| YWidget::~YWidget | ( | ) | [virtual] |
Destructor
| virtual char* YWidget::widgetClass | ( | ) | [inline, virtual] |
Returns a descriptive name of this widget class for logging, debugging etc.
Reimplemented in YAlignment, YBarGraph, YCheckBox, YColoredLabel, YComboBox, YContainerWidget, YDate, YDialog, YDownloadProgress, YDumbTab, YEmpty, YFrame, YImage, YIntField, YLabel, YLogView, YMenuButton, YMultiLineEdit, YMultiProgressMeter, YMultiSelectionBox, YPackageSelector, YPartitionSplitter, YProgressBar, YPushButton, YRadioButton, YRadioButtonGroup, YReplacePoint, YRichText, YSelectionBox, YSelectionWidget, YSlider, YSpacing, YSplit, YSquash, YTable, YTextEntry, YTime, YTree, and YWizard.
| string YWidget::debugLabel | ( | ) | [virtual] |
Returns a descriptive label of this widget instance.
This default implementation returns this widget's "shortcut property" (possibly trunctated to avoid over-long texts) - the property that contains the keyboard shortcut used to activate this widget or to move the keyboard focus to it. In most cases this is this widget's label.
Note: This is usually translated to the user's target language. This makes this useful for debugging only.
Reimplemented in YContainerWidget, YDialog, and YLabel.
| bool YWidget::isValid | ( | ) | const [inline] |
Checks whether or not this object is valid. This is to enable dangling pointer error checking ( i.e. this object is already deallocated, but a pointer to it is still in use ).
| int YWidget::internalId | ( | ) | const [inline] |
Return the widget serial number (the internal widget ID).
| void YWidget::setId | ( | const YCPValue & | id | ) |
Sets the id of the widget
| bool YWidget::hasId | ( | ) | const |
Checks whether or not the widget has an ID
| YCPValue YWidget::id | ( | ) | const |
Gets the id of the widget
| YWidget * YWidget::yDialog | ( | ) |
Return the YDialog this widget belongs to. Returns 0 if there is no dialog parent.
| virtual void YWidget::childDeleted | ( | YWidget * | child | ) | [inline, virtual] |
Notify a widget that can have children that a child has been deleted. This is called in the YWidget destructor for the parent widget. All container widgets should overwrite this function and update any internal pointers accordingly.
Background: Qt widgets (and objects inherited from them) automatically delete any child widgets if they are deleted themselves. This conflicts with destructors that delete child widgets.
Reimplemented in YContainerWidget.
| bool YWidget::isDialog | ( | ) | const [virtual] |
Returns true if this is a dialog widget. The default implementation returns 'false'.
Reimplemented in YDialog.
| bool YWidget::isContainer | ( | ) | const [virtual] |
Returns true if this is a container widget. The default implementation returns false.
Reimplemented in YContainerWidget.
| bool YWidget::isReplacePoint | ( | ) | const [virtual] |
Returns true if this is a replace point widget. The default implementation returns false.
Reimplemented in YReplacePoint.
| bool YWidget::isRadioButtonGroup | ( | ) | const [virtual] |
Returns true if this is a button group widget. The default implementation return false.
Reimplemented in YRadioButtonGroup.
| bool YWidget::isLayoutStretch | ( | YUIDimension | dim | ) | const [virtual] |
| long YWidget::nicesize | ( | YUIDimension | dim | ) | [pure virtual] |
Minimum size the widget should have to make it look and feel nice. For a push button this would include some space around the text to make it look nice.
| dim | Dimension, either YD_HORIZ or YD_VERT |
Implemented in YAlignment, YContainerWidget, YEmpty, YSpacing, and YSplit.
| bool YWidget::stretchable | ( | YUIDimension | dim | ) | const [virtual] |
This is a boolean value that determines whether the widget is resizable beyond its nice size in the specified dimension. A selection box is stretchable in both dimensions, a push button is not stretchable by default, a frame is stretchable if its contents are stretchable. Most widgets accept a `hstretch or `vstretch option to become stretchable even when they are not by default.
| dim | Dimension, either YD_HORIZ or YD_VERT |
Reimplemented in YAlignment, YContainerWidget, YSplit, and YSquash.
| void YWidget::setStretchable | ( | YUIDimension | dim, | |
| bool | newStretch | |||
| ) |
Set the stretchable state to "newStretch" regardless of any `hstretch or `vstretch options.
| void YWidget::setDefaultStretchable | ( | YUIDimension | dim, | |
| bool | newStretch | |||
| ) |
Set the stretchable state to "newStretch". `hstretch or `vstretch options may override this.
| long YWidget::weight | ( | YUIDimension | dim | ) | [virtual] |
The weight is used in situations where all widgets can get there nice size and yet space is available. The remaining space will be devided between all stretchable widgets according to their weights. A widget with greater weight will get more space. The default weight for all widgets is 0.
| dim | Dimension, either YD_HORIZ or YD_VERT |
| bool YWidget::hasWeight | ( | YUIDimension | dim | ) | [virtual] |
Return whether or not the widget has a weight.
| void YWidget::setSize | ( | long | newwidth, | |
| long | newheight | |||
| ) | [virtual] |
Sets the new size of the widget. If you overload this function make the underlying ui specific widget have exactly that size. You should _not_ change the nicesize, of course. The unit is according to and nicesize(). This function is called from the layout algorithm, which has decides ( using the layout properties ) how large the widget now actually should be.
The default implementation does nothing.
Reimplemented in YAlignment, YContainerWidget, and YSplit.
| void YWidget::setEnabling | ( | bool | enabled | ) | [virtual] |
Sets the enabled state of the widget. All new widgets are enabled per definition. Only enabled widgets can take user input.
| bool YWidget::getEnabling | ( | ) | const |
Queries the enabled of a widget.
| void YWidget::setNotify | ( | bool | notify | ) |
Sets the Notify property
| bool YWidget::getNotify | ( | ) | const |
Returns whether the widget will notify, i.e. will case UserInput to return.
| bool YWidget::sendKeyEvents | ( | ) | const [inline] |
Returns 'true' if this widget should send key events, i.e. if it has `opt(`keyEvent) set.
| void YWidget::setSendKeyEvents | ( | bool | doSend | ) | [inline] |
Specify whether or not this widget should send key events.
| bool YWidget::autoShortcut | ( | ) | const [inline] |
Returns 'true' if a keyboard shortcut should automatically be assigned to this widget - without complaints in the log file.
| void YWidget::setAutoShortcut | ( | bool | _newAutoShortcut | ) | [inline] |
Sets the 'autoShortcut' flag.
Implements the ui command ChangeWidget. Implement this method in your widget subclass and handle their all properties special to that widget. If you encounter an unknown property, call YWidget::changeWidget
Reimplemented in YBarGraph, YCheckBox, YColoredLabel, YComboBox, YDate, YDownloadProgress, YDumbTab, YFrame, YIntField, YLabel, YLogView, YMenuButton, YMultiLineEdit, YMultiProgressMeter, YMultiSelectionBox, YPartitionSplitter, YProgressBar, YPushButton, YRadioButton, YRadioButtonGroup, YRichText, YSelectionBox, YSlider, YTable, YTextEntry, YTime, and YTree.
| YCPValue YWidget::changeWidgetTerm | ( | const YCPTerm & | property, | |
| const YCPValue & | newvalue | |||
| ) | [virtual] |
Implements the ui command ChangeWidget in the incarnation, where the property is given in form of a term rather than a symbol. Implement this method in your widget subclass and handle their all properties special to that widget.
If you encounter an unknown property, call YWidget::changeWidget
Reimplemented in YTable.
Implements the ui command QueryWidget. Implement this method in your widget subclass and handle their all properties special to that widget. If you encounter an unknown property, call YWidget::queryWidget
Reimplemented in YCheckBox, YColoredLabel, YComboBox, YDate, YDialog, YDownloadProgress, YDumbTab, YFrame, YIntField, YLabel, YLogView, YMenuButton, YMultiLineEdit, YMultiProgressMeter, YMultiSelectionBox, YPartitionSplitter, YProgressBar, YPushButton, YRadioButton, YRadioButtonGroup, YRichText, YSelectionBox, YSlider, YTable, YTextEntry, YTime, YTree, and YWizard.
Implements the ui command QueryWidget in the incarnation, where the property is given in form of a term rather than a symbol. Implement this method in your widget subclass and handle their all properties special to that widget. If you encounter an unknown property, call YWidget::queryWidget
Reimplemented in YTable.
| void * YWidget::widgetRep | ( | ) |
Returns a pointer to the ui specific widget implementation.
| void YWidget::setWidgetRep | ( | void * | ) |
Sets the pointer to the ui specific widget implementation.
| bool YWidget::setKeyboardFocus | ( | ) | [virtual] |
Set the keyboard focus to this widget. The default implementation just emits a warning message. Overwrite this function for all widgets that can accept the keyboard focus.
This function returns true if the widget did accept the keyboard focus, and false if not.
| void YWidget::saveUserInput | ( | YMacroRecorder * | macroRecorder | ) | [virtual] |
Save the user input of this widget to a macro recorder, e.g. input field contents, check box state etc.
This default implementation does nothing. Overwrite this method in any derived class that has user input to save, e.g. TextEntry etc. and call YMacroRecorder::recordWidgetProperty() in the overwritten method.
Reimplemented in YCheckBox, YComboBox, YContainerWidget, YIntField, YMultiLineEdit, YMultiSelectionBox, YPartitionSplitter, YRadioButton, YSelectionBox, YSlider, YTable, YTextEntry, and YTree.
| virtual const char* YWidget::shortcutProperty | ( | ) | [inline, virtual] |
The name of the widget property that holds the keyboard shortcut, if any. Overwrite this for widgets that can have keyboard shortcuts.
Reimplemented in YCheckBox, YIntField, YLogView, YMenuButton, YMultiLineEdit, YPartitionSplitter, YPushButton, YRadioButton, YSelectionWidget, YSlider, YTextEntry, and YTree.
| virtual const char* YWidget::userInputProperty | ( | ) | [inline, virtual] |
The name of the widget property that will return user input, if there is any. Widgets that do have user input (such as TextEntry, ComboBox, SelBox) should overwrite this methods. Widgets that are purely passive (such as Label, RichText) should not.
Reimplemented in YCheckBox, YComboBox, YIntField, YMultiLineEdit, YMultiSelectionBox, YPartitionSplitter, YRadioButton, YSelectionBox, YSlider, YTable, YTextEntry, and YTree.
| virtual void YWidget::startMultipleChanges | ( | ) | [inline, virtual] |
In some UIs updating the screen content is an expensive operation. Use startMultipleChanges() to tell the ui that you're going to perform multiple chages to the widget. The UI may delay any screen updates until doneMultipleChanges() is called.
| virtual void YWidget::doneMultipleChanges | ( | ) | [inline, virtual] |
In some UIs updating the screen content is an expensive operation. Use startMultipleChanges() to tell the ui that you're going to perform multiple chages to the widget. The UI may delay any screen updates until doneMultipleChanges() is called.
| void YWidget::invalidate | ( | ) | [inline, private] |
Make this widget invalid. This operation cannot be reversed.
int YWidget::magic [private] |
This object is only valid if this magic number is YWIDGET_MAGIC. Use YWidget::isValid() to check this.
YCPValue YWidget::user_widget_id [protected] |
The user provided widget id of this widget - strictly for user purposes. May or may not be set. May or may not be unique.
int YWidget::internal_widget_id [protected] |
The internal unique widget id of this widget. Used to compare widget identity.
int YWidget::next_internal_widget_id [static, protected] |
The next internal widget id to be used for the next object of this class. Initialized in YWidget.cc.
YWidget* YWidget::yparent [protected] |
The parent YWidget.
bool YWidget::enabled [protected] |
Flag: Can this widget currently receive user input?
bool YWidget::notify [protected] |
Flag: Make UserInput() return on detailed events?
bool YWidget::_sendKeyEvents [protected] |
Flag: Make UserInput() return on single key events?
bool YWidget::_autoShortcut [protected] |
Flag: Automatically assign a keyboard shortcut without complaints in the log file?
void* YWidget::rep [protected] |
Pointer to the UI specific widget representation that belongs to this widget. For Qt, this will be a pointer to a QWidget (subclass).
bool YWidget::_stretch[YUIAllDimensions] [protected] |
Stretchability in both dimensions.
long YWidget::_weight[YUIAllDimensions] [protected] |
Weight in both dimensions.
long YWidget::windowID [protected] |
window ID of the current widget
1.5.0