Author: sh-sh-sh Date: Wed Sep 10 16:43:48 2008 New Revision: 50972 URL: http://svn.opensuse.org/viewcvs/yast?rev=50972&view=rev Log: differentiate in widgetClass() Modified: trunk/libyui/src/YAlignment.cc trunk/libyui/src/YAlignment.h trunk/libyui/src/YInputField.cc trunk/libyui/src/YInputField.h trunk/libyui/src/YLabel.cc trunk/libyui/src/YLabel.h trunk/libyui/src/YLayoutBox.cc trunk/libyui/src/YLayoutBox.h trunk/libyui/src/YSpacing.cc trunk/libyui/src/YSpacing.h trunk/libyui/src/YSquash.cc trunk/libyui/src/YSquash.h Modified: trunk/libyui/src/YAlignment.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YAlignment.cc?rev=50972&r1=50971&r2=50972&view=diff ============================================================================== --- trunk/libyui/src/YAlignment.cc (original) +++ trunk/libyui/src/YAlignment.cc Wed Sep 10 16:43:48 2008 @@ -170,7 +170,7 @@ void YAlignment::addChild( YWidget * child ) { YSingleChildContainerWidget::addChild( child ); - + if ( minWidth() > 0 ) child->setStretchable( YD_HORIZ, true ); if ( minHeight() > 0 ) child->setStretchable( YD_VERT , true ); } @@ -192,7 +192,7 @@ int preferredWidth = firstChild()->preferredWidth(); preferredWidth += leftMargin() + rightMargin(); - + return max( minWidth(), preferredWidth ); } @@ -204,7 +204,7 @@ int preferredHeight = firstChild()->preferredHeight(); preferredHeight += topMargin() + bottomMargin(); - + return max( minHeight(), preferredHeight ); } @@ -321,7 +321,7 @@ void YAlignment::setBackgroundPixmap( const string & pixmapFileName ) { string pixmap = pixmapFileName; - + if ( pixmap.length() > 0 && pixmap[0] != '/' && // Absolute path? pixmap[0] != '.' ) // Path relative to $CWD ? @@ -332,3 +332,46 @@ priv->backgroundPixmap = pixmap; } + + +const char * +YAlignment::widgetClass() const +{ + string wClass = "YAlignment"; + string subClass; + + if ( priv->alignment.hor == YAlignBegin ) subClass = "Left"; + else if ( priv->alignment.hor == YAlignEnd ) subClass = "Right"; + else if ( priv->alignment.hor == YAlignCenter ) + { + if ( priv->alignment.vert == YAlignCenter ) subClass = "HVCenter"; + else subClass = "HCenter"; + } + else if ( priv->alignment.vert == YAlignBegin ) subClass = "Top"; + else if ( priv->alignment.vert == YAlignEnd ) subClass = "Bottom"; + else if ( priv->alignment.vert == YAlignCenter ) subClass = "VCenter"; + + if ( priv->alignment.hor == YAlignUnchanged && + priv->alignment.vert == YAlignUnchanged ) + { + if ( priv->leftMargin > 0 || + priv->rightMargin > 0 || + priv->topMargin > 0 || + priv->bottomMargin > 0 ) + { + wClass = "YMarginBox"; + } + + if ( priv->minWidth > 0 || priv->minHeight > 0 ) + { + if ( priv->minWidth == 0 ) wClass = "YMinHeight"; + else if ( priv->minHeight == 0 ) wClass = "YMinWidth"; + else wClass = "YMinSize"; + } + } + + if ( ! subClass.empty() ) + wClass += "_" + subClass; + + return wClass.c_str(); +} Modified: trunk/libyui/src/YAlignment.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YAlignment.h?rev=50972&r1=50971&r2=50972&view=diff ============================================================================== --- trunk/libyui/src/YAlignment.h (original) +++ trunk/libyui/src/YAlignment.h Wed Sep 10 16:43:48 2008 @@ -53,7 +53,7 @@ * Return a descriptive name of this widget class for logging, * debugging etc. **/ - virtual const char * widgetClass() const { return "YAlignment"; } + virtual const char * widgetClass() const; /** * Return the alignment in the specified dimension. Modified: trunk/libyui/src/YInputField.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YInputField.cc?rev=50972&r1=50971&r2=50972&view=diff ============================================================================== --- trunk/libyui/src/YInputField.cc (original) +++ trunk/libyui/src/YInputField.cc Wed Sep 10 16:43:48 2008 @@ -184,3 +184,10 @@ } } + +const char * +YInputField::widgetClass() const +{ + if ( priv->passwordMode ) return "YPasswordField"; + else return "YInputField"; +} Modified: trunk/libyui/src/YInputField.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YInputField.h?rev=50972&r1=50971&r2=50972&view=diff ============================================================================== --- trunk/libyui/src/YInputField.h (original) +++ trunk/libyui/src/YInputField.h Wed Sep 10 16:43:48 2008 @@ -61,7 +61,7 @@ * Return a descriptive name of this widget class for logging, * debugging etc. **/ - virtual const char * widgetClass() const { return "YInputField"; } + virtual const char * widgetClass() const; /** * Get the current value (the text entered by the user or set from the Modified: trunk/libyui/src/YLabel.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YLabel.cc?rev=50972&r1=50971&r2=50972&view=diff ============================================================================== --- trunk/libyui/src/YLabel.cc (original) +++ trunk/libyui/src/YLabel.cc Wed Sep 10 16:43:48 2008 @@ -173,3 +173,13 @@ return label; } + + + +const char * +YLabel::widgetClass() const +{ + if ( priv->isHeading ) return "YLabel_Heading"; + else if ( priv->isOutputField ) return "YLabel_OutputField"; + else return "YLabel"; +} Modified: trunk/libyui/src/YLabel.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YLabel.h?rev=50972&r1=50971&r2=50972&view=diff ============================================================================== --- trunk/libyui/src/YLabel.h (original) +++ trunk/libyui/src/YLabel.h Wed Sep 10 16:43:48 2008 @@ -61,7 +61,7 @@ * * Reimplemented from YWidget. **/ - virtual const char * widgetClass() const { return "YLabel"; } + virtual const char * widgetClass() const; /** * Return the text the widget displays. Modified: trunk/libyui/src/YLayoutBox.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YLayoutBox.cc?rev=50972&r1=50971&r2=50972&view=diff ============================================================================== --- trunk/libyui/src/YLayoutBox.cc (original) +++ trunk/libyui/src/YLayoutBox.cc Wed Sep 10 16:43:48 2008 @@ -749,3 +749,8 @@ } +const char * +YLayoutBox::widgetClass() const +{ + return primary() == YD_VERT ? "YVBox" : "YHBox"; +} Modified: trunk/libyui/src/YLayoutBox.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YLayoutBox.h?rev=50972&r1=50971&r2=50972&view=diff ============================================================================== --- trunk/libyui/src/YLayoutBox.h (original) +++ trunk/libyui/src/YLayoutBox.h Wed Sep 10 16:43:48 2008 @@ -51,8 +51,7 @@ * Returns a descriptive name of this widget class for logging, * debugging etc. **/ - virtual const char * widgetClass() const - { return primary() == YD_VERT ? "YVBox" : "YHBox"; } + virtual const char * widgetClass() const; /** * Return the primary dimension, i.e., the dimension this LayoutBox lays @@ -76,21 +75,6 @@ void setDebugLayout( bool deb = true ); /** - * Minimum size the widget should have to make it look and feel - * nice, i.e. all of the widget's preferred size. - * - * For the "primary" dimension, this is the sum of the children's - * preferred sizes with respect to any specified weight ratios - - * i.e. the weights will always be respected. Children may be - * stretched as appropriate. - * - * For the "other" dimension, this is the maximum of the children's - * preferred sizes in that dimension. - * - * @param dim Dimension, either YD_HORIZ or YD_VERT - **/ - - /** * Preferred size of the widget in the specified dimension. * * Reimplemented from YWidget. Modified: trunk/libyui/src/YSpacing.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YSpacing.cc?rev=50972&r1=50971&r2=50972&view=diff ============================================================================== --- trunk/libyui/src/YSpacing.cc (original) +++ trunk/libyui/src/YSpacing.cc Wed Sep 10 16:43:48 2008 @@ -90,3 +90,14 @@ } +const char * +YSpacing::widgetClass() const +{ + if ( priv->size > 0 ) + return ( priv->dim == YD_HORIZ ) ? "YHSpacing" : "YVSpacing"; + + if ( stretchable( YD_HORIZ ) ) return "YHStretch"; + if ( stretchable( YD_VERT ) ) return "YVStretch"; + + return "YSpacing"; +} Modified: trunk/libyui/src/YSpacing.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YSpacing.h?rev=50972&r1=50971&r2=50972&view=diff ============================================================================== --- trunk/libyui/src/YSpacing.h (original) +++ trunk/libyui/src/YSpacing.h Wed Sep 10 16:43:48 2008 @@ -58,7 +58,7 @@ * Return a descriptive name of this widget class for logging, * debugging etc. **/ - virtual const char * widgetClass() const { return "YSpacing"; } + virtual const char * widgetClass() const; /** * Return the primary dimension of this Spacing/Stretch, Modified: trunk/libyui/src/YSquash.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YSquash.cc?rev=50972&r1=50971&r2=50972&view=diff ============================================================================== --- trunk/libyui/src/YSquash.cc (original) +++ trunk/libyui/src/YSquash.cc Wed Sep 10 16:43:48 2008 @@ -69,3 +69,12 @@ return ! priv->squash[ dim ] && firstChild()->stretchable( dim ); } + +const char * +YSquash::widgetClass() const +{ + if ( priv->squash.hor && priv->squash.vert ) return "YHVSquash"; + else if ( priv->squash.hor ) return "YHSquash"; + else if ( priv->squash.vert ) return "YVSquash"; + else return "YSquash_NoSquash"; +} Modified: trunk/libyui/src/YSquash.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YSquash.h?rev=50972&r1=50971&r2=50972&view=diff ============================================================================== --- trunk/libyui/src/YSquash.h (original) +++ trunk/libyui/src/YSquash.h Wed Sep 10 16:43:48 2008 @@ -53,7 +53,7 @@ * Returns a descriptive name of this widget class for logging, * debugging etc. **/ - virtual const char * widgetClass() const { return "YSquash"; } + virtual const char * widgetClass() const; /** * Returns 'true' if this widget squashes horizontally. -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org