libyui  3.3.1
YAlignment Class Referenceabstract

Implementation of all the alignment widgets: More...

#include <YAlignment.h>

Inheritance diagram for YAlignment:
Collaboration diagram for YAlignment:

Public Member Functions

virtual ~YAlignment ()
 Destructor.
 
virtual const char * widgetClass () const
 Return a descriptive name of this widget class for logging, debugging etc.
 
YAlignmentType alignment (YUIDimension dim) const
 Return the alignment in the specified dimension.
 
int leftMargin () const
 Return the left margin in pixels, the distance between the left edge of this alignment and the left edge of the child widget.
 
int rightMargin () const
 Return the right margin in pixels, the distance between the right edge of this alignment and the right edge of the child widget.
 
int topMargin () const
 Return the top margin in pixels, the distance between the top edge of this alignment and the top edge of the child widget.
 
int bottomMargin () const
 Return the bottom margin in pixels, the distance between the bottom edge of this alignment and the bottom edge of the child widget.
 
int totalMargins (YUIDimension dim) const
 Return the sum of all margins in the specified dimension.
 
void setLeftMargin (int margin)
 Set the left margin in pixels.
 
void setRightMargin (int margin)
 Set the right margin in pixels.
 
void setTopMargin (int margin)
 Set the top margin in pixels.
 
void setBottomMargin (int margin)
 Set the bottom margin in pixels.
 
int minWidth () const
 Return the minimum width of this alignment or 0 if none is set. More...
 
int minHeight () const
 Return the minimum height of this alignment or 0 if none is set. More...
 
void setMinWidth (int width)
 Set the minimum width to return for preferredWidth().
 
void setMinHeight (int height)
 Set the minimum height to return for preferredHeight().
 
virtual void setBackgroundPixmap (const std::string &pixmapFileName)
 Set a background pixmap. More...
 
std::string backgroundPixmap () const
 Return the name of the background pixmap or an empty string, if there is none.
 
virtual void addChild (YWidget *child)
 Add a child widget. More...
 
virtual void moveChild (YWidget *child, int newx, int newy)=0
 Move a child widget to a new position.
 
virtual bool stretchable (YUIDimension dim) const
 Return this widget's stretchability. More...
 
virtual int preferredWidth ()
 Preferred width of the widget. More...
 
virtual int preferredHeight ()
 Preferred height of the widget. More...
 
virtual void setSize (int newWidth, int newHeight)
 Set the current size and move the child widget according to its alignment. More...
 
- Public Member Functions inherited from YSingleChildContainerWidget
virtual ~YSingleChildContainerWidget ()
 Destructor.
 
- Public Member Functions inherited from YWidget
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...
 
virtual const YPropertySetpropertySet ()
 Return this class's property set. 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...
 
bool hasChildren () const
 Returns 'true' if this widget has any children.
 
YWidgetfirstChild () const
 Returns the first child or 0 if there is none. More...
 
YWidgetlastChild () 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 removeChild (YWidget *child)
 Remove a child. More...
 
void deleteChildren ()
 Delete all children and remove them from the children manager's list.
 
YWidgetparent () 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.
 
YDialogfindDialog ()
 Traverse up the widget hierarchy and find the dialog this widget belongs to. More...
 
YWidgetfindWidget (YWidgetID *id, bool doThrow=true) const
 Recursively find a widget by its ID. More...
 
virtual int preferredSize (YUIDimension dim)
 Preferred size of the widget in the specified dimension. 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.
 
YWidgetIDid () 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.
 
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 Member Functions

 YAlignment (YWidget *parent, YAlignmentType horAlign, YAlignmentType vertAlign)
 Constructor.
 
- Protected Member Functions inherited from YSingleChildContainerWidget
 YSingleChildContainerWidget (YWidget *parent)
 Constructor.
 
- Protected Member Functions inherited from YWidget
 YWidget (YWidget *parent)
 Constructor.
 
YWidgetChildrenManagerchildrenManager () 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.
 

Protected Attributes

ImplPtr< YAlignmentPrivatepriv
 

Detailed Description

Implementation of all the alignment widgets:

  • Left, Right, HCenter,
  • Top, Bottom, VCenter,
  • HVCenter
  • MinSize, MinWidth, MinHeight

Definition at line 41 of file YAlignment.h.

Member Function Documentation

◆ addChild()

void YAlignment::addChild ( YWidget child)
virtual

Add a child widget.

Reimplemented from YSingleChildContainerWidget to propagate stretchability down to the single child.

Reimplemented from YWidget.

Definition at line 177 of file YAlignment.cc.

Here is the call graph for this function:

◆ minHeight()

int YAlignment::minHeight ( ) const

Return the minimum height of this alignment or 0 if none is set.

preferredHeight() will never return less than this value.

Definition at line 153 of file YAlignment.cc.

◆ minWidth()

int YAlignment::minWidth ( ) const

Return the minimum width of this alignment or 0 if none is set.

preferredWidth() will never return less than this value.

Definition at line 147 of file YAlignment.cc.

◆ preferredHeight()

int YAlignment::preferredHeight ( )
virtual

Preferred height of the widget.

Reimplemented from YWidget.

Reimplemented from YSingleChildContainerWidget.

Definition at line 207 of file YAlignment.cc.

Here is the call graph for this function:

◆ preferredWidth()

int YAlignment::preferredWidth ( )
virtual

Preferred width of the widget.

Reimplemented from YWidget.

Reimplemented from YSingleChildContainerWidget.

Definition at line 195 of file YAlignment.cc.

Here is the call graph for this function:

◆ setBackgroundPixmap()

void YAlignment::setBackgroundPixmap ( const std::string &  pixmapFileName)
virtual

Set a background pixmap.

Derived classes may want to overwrite this.

This parent method should be called first in the overwritten method to ensure path expansion is done as specified (prepend the theme path ("/usr/share/libyui/theme/") if the path doesn't start with "/" or ".").

Definition at line 334 of file YAlignment.cc.

Here is the call graph for this function:

◆ setSize()

void YAlignment::setSize ( int  newWidth,
int  newHeight 
)
virtual

Set the current size and move the child widget according to its alignment.

Derived classes should reimplement this, but call this base class function in their own implementation.

Reimplemented from YSingleChildContainerWidget.

Definition at line 219 of file YAlignment.cc.

Here is the call graph for this function:

◆ stretchable()

bool YAlignment::stretchable ( YUIDimension  dim) const
virtual

Return this widget's stretchability.

Reimplemented from YWidget.

In an aligned dimension the widget is always stretchable. In an unchanged dimension the widget is stretchable if the child is stretchable.

Reimplemented from YSingleChildContainerWidget.

Definition at line 186 of file YAlignment.cc.

Here is the call graph for this function:

The documentation for this class was generated from the following files: