Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Examples

YWidget Class Reference

Abstract base class of all ui widgets. More...

#include <YWidget.h>

Inheritance diagram for YWidget:

YBarGraph YCheckBox YColoredLabel YComboBox YContainerWidget YDownloadProgress YEmpty YImage YIntField YLabel YLogView YMenuButton YMultiLineEdit YMultiSelectionBox YPackageSelector YPartitionSplitter YProgressBar YPushButton YRadioButton YRichText YSelectionBox YSlider YSpacing YTable YTextEntry YTree List of all members.

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)
YWidgetyParent () const
YWidgetyDialog ()
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 void startMultipleChanges ()
virtual void doneMultipleChanges ()

Protected Attributes

YCPValue user_widget_id
int internal_widget_id
YWidgetyparent
bool enabled
bool notify
bool _sendKeyEvents
bool _autoShortcut
void * rep
bool _stretch [YUIAllDimensions]
long _weight [YUIAllDimensions]
long windowID

Static Protected Attributes

int next_internal_widget_id = 0

Private Member Functions

void invalidate ()

Private Attributes

int magic

Detailed Description

Abstract base class of all ui widgets.

AAA_All-Widgets --- none

notify Make UserInput() return on any action in this widget. Normally UserInput() returns only when a button is clicked; with this option on you can make it return for other events, too, e.g. when the user selects an item in a SelectionBox ( if `opt( `notify ) is set for that SelectionBox ). Only widgets with this option set are affected.

disabled Set this widget insensitive, i.e. disable any user interaction. The widget will show this state by being greyed out ( depending on the specific UI ).

hstretch Make this widget stretchable in the horizontal dimension.
See the Layout HOWTO for details.

vstretch Make this widget stretchable in the vertical dimension.
See the Layout HOWTO for details.

hvstretch Make this widget stretchable in both dimensions.
See the Layout HOWTO for details.

autoShortcut Automatically choose a keyboard shortcut for this widget and don't complain in the log file about the missing shortcut.
Don't use this regularly for all widgets - manually chosen keyboard shortcuts are almost always better than those automatically assigned. Refer to the style guide for details.
This option is intended used for automatically generated data, e.g., RadioButtons for software selections that come from file or from some other data base.

key_F1 (NCurses only) activate this widget with the F1 key key_F2 (NCurses only) activate this widget with the F2 key key_Fxx (NCurses only) activate this widget with the Fxx key key_F24 (NCurses only) activate this widget with the F24 key key_none (NCurses only) no function key for this widget

keyEvents (NCurses only) Make UserInput() / WaitForEvent() return on keypresses within this widget. Exactly which keys trigger such a key event is UI specific. This is not for general use.

This is not a widget for general usage, this is just a placeholder for descriptions of options that all widgets have in common.

Use them for any widget whenever it makes sense.

AutoShortcut1.ycp AutoShortcut2.ycp


Constructor & Destructor Documentation

YWidget::YWidget const YWidgetOpt opt  ) 
 

Constructor

YWidget::~YWidget  )  [virtual]
 

Destructor


Member Function Documentation

bool YWidget::autoShortcut  )  const [inline]
 

Returns 'true' if a keyboard shortcut should automatically be assigned to this widget - without complaints in the log file.

YCPValue YWidget::changeWidget const YCPSymbol property,
const YCPValue newvalue
[virtual]
 

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, YDownloadProgress, YDumbTab, YFrame, YIntField, YLabel, YLogView, YMenuButton, YMultiLineEdit, YMultiSelectionBox, YPartitionSplitter, YProgressBar, YPushButton, YRadioButton, YRadioButtonGroup, YRichText, YSelectionBox, YSlider, YTable, YTextEntry, 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.

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.

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.

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.

bool YWidget::getEnabling  )  const
 

Queries the enabled of a widget.

bool YWidget::getNotify  )  const
 

Returns whether the widget will notify, i.e. will case UserInput to return.

bool YWidget::hasId  )  const
 

Checks whether or not the widget has an ID

bool YWidget::hasWeight YUIDimension  dim  )  [virtual]
 

Return whether or not the widget has a weight.

YCPValue YWidget::id  )  const
 

Gets the id of the widget

int YWidget::internalId  )  const [inline]
 

Return the widget serial number (the internal widget ID).

void YWidget::invalidate  )  [inline, private]
 

Make this widget invalid. This operation cannot be reversed.

bool YWidget::isContainer  )  const [virtual]
 

Returns true if this is a container widget. The default implementation returns false.

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::isLayoutStretch YUIDimension  dim  )  const [virtual]
 

Returns true if this is a layout stretch space in dimension "dim". Such widgets will receive special treatment in layout calculations. The default implementation returns false.

Reimplemented in YEmpty, and YSpacing.

bool YWidget::isRadioButtonGroup  )  const [virtual]
 

Returns true if this is a button group widget. The default implementation return false.

Reimplemented in YRadioButtonGroup.

bool YWidget::isReplacePoint  )  const [virtual]
 

Returns true if this is a replace point widget. The default implementation returns false.

Reimplemented in YReplacePoint.

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 ).

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.

Parameters:
dim Dimension, either YD_HORIZ or YD_VERT

Implemented in YContainerWidget, YEmpty, YSpacing, and YSplit.

YCPValue YWidget::queryWidget const YCPSymbol property  )  [virtual]
 

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, YDownloadProgress, YDumbTab, YFrame, YIntField, YLabel, YLogView, YMenuButton, YMultiLineEdit, YMultiSelectionBox, YPartitionSplitter, YProgressBar, YPushButton, YRadioButton, YRadioButtonGroup, YRichText, YSelectionBox, YSlider, YTable, YTextEntry, YTree, and YWizard.

YCPValue YWidget::queryWidgetTerm const YCPTerm property  )  [virtual]
 

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::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.

bool YWidget::sendKeyEvents  )  const [inline]
 

Returns 'true' if this widget should send key events, i.e. if it has `opt(`keyEvent) set.

void YWidget::setAutoShortcut bool  _newAutoShortcut  )  [inline]
 

Sets the 'autoShortcut' flag.

void YWidget::setDefaultStretchable YUIDimension  dim,
bool  newStretch
 

Set the stretchable state to "newStretch". `hstretch or `vstretch options may override this.

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.

void YWidget::setId const YCPValue id  ) 
 

Sets the id of the widget

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::setNotify bool  notify  ) 
 

Sets the Notify property

void YWidget::setParent YWidget parent  ) 
 

Set the parent YWidget of this widget.

void YWidget::setSendKeyEvents bool  doSend  )  [inline]
 

Specify whether or not this widget should send key events.

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::setStretchable YUIDimension  dim,
bool  newStretch
 

Set the stretchable state to "newStretch" regardless of any `hstretch or `vstretch options.

void YWidget::setWidgetRep void *   ) 
 

Sets the pointer to the ui specific widget implementation.

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, YComboBox, YIntField, YLogView, YMenuButton, YMultiLineEdit, YMultiSelectionBox, YPartitionSplitter, YPushButton, YRadioButton, YSelectionBox, YSlider, 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.

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.

Parameters:
dim Dimension, either YD_HORIZ or YD_VERT

Reimplemented in YAlignment, YContainerWidget, YSplit, and YSquash.

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.

Parameters:
dim Dimension, either YD_HORIZ or YD_VERT

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, YDialog, YDownloadProgress, YDumbTab, YEmpty, YFrame, YImage, YIntField, YLabel, YLogView, YMenuButton, YMultiLineEdit, YMultiSelectionBox, YPackageSelector, YPartitionSplitter, YProgressBar, YPushButton, YRadioButton, YRadioButtonGroup, YReplacePoint, YRichText, YSelectionBox, YSlider, YSpacing, YSplit, YSquash, YTable, YTextEntry, YTree, and YWizard.

void * YWidget::widgetRep  ) 
 

Returns a pointer to the ui specific widget implementation.

YWidget * YWidget::yDialog  ) 
 

Return the YDialog this widget belongs to. Returns 0 if there is no dialog parent.

YWidget * YWidget::yParent  )  const
 

Return the parent YWidget of this widget.


Member Data Documentation

bool YWidget::_autoShortcut [protected]
 

Flag: Automatically assign a keyboard shortcut without complaints in the log file?

bool YWidget::_sendKeyEvents [protected]
 

Flag: Make UserInput() return on single key events?

bool YWidget::_stretch[ YUIAllDimensions ] [protected]
 

Stretchability in both dimensions.

long YWidget::_weight[ YUIAllDimensions ] [protected]
 

Weight in both dimensions.

bool YWidget::enabled [protected]
 

Flag: Can this widget currently receive user input?

int YWidget::internal_widget_id [protected]
 

The internal unique widget id of this widget. Used to compare widget identity.

int YWidget::magic [private]
 

This object is only valid if this magic number is YWIDGET_MAGIC. Use YWidget::isValid() to check this.

int YWidget::next_internal_widget_id = 0 [static, protected]
 

The next internal widget id to be used for the next object of this class. Initialized in YWidget.cc.

bool YWidget::notify [protected]
 

Flag: Make UserInput() return on detailed events?

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).

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.

long YWidget::windowID [protected]
 

window ID of the current widget

YWidget* YWidget::yparent [protected]
 

The parent YWidget.


The documentation for this class was generated from the following files:
Generated on Fri Nov 9 18:15:25 2007 for yast2-core by doxygen 1.3.6