Author: sh-sh-sh
Date: Mon Jun 18 14:52:03 2007
New Revision: 38504
URL: http://svn.opensuse.org/viewcvs/yast?rev=38504&view=rev
Log:
migrated ReplacePoint
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
branches/tmp/sh/mod-ui/core/libyui/src/YReplacePoint.cc
branches/tmp/sh/mod-ui/core/libyui/src/YReplacePoint.h
branches/tmp/sh/mod-ui/core/libyui/src/YUI.h
branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
branches/tmp/sh/mod-ui/core/libyui/src/YUI_widgets.cc
branches/tmp/sh/mod-ui/core/libyui/src/YWidget.cc
branches/tmp/sh/mod-ui/core/libyui/src/YWidget.h
Modified: branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog?rev=38504&r1=38503&r2=38504&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog Mon Jun 18 14:52:03 2007
@@ -91,3 +91,11 @@
* label is now std::string , no longer YCPString
+* YReplacePoint:
+
+ * now derived from YSingleChildContainerWidget
+ * removed YWidget::isReplacePoint() / YReplacePoint::isReplacePoint()
+ * no more YContainerWidget::childAdded(),
+ reimplement YWidget::addChild() instead
+ (but remember to call YWidget::addChild() in that reimplemented function)
+
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YReplacePoint.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YReplacePoint.cc?rev=38504&r1=38503&r2=38504&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YReplacePoint.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YReplacePoint.cc Mon Jun 18 14:52:03 2007
@@ -19,14 +19,9 @@
#include "YReplacePoint.h"
-YReplacePoint::YReplacePoint( const YWidgetOpt & opt )
- : YContainerWidget( opt )
+YReplacePoint::YReplacePoint( YWidget * parent )
+ : YSingleChildContainerWidget( parent )
{
// NOP
}
-bool YReplacePoint::isReplacePoint() const
-{
- return true;
-}
-
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YReplacePoint.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YReplacePoint.h?rev=38504&r1=38503&r2=38504&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YReplacePoint.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YReplacePoint.h Mon Jun 18 14:52:03 2007
@@ -19,29 +19,21 @@
#ifndef YReplacePoint_h
#define YReplacePoint_h
-#include "YContainerWidget.h"
+#include "YSingleChildContainerWidget.h"
-/**
- * @short Implementation of the ReplacePoint widget.
- */
-class YReplacePoint : public YContainerWidget
+class YReplacePoint : public YSingleChildContainerWidget
{
public:
/**
* Constructor
- */
- YReplacePoint( const YWidgetOpt & opt );
+ **/
+ YReplacePoint( YWidget * parent );
/**
* Returns a descriptive name of this widget class for logging,
* debugging etc.
- */
+ **/
virtual const char * widgetClass() { return "YReplacePoint"; }
-
- /**
- * Inherited from YWidget. Returns true.
- */
- bool isReplacePoint() const;
};
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YUI.h?rev=38504&r1=38503&r2=38504&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI.h Mon Jun 18 14:52:03 2007
@@ -499,11 +499,6 @@
virtual YDialog *createDialog( YWidgetOpt & opt ) = 0;
/**
- * Creates a replace point.
- */
- virtual YContainerWidget *createReplacePoint( YWidget *parent, YWidgetOpt & opt ) = 0;
-
- /**
* Creates a squash widget
*/
virtual YContainerWidget *createSquash( YWidget *parent, YWidgetOpt & opt, bool hsquash, bool vsquash ) = 0;
@@ -1084,13 +1079,8 @@
/**
- * Helper function of createWidgetTree. Creates a replace point
- * @param parent the widget or dialog this widget is contained in
- * @param term The term specifying the widget, e.g. `ReplacePoint( `PushButton( "OK" ) )
- * @param optList The list of widget options( as specified with `opt( ... ) )
- * @param argnr the index of the first non-id and non-opt argument( 0, 1 or 2 )
- * @param rbg Pointer to the current radio button group
- */
+ * Helper function of createWidgetTree. Creates a replace point.
+ **/
YWidget *createReplacePoint( YWidget *parent, YWidgetOpt & opt,
const YCPTerm & term, const YCPList & optList, int argnr );
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc?rev=38504&r1=38503&r2=38504&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc Mon Jun 18 14:52:03 2007
@@ -1031,19 +1031,18 @@
}
YCPValue id = getId( id_value );
- YWidget *replacePoint = widgetWithId( id, true ); // reports error
- if ( ! replacePoint ) return YCPBoolean( false );
+ YWidget * widget = widgetWithId( id, true ); // reports error
+ if ( ! widget ) return YCPBoolean( false );
+
+ YReplacePoint * replacePoint = dynamic_cast (widget);
- if ( ! replacePoint->isReplacePoint() )
+ if ( ! replacePoint )
{
y2error( "ReplaceWidget: widget %s is not a ReplacePoint",
id->toString().c_str() );
return YCPBoolean( false );
}
- // YReplacePoint *rp = dynamic_cast ( replacePoint );
- // assert( rp );
-
#if VERBOSE_REPLACE_WIDGET
replacePoint->dumpDialogWidgetTree();
#endif
@@ -1051,14 +1050,14 @@
YWidget::OptimizeChanges below( *currentDialog() ); // delay screen updates until this block is left
replacePoint->deleteChildren();
- YWidget *widget = createWidgetTree( replacePoint, newContentTerm );
- widget->setParent( replacePoint );
+ YWidget * child = createWidgetTree( replacePoint, newContentTerm );
+ child->setParent( replacePoint );
#if VERBOSE_REPLACE_WIDGET
replacePoint->dumpDialogWidgetTree();
#endif
- if ( widget )
+ if ( child )
{
blockEvents(); // We don't want self-generated events from UI builtins.
currentDialog()->setInitialSize();
@@ -1788,19 +1787,10 @@
if ( ! widget )
return YCPVoid();
- YContainerWidget * container = dynamic_cast( widget );
-
- if ( ! container )
- container = dynamic_cast( widget->parent() );
-
- if ( container )
- {
- YCPList userInputList;
- container->collectUserInput( userInputList );
- return userInputList;
- }
- else // should never happen
- return YCPVoid();
+ YCPList userInputList;
+ widget->collectUserInput( userInputList );
+
+ return userInputList;
}
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI_widgets.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YUI_widgets.cc?rev=38504&r1=38503&r2=38504&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI_widgets.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI_widgets.cc Mon Jun 18 14:52:03 2007
@@ -43,6 +43,7 @@
#include "YPushButton.h"
#include "YRadioButton.h"
#include "YRadioButtonGroup.h"
+#include "YReplacePoint.h"
#include "YSelectionBox.h"
#include "YTable.h"
#include "YTextEntry.h"
@@ -298,7 +299,7 @@
// FIXME: Obsolete
y2warning( "Late adding child %s to %s", w->widgetClass(), p->widgetClass() );
p->addChild( w );
-
+
// FIXME: Obsolete
// FIXME: Obsolete
// FIXME: Obsolete
@@ -361,18 +362,16 @@
}
rejectAllOptions( term,optList );
- YContainerWidget * replacePoint = createReplacePoint( parent, opt );
- if ( replacePoint )
+ YReplacePoint * replacePoint = YUI::widgetFactory()->createReplacePoint( parent );
+ YWidget * child = createWidgetTree( replacePoint, term->value( argnr )->asTerm() );
+
+ if ( ! child )
{
- replacePoint->setParent( parent );
- YWidget * child = createWidgetTree( replacePoint, term->value( argnr )->asTerm() );
- if ( ! child )
- {
- delete replacePoint;
- return 0;
- }
+ delete replacePoint;
+ return 0;
}
+
return replacePoint;
}
@@ -541,7 +540,7 @@
*/
YWidget * YUI::createAlignment( YWidget * parent, YWidgetOpt & opt, const YCPTerm & term,
- const YCPList & optList, int argnr,
+ const YCPList & optList, int argnr,
YAlignmentType horAlign, YAlignmentType vertAlign )
{
int argc = term->size() - argnr;
@@ -591,7 +590,7 @@
delete alignment;
return 0;
}
-
+
return alignment;
}
@@ -615,7 +614,7 @@
*/
YWidget * YUI::createMinSize( YWidget * parent, YWidgetOpt & opt, const YCPTerm & term,
- const YCPList & optList, int argnr,
+ const YCPList & optList, int argnr,
bool hor, bool vert )
{
int argc = term->size() - argnr;
@@ -765,7 +764,7 @@
rejectAllOptions( term, optList );
-
+
YAlignment * marginBox = YUI::widgetFactory()->createMarginBox( parent, leftMargin, rightMargin, topMargin, bottomMargin );
YWidget *child = createWidgetTree( marginBox, childTerm );
@@ -978,7 +977,7 @@
*/
YWidget * YUI::createLayoutBox( YWidget * parent, YWidgetOpt & opt, const YCPTerm & term,
- const YCPList & optList, int argnr,
+ const YCPList & optList, int argnr,
YUIDimension dim )
{
// Parse options
@@ -1016,7 +1015,7 @@
return 0;
}
}
-
+
return layoutBox;
}
@@ -1584,14 +1583,14 @@
}
rejectAllOptions( term,optList );
-
+
string label = term->value( argnr )->asString()->value();
bool isChecked = false;
if ( s == 2 )
isChecked = term->value( argnr+1 )->asBoolean()->value();
YRadioButton * radioButton = widgetFactory()->createRadioButton( parent, label, isChecked );
-
+
if ( opt.boldFont.value() )
radioButton->setUseBoldFont();
@@ -1640,7 +1639,7 @@
radioButtonGroup->setParent( parent );
YWidget *child = createWidgetTree( radioButtonGroup, term->value( argnr )->asTerm() );
- if ( ! child )
+ if ( ! child )
{
delete radioButtonGroup;
return 0;
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YWidget.cc?rev=38504&r1=38503&r2=38504&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YWidget.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YWidget.cc Mon Jun 18 14:52:03 2007
@@ -463,12 +463,6 @@
}
-bool YWidget::isReplacePoint() const
-{
- return false;
-}
-
-
bool YWidget::isLayoutStretch( YUIDimension dim ) const
{
return false;
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YWidget.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YWidget.h?rev=38504&r1=38503&r2=38504&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YWidget.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YWidget.h Mon Jun 18 14:52:03 2007
@@ -342,12 +342,6 @@
virtual bool isDialog() const;
/**
- * Returns true if this is a replace point widget. The default implementation
- * returns false.
- */
- virtual bool isReplacePoint() const;
-
- /**
* 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.
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org