Author: sh-sh-sh
Date: Mon Jul 2 15:38:20 2007
New Revision: 39105
URL: http://svn.opensuse.org/viewcvs/yast?rev=39105&view=rev
Log:
compiles
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc
branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc
branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h
branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.cc
branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.h
branches/tmp/sh/mod-ui/core/libyui/src/YMultiSelectionBox.cc
branches/tmp/sh/mod-ui/core/libyui/src/YMultiSelectionBox.h
branches/tmp/sh/mod-ui/core/libyui/src/YSelectionBox.cc
branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc
branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.h
branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc
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/YWidgetFactory.h
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc?rev=39105&r1=39104&r2=39105&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc Mon Jul 2 15:38:20 2007
@@ -1796,19 +1796,16 @@
YSelectionBox *selBox = YUI::widgetFactory()->createSelectionBox( parent, label );
-#warning TO DO: shrinkable / immediate
-#if 0
if ( shrinkable )
selBox->setShrinkable( true );
if ( immediate )
- selBox->setImmediate( true ); // includes setNotify()
-#endif
+ selBox->setImmediateMode( true ); // includes setNotify()
if ( numargs >= 2 )
{
YCPList itemList = term->value( argnr+1 )->asList();
- selBox->addItems( YCPItemParser::parseItemList( itemList );
+ selBox->addItems( YCPItemParser::parseItemList( itemList ) );
}
return selBox;
@@ -1858,21 +1855,27 @@
return 0;
}
+ string label = term->value( argnr )->asString()->value();
+ bool shrinkable = false;
+
for ( int o=0; o < optList->size(); o++ )
{
- if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_shrinkable ) opt.isShrinkable.setValue( true );
+ if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_shrinkable ) shrinkable = true;
else logUnknownOption( term, optList->value(o) );
}
- YMultiSelectionBox *multi_sel_box =
- dynamic_cast ( YUI::ui()->createMultiSelectionBox( parent, opt, term->value( argnr )->asString() ) );
+ YMultiSelectionBox * multiSelectionBox = YUI::widgetFactory()->createMultiSelectionBox( parent, label );
+
+ if ( shrinkable )
+ multiSelectionBox->setShrinkable( true );
- if ( multi_sel_box && numargs >= 2 )
+ if ( numargs >= 2 )
{
- multi_sel_box->parseItemList( term->value( argnr+1 )->asList() );
+ YCPList itemList = term->value( argnr+1 )->asList();
+ multiSelectionBox->addItems( YCPItemParser::parseItemList( itemList ) );
}
- return multi_sel_box;
+ return multiSelectionBox;
}
@@ -1926,20 +1929,24 @@
return 0;
}
+ string label = term->value( argnr )->asString()->value();
+ bool editable = false;
+
for ( int o=0; o < optList->size(); o++ )
{
- if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_editable ) opt.isEditable.setValue( true );
+ if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_editable ) editable = true;
else logUnknownOption( term, optList->value(o) );
}
- YComboBox *combo_box = dynamic_cast ( YUI::ui()->createComboBox( parent, opt, term->value( argnr )->asString() ) );
+ YComboBox * comboBox = YUI::widgetFactory()->createComboBox( parent, label, editable );
- if ( combo_box && numargs >=2 )
+ if ( numargs >= 2 )
{
- combo_box->parseItemList( term->value( argnr+1 )->asList() );
+ YCPList itemList = term->value( argnr+1 )->asList();
+ comboBox->addItems( YCPItemParser::parseItemList( itemList ) );
}
- return combo_box;
+ return comboBox;
}
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc?rev=39105&r1=39104&r2=39105&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc Mon Jul 2 15:38:20 2007
@@ -23,8 +23,13 @@
#include
#include
#include
+#include
+
+#define y2log_component "ui"
+#include
#include "YCPPropertyHandler.h"
+#include "YCPItemParser.h"
#include "YCheckBox.h"
#include "YSelectionBox.h"
@@ -58,7 +63,7 @@
if ( trySetSelectionWidgetItems( widget, val ) ) return;
}
- y2error( "Can't handle property %s::%s - not changing anything"
+ y2error( "Can't handle property %s::%s - not changing anything",
widget->widgetClass(), propertyName.c_str() );
}
@@ -79,8 +84,19 @@
{
val = tryGetSelectionBoxValue ( widget ); if ( ! val.isNull() ) return val;
val = tryGetComboBoxValue ( widget ); if ( ! val.isNull() ) return val;
+
+ // tryGetMultiSelectionBoxCurrentItem
}
+
+ // FIXME: TO DO:
+ // FIXME: TO DO:
+ // FIXME: TO DO:
+
+ // tryGetMultiSelectionBoxSelectedItems
+ // tryGetSelectionWidgetItems
+ // tryGetRadioButtonGroupCurrentButton
+
y2error( "Can't handle property %s::%s - returning 'nil'",
widget->widgetClass(), propertyName.c_str() );
@@ -113,7 +129,7 @@
YUI_THROW( YUIBadPropertyArgException( YProperty( YUIProperty_Value,
YOtherProperty ),
- checkbox ) );
+ checkBox ) );
return false;
}
@@ -147,7 +163,7 @@
bool
YCPPropertyHandler::trySetComboBoxValue( YWidget * widget, const YCPValue & val )
{
- YSelectionBox * comboBox = dynamic_cast (widget);
+ YComboBox * comboBox = dynamic_cast (widget);
if ( ! comboBox )
return false;
@@ -164,7 +180,7 @@
{
if ( val->isString() || val->isInteger() )
{
- comboBox->setText( val->toString() );
+ comboBox->setValue( val->toString() );
return true;
}
}
@@ -189,13 +205,13 @@
wantedId = val->asTerm()->value(0);
}
- for ( YItemIterator it = selWidget->itemsBegin();
+ for ( YItemConstIterator it = selWidget->itemsBegin();
it != selWidget->itemsEnd();
++it )
{
YCPItem * item = dynamic_cast (*it);
- if ( item && item->id() && wantedId )
+ if ( item && wantedId->equal( item->id() ) )
return item;
}
@@ -206,18 +222,18 @@
bool
YCPPropertyHandler::trySetSelectionWidgetItems( YWidget * widget, const YCPValue & val )
{
- YSelectionWidget * selWidget = dynamic_cast (widget );
+ YSelectionWidget * selWidget = dynamic_cast (widget );
if ( ! selWidget )
return false;
if ( val->isList() )
{
- selWidget->setItems( YCPItemParser::parseItemList( val->asList ) );
+ selWidget->setItems( YCPItemParser::parseItemList( val->asList() ) );
return true;
}
- YUI_THROW( YUIBadPropertyArgException( YProperty( propertyName,
+ YUI_THROW( YUIBadPropertyArgException( YProperty( YUIProperty_Items,
YOtherProperty ),
widget ) );
return false;
@@ -231,7 +247,7 @@
YCPValue
-YPropertyHandler::tryGetCheckBoxValue( YWidget * widget )
+YCPPropertyHandler::tryGetCheckBoxValue( YWidget * widget )
{
YCheckBox * checkBox = dynamic_cast (widget);
@@ -251,7 +267,7 @@
YCPValue
-YPropertyHandler::tryGetComboBoxValue( YWidget * widget )
+YCPPropertyHandler::tryGetComboBoxValue( YWidget * widget )
{
YComboBox * comboBox = dynamic_cast (widget);
@@ -269,19 +285,19 @@
return item->id();
}
- return YCPString( comboBox->text() );
+ return YCPString( comboBox->value() );
}
YCPValue
-YPropertyHandler::tryGetSelectionBoxValue( YWidget * widget )
+YCPPropertyHandler::tryGetSelectionBoxValue( YWidget * widget )
{
YSelectionBox * selBox = dynamic_cast (widget);
if ( ! selBox )
return YCPNull();
- YItem * selectedItem = selBox()->selectedItem();
+ YItem * selectedItem = selBox->selectedItem();
if ( selectedItem )
{
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h?rev=39105&r1=39104&r2=39105&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h Mon Jul 2 15:38:20 2007
@@ -27,6 +27,10 @@
using std::string;
+class YCPItem;
+class YWidget;
+class YSelectionWidget;
+
/**
* Get and set complex widget properties.
@@ -39,7 +43,7 @@
* versa) or for historical reasons to maintain backward compatibility with
* existing YCP code.
**/
-class YPropertyHandler
+class YCPPropertyHandler
{
public:
/**
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.cc?rev=39105&r1=39104&r2=39105&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.cc Mon Jul 2 15:38:20 2007
@@ -29,8 +29,8 @@
struct YComboBoxPrivate
{
YComboBoxPrivate( bool editable )
- , editable( editable )
- , inputMaxLength( -1 );
+ : editable( editable )
+ , inputMaxLength( -1 )
{}
bool editable;
@@ -42,8 +42,9 @@
YComboBox::YComboBox( YWidget * parent, const string & label, bool editable )
- : YSelectionWidget( parent, label )
- , priv( new YComboBoxPrivate( editable )
+ : YSelectionWidget( parent, label,
+ true ) // enforceSingleSelection
+ , priv( new YComboBoxPrivate( editable ) )
{
YUI_CHECK_NEW( priv );
}
@@ -122,7 +123,7 @@
}
-const YItem *
+YItem *
YComboBox::selectedItem()
{
string currentText = text();
@@ -146,8 +147,9 @@
else
{
YSelectionWidget::deselectAllItems();
- return 0;
}
+
+ return 0;
}
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.h?rev=39105&r1=39104&r2=39105&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.h Mon Jul 2 15:38:20 2007
@@ -54,7 +54,7 @@
* 'editable' means the user can freely enter any value without being
* restricted to the items of the ComboBox's list.
**/
- YComboBox( YWidget * parent, const string * label, bool editable );
+ YComboBox( YWidget * parent, const string & label, bool editable );
public:
/**
@@ -109,7 +109,7 @@
* compare an editable ComboBox's user input against the text labels of
* all items and try to return an item if there is any match.
**/
- virtual const YItem * selectedItem();
+ virtual YItem * selectedItem();
/**
* Return all selected items.
@@ -171,6 +171,35 @@
virtual void setInputMaxLength( int numberOfChars );
/**
+ * Set a property.
+ * Reimplemented from YWidget.
+ *
+ * This function may throw YUIPropertyExceptions.
+ *
+ * This function returns 'true' if the value was successfully set and
+ * 'false' if that value requires special handling (not in error cases:
+ * those are covered by exceptions).
+ **/
+ virtual bool setProperty( const string & propertyName,
+ const YPropertyValue & val );
+
+ /**
+ * Get a property.
+ * Reimplemented from YWidget.
+ *
+ * This method may throw YUIPropertyExceptions.
+ **/
+ virtual YPropertyValue getProperty( const string & propertyName );
+
+ /**
+ * Return this class's property set.
+ * This also initializes the property upon the first call.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual const YPropertySet & propertySet();
+
+ /**
* The name of the widget property that will return user input.
* Inherited from YWidget.
**/
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YMultiSelectionBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YMultiSelectionBox.cc?rev=39105&r1=39104&r2=39105&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YMultiSelectionBox.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YMultiSelectionBox.cc Mon Jul 2 15:38:20 2007
@@ -17,144 +17,115 @@
/-*/
-#include
-#include
-#include
-#define y2log_component "ui"
#include
+#include "YMultiSelectionBox.h"
#include "YUISymbols.h"
#include "YMacroRecorder.h"
-#include "YMultiSelectionBox.h"
+#include "YUIException.h"
-YMultiSelectionBox::YMultiSelectionBox( const YWidgetOpt & opt, YCPString label )
- : YSelectionWidget( opt,label )
+struct YMultiSelectionBoxPrivate
{
- // y2debug( "YMultiSelectionBox( %s )", label->value_cstr() );
+ YMultiSelectionBoxPrivate()
+ : shrinkable( false )
+ {}
+
+ bool shrinkable;
+};
+
- // Derived classes need to check opt.shrinkable!
+YMultiSelectionBox::YMultiSelectionBox( YWidget * parent, const string & label )
+ : YSelectionWidget( parent, label,
+ false ) // enforceSingleSelection
+ , priv( new YMultiSelectionBoxPrivate )
+{
+ YUI_CHECK_NEW( priv );
+
setDefaultStretchable( YD_HORIZ, true );
setDefaultStretchable( YD_VERT, true );
}
-YCPValue YMultiSelectionBox::changeWidget( const YCPSymbol & property, const YCPValue & newValue )
+YMultiSelectionBox::~YMultiSelectionBox()
{
- string sym = property->symbol();
+ // NOP
+}
- /**
- * @property string Label
- * The label above the list describing what it is all about
- */
- if ( sym == YUIProperty_Label )
- {
- return changeLabel( newValue );
- }
-
- /**
- * @property string CurrentItem
- * The item that currently has the keyboard focus
- */
- else if ( sym == YUIProperty_CurrentItem ) // Select item with that id
- {
- int index = itemWithId( newValue, true ); // true: log error
- if ( index < 0 ) return YCPBoolean( false );
- else
- {
- setCurrentItem( index );
- return YCPBoolean( true );
- }
- }
- /**
- * @property id_list SelectedItems
- * The items that are currently selected
- */
- else if ( sym == YUIProperty_SelectedItems )
- {
- if ( ! newValue->isList() )
- {
- y2error( "MultiSelectionBox: Can't set property %s: "
- "Expected list of IDs or item labels, not %s",
- sym.c_str(), newValue->toString().c_str() );
-
- return YCPBoolean( false );
- }
-
- OptimizeChanges below( *this ); // delay screen updates until this block is left
-
- deselectAllItems();
- YCPList selected_items = newValue->asList();
-
- for ( int i = 0; i < selected_items->size(); i++ )
- {
- YCPValue id = selected_items->value(i);
- int index = itemWithId( id, true ); // true: log error
-
- if ( index < 0 ) // No such item
- {
- return YCPBoolean( false );
- }
-
- selectItem( index );
- }
-
- return YCPBoolean( false );
- }
+bool YMultiSelectionBox::shrinkable() const
+{
+ return priv->shrinkable;
+}
+
+
+void YMultiSelectionBox::setShrinkable( bool shrinkable )
+{
+ priv->shrinkable = shrinkable;
+}
- /**
- * @property id_list Items
- * The items that are displayed
- */
- else if ( sym == YUIProperty_Items )
+
+const YPropertySet &
+YMultiSelectionBox::propertySet()
+{
+ static YPropertySet propSet;
+
+ if ( propSet.isEmpty() )
{
- return changeItems ( newValue );
+ /*
+ * @property itemList SelectedItems All currently selected items
+ * @property itemList Items All items
+ * @property itemID CurrentItem The current item (no matter if selected or not)
+ * @property string Label Caption above the input field
+ */
+ propSet.add( YProperty( YUIProperty_CurrentItem, YOtherProperty ) );
+ propSet.add( YProperty( YUIProperty_SelectedItems, YOtherProperty ) );
+ propSet.add( YProperty( YUIProperty_Items, YOtherProperty ) );
+ propSet.add( YProperty( YUIProperty_Label, YStringProperty ) );
+ propSet.add( YWidget::propertySet() );
}
- else
- return YWidget::changeWidget( property, newValue );
-}
+ return propSet;
+}
-YCPValue YMultiSelectionBox::queryWidget( const YCPSymbol & property )
+bool
+YMultiSelectionBox::setProperty( const string & propertyName, const YPropertyValue & val )
{
- string sym = property->symbol();
- if ( sym == YUIProperty_Label ) return getLabel();
- else if ( sym == YUIProperty_CurrentItem )
- {
- int index = getCurrentItem();
- // y2debug( "current item: %d", index );
+ propertySet().check( propertyName, val.type() ); // throws exceptions if not found or type mismatch
- if ( index >= 0 )
- {
- if ( item_ids->value( index ).isNull() ) return item_labels->value( index );
- else return item_ids->value( index );
- }
- else return YCPVoid();
- }
- else if ( sym == YUIProperty_SelectedItems )
+ if ( propertyName == YUIProperty_CurrentItem ) return false; // Needs special handling
+ else if ( propertyName == YUIProperty_SelectedItems ) return false; // Needs special handling
+ else if ( propertyName == YUIProperty_Items ) return false; // Needs special handling
+ else if ( propertyName == YUIProperty_Label ) setLabel( val.stringVal() );
+ else
{
- YCPList selected_items;
+ YWidget::setProperty( propertyName, val );
+ }
+
+ return true; // success -- no special processing necessary
+}
+
- for ( int i = 0; i < numItems(); i++ )
- {
- if ( itemIsSelected(i) ) // ask specific UI for selection state
- {
- selected_items->add( item_ids->value(i).isNull() ||
- item_ids->value(i)->isVoid() ?
- item_labels->value(i) : item_ids->value(i) );
- }
- }
+YPropertyValue
+YMultiSelectionBox::getProperty( const string & propertyName )
+{
+ propertySet().check( propertyName ); // throws exceptions if not found
- return selected_items;
+ if ( propertyName == YUIProperty_CurrentItem ) return YPropertyValue( YOtherProperty );
+ else if ( propertyName == YUIProperty_SelectedItems ) return YPropertyValue( YOtherProperty );
+ else if ( propertyName == YUIProperty_Items ) return YPropertyValue( YOtherProperty );
+ else if ( propertyName == YUIProperty_Label ) return YPropertyValue( label() );
+ else
+ {
+ return YWidget::getProperty( propertyName );
}
- else return YWidget::queryWidget( property );
}
+
void YMultiSelectionBox::saveUserInput( YMacroRecorder *macroRecorder )
{
macroRecorder->recordWidgetProperty( this, YUIProperty_CurrentItem );
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YMultiSelectionBox.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YMultiSelectionBox.h?rev=39105&r1=39104&r2=39105&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YMultiSelectionBox.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YMultiSelectionBox.h Mon Jul 2 15:38:20 2007
@@ -20,82 +20,105 @@
#define YMultiSelectionBox_h
#include "YSelectionWidget.h"
-#include
-#include
-#include
class YMacroRecorder;
+class YMultiSelectionBoxPrivate;
class YMultiSelectionBox : public YSelectionWidget
{
protected:
/**
- * Constructor
- * @param text the initial text of the MultiSelectionBox label
- * @param opt the widget options
+ * Constructor.
**/
- YMultiSelectionBox( const YWidgetOpt & opt, YCPString label );
+ YMultiSelectionBox( YWidget * parent, const string & label );
public:
/**
+ * Destructor.
+ **/
+ virtual ~YMultiSelectionBox();
+
+ /**
* Returns a descriptive name of this widget class for logging,
* debugging etc.
**/
virtual const char * widgetClass() { return "YMultiSelectionBox"; }
/**
- * Implements the ui command changeWidget.
+ * Return 'true' if this MultiSelectionBox should be very small.
**/
- YCPValue changeWidget( const YCPSymbol & property, const YCPValue & newvalue );
+ bool shrinkable() const;
/**
- * Implements the ui command queryWidget
+ * Make this MultiSelectionBox very small. This will take effect only upon
+ * the next geometry management run.
+ *
+ * Derived classes can overwrite this, but should call this base class
+ * function in the new function.
**/
- YCPValue queryWidget( const YCPSymbol & property );
+ virtual void setShrinkable( bool shrinkable = true );
/**
- * The name of the widget property that will return user input.
- * Inherited from YWidget.
+ * Set a property.
+ * Reimplemented from YWidget.
+ *
+ * This function may throw YUIPropertyExceptions.
+ *
+ * This function returns 'true' if the value was successfully set and
+ * 'false' if that value requires special handling (not in error cases:
+ * those are covered by exceptions).
**/
- const char *userInputProperty() { return YUIProperty_SelectedItems; }
-
-
-protected:
+ virtual bool setProperty( const string & propertyName,
+ const YPropertyValue & val );
+
/**
- * Check whether or not item #index is selected.
+ * Get a property.
+ * Reimplemented from YWidget.
*
- * Reimplement this in derived classes!
+ * This method may throw YUIPropertyExceptions.
**/
- virtual bool itemIsSelected( int index ) = 0;
+ virtual YPropertyValue getProperty( const string & propertyName );
/**
- * Select item #index.
+ * Return this class's property set.
+ * This also initializes the property upon the first call.
*
- * Reimplement this in derived classes!
+ * Reimplemented from YWidget.
**/
- virtual void selectItem( int index ) = 0;
+ virtual const YPropertySet & propertySet();
/**
- * Deselect all items.
- *
- * Reimplement this in derived classes!
+ * The name of the widget property that will return user input.
+ * Inherited from YWidget.
**/
- virtual void deselectAllItems() = 0;
+ const char *userInputProperty() { return YUIProperty_SelectedItems; }
/**
- * Returns the index of the item that currently has the keyboard focus.
+ * Return the the item that currently has the keyboard focus
+ * or 0 if no item currently has the keyboard focus.
*
- * Reimplement this in derived classes!
+ * Notice that for a MultiSelectionBox the current item is not necessarily
+ * selected, i.e., its check box may or may not be checked.
+ *
+ * Derived classes are required to implement this function.
**/
- virtual int getCurrentItem() = 0;
+ virtual YItem * currentItem() = 0;
/**
- * Set the keyboard focus to one item.
+ * Set the keyboard focus to the specified item.
+ * 0 means clear the keyboard focus.
+ *
+ * Notice that for a MultiSelectionBox the current item is not necessarily
+ * selected, i.e., its check box may or may not be checked.
+ * Use selectItem() for that.
+ *
+ * Also notice that selectItem() does not make that newly selected item the
+ * current item.
*
- * Reimplement this in derived classes!
+ * Derived classes are required to implement this function.
**/
- virtual void setCurrentItem( int index ) = 0;
+ virtual void setCurrentItem( YItem * item ) = 0;
private:
/**
@@ -104,6 +127,9 @@
* handled by the abstract libyui level, not by a specific UI.
**/
virtual void saveUserInput( YMacroRecorder *macroRecorder );
+
+
+ ImplPtr<YMultiSelectionBoxPrivate> priv;
};
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YSelectionBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YSelectionBox.cc?rev=39105&r1=39104&r2=39105&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YSelectionBox.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YSelectionBox.cc Mon Jul 2 15:38:20 2007
@@ -30,18 +30,18 @@
{
YSelectionBoxPrivate()
: shrinkable( false )
- , immediate( false )
+ , immediateMode( false )
{}
bool shrinkable;
- bool immediate;
+ bool immediateMode;
};
YSelectionBox::YSelectionBox( YWidget * parent, const string & label )
- : YSelectionWidget( parent,label,
+ : YSelectionWidget( parent, label,
true ) // enforceSingleSelection
, priv( new YSelectionBoxPrivate() )
{
@@ -53,7 +53,7 @@
}
-YSelectionBox::~YSelectionBox
+YSelectionBox::~YSelectionBox()
{
// NOP
}
@@ -61,7 +61,7 @@
bool YSelectionBox::shrinkable() const
{
- return priv->shrinkable();
+ return priv->shrinkable;
}
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc?rev=39105&r1=39104&r2=39105&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc Mon Jul 2 15:38:20 2007
@@ -60,7 +60,7 @@
}
-YSelectionWidget::deleteAllItems()
+void YSelectionWidget::deleteAllItems()
{
YItemIterator it = priv->itemCollection.begin();
@@ -116,7 +116,7 @@
{
string fullPath;
- if ( item && ! icon->iconName().empty() )
+ if ( item && ! item->iconName().empty() )
{
// FIXME
// FIXME
@@ -132,7 +132,7 @@
// FIXME
// FIXME
- fullPath += priv->iconBasePath + "/" + icon->iconName();
+ fullPath += priv->iconBasePath + "/" + item->iconName();
}
return fullPath;
@@ -141,12 +141,12 @@
void YSelectionWidget::addItem( YItem * item )
{
- YUI_CHECK_NULL( item );
+ YUI_CHECK_PTR( item );
// Add the new item to the item list
priv->itemCollection.push_back( item );
- item->setIndex( itemCollection.size() - 1 );
+ item->setIndex( priv->itemCollection.size() - 1 );
if ( item->hasIconName() )
priv->hasIcons = true;
@@ -155,7 +155,7 @@
// Enforce single selection (if applicable)
//
- if ( priv->enforceSingleSelection && selected )
+ if ( priv->enforceSingleSelection && item->selected() )
{
YItem * oldSelectedItem = selectedItem();
@@ -185,7 +185,7 @@
{
YItem * item = new YItem( itemLabel, iconName, selected );
YUI_CHECK_NEW( item );
- additem( item );
+ addItem( item );
}
@@ -238,10 +238,10 @@
YItem *
YSelectionWidget::itemAt( int index ) const
{
- if ( index < 0 || index >= priv->itemCollection.size() )
+ if ( index < 0 || index >= (int) priv->itemCollection.size() )
return 0;
- return priv->itemCollection( index );
+ return priv->itemCollection[ index ];
}
@@ -251,7 +251,7 @@
}
-const YItem *
+YItem *
YSelectionWidget::selectedItem()
{
for ( YItemConstIterator it = itemsBegin();
@@ -266,10 +266,10 @@
}
-YItemConstList
+YConstItemCollection
YSelectionWidget::selectedItems()
{
- YItemConstList selectedItems;
+ YConstItemCollection selectedItems;
for ( YItemConstIterator it = itemsBegin();
it != itemsEnd();
@@ -291,7 +291,7 @@
void YSelectionWidget::selectItem( YItem * item, bool selected )
{
- YUI_CHECK_NULL( item );
+ YUI_CHECK_PTR( item );
if ( ! itemsContain( item ) )
YUI_THROW( YUIException( "Item does not belong to this widget" ) );
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.h?rev=39105&r1=39104&r2=39105&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.h Mon Jul 2 15:38:20 2007
@@ -116,7 +116,7 @@
* Delete all items and add new items.
**/
void setItems( const YItemCollection & itemCollection )
- { deleteAllItems(); addItems( itemCollection ) }
+ { deleteAllItems(); addItems( itemCollection ); }
/**
* Return an iterator that points to the first item.
@@ -156,7 +156,7 @@
/**
* Return the (first) selected item or 0 if none is selected.
**/
- virtual const YItem * selectedItem();
+ virtual YItem * selectedItem();
/**
* Return all selected items. This is mostly useful for derived classes
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc?rev=39105&r1=39104&r2=39105&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc Mon Jul 2 15:38:20 2007
@@ -377,6 +377,10 @@
bool YTree::parseItemList( const YCPList & itemList,
YTreeItem * parentItem )
{
+ // FIXME
+ // FIXME
+ // FIXME
+#if 0
for ( int i=0; i < itemList->size(); i++ )
{
YCPValue item = itemList->value(i);
@@ -424,7 +428,11 @@
return false;
}
}
-
+#endif
+ // FIXME
+ // FIXME
+ // FIXME
+
return true;
}
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=39105&r1=39104&r2=39105&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI.h Mon Jul 2 15:38:20 2007
@@ -449,9 +449,6 @@
virtual YWidget *createLogView( YWidget *parent, YWidgetOpt & opt, const YCPString & label, int visibleLines, int maxLines ) = 0;
virtual YWidget *createMenuButton( YWidget *parent, YWidgetOpt & opt, const YCPString & label ) = 0;
virtual YWidget *createMultiLineEdit( YWidget *parent, YWidgetOpt & opt, const YCPString & label, const YCPString & text ) = 0;
- virtual YWidget *createSelectionBox( YWidget *parent, YWidgetOpt & opt, const YCPString & label ) = 0;
- virtual YWidget *createMultiSelectionBox( YWidget *parent, YWidgetOpt & opt, const YCPString & label ) = 0;
- virtual YWidget *createComboBox( YWidget *parent, YWidgetOpt & opt, const YCPString & label ) = 0;
virtual YWidget *createTree( YWidget *parent, YWidgetOpt & opt, const YCPString & label ) = 0;
virtual YWidget *createTable( YWidget *parent, YWidgetOpt & opt, vector<string> header ) = 0;
virtual YWidget *createProgressBar( YWidget *parent, YWidgetOpt & opt, const YCPString & label, const YCPInteger & maxprogress, const YCPInteger & progress ) = 0;
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=39105&r1=39104&r2=39105&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 Jul 2 15:38:20 2007
@@ -53,6 +53,7 @@
#include "YCPValueWidgetID.h"
#include "YCPDialogParser.h"
#include "YCPItemParser.h"
+#include "YCPPropertyHandler.h"
#include "YOptionalWidgetFactory.h"
#include "YCheckBox.h"
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YWidgetFactory.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YWidgetFactory.h?rev=39105&r1=39104&r2=39105&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YWidgetFactory.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YWidgetFactory.h Mon Jul 2 15:38:20 2007
@@ -41,6 +41,7 @@
class YLogView;
class YMenuButton;
class YMultiLineEdit;
+class YMultiSelectionBox;
class YPackageSelector;
class YProgressBar;
class YPushButton;
@@ -113,7 +114,7 @@
virtual YMultiLineEdit * createMultiLineEdit ( YWidget * parent, const string & label ) = 0;
virtual YImage * createImage ( YWidget * parent, const string & imageFileName, bool animated = false ) = 0;
virtual YLogView * createLogView ( YWidget * parent, const string & label, int visibleLines, int storedLines = 0 ) = 0;
- virtual YSelectionBox * createMultiSelectionBox ( YWidget * parent, const string & label ) = 0;
+ virtual YMultiSelectionBox *createMultiSelectionBox ( YWidget * parent, const string & label ) = 0;
virtual YPackageSelector * createPackageSelector ( YWidget * parent, long ModeFlags = 0 ) = 0;
virtual YWidget * createPkgSpecial ( YWidget * parent, const string & subwidgetName ) = 0; // NCurses only
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org