YaST Commits
Threads by month
- ----- 2024 -----
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
June 2007
- 27 participants
- 490 discussions
[yast-commit] r39071 - in /branches/tmp/sh/mod-ui/ncurses/src: NCPopupTextEntry.cc NCRadioButton.cc
by gs@svn.opensuse.org 28 Jun '07
by gs@svn.opensuse.org 28 Jun '07
28 Jun '07
Author: gs
Date: Thu Jun 28 12:31:20 2007
New Revision: 39071
URL: http://svn.opensuse.org/viewcvs/yast?rev=39071&view=rev
Log:
fixed typos
Modified:
branches/tmp/sh/mod-ui/ncurses/src/NCPopupTextEntry.cc
branches/tmp/sh/mod-ui/ncurses/src/NCRadioButton.cc
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPopupTextEntry.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCP…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCPopupTextEntry.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCPopupTextEntry.cc Thu Jun 28 12:31:20 2007
@@ -32,16 +32,16 @@
const YCPString & text,
unsigned maxInput,
unsigned maxFld,
- NCTextEntry::FTYPE t )
+ NCInputField::FTYPE t )
: NCPopup( at )
, wtext( 0 )
{
YWidgetOpt opt;
//opt.notifyMode.setValue( true );
- wtext = new NCTextEntry( this,
- label->toString(),
- false // passwordMode = false
- );
+ wtext = new NCInputField( this,
+ label->toString(),
+ false // passwordMode = false
+ );
wtext->setFldtype( t );
wtext->setReturnOnReturn( true );
addChild( wtext );
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCRadioButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCR…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCRadioButton.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCRadioButton.cc Thu Jun 28 12:31:20 2007
@@ -32,7 +32,7 @@
// DESCRIPTION :
//
NCRadioButton::NCRadioButton( NCWidget * parent,
- const string & nlabel, )
+ const string & nlabel )
: YRadioButton( dynamic_cast<YWidget *>(parent), nlabel )
, NCWidget( parent )
, checked( false )
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39070 - in /branches/tmp/sh/mod-ui/ncurses/src: ./ pkg/
by gs@svn.opensuse.org 28 Jun '07
by gs@svn.opensuse.org 28 Jun '07
28 Jun '07
Author: gs
Date: Thu Jun 28 12:18:13 2007
New Revision: 39070
URL: http://svn.opensuse.org/viewcvs/yast?rev=39070&view=rev
Log:
try to make widget factory work (not yet finished)
Modified:
branches/tmp/sh/mod-ui/ncurses/src/Makefile.am
branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorStart.h
branches/tmp/sh/mod-ui/ncurses/src/NCPopupTextEntry.h
branches/tmp/sh/mod-ui/ncurses/src/NCRadioButton.cc
branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc
branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.h
branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc
branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.h
branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.h
Modified: branches/tmp/sh/mod-ui/ncurses/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/Mak…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/Makefile.am (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/Makefile.am Thu Jun 28 12:18:13 2007
@@ -84,8 +84,6 @@
NCLogView.h \
NCMultiLineEdit.h \
NCFileSelection.h \
- NCAskForDirectory.h \
- NCAskForFile.h \
NCPopup.h \
NCPopupTable.h \
NCPopupList.h \
@@ -98,6 +96,9 @@
Y2CCNCursesUI.h \
YNCursesComponent.h
+# NCAskForDirectory.h \
+# NCAskForFile.h
+
libpy2ncurses_la_SOURCES = \
Y2Log.cc \
position.cc \
@@ -155,8 +156,6 @@
NCLogView.cc \
NCMultiLineEdit.cc \
NCFileSelection.cc \
- NCAskForDirectory.cc \
- NCAskForFile.cc \
\
NCPopup.cc \
NCPopupTable.cc \
@@ -167,6 +166,9 @@
\
Y2CCNCursesUI.cc
+# NCAskForDirectory.cc \
+# NCAskForFile.cc
+
#libpy2ncurses_la_SOURCES = $(liby2ncurses_la_SOURCES) \
# Y2CCNCursesUI.cc Y2CCNCursesUI.h \
# YNCursesComponent.h
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorStart.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCP…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorStart.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorStart.h Thu Jun 28 12:18:13 2007
@@ -31,7 +31,7 @@
class NCPkgTable;
-
+class NCPackageSelector;
/**
* @short the package selector widget
@@ -77,6 +77,9 @@
virtual long nicesize( YUIDimension dim ) { return NCSplit::nicesize( dim ); }
+ virtual int preferredWidth() { return NCSplit::preferredWidth(); }
+ virtual int preferredHeight() { return NCSplit::preferredHeight(); }
+
/**
* Set the new size of the widget.
*
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPopupTextEntry.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCP…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCPopupTextEntry.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCPopupTextEntry.h Thu Jun 28 12:18:13 2007
@@ -22,7 +22,7 @@
#include <iosfwd>
#include "NCPopup.h"
-#include "NCTextEntry.h"
+#include "NCInputField.h"
///////////////////////////////////////////////////////////////////
@@ -38,7 +38,7 @@
private:
- NCTextEntry * wtext;
+ NCInputField * wtext;
virtual bool postAgain();
@@ -49,7 +49,7 @@
const YCPString & text,
unsigned maxInput = 0,
unsigned maxFld = 0,
- NCTextEntry::FTYPE t = NCTextEntry::PLAIN );
+ NCInputField::FTYPE t = NCInputField::PLAIN );
virtual ~NCPopupTextEntry();
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCRadioButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCR…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCRadioButton.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCRadioButton.cc Thu Jun 28 12:18:13 2007
@@ -32,7 +32,7 @@
// DESCRIPTION :
//
NCRadioButton::NCRadioButton( NCWidget * parent,
- const string & nlabel )
+ const string & nlabel, )
: YRadioButton( dynamic_cast<YWidget *>(parent), nlabel )
, NCWidget( parent )
, checked( false )
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCW…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc Thu Jun 28 12:18:13 2007
@@ -10,65 +10,24 @@
| (C) SuSE GmbH |
\----------------------------------------------------------------------/
- File: NCWidgetFactory.cc
+ File: NCWidgetFactory.cc
- Author: Gabriele Mohr <gs(a)suse.de>
+ Author: Stefan Hundhammer <sh(a)suse.de>
/-*/
+
#include "NCWidgetFactory.h"
+#include "YUIException.h"
+
#include <string>
-#include <sys/time.h>
-#include <unistd.h>
-#include "Y2Log.h"
-#include <YEvent.h>
-#include "YDialog.h"
-
-#include <ycp/y2log.h>
-#include <ycp/Parser.h>
-#include <ycp/YCPString.h>
-#include <ycp/YCPVoid.h>
-#include <ycp/YCPMap.h>
-#include <yui/YUI.h>
-
-#include "NCDialog.h"
-#include "NCAlignment.h"
-#include "NCCheckBox.h"
-#include "NCEmpty.h"
-#include "NCSpacing.h"
-#include "NCFrame.h"
-#include "NCCheckBoxFrame.h"
-#include "NCImage.h"
-#include "NCLabel.h"
-#include "NCProgressBar.h"
-#include "NCPushButton.h"
-#include "NCMenuButton.h"
-#include "NCRadioButton.h"
-#include "NCRadioButtonGroup.h"
-#include "NCReplacePoint.h"
-#include "NCRichText.h"
-#include "NCSelectionBox.h"
-#include "NCMultiSelectionBox.h"
-#include "NCSplit.h"
-#include "NCSquash.h"
-#include "NCTable.h"
-#include "NCInputField.h"
-#include "NCIntField.h"
-#include "NCComboBox.h"
-#include "NCTree.h"
-#include "NCLogView.h"
-#include "NCMultiLineEdit.h"
-#include "NCPackageSelectorPlugin.h"
-#include "NCPackageSelectorStart.h"
-#include "NCAskForDirectory.h"
-#include "NCAskForFile.h"
-#include "NCstring.h"
-extern string language2encoding( string lang );
+using std::string;
-NCWidgetFactory::NCWidgetFactory( )
- : YWidgetFactory ()
+
+NCWidgetFactory::NCWidgetFactory()
+ : YWidgetFactory()
{
// NOP
}
@@ -79,317 +38,303 @@
}
-///////////////////////////////////////////////////////////////////
+
+
//
-// Widget creation functions - container widgets
+// Dialogs
//
-///////////////////////////////////////////////////////////////////
-
-//#define ONCREATE WIDDBG << endl
-#define ONCREATE
-YContainerWidget * YNCursesUI::createSplit( YWidget * parent, YWidgetOpt & opt,
- YUIDimension dimension )
+NCDialog *
+NCWidgetFactory::createMainDialog()
{
- ONCREATE;
- return new NCSplit( dynamic_cast<NCWidget *>( parent ), opt,
- dimension );
+ return 0; // FIXME: TO DO
}
-YSingleChildContainerWidget * YNCursesUI::createReplacePoint( YWidget * parent )
-{
- ONCREATE;
- return new NCReplacePoint( dynamic_cast<NCWidget *>( parent ) );
-}
-YSingleChildContainerWidget * YNCursesUI::createAlignment( YWidget * parent,
- YAlignmentType halign,
- YAlignmentType valign )
-{
- ONCREATE;
- return new NCAlignment( dynamic_cast<NCWidget *>( parent ),
- halign, valign );
-}
-YSingleChildContainerWidget * YNCursesUI::createSquash( YWidget * parent,
- bool hsquash,
- bool vsquash )
+NCDialog *
+NCWidgetFactory::createPopupDialog()
{
- ONCREATE;
- return new NCSquash( dynamic_cast<NCWidget *>( parent ),
- hsquash, vsquash );
+ return 0; // FIXME: TO DO
}
-YSingleChildContainerWidget * YNCursesUI::createFrame( YWidget * parent,
- const string & label )
+
+
+
+
+//
+// Common Leaf Widgets
+//
+
+NCPushButton *
+NCWidgetFactory::createPushButton( YWidget * parent, const string & label )
{
- ONCREATE;
- return new NCFrame( dynamic_cast<NCWidget *>( parent ), label );
+ NCPushButton * pushButton = new NCPushButton( dynamic_cast<NCWidget *>(parent), label );
+ YUI_CHECK_NEW( pushButton );
+
+ return pushButton;
}
-YSingleChildContainerWidget * YNCursesUI::createCheckBoxFrame( YWidget * parent,
- const string & label, bool checked )
+
+
+NCLabel *
+NCWidgetFactory::createLabel( YWidget * parent,
+ const string & text,
+ bool isHeading,
+ bool isOutputField )
{
- ONCREATE;
- return new NCCheckBoxFrame( dynamic_cast<NCWidget *>( parent ), label, checked );
+ NCLabel * label = new NCLabel( dynamic_cast<NCWidget *>( parent ), text, isHeading, isOutputField );
+ YUI_CHECK_NEW( label );
+
+ return label;
}
-///////////////////////////////////////////////////////////////////
-//
-// Widget creation functions - leaf widgets
-//
-///////////////////////////////////////////////////////////////////
-YWidget * YNCursesUI::createEmpty( YWidget * parent )
+
+NCInputField *
+NCWidgetFactory::createInputField( YWidget * parent, const string & label, bool passwordMode )
{
- ONCREATE;
- return new NCEmpty( dynamic_cast<NCWidget *>( parent ) );
+ NCInputField * inputField = new NCInputField( dynamic_cast<NCWidget *>( parent ), label, passwordMode );
+ YUI_CHECK_NEW( inputField );
+
+ return inputField;
}
-YWidget * YNCursesUI::createSpacing( YWidget * parent,
- YUIDimension dim,
- bool stretchable,
- YLayoutSize_t layoutUnits )
+
+NCCheckBox *
+NCWidgetFactory::createCheckBox( YWidget * parent, const string & label, bool isChecked )
{
- ONCREATE;
- return new NCSpacing( dynamic_cast<NCWidget *>( parent ), dim,
- stretchable, layoutUnits );
+ return 0; // FIXME: TO DO
}
-YWidget * YNCursesUI::createLabel( YWidget * parent, const string & text,
- bool isHeading, bool isOutputField )
+
+
+NCRadioButton *
+NCWidgetFactory::createRadioButton( YWidget * parent, const string & label, bool checked )
{
- ONCREATE;
- return new NCLabel( dynamic_cast<NCWidget *>( parent ), text,
- isHeading, isOutputField );
+ NCRadioButton * radioButton = new NCRadioButton( dynamic_cast<NCWidget *>( parent ), label );
+ YUI_CHECK_NEW( radioButton );
+
+ // Register radio button with its button group.
+ // This has to be done after all constructors are done so virtual functions
+ // can be used.
+
+ if ( radioButton->buttonGroup() )
+ radioButton->buttonGroup()->addRadioButton( radioButton );
+
+ return radioButton;
}
-YWidget * YNCursesUI::createRichText( YWidget * parent, YWidgetOpt & opt,
- const YCPString & text )
+
+
+NCComboBox *
+NCWidgetFactory::createComboBox( YWidget * parent, const string & label, bool editable )
{
- ONCREATE;
- return new NCRichText( dynamic_cast<NCWidget *>( parent ), opt,
- text );
+ return 0; // FIXME: TO DO
}
-YWidget * YNCursesUI::createLogView( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label,
- int visibleLines,
- int maxLines )
+
+
+NCSelectionBox *
+NCWidgetFactory::createSelectionBox( YWidget * parent, const string & label )
{
- ONCREATE;
- return new NCLogView( dynamic_cast<NCWidget *>( parent ), opt,
- label, visibleLines, maxLines );
+ return 0; // FIXME: TO DO
}
-YWidget * YNCursesUI::createPushButton( YWidget * parent,
- const string & label )
+
+
+NCTree *
+NCWidgetFactory::createTree( YWidget * parent, const string & label )
{
- ONCREATE;
- return new NCPushButton( dynamic_cast<NCWidget *>( parent ), label );
+ return 0; // FIXME: TO DO
}
-YWidget * YNCursesUI::createMenuButton( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label )
+
+
+NCTable *
+NCWidgetFactory::createTable( YWidget * parent )
{
- ONCREATE;
- return new NCMenuButton( dynamic_cast<NCWidget *>( parent ), opt,
- label );
+ return 0; // FIXME: TO DO
}
-YWidget * YNCursesUI::createRadioButton( YWidget * parent,
- const string & label )
+
+
+NCProgressBar *
+NCWidgetFactory::createProgressBar( YWidget * parent, const string & label, int maxValue )
{
- ONCREATE;
- return new NCRadioButton( dynamic_cast<NCWidget *>( parent ),
- label );
+ return 0; // FIXME: TO DO
}
-YWidget * YNCursesUI::createCheckBox( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label,
- bool checked )
+
+
+NCRichText *
+NCWidgetFactory::createRichText( YWidget * parent )
{
- ONCREATE;
- return new NCCheckBox( dynamic_cast<NCWidget *>( parent ), opt,
- label, checked );
+ return 0; // FIXME: TO DO
}
-YWidget * YNCursesUI::createInputField( YWidget * parent,
- const string & label,
- bool passwordMode )
+
+
+
+//
+// Less Common Leaf Widgets
+//
+
+NCIntField *
+NCWidgetFactory::createIntField( YWidget * parent, const string & label, int minVal, int maxVal, int initialVal )
{
- ONCREATE;
- return new NCInputField( dynamic_cast<NCWidget *>( parent ),
- label, passwordMode );
+ return 0; // FIXME: TO DO
}
-YWidget *YNCursesUI::createMultiLineEdit( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label,
- const YCPString & initialText )
+
+
+NCMenuButton *
+NCWidgetFactory::createMenuButton( YWidget * parent, const string & label )
{
- ONCREATE;
- return new NCMultiLineEdit( dynamic_cast<NCWidget *>( parent ), opt,
- label, initialText );
+ return 0; // FIXME: TO DO
}
-YWidget * YNCursesUI::createSelectionBox( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label )
+
+
+NCMultiLineEdit *
+NCWidgetFactory::createMultiLineEdit( YWidget * parent, const string & label )
{
- ONCREATE;
- return new NCSelectionBox( dynamic_cast<NCWidget *>( parent ), opt,
- label );
+ return 0; // FIXME: TO DO
}
-YWidget * YNCursesUI::createMultiSelectionBox( YWidget *parent, YWidgetOpt & opt,
- const YCPString & label )
+
+
+NCImage *
+NCWidgetFactory::createImage( YWidget * parent, const string & imagePath )
{
- ONCREATE;
- return new NCMultiSelectionBox( dynamic_cast<NCWidget *>( parent ), opt,
- label );
+ return 0; // FIXME: TO DO
}
-YWidget * YNCursesUI::createComboBox( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label )
+
+
+NCLogView *
+NCWidgetFactory::createLogView( YWidget * parent, const string & label, int visibleLines, int storedLines )
{
- ONCREATE;
- return new NCComboBox( dynamic_cast<NCWidget *>( parent ), opt,
- label );
+ return 0; // FIXME: TO DO
}
-YWidget * YNCursesUI::createTree( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label )
+
+
+NCSelectionBox *
+NCWidgetFactory::createMultiSelectionBox( YWidget * parent, const string & label )
{
- ONCREATE;
- return new NCTree( dynamic_cast<NCWidget *>( parent ), opt,
- label );
+ return 0; // FIXME: TO DO
}
-YWidget * YNCursesUI::createTable( YWidget * parent, YWidgetOpt & opt,
- vector<string> header )
+
+
+
+YPackageSelector *
+NCWidgetFactory::createPackageSelector( YWidget * parent )
{
- ONCREATE;
- return new NCTable( dynamic_cast<NCWidget *>( parent ), opt,
- header, true );
+ return 0; // FIXME: TO DO
}
-YWidget * YNCursesUI::createProgressBar( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label,
- const YCPInteger & maxprogress,
- const YCPInteger & progress )
+
+
+YPkgSpecial *
+NCWidgetFactory::createPkgSpecial( YWidget * parent )
{
- ONCREATE;
- return new NCProgressBar( dynamic_cast<NCWidget *>( parent ), opt,
- label, maxprogress, progress );
+ YUI_THROW( YUIUnsupportedWidgetException( "NCPkgSpecial" ) ); // NCurses only
+ return 0;
}
-YWidget * YNCursesUI::createImage( YWidget * parent, YWidgetOpt & opt,
- YCPByteblock /* not used */,
- YCPString defaulttext )
+
+//
+// Layout Helpers
+//
+
+NCSpacing *
+NCWidgetFactory::createSpacing( YWidget * parent, YUIDimension dim, bool stretchable, YLayoutSize_t size )
{
- ONCREATE;
- return new NCImage( dynamic_cast<NCWidget *>( parent ), opt,
- defaulttext );
+ NCSpacing * spacing = new NCSpacing( dynamic_cast<NCWidget *>( parent ), dim, stretchable, size );
+ YUI_CHECK_NEW( spacing );
+
+ return spacing;
}
-YWidget * YNCursesUI::createImage( YWidget * parent, YWidgetOpt & opt,
- YCPString /* not used */,
- YCPString defaulttext )
+
+NCEmpty *
+NCWidgetFactory::createEmpty( YWidget * parent )
{
- ONCREATE;
- return new NCImage( dynamic_cast<NCWidget *>( parent ), opt,
- defaulttext );
+ NCEmpty * empty = new NCEmpty( dynamic_cast<NCWidget *>( parent ) );
+ YUI_CHECK_NEW( empty );
+
+ return empty;
}
-YWidget * YNCursesUI::createIntField( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label,
- int minValue, int maxValue,
- int initialValue )
+
+NCAlignment *
+NCWidgetFactory::createAlignment( YWidget * parent,
+ YAlignmentType horAlignment,
+ YAlignmentType vertAlignment )
{
- ONCREATE;
- return new NCIntField( dynamic_cast<NCWidget *>( parent ), opt,
- label, minValue, maxValue, initialValue );
+ NCAlignment * alignment = new NCAlignment( dynamic_cast<NCWidget *>( parent ), horAlignment, vertAlignment );
+ YUI_CHECK_NEW( alignment );
+
+ return alignment;
}
-///////////////////////////////////////////////////////////////////
-//
-// package selection
-//
-///////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : YNCursesUI::packageSelectorPlugin()
-// METHOD TYPE : NCPackageSelectorPlugin
-//
-// DESCRIPTION : Create the package selector plugin
-//
-NCPackageSelectorPlugin * YNCursesUI::packageSelectorPlugin()
+NCSquash *
+NCWidgetFactory::createSquash( YWidget * parent, bool horSquash, bool vertSquash )
{
- static NCPackageSelectorPlugin * plugin = 0;
+ NCSquash * squash = new NCSquash( dynamic_cast<NCWidget *>(parent), horSquash, vertSquash );
+ YUI_CHECK_NEW( squash );
- if ( ! plugin )
- {
- plugin = new NCPackageSelectorPlugin();
+ return squash;
+}
- // This is a deliberate memory leak: If an application requires a
- // PackageSelector, it is a package selection application by
- // definition. In this case, the ncurses_pkg plugin is intentionally
- // kept open to avoid repeated start-up cost of the plugin and libzypp.
- }
- return plugin;
-}
-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : YNCursesUI::createPackageSelector
-// METHOD TYPE : YWidget
-//
-// DESCRIPTION : Calls NCPackageSelectorPlugin::createPackageSelector
-//
-YWidget * YNCursesUI::createPackageSelector( YWidget * parent,
- YWidgetOpt & opt,
- const YCPString & floppyDevice )
+NCFrame *
+NCWidgetFactory::createFrame( YWidget * parent, const string & label )
{
- ONCREATE;
- YWidget * w = 0;
+ NCFrame * frame = new NCFrame( dynamic_cast<NCWidget *>(parent), label );
+ YUI_CHECK_NEW( frame );
+
+ return frame;
+}
- NCPackageSelectorPlugin * plugin = packageSelectorPlugin();
- if ( plugin )
- {
- w = plugin->createPackageSelector( parent, opt );
- }
- return w;
+NCCheckBoxFrame *
+NCWidgetFactory::createCheckBoxFrame( YWidget * parent, const string & label, bool checked )
+{
+ NCCheckBoxFrame * checkBoxFrame = new NCCheckBoxFrame( dynamic_cast<NCWidget *>( parent ), label, checked );
+ YUI_CHECK_NEW( checkBoxFrame );
+
+ return checkBoxFrame;
}
-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : YNCursesUI::createPkgSpecial
-// METHOD TYPE : YWidget
-//
-// DESCRIPTION : creates special widgets used for the package selection
-// dialog (which do not have a corresponding widget in qt-ui)
-//
-YWidget * YNCursesUI::createPkgSpecial( YWidget *parent, YWidgetOpt &opt, const YCPString &subwidget )
+
+
+NCRadioButtonGroup *
+NCWidgetFactory::createRadioButtonGroup( YWidget * parent )
{
- ONCREATE;
- YWidget * w = 0;
+ NCRadioButtonGroup * radioButtonGroup = new NCRadioButtonGroup( dynamic_cast<NCWidget *>( parent ) );
+ YUI_CHECK_NEW( radioButtonGroup );
- NCPackageSelectorPlugin * plugin = packageSelectorPlugin();
+ return radioButtonGroup;
+}
+
- if ( plugin )
- {
- w = plugin->createPkgSpecial( parent, opt, subwidget );
- }
+
+NCReplacePoint *
+NCWidgetFactory::createReplacePoint( YWidget * parent )
+{
+ NCReplacePoint * replacePoint = new NCReplacePoint( dynamic_cast<NCWidget *>( parent ) );
+ YUI_CHECK_NEW( replacePoint );
- return w;
+ return replacePoint;
}
+
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCW…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.h Thu Jun 28 12:18:13 2007
@@ -1,264 +1,147 @@
/*---------------------------------------------------------------------\
-| |
-| __ __ ____ _____ ____ |
-| \ \ / /_ _/ ___|_ _|___ \ |
-| \ V / _` \___ \ | | __) | |
-| | | (_| |___) || | / __/ |
-| |_|\__,_|____/ |_| |_____| |
-| |
-| core system |
-| (C) SuSE GmbH |
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
\----------------------------------------------------------------------/
- File: NCWidgetFactory.h
+ File: NCWidgetFactory.h
- Author: Gabriele Mohr <@suse.de>
+ Author: Gabriele Mohr <gs(a)suse.de>
/-*/
-
#ifndef NCWidgetFactory_h
#define NCWidgetFactory_h
+
#include "YWidgetFactory.h"
+#include "NCAlignment.h"
+#include "NCCheckBox.h"
+#include "NCCheckBoxFrame.h"
+#include "NCComboBox.h"
+#include "NCDialog.h"
+#include "NCEmpty.h"
+#include "NCFrame.h"
+#include "NCImage.h"
+#include "NCInputField.h"
+#include "NCIntField.h"
+#include "NCLabel.h"
+#include "NCLogView.h"
+#include "NCMenuButton.h"
+#include "NCMultiLineEdit.h"
+#include "NCPackageSelectorStart.h"
+#include "NCProgressBar.h"
+#include "NCPushButton.h"
+#include "NCRadioButton.h"
+#include "NCRadioButtonGroup.h"
+#include "NCReplacePoint.h"
+#include "NCRichText.h"
+#include "NCSelectionBox.h"
+#include "NCSpacing.h"
+#include "NCSquash.h"
+#include "NCTable.h"
+#include "NCTree.h"
-/**
- * @short YaST2 Component: NCursesUI Widget Factory
- * Concrete widget factory for mandatory widgets.
- */
-class NCWidgetFactory : public YWidgetFactory
-{
- protected:
+using std::string;
- friend class NCursesUI;
- /**
- * Constructor.
- *
- * Use YUI::widgetFactory() to get the singleton for this class.
- **/
- NCWidgetFactory();
- /**
- * Destructory.
- **/
- virtual ~NCWidgetFactory();
-
+/**
+ * Concrete widget factory for mandatory widgets.
+ **/
+class NCWidgetFactory: public YWidgetFactory
+{
public:
+ // Note: Using covariant return types for all createSomeWidget() methods
+ // (returning NCSomeWidget where the base class declares virtual methods that
+ // return YSomeWidget)
+
//
- // Widget creation functions - container widgets
+ // Dialogs
//
- /**
- * Creates a split
- */
- virtual YContainerWidget * createSplit( YWidget * parent, YWidgetOpt & opt,
- YUIDimension dimension );
-
- /**
- * Creates a replace point.
- */
- virtual YSingleChildContainerWidget * createReplacePoint( YWidget * parent );
-
- /**
- * Creates an alignment widget
- */
- virtual YSingleChildContainerWidget * createAlignment( YWidget * parent,
- YAlignmentType halign,
- YAlignmentType valign);
-
- /**
- * Creates a squash widget
- */
- virtual YSingleChildContainerWidget * createSquash( YWidget * parent,
- bool hsquash,
- bool vsquash );
-
- /**
- * Creates a radio button group.
- */
- // virtual YContainerWidget * createRadioButtonGroup( YWidget * parent, YWidgetOpt & opt );
+ virtual NCDialog * createMainDialog();
+ virtual NCDialog * createPopupDialog();
- /**
- * Creates a frame widget
- */
- virtual YSingleChildContainerWidget * createFrame( YWidget * parent,
- const string & label );
-
- virtual YSingleChildContainerWidget * createCheckBoxFrame( YWidget * parent,
- const string & label,
- bool checked );
//
- // Widget creation functions - leaf widgets
+ // Common Leaf Widgets
//
- /**
- * Creates an empty widget
- */
- virtual YWidget * createEmpty( YWidget * parent );
-
- /**
- * Creates a spacing widget
- */
- virtual YWidget * createSpacing( YWidget * parent,
- YUIDimension dim,
- bool stretchable,
- YLayoutSize_t layoutUnits );
-
- /**
- * Creates a label.
- * @param text Initial text of the label
- * @param heading true if the label is a Heading()
- * @param output_field true if the label should look like an output field (3D look)
- */
- virtual YWidget * createLabel( YWidget * parent, const string & text,
- bool isHeading, bool isOutputField );
-
- /**
- * Creates a rich text widget
- * @param text Initial text of the label
- */
- virtual YWidget * createRichText( YWidget * parent, YWidgetOpt & opt,
- const YCPString & text );
-
- /**
- * Creates a log view widget
- * @param label label above the log view
- * @param visibleLines default number of vislible lines
- * @param maxLines number of lines to store (use 0 for "all")
- */
- virtual YWidget * createLogView( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label,
- int visibleLines,
- int maxLines );
+ virtual NCPushButton * createPushButton ( YWidget * parent, const string & label );
+ virtual NCLabel * createLabel ( YWidget * parent, const string & text, bool isHeading = false, bool isOutputField = false );
+ virtual NCInputField * createInputField ( YWidget * parent, const string & label, bool passwordMode = false );
+ virtual NCCheckBox * createCheckBox ( YWidget * parent, const string & label, bool isChecked = false );
+ virtual NCRadioButton * createRadioButton ( YWidget * parent, const string & label, bool isChecked = false );
+ virtual NCComboBox * createComboBox ( YWidget * parent, const string & label, bool editable = false );
+ virtual NCSelectionBox * createSelectionBox ( YWidget * parent, const string & label );
+ virtual NCTree * createTree ( YWidget * parent, const string & label );
+ virtual NCTable * createTable ( YWidget * parent );
+ virtual NCProgressBar * createProgressBar ( YWidget * parent, const string & label, int maxValue = 100 );
+ virtual NCRichText * createRichText ( YWidget * parent );
- /**
- * Creates a MultiLineEdit widget
- * @param label label above the edit field
- * @param text initial contents of the edit field
- */
- virtual YWidget * createMultiLineEdit( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label,
- const YCPString & text);
-
- /**
- * Creates a push button.
- * @param label Label of the button
- * @param default_button true if the button should be the dialogs default button
- */
- virtual YWidget * createPushButton( YWidget * parent,
- const string & label );
-
- /**
- * Creates a menu button.
- * @param label Label of the button
- */
- virtual YWidget * createMenuButton( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label );
+ //
+ // Less Common Leaf Widgets
+ //
- /**
- * Creates a radio button and inserts it into a radio button group
- * @param label Label of the radio button
- * @param rbg the radio button group the new button will belong to
- */
- virtual YWidget * createRadioButton( YWidget * parent,
- const string & label );
+ virtual NCIntField * createIntField ( YWidget * parent, const string & label, int minVal, int maxVal, int initialVal );
+ virtual NCMenuButton * createMenuButton ( YWidget * parent, const string & label );
+ virtual NCMultiLineEdit * createMultiLineEdit ( YWidget * parent, const string & label );
+ virtual NCImage * createImage ( YWidget * parent, const string & imagePath );
+ virtual NCLogView * createLogView ( YWidget * parent, const string & label, int visibleLines, int storedLines = 0 );
+ virtual NCSelectionBox * createMultiSelectionBox ( YWidget * parent, const string & label );
- /**
- * Creates a check box
- * @param label Label of the checkbox
- * @param true if it is checked
- */
- virtual YWidget * createCheckBox( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label,
- bool checked );
+ virtual YPackageSelector * createPackageSelector ( YWidget * parent );
+ virtual YPkgSpecial * createPkgSpecial ( YWidget * parent ); // NCurses only, will throw exception in the Qt UI
- /**
- * Creates a text entry or password entry field.
- */
- virtual YWidget * createTextEntry( YWidget * parent,
- const string & label,
- bool passwordMode );
+ //
+ // Layout Helpers
+ //
- /**
- * Creates a selection box
- */
- virtual YWidget * createSelectionBox( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label );
+ virtual NCSpacing * createSpacing ( YWidget * parent, YUIDimension dim, bool stretchable = false, YLayoutSize_t size = 0.0 );
+ virtual NCEmpty * createEmpty ( YWidget * parent );
+ virtual NCAlignment * createAlignment ( YWidget * parent, YAlignmentType horAlignment, YAlignmentType vertAlignment );
+ virtual NCSquash * createSquash ( YWidget * parent, bool horSquash, bool vertSquash );
- /**
- * Creates a multi selection box
- */
- virtual YWidget * createMultiSelectionBox( YWidget *parent, YWidgetOpt & opt,
- const YCPString & label );
+ //
+ // Visual Grouping
+ //
- /**
- * Creates a combo box
- */
- virtual YWidget * createComboBox( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label );
+ virtual NCFrame * createFrame ( YWidget * parent, const string & label );
+ virtual NCCheckBoxFrame * createCheckBoxFrame ( YWidget * parent, const string & label, bool checked );
- /**
- * Creates a tree
- */
- virtual YWidget * createTree( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label );
+ //
+ // Logical Grouping
+ //
- /**
- * Creates a table widget
- */
- virtual YWidget * createTable( YWidget * parent, YWidgetOpt & opt,
- vector<string> header );
+ virtual NCRadioButtonGroup *createRadioButtonGroup ( YWidget * parent );
+ virtual NCReplacePoint * createReplacePoint ( YWidget * parent );
- /**
- * Creates a progress bar
- */
- virtual YWidget * createProgressBar( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label,
- const YCPInteger & maxprogress,
- const YCPInteger & progress);
- /**
- * Creates an image widget from a YCP byteblock
- */
- virtual YWidget * createImage( YWidget * parent, YWidgetOpt & opt,
- YCPByteblock imagedata,
- YCPString defaulttext);
+protected:
- /**
- * Creates an image widget from a YCP byteblock
- */
- virtual YWidget * createImage( YWidget * parent, YWidgetOpt & opt,
- YCPString filename,
- YCPString defaulttext);
+ friend class NCUI;
/**
- * Creates an IntField widget.
- */
- virtual YWidget * createIntField( YWidget * parent, YWidgetOpt & opt,
- const YCPString & label,
- int minValue, int maxValue,
- int initialValue );
+ * Constructor.
+ *
+ * Use YUI::widgetFactory() to get the singleton for this class.
+ **/
+ NCWidgetFactory();
/**
- * Creates the PackageSelector widget (i.e. a widget tree).
- */
- virtual YWidget * createPackageSelector( YWidget *parent,
- YWidgetOpt &opt,
- const YCPString & floppyDevice );
+ * Destructory.
+ **/
+ virtual ~NCWidgetFactory();
-
- /**
- * Creates a special subwidget used for Package Selection (which doesn't exist in QT-UI).
- */
- virtual YWidget * createPkgSpecial( YWidget *parent,
- YWidgetOpt &opt,
- const YCPString &subwidget );
-
+}; // class NCWidgetFactory
-};
#endif // NCWidgetFactory_h
-
Modified: branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/YNC…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc Thu Jun 28 12:18:13 2007
@@ -66,6 +66,7 @@
#include "NCAskForFile.h"
#include "NCstring.h"
+
extern string language2encoding( string lang );
YNCursesUI::YNCursesUI( int argc, char **argv, bool with_threads, const char * macro_file )
@@ -119,6 +120,38 @@
YNCursesUI * YNCursesUI::_ui = 0;
+YWidgetFactory *
+YNCursesUI::createWidgetFactory()
+{
+ NCWidgetFactory * factory = new NCWidgetFactory();
+ YUI_CHECK_NEW( factory );
+
+ return factory;
+}
+
+
+
+YOptionalWidgetFactory *
+YNCursesUI::createOptionalWidgetFactory()
+{
+ NCOptionalWidgetFactory * factory = new NCOptionalWidgetFactory();
+ YUI_CHECK_NEW( factory );
+
+ return factory;
+}
+
+
+YApplication *
+YNCursesUI::createApplication()
+{
+ NCApplication * app = new NCApplication();
+ YUI_CHECK_NEW( app );
+
+ return app;
+}
+
+
+
/******************************************************************
**
**
Modified: branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/YNC…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.h Thu Jun 28 12:18:13 2007
@@ -27,6 +27,10 @@
#include "YUI.h"
#include "YSingleChildContainerWidget.h"
+#include "NCWidgetFactory.h"
+#include "NCOptionalWidgetFactory.h"
+#include "NCApplication.h"
+
#include "NCurses.h"
class YUI;
@@ -53,6 +57,30 @@
protected:
+ /**
+ * Create the widget factory that provides all the createXY() methods for
+ * standard (mandatory, i.e. non-optional) widgets.
+ *
+ * Reimplemented from YUI.
+ **/
+ virtual YWidgetFactory * createWidgetFactory();
+
+ /**
+ * Create the widget factory that provides all the createXY() methods for
+ * optional ("special") widgets and the corresponding hasXYWidget()
+ * methods.
+ *
+ * Reimplemented from YUI.
+ **/
+ virtual YOptionalWidgetFactory * createOptionalWidgetFactory();
+
+ /*
+ * Create the YApplication object that provides global methods.
+ *
+ * Reimplemented from YUI.
+ **/
+ virtual YApplication * createApplication();
+
virtual bool want_colors();
virtual void init_title();
Modified: branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/pkg…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.h Thu Jun 28 12:18:13 2007
@@ -46,6 +46,7 @@
class NCPkgPopupDiskspace;
class NCPkgPopupSearch;
class NCPkgPopupFile;
+class YNCursesUI;
///////////////////////////////////////////////////////////////////
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39069 - in /branches/tmp/dmacvicar/ruby-yast: CMakeLists.txt TODO package/ package/yast2-ruby-bindings.changes yast2-ruby-bindings.spec.in
by dmacvicar@svn.opensuse.org 28 Jun '07
by dmacvicar@svn.opensuse.org 28 Jun '07
28 Jun '07
Author: dmacvicar
Date: Thu Jun 28 11:50:07 2007
New Revision: 39069
URL: http://svn.opensuse.org/viewcvs/yast?rev=39069&view=rev
Log:
package builds
Added:
branches/tmp/dmacvicar/ruby-yast/package/
branches/tmp/dmacvicar/ruby-yast/package/yast2-ruby-bindings.changes
Modified:
branches/tmp/dmacvicar/ruby-yast/CMakeLists.txt
branches/tmp/dmacvicar/ruby-yast/TODO
branches/tmp/dmacvicar/ruby-yast/yast2-ruby-bindings.spec.in
Modified: branches/tmp/dmacvicar/ruby-yast/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/CMake…
==============================================================================
--- branches/tmp/dmacvicar/ruby-yast/CMakeLists.txt (original)
+++ branches/tmp/dmacvicar/ruby-yast/CMakeLists.txt Thu Jun 28 11:50:07 2007
@@ -1,4 +1,4 @@
-PROJECT(yast2-bindings)
+PROJECT(yast2-ruby-bindings)
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 -Wall -Woverloaded-virtual" )
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O3 -Wall" )
@@ -18,7 +18,7 @@
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
#SET(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules ${CMAKE_MODULE_PATH})
-SET( PACKAGE "yast2-bindings" )
+SET( PACKAGE "yast2-ruby-bindings" )
INCLUDE(${CMAKE_SOURCE_DIR}/VERSION.cmake)
SET ( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
@@ -70,7 +70,7 @@
# RPM SPEC #
####################################################################
MESSAGE(STATUS "Writing spec file...")
-CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/${PACKAGE}.spec.cmake ${CMAKE_BINARY_DIR}/package/${PACKAGE}.spec @ONLY)
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/${PACKAGE}.spec.in ${CMAKE_BINARY_DIR}/package/${PACKAGE}.spec @ONLY)
ADD_SUBDIRECTORY(src)
Modified: branches/tmp/dmacvicar/ruby-yast/TODO
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/TODO?…
==============================================================================
--- branches/tmp/dmacvicar/ruby-yast/TODO (original)
+++ branches/tmp/dmacvicar/ruby-yast/TODO Thu Jun 28 11:50:07 2007
@@ -0,0 +1,5 @@
+What is missing.
+
+- UI support
+- Conversion of some types from ruby to YCP like hash and arrays
+- handling of abort signal from the interpreter.
Added: branches/tmp/dmacvicar/ruby-yast/package/yast2-ruby-bindings.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/packa…
==============================================================================
(empty)
Modified: branches/tmp/dmacvicar/ruby-yast/yast2-ruby-bindings.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/yast2…
==============================================================================
--- branches/tmp/dmacvicar/ruby-yast/yast2-ruby-bindings.spec.in (original)
+++ branches/tmp/dmacvicar/ruby-yast/yast2-ruby-bindings.spec.in Thu Jun 28 11:50:07 2007
@@ -6,15 +6,16 @@
# norootforbuild
Name: yast2-ruby-bindings
-Version: 0.1
+Version: @VERSION@
Release: 0
License: GPL
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-ruby-bindings-0.1.tar.bz2
+Source0: yast2-ruby-bindings-%{version}.tar.bz2
prefix: /usr
-BuildRequires: cmake blocxx-devel curl-devel gcc-c++ libxcrypt-devel rpm-devel yast2-core-devel yast2-devtools libzypp-devel
+#BuildRequires: cmake blocxx-devel curl-devel gcc-c++ libxcrypt-devel rpm-devel yast2-core-devel yast2-devtools libzypp-devel
+BuildRequires: cmake blocxx-devel curl-devel gcc-c++ libxcrypt-devel rpm-devel yast2-core-devel yast2-devtools
# libzypp-devel is missing .la requires
BuildRequires: boost-devel dbus-1-devel hal-devel ruby-devel
Requires: yast2-core >= 2.13.28
@@ -41,12 +42,7 @@
%install
cd build
make install DESTDIR=$RPM_BUILD_ROOT
-#make -C doc/autodoc install DESTDIR=$RPM_BUILD_ROOT
-#%suse_update_desktop_file -G "" -C "" package-manager
-#make -C po install DESTDIR=$RPM_BUILD_ROOT
-# Create filelist with translatins
cd ..
-#rm $RPM_BUILD_ROOT/%{_libdir}/YaST2/plugin/libpy2lang_ruby.la
%clean
rm -rf "$RPM_BUILD_ROOT"
@@ -55,7 +51,8 @@
%files
%defattr (-, root, root)
-@YAST_PLUGIN_DIR@/libpy2lang_ruby.so.*
+#@YAST_PLUGIN_DIR@/libpy2lang_ruby.so.*
@YAST_PLUGIN_DIR@/libpy2lang_ruby.so
# libYCP goes elsewhere
-%{_libdir}/ruby/vendor_ruby/%{rb_ver}/%{rb_arch}/yast.so
+#%{_libdir}/ruby/vendor_ruby/%{rb_ver}/%{rb_arch}/yast.so
+%{_libdir}/ruby/%{rb_ver}/%{rb_arch}/yast.so
\ No newline at end of file
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39068 - in /branches/tmp/dmacvicar/ruby-yast: ./ examples/ruby/ src/
by dmacvicar@svn.opensuse.org 28 Jun '07
by dmacvicar@svn.opensuse.org 28 Jun '07
28 Jun '07
Author: dmacvicar
Date: Thu Jun 28 11:16:36 2007
New Revision: 39068
URL: http://svn.opensuse.org/viewcvs/yast?rev=39068&view=rev
Log:
prepare for packaging
Added:
branches/tmp/dmacvicar/ruby-yast/MAINTAINER
branches/tmp/dmacvicar/ruby-yast/TODO
branches/tmp/dmacvicar/ruby-yast/yast2-ruby-bindings.spec.in
Removed:
branches/tmp/dmacvicar/ruby-yast/extconf.rb
branches/tmp/dmacvicar/ruby-yast/myutils.rb
branches/tmp/dmacvicar/ruby-yast/ryast.h
branches/tmp/dmacvicar/ruby-yast/src/ryast.cpp
branches/tmp/dmacvicar/ruby-yast/test.rb
branches/tmp/dmacvicar/ruby-yast/test2.rb
Modified:
branches/tmp/dmacvicar/ruby-yast/CMakeLists.txt
branches/tmp/dmacvicar/ruby-yast/examples/ruby/Bar.rb
branches/tmp/dmacvicar/ruby-yast/examples/ruby/scr.rb
branches/tmp/dmacvicar/ruby-yast/src/CMakeLists.txt
Modified: branches/tmp/dmacvicar/ruby-yast/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/CMake…
==============================================================================
--- branches/tmp/dmacvicar/ruby-yast/CMakeLists.txt (original)
+++ branches/tmp/dmacvicar/ruby-yast/CMakeLists.txt Thu Jun 28 11:16:36 2007
@@ -70,7 +70,7 @@
# RPM SPEC #
####################################################################
MESSAGE(STATUS "Writing spec file...")
-#CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/${PACKAGE}.spec.cmake ${CMAKE_BINARY_DIR}/package/${PACKAGE}.spec @ONLY)
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/${PACKAGE}.spec.cmake ${CMAKE_BINARY_DIR}/package/${PACKAGE}.spec @ONLY)
ADD_SUBDIRECTORY(src)
Added: branches/tmp/dmacvicar/ruby-yast/MAINTAINER
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/MAINT…
==============================================================================
--- branches/tmp/dmacvicar/ruby-yast/MAINTAINER (added)
+++ branches/tmp/dmacvicar/ruby-yast/MAINTAINER Thu Jun 28 11:16:36 2007
@@ -0,0 +1,2 @@
+Duncan Mac-Vicar <dmacvicar(a)suse.de>
+
Added: branches/tmp/dmacvicar/ruby-yast/TODO
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/TODO?…
==============================================================================
(empty)
Modified: branches/tmp/dmacvicar/ruby-yast/examples/ruby/Bar.rb
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/examp…
==============================================================================
--- branches/tmp/dmacvicar/ruby-yast/examples/ruby/Bar.rb (original)
+++ branches/tmp/dmacvicar/ruby-yast/examples/ruby/Bar.rb Thu Jun 28 11:16:36 2007
@@ -3,6 +3,6 @@
module Bar
def self.try
m = YaST::Module.new("SCR")
- return m.Read(".proc.modules").class.to_s
+ return m.Execute(".target.bash", "firefox").class.to_s
end
end
Modified: branches/tmp/dmacvicar/ruby-yast/examples/ruby/scr.rb
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/examp…
==============================================================================
--- branches/tmp/dmacvicar/ruby-yast/examples/ruby/scr.rb (original)
+++ branches/tmp/dmacvicar/ruby-yast/examples/ruby/scr.rb Thu Jun 28 11:16:36 2007
@@ -1,5 +1,10 @@
require 'yast'
m = YaST::Module.new("SCR")
-puts m.bar
-exit
\ No newline at end of file
+modules = m.Read(".proc.modules")
+modules.each do | k, v |
+ puts "#{k}:"
+ v.each do | a, b |
+ puts " #{a} - #{b}"
+ end
+end
\ No newline at end of file
Modified: branches/tmp/dmacvicar/ruby-yast/src/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/src/C…
==============================================================================
--- branches/tmp/dmacvicar/ruby-yast/src/CMakeLists.txt (original)
+++ branches/tmp/dmacvicar/ruby-yast/src/CMakeLists.txt Thu Jun 28 11:16:36 2007
@@ -1,2 +1,2 @@
-ADD_SUBDIRECTORY(swig)
+#ADD_SUBDIRECTORY(swig)
ADD_SUBDIRECTORY(ruby)
\ No newline at end of file
Added: branches/tmp/dmacvicar/ruby-yast/yast2-ruby-bindings.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/yast2…
==============================================================================
--- branches/tmp/dmacvicar/ruby-yast/yast2-ruby-bindings.spec.in (added)
+++ branches/tmp/dmacvicar/ruby-yast/yast2-ruby-bindings.spec.in Thu Jun 28 11:16:36 2007
@@ -0,0 +1,61 @@
+
+
+#
+# spec file for package yast2-ruby-bindings (Version 0.1)
+#
+# norootforbuild
+
+Name: yast2-ruby-bindings
+Version: 0.1
+Release: 0
+License: GPL
+Group: System/YaST
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Source0: yast2-ruby-bindings-0.1.tar.bz2
+prefix: /usr
+
+BuildRequires: cmake blocxx-devel curl-devel gcc-c++ libxcrypt-devel rpm-devel yast2-core-devel yast2-devtools libzypp-devel
+# libzypp-devel is missing .la requires
+BuildRequires: boost-devel dbus-1-devel hal-devel ruby-devel
+Requires: yast2-core >= 2.13.28
+Requires: ruby
+Summary: -
+
+%description
+-
+
+%prep
+%setup -n yast2-ruby-bindings-%{version}
+%build
+mkdir build
+cd build
+cmake -DCMAKE_INSTALL_PREFIX=%{prefix} \
+ -DLIB=%{_lib} \
+ -DCMAKE_C_FLAGS="%{optflags}" \
+ -DCMAKE_CXX_FLAGS="%{optflags}" \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_SKIP_RPATH=1 \
+ ..
+make %{?jobs:-j %jobs}
+
+%install
+cd build
+make install DESTDIR=$RPM_BUILD_ROOT
+#make -C doc/autodoc install DESTDIR=$RPM_BUILD_ROOT
+#%suse_update_desktop_file -G "" -C "" package-manager
+#make -C po install DESTDIR=$RPM_BUILD_ROOT
+# Create filelist with translatins
+cd ..
+#rm $RPM_BUILD_ROOT/%{_libdir}/YaST2/plugin/libpy2lang_ruby.la
+
+%clean
+rm -rf "$RPM_BUILD_ROOT"
+
+@CLEAN@
+
+%files
+%defattr (-, root, root)
+@YAST_PLUGIN_DIR@/libpy2lang_ruby.so.*
+@YAST_PLUGIN_DIR@/libpy2lang_ruby.so
+# libYCP goes elsewhere
+%{_libdir}/ruby/vendor_ruby/%{rb_ver}/%{rb_arch}/yast.so
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39067 - /branches/tmp/sh/mod-ui/ncurses/src/NCRichText.cc
by gs@svn.opensuse.org 28 Jun '07
by gs@svn.opensuse.org 28 Jun '07
28 Jun '07
Author: gs
Date: Thu Jun 28 10:51:42 2007
New Revision: 39067
URL: http://svn.opensuse.org/viewcvs/yast?rev=39067&view=rev
Log:
fixed typo
Modified:
branches/tmp/sh/mod-ui/ncurses/src/NCRichText.cc
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCRichText.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCR…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCRichText.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCRichText.cc Thu Jun 28 10:51:42 2007
@@ -323,7 +323,7 @@
string ycpstr;
NCstring::RecodeFromWchar( anchors[armed].target, "UTF-8", &ycpstr );
NCMIL << "LINK: " << ycpstr << endl;
- YStringWidgetID * selectionID = new YCPStringWidgetID( ycpstr );
+ YStringWidgetID * selectionID = new YStringWidgetID( ycpstr );
//ret.selection = YCPString( ycpstr );
ret.selection = selectionID;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39066 - in /branches/tmp/sh/mod-ui/ncurses/src: ./ pkg/
by gs@svn.opensuse.org 28 Jun '07
by gs@svn.opensuse.org 28 Jun '07
28 Jun '07
Author: gs
Date: Thu Jun 28 10:51:04 2007
New Revision: 39066
URL: http://svn.opensuse.org/viewcvs/yast?rev=39066&view=rev
Log:
replace NCTextEntry by NCInputField
Modified:
branches/tmp/sh/mod-ui/ncurses/src/NCAskForDirectory.cc
branches/tmp/sh/mod-ui/ncurses/src/NCInputField.h
branches/tmp/sh/mod-ui/ncurses/src/NCIntField.cc
branches/tmp/sh/mod-ui/ncurses/src/NCMultiLineEdit.cc
branches/tmp/sh/mod-ui/ncurses/src/NCPopupInfo.cc
branches/tmp/sh/mod-ui/ncurses/src/NCPopupTextEntry.cc
branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc
branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc
branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.h
branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupDeps.cc
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCAskForDirectory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCA…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCAskForDirectory.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCAskForDirectory.cc Thu Jun 28 10:51:04 2007
@@ -256,17 +256,18 @@
postevent.detail = NCursesEvent::NODETAIL;
- YCPValue currentId = dynamic_cast<YWidget *>(postevent.widget)->id();
+ //YCPValue currentId = dynamic_cast<YWidget *>(postevent.widget)->id();
+ YWidgetID * currentId = dynamic_cast<YWidget *>(postevent.widget)->id();
- if ( !currentId.isNull() )
+ if ( currentId )
{
- if ( currentId->compare( YCPString(idOk->name()) ) == YO_EQUAL )
+ if ( currentId->toString() == idOk->name() )
{
postevent.result = YCPString( dirList->getCurrentDir() );
// return false means: close the popup
return false;
}
- else if ( currentId->compare( YCPString(idDirList->name()) ) == YO_EQUAL )
+ else if ( currentId->toString() == idDirList->name() )
{
unsigned int i = dirName->getListSize();
@@ -284,12 +285,12 @@
dirList->fillList();
}
}
- else if ( currentId->compare( YCPString(idDirName->name()) ) == YO_EQUAL )
+ else if ( currentId->toString() == idDirName->name() )
{
dirList->setStartDir( dirName->getValue() );
dirList->fillList();
}
- else if ( currentId->compare( YCPString(idDetails->name()) ) == YO_EQUAL )
+ else if ( currentId->toString() == idDetails->name() )
{
bool details = getCheckBoxValue( detailed );
if ( details )
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCInputField.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCI…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCInputField.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCInputField.h Thu Jun 28 10:51:04 2007
@@ -132,7 +132,7 @@
// limits the input to numberOfChars characters and truncates the text
// if appropriate
- void setInputMaxLength( const YCPInteger & numberOfChars);
+ void setInputMaxLength( int numberOfChars );
void setCurPos( unsigned pos ) { curpos = pos; }
};
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCIntField.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCI…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCIntField.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCIntField.cc Thu Jun 28 10:51:04 2007
@@ -410,7 +410,7 @@
string text( 1, (char )first);
NCPopupTextEntry dialog( at, label, text, vlen, 0,
- NCTextEntry::NUMBER );
+ NCInputField::NUMBER );
while ( dialog.post() != -1 ) {
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCMultiLineEdit.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCM…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCMultiLineEdit.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCMultiLineEdit.cc Thu Jun 28 10:51:04 2007
@@ -68,7 +68,7 @@
int NCMultiLineEdit::preferredWidth()
{
- defsze.W = ( 5 > labelWidht() ? 5 : labelWidht() ) + 2
+ defsze.W = ( 5 > labelWidht() ? 5 : labelWidht() ) + 2;
return wGetDefsze().W;
}
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPopupInfo.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCP…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCPopupInfo.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCPopupInfo.cc Thu Jun 28 10:51:04 2007
@@ -25,6 +25,8 @@
#include "NCSplit.h"
#include "NCSpacing.h"
+#include "YWidgetID.h"
+
namespace
{
const YCPTerm idOk( "ok" );
@@ -88,8 +90,9 @@
addChild( split );
// add the headline
- opt.isHeading.setValue( true );
- NCLabel * head = new NCLabel( split, opt, headline );
+ // opt.isHeading.setValue( true );
+ //NCLabel * head = new NCLabel( split, opt, headline );
+ NCLabel * head = new NCLabel( split, headline->toString(), true, false ); // isHeading = true
split->addChild( head );
// add the rich text widget
@@ -101,30 +104,35 @@
if ( okButtonLabel != "" && cancelButtonLabel != "" )
{
opt.isHStretchable.setValue( true );
- hSplit->addChild( new NCSpacing( hSplit, opt, 0.4, true, false ) );
+ //hSplit->addChild( new NCSpacing( hSplit, opt, 0.4, true, false ) );
+ hSplit->addChild( new NCSpacing( hSplit, YD_HORIZ, true, 0.4 ) ); // stretchable = true
}
if ( okButtonLabel != "" )
{
opt.key_Fxx.setValue( 10 );
// add the OK button
- okButton = new NCPushButton( hSplit, opt, YCPString(okButtonLabel) );
- okButton->setId( YCPString(idOk->name()) );
+ okButton = new NCPushButton( hSplit, okButtonLabel );
+ YStringWidgetID * okID = new YStringWidgetID (idOk->name() );
+ okButton->setId( okID );
hSplit->addChild( okButton );
}
if ( cancelButtonLabel != "" )
{
- hSplit->addChild( new NCSpacing( hSplit, opt, 0.4, true, false ) );
+ //hSplit->addChild( new NCSpacing( hSplit, opt, 0.4, true, false ) );
+ hSplit->addChild( new NCSpacing( hSplit, YD_HORIZ, true, 0.4 ) );
opt.key_Fxx.setValue( 9 );
// add the Cancel button
- cancelButton = new NCPushButton( hSplit, opt, YCPString(cancelButtonLabel) );
- cancelButton->setId( YCPString(idCancel->name()) );
+ cancelButton = new NCPushButton( hSplit, cancelButtonLabel );
+ YStringWidgetID * cancelID = new YStringWidgetID( cancelButtonLabel );
+ cancelButton->setId( cancelID );
hSplit->addChild( cancelButton );
- hSplit->addChild( new NCSpacing( hSplit, opt, 0.4, true, false ) );
+ //hSplit->addChild( new NCSpacing( hSplit, opt, 0.4, true, false ) );
+ hSplit->addChild( new NCSpacing( hSplit, YD_HORIZ, true, 0.4 ) );
}
}
@@ -219,10 +227,10 @@
if ( okButton && cancelButton )
{
- YCPValue currentId = dynamic_cast<YWidget *>(postevent.widget)->id();
+ YWidgetID * currentId = dynamic_cast<YWidget *>(postevent.widget)->id();
- if ( !currentId.isNull()
- && currentId->compare( YCPString(idCancel->name()) ) == YO_EQUAL )
+ if ( currentId
+ && currentId->toString() == idCancel->name() )
{
// close the dialog
postevent = NCursesEvent::cancel;
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPopupTextEntry.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCP…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCPopupTextEntry.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCPopupTextEntry.cc Thu Jun 28 10:51:04 2007
@@ -38,9 +38,10 @@
{
YWidgetOpt opt;
//opt.notifyMode.setValue( true );
- wtext = new NCTextEntry( this, opt,
- label, text,
- maxInput, maxFld );
+ wtext = new NCTextEntry( this,
+ label->toString(),
+ false // passwordMode = false
+ );
wtext->setFldtype( t );
wtext->setReturnOnReturn( true );
addChild( wtext );
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCW…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc Thu Jun 28 10:51:04 2007
@@ -53,7 +53,7 @@
#include "NCSplit.h"
#include "NCSquash.h"
#include "NCTable.h"
-#include "NCTextEntry.h"
+#include "NCInputField.h"
#include "NCIntField.h"
#include "NCComboBox.h"
#include "NCTree.h"
@@ -215,13 +215,13 @@
label, checked );
}
-YWidget * YNCursesUI::createTextEntry( YWidget * parent,
+YWidget * YNCursesUI::createInputField( YWidget * parent,
const string & label,
bool passwordMode )
{
ONCREATE;
- return new NCTextEntry( dynamic_cast<NCWidget *>( parent ),
- label, passwordMode );
+ return new NCInputField( dynamic_cast<NCWidget *>( parent ),
+ label, passwordMode );
}
YWidget *YNCursesUI::createMultiLineEdit( YWidget * parent, YWidgetOpt & opt,
Modified: branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/YNC…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc Thu Jun 28 10:51:04 2007
@@ -54,7 +54,7 @@
#include "NCSplit.h"
#include "NCSquash.h"
#include "NCTable.h"
-#include "NCTextEntry.h"
+#include "NCInputField.h"
#include "NCIntField.h"
#include "NCComboBox.h"
#include "NCTree.h"
@@ -474,13 +474,13 @@
label, checked );
}
-YWidget * YNCursesUI::createTextEntry( YWidget * parent,
+YWidget * YNCursesUI::createInputField( YWidget * parent,
const string & label,
bool passwordMode )
{
ONCREATE;
- return new NCTextEntry( dynamic_cast<NCWidget *>( parent ),
- label, passwordMode );
+ return new NCInputField( dynamic_cast<NCWidget *>( parent ),
+ label, passwordMode );
}
YWidget *YNCursesUI::createMultiLineEdit( YWidget * parent, YWidgetOpt & opt,
Modified: branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/YNC…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.h Thu Jun 28 10:51:04 2007
@@ -238,9 +238,9 @@
/**
* Creates a text entry or password entry field.
*/
- virtual YWidget * createTextEntry( YWidget * parent,
- const string & label,
- bool passwordMode );
+ virtual YWidget * createInputField( YWidget * parent,
+ const string & label,
+ bool passwordMode );
/**
* Creates a selection box
Modified: branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupDeps.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/pkg…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupDeps.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupDeps.cc Thu Jun 28 10:51:04 2007
@@ -151,10 +151,12 @@
//vSplit->addChild( new NCSpacing( vSplit, opt, 0.2, false, true ) );
vSplit->addChild( new NCSpacing( vSplit, YD_VERT, true, 0.2 ) ); // stretchable = true
- details = new NCTextEntry( vSplit, opt,
- YCPString( "" ), YCPString( "" ),
- 200, 200 );
-
+ details = new NCTextEntry( vSplit,
+ "", false );
+ details->setInputMaxLength( 200 );
+ // FIXME
+ //details->setMaxFld( 200 );
+
vSplit->addChild( details );
//vSplit->addChild( new NCSpacing( vSplit, opt, 0.8, false, true ) );
vSplit->addChild( new NCSpacing( vSplit, YD_VERT, true, 0.8 ) ); // stretchable = true
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39065 - in /branches/tmp/sh/mod-ui/ncurses/src: NCApplication.cc NCApplication.h NCOptionalWidgetFactory.cc NCOptionalWidgetFactory.h NCWidgetFactory.cc NCWidgetFactory.h
by gs@svn.opensuse.org 28 Jun '07
by gs@svn.opensuse.org 28 Jun '07
28 Jun '07
Author: gs
Date: Thu Jun 28 10:43:58 2007
New Revision: 39065
URL: http://svn.opensuse.org/viewcvs/yast?rev=39065&view=rev
Log:
add new classes for widget factory
Added:
branches/tmp/sh/mod-ui/ncurses/src/NCApplication.cc
branches/tmp/sh/mod-ui/ncurses/src/NCApplication.h
branches/tmp/sh/mod-ui/ncurses/src/NCOptionalWidgetFactory.cc
branches/tmp/sh/mod-ui/ncurses/src/NCOptionalWidgetFactory.h
branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc
branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.h
Added: branches/tmp/sh/mod-ui/ncurses/src/NCApplication.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCA…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCApplication.cc (added)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCApplication.cc Thu Jun 28 10:43:58 2007
@@ -0,0 +1,34 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: NCApplication.cc
+
+ Author: Gabriele Mohr <gs(a)suse.de>
+
+/-*/
+
+
+#include "NCApplication.h"
+
+
+NCApplication::NCApplication()
+{
+
+}
+
+
+NCApplication::~NCApplication()
+{
+
+}
+
+
Added: branches/tmp/sh/mod-ui/ncurses/src/NCApplication.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCA…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCApplication.h (added)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCApplication.h Thu Jun 28 10:43:58 2007
@@ -0,0 +1,47 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: NCApplication.h
+
+ Author: Gabriele Mohr <gs(a)suse.de>
+
+/-*/
+
+
+#ifndef NCApplication_h
+#define NCApplication_h
+
+#include "YApplication.h"
+
+
+class NCApplication: public YApplication
+{
+
+protected:
+
+ friend class YNCursesUI;
+
+ /**
+ * Constructor.
+ *
+ * Use YUI::app() to get the singleton for this class.
+ **/
+ NCApplication();
+
+ /**
+ * Destructor.
+ **/
+ virtual ~NCApplication();
+};
+
+
+#endif // NCApplication_h
Added: branches/tmp/sh/mod-ui/ncurses/src/NCOptionalWidgetFactory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCO…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCOptionalWidgetFactory.cc (added)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCOptionalWidgetFactory.cc Thu Jun 28 10:43:58 2007
@@ -0,0 +1,42 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: NCOptionalWidgetFactory.cc
+
+ Author: Gabriele Mohr <gs(a)suse.de>
+
+/-*/
+
+#include "NCOptionalWidgetFactory.h"
+#include "YUIException.h"
+
+
+#define THROW_UNSUPPORTED( WIDGET_TYPE ) \
+ YUI_THROW( YUIUnsupportedWidgetException( WIDGET_TYPE ) ); \
+ return 0
+
+
+
+NCOptionalWidgetFactory::NCOptionalWidgetFactory()
+ : YOptionalWidgetFactory()
+{
+ // NOP
+}
+
+NCOptionalWidgetFactory::~NCOptionalWidgetFactory()
+{
+ // NOP
+}
+
+
+
+
Added: branches/tmp/sh/mod-ui/ncurses/src/NCOptionalWidgetFactory.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCO…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCOptionalWidgetFactory.h (added)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCOptionalWidgetFactory.h Thu Jun 28 10:43:58 2007
@@ -0,0 +1,63 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: NCOptionalWidgetFactory.h
+
+ Author: Gabriele Mohr <gs(a)suse.de>
+
+/-*/
+
+#ifndef NCOptionalWidgetFactory_h
+#define NCOptionalWidgetFactory_h
+
+
+#include "YOptionalWidgetFactory.h"
+
+
+/**
+ * Widget factory for optional ("special") widgets.
+ *
+ * Remember to always check with the corresponding "has..()" method if the
+ * current UI actually provides the requested widget. Otherwise the
+ * "create...()" method will throw an exception.
+ **/
+class NCOptionalWidgetFactory: public YOptionalWidgetFactory
+{
+public:
+
+ //
+ // Optional Widgets
+ //
+
+ // PkgSpecial()
+
+protected:
+
+ friend class YNCursesUI;
+
+ /**
+ * Constructor.
+ *
+ * Use YUI::optionalWidgetFactory() to get the singleton for this class.
+ **/
+ NCOptionalWidgetFactory();
+
+ /**
+ * Destructor.
+ **/
+ virtual ~NCOptionalWidgetFactory();
+
+}; // class NCOptionalWidgetFactory
+
+
+
+#endif // NCOptionalWidgetFactory_h
Added: branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCW…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc (added)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.cc Thu Jun 28 10:43:58 2007
@@ -0,0 +1,395 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: NCWidgetFactory.cc
+
+ Author: Gabriele Mohr <gs(a)suse.de>
+
+/-*/
+
+#include "NCWidgetFactory.h"
+#include <string>
+#include <sys/time.h>
+#include <unistd.h>
+
+#include "Y2Log.h"
+#include <YEvent.h>
+#include "YDialog.h"
+
+#include <ycp/y2log.h>
+#include <ycp/Parser.h>
+#include <ycp/YCPString.h>
+#include <ycp/YCPVoid.h>
+#include <ycp/YCPMap.h>
+#include <yui/YUI.h>
+
+#include "NCDialog.h"
+#include "NCAlignment.h"
+#include "NCCheckBox.h"
+#include "NCEmpty.h"
+#include "NCSpacing.h"
+#include "NCFrame.h"
+#include "NCCheckBoxFrame.h"
+#include "NCImage.h"
+#include "NCLabel.h"
+#include "NCProgressBar.h"
+#include "NCPushButton.h"
+#include "NCMenuButton.h"
+#include "NCRadioButton.h"
+#include "NCRadioButtonGroup.h"
+#include "NCReplacePoint.h"
+#include "NCRichText.h"
+#include "NCSelectionBox.h"
+#include "NCMultiSelectionBox.h"
+#include "NCSplit.h"
+#include "NCSquash.h"
+#include "NCTable.h"
+#include "NCTextEntry.h"
+#include "NCIntField.h"
+#include "NCComboBox.h"
+#include "NCTree.h"
+#include "NCLogView.h"
+#include "NCMultiLineEdit.h"
+#include "NCPackageSelectorPlugin.h"
+#include "NCPackageSelectorStart.h"
+#include "NCAskForDirectory.h"
+#include "NCAskForFile.h"
+#include "NCstring.h"
+
+extern string language2encoding( string lang );
+
+NCWidgetFactory::NCWidgetFactory( )
+ : YWidgetFactory ()
+{
+ // NOP
+}
+
+NCWidgetFactory::~NCWidgetFactory()
+{
+ // NOP
+}
+
+
+///////////////////////////////////////////////////////////////////
+//
+// Widget creation functions - container widgets
+//
+///////////////////////////////////////////////////////////////////
+
+//#define ONCREATE WIDDBG << endl
+#define ONCREATE
+
+YContainerWidget * YNCursesUI::createSplit( YWidget * parent, YWidgetOpt & opt,
+ YUIDimension dimension )
+{
+ ONCREATE;
+ return new NCSplit( dynamic_cast<NCWidget *>( parent ), opt,
+ dimension );
+}
+
+YSingleChildContainerWidget * YNCursesUI::createReplacePoint( YWidget * parent )
+{
+ ONCREATE;
+ return new NCReplacePoint( dynamic_cast<NCWidget *>( parent ) );
+}
+
+YSingleChildContainerWidget * YNCursesUI::createAlignment( YWidget * parent,
+ YAlignmentType halign,
+ YAlignmentType valign )
+{
+ ONCREATE;
+ return new NCAlignment( dynamic_cast<NCWidget *>( parent ),
+ halign, valign );
+}
+
+YSingleChildContainerWidget * YNCursesUI::createSquash( YWidget * parent,
+ bool hsquash,
+ bool vsquash )
+{
+ ONCREATE;
+ return new NCSquash( dynamic_cast<NCWidget *>( parent ),
+ hsquash, vsquash );
+}
+
+YSingleChildContainerWidget * YNCursesUI::createFrame( YWidget * parent,
+ const string & label )
+{
+ ONCREATE;
+ return new NCFrame( dynamic_cast<NCWidget *>( parent ), label );
+}
+
+YSingleChildContainerWidget * YNCursesUI::createCheckBoxFrame( YWidget * parent,
+ const string & label, bool checked )
+{
+ ONCREATE;
+ return new NCCheckBoxFrame( dynamic_cast<NCWidget *>( parent ), label, checked );
+}
+
+///////////////////////////////////////////////////////////////////
+//
+// Widget creation functions - leaf widgets
+//
+///////////////////////////////////////////////////////////////////
+
+YWidget * YNCursesUI::createEmpty( YWidget * parent )
+{
+ ONCREATE;
+ return new NCEmpty( dynamic_cast<NCWidget *>( parent ) );
+}
+
+
+YWidget * YNCursesUI::createSpacing( YWidget * parent,
+ YUIDimension dim,
+ bool stretchable,
+ YLayoutSize_t layoutUnits )
+{
+ ONCREATE;
+ return new NCSpacing( dynamic_cast<NCWidget *>( parent ), dim,
+ stretchable, layoutUnits );
+}
+
+YWidget * YNCursesUI::createLabel( YWidget * parent, const string & text,
+ bool isHeading, bool isOutputField )
+{
+ ONCREATE;
+ return new NCLabel( dynamic_cast<NCWidget *>( parent ), text,
+ isHeading, isOutputField );
+}
+
+YWidget * YNCursesUI::createRichText( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & text )
+{
+ ONCREATE;
+ return new NCRichText( dynamic_cast<NCWidget *>( parent ), opt,
+ text );
+}
+
+YWidget * YNCursesUI::createLogView( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label,
+ int visibleLines,
+ int maxLines )
+{
+ ONCREATE;
+ return new NCLogView( dynamic_cast<NCWidget *>( parent ), opt,
+ label, visibleLines, maxLines );
+}
+
+YWidget * YNCursesUI::createPushButton( YWidget * parent,
+ const string & label )
+{
+ ONCREATE;
+ return new NCPushButton( dynamic_cast<NCWidget *>( parent ), label );
+}
+
+YWidget * YNCursesUI::createMenuButton( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label )
+{
+ ONCREATE;
+ return new NCMenuButton( dynamic_cast<NCWidget *>( parent ), opt,
+ label );
+}
+
+YWidget * YNCursesUI::createRadioButton( YWidget * parent,
+ const string & label )
+{
+ ONCREATE;
+ return new NCRadioButton( dynamic_cast<NCWidget *>( parent ),
+ label );
+}
+
+YWidget * YNCursesUI::createCheckBox( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label,
+ bool checked )
+{
+ ONCREATE;
+ return new NCCheckBox( dynamic_cast<NCWidget *>( parent ), opt,
+ label, checked );
+}
+
+YWidget * YNCursesUI::createTextEntry( YWidget * parent,
+ const string & label,
+ bool passwordMode )
+{
+ ONCREATE;
+ return new NCTextEntry( dynamic_cast<NCWidget *>( parent ),
+ label, passwordMode );
+}
+
+YWidget *YNCursesUI::createMultiLineEdit( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label,
+ const YCPString & initialText )
+{
+ ONCREATE;
+ return new NCMultiLineEdit( dynamic_cast<NCWidget *>( parent ), opt,
+ label, initialText );
+}
+
+YWidget * YNCursesUI::createSelectionBox( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label )
+{
+ ONCREATE;
+ return new NCSelectionBox( dynamic_cast<NCWidget *>( parent ), opt,
+ label );
+}
+
+YWidget * YNCursesUI::createMultiSelectionBox( YWidget *parent, YWidgetOpt & opt,
+ const YCPString & label )
+{
+ ONCREATE;
+ return new NCMultiSelectionBox( dynamic_cast<NCWidget *>( parent ), opt,
+ label );
+}
+
+YWidget * YNCursesUI::createComboBox( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label )
+{
+ ONCREATE;
+ return new NCComboBox( dynamic_cast<NCWidget *>( parent ), opt,
+ label );
+}
+
+YWidget * YNCursesUI::createTree( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label )
+{
+ ONCREATE;
+ return new NCTree( dynamic_cast<NCWidget *>( parent ), opt,
+ label );
+}
+
+YWidget * YNCursesUI::createTable( YWidget * parent, YWidgetOpt & opt,
+ vector<string> header )
+{
+ ONCREATE;
+ return new NCTable( dynamic_cast<NCWidget *>( parent ), opt,
+ header, true );
+}
+
+YWidget * YNCursesUI::createProgressBar( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label,
+ const YCPInteger & maxprogress,
+ const YCPInteger & progress )
+{
+ ONCREATE;
+ return new NCProgressBar( dynamic_cast<NCWidget *>( parent ), opt,
+ label, maxprogress, progress );
+}
+
+YWidget * YNCursesUI::createImage( YWidget * parent, YWidgetOpt & opt,
+ YCPByteblock /* not used */,
+ YCPString defaulttext )
+{
+ ONCREATE;
+ return new NCImage( dynamic_cast<NCWidget *>( parent ), opt,
+ defaulttext );
+}
+
+YWidget * YNCursesUI::createImage( YWidget * parent, YWidgetOpt & opt,
+ YCPString /* not used */,
+ YCPString defaulttext )
+{
+ ONCREATE;
+ return new NCImage( dynamic_cast<NCWidget *>( parent ), opt,
+ defaulttext );
+}
+
+
+YWidget * YNCursesUI::createIntField( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label,
+ int minValue, int maxValue,
+ int initialValue )
+{
+ ONCREATE;
+ return new NCIntField( dynamic_cast<NCWidget *>( parent ), opt,
+ label, minValue, maxValue, initialValue );
+}
+
+///////////////////////////////////////////////////////////////////
+//
+// package selection
+//
+///////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : YNCursesUI::packageSelectorPlugin()
+// METHOD TYPE : NCPackageSelectorPlugin
+//
+// DESCRIPTION : Create the package selector plugin
+//
+NCPackageSelectorPlugin * YNCursesUI::packageSelectorPlugin()
+{
+ static NCPackageSelectorPlugin * plugin = 0;
+
+ if ( ! plugin )
+ {
+ plugin = new NCPackageSelectorPlugin();
+
+ // This is a deliberate memory leak: If an application requires a
+ // PackageSelector, it is a package selection application by
+ // definition. In this case, the ncurses_pkg plugin is intentionally
+ // kept open to avoid repeated start-up cost of the plugin and libzypp.
+ }
+
+ return plugin;
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : YNCursesUI::createPackageSelector
+// METHOD TYPE : YWidget
+//
+// DESCRIPTION : Calls NCPackageSelectorPlugin::createPackageSelector
+//
+YWidget * YNCursesUI::createPackageSelector( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & floppyDevice )
+{
+ ONCREATE;
+ YWidget * w = 0;
+
+ NCPackageSelectorPlugin * plugin = packageSelectorPlugin();
+
+ if ( plugin )
+ {
+ w = plugin->createPackageSelector( parent, opt );
+ }
+
+ return w;
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : YNCursesUI::createPkgSpecial
+// METHOD TYPE : YWidget
+//
+// DESCRIPTION : creates special widgets used for the package selection
+// dialog (which do not have a corresponding widget in qt-ui)
+//
+YWidget * YNCursesUI::createPkgSpecial( YWidget *parent, YWidgetOpt &opt, const YCPString &subwidget )
+{
+ ONCREATE;
+ YWidget * w = 0;
+
+ NCPackageSelectorPlugin * plugin = packageSelectorPlugin();
+
+ if ( plugin )
+ {
+ w = plugin->createPkgSpecial( parent, opt, subwidget );
+ }
+
+ return w;
+}
+
+
Added: branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCW…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.h (added)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCWidgetFactory.h Thu Jun 28 10:43:58 2007
@@ -0,0 +1,264 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: NCWidgetFactory.h
+
+ Author: Gabriele Mohr <@suse.de>
+
+/-*/
+
+
+#ifndef NCWidgetFactory_h
+#define NCWidgetFactory_h
+
+#include "YWidgetFactory.h"
+
+
+/**
+ * @short YaST2 Component: NCursesUI Widget Factory
+ * Concrete widget factory for mandatory widgets.
+ */
+class NCWidgetFactory : public YWidgetFactory
+{
+ protected:
+
+ friend class NCursesUI;
+
+ /**
+ * Constructor.
+ *
+ * Use YUI::widgetFactory() to get the singleton for this class.
+ **/
+ NCWidgetFactory();
+
+ /**
+ * Destructory.
+ **/
+ virtual ~NCWidgetFactory();
+
+public:
+
+ //
+ // Widget creation functions - container widgets
+ //
+
+ /**
+ * Creates a split
+ */
+ virtual YContainerWidget * createSplit( YWidget * parent, YWidgetOpt & opt,
+ YUIDimension dimension );
+
+ /**
+ * Creates a replace point.
+ */
+ virtual YSingleChildContainerWidget * createReplacePoint( YWidget * parent );
+
+ /**
+ * Creates an alignment widget
+ */
+ virtual YSingleChildContainerWidget * createAlignment( YWidget * parent,
+ YAlignmentType halign,
+ YAlignmentType valign);
+
+ /**
+ * Creates a squash widget
+ */
+ virtual YSingleChildContainerWidget * createSquash( YWidget * parent,
+ bool hsquash,
+ bool vsquash );
+
+ /**
+ * Creates a radio button group.
+ */
+ // virtual YContainerWidget * createRadioButtonGroup( YWidget * parent, YWidgetOpt & opt );
+
+ /**
+ * Creates a frame widget
+ */
+ virtual YSingleChildContainerWidget * createFrame( YWidget * parent,
+ const string & label );
+
+ virtual YSingleChildContainerWidget * createCheckBoxFrame( YWidget * parent,
+ const string & label,
+ bool checked );
+ //
+ // Widget creation functions - leaf widgets
+ //
+
+ /**
+ * Creates an empty widget
+ */
+ virtual YWidget * createEmpty( YWidget * parent );
+
+ /**
+ * Creates a spacing widget
+ */
+ virtual YWidget * createSpacing( YWidget * parent,
+ YUIDimension dim,
+ bool stretchable,
+ YLayoutSize_t layoutUnits );
+
+ /**
+ * Creates a label.
+ * @param text Initial text of the label
+ * @param heading true if the label is a Heading()
+ * @param output_field true if the label should look like an output field (3D look)
+ */
+ virtual YWidget * createLabel( YWidget * parent, const string & text,
+ bool isHeading, bool isOutputField );
+
+ /**
+ * Creates a rich text widget
+ * @param text Initial text of the label
+ */
+ virtual YWidget * createRichText( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & text );
+
+ /**
+ * Creates a log view widget
+ * @param label label above the log view
+ * @param visibleLines default number of vislible lines
+ * @param maxLines number of lines to store (use 0 for "all")
+ */
+ virtual YWidget * createLogView( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label,
+ int visibleLines,
+ int maxLines );
+
+ /**
+ * Creates a MultiLineEdit widget
+ * @param label label above the edit field
+ * @param text initial contents of the edit field
+ */
+ virtual YWidget * createMultiLineEdit( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label,
+ const YCPString & text);
+
+ /**
+ * Creates a push button.
+ * @param label Label of the button
+ * @param default_button true if the button should be the dialogs default button
+ */
+ virtual YWidget * createPushButton( YWidget * parent,
+ const string & label );
+
+ /**
+ * Creates a menu button.
+ * @param label Label of the button
+ */
+ virtual YWidget * createMenuButton( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label );
+
+ /**
+ * Creates a radio button and inserts it into a radio button group
+ * @param label Label of the radio button
+ * @param rbg the radio button group the new button will belong to
+ */
+ virtual YWidget * createRadioButton( YWidget * parent,
+ const string & label );
+
+ /**
+ * Creates a check box
+ * @param label Label of the checkbox
+ * @param true if it is checked
+ */
+ virtual YWidget * createCheckBox( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label,
+ bool checked );
+
+ /**
+ * Creates a text entry or password entry field.
+ */
+ virtual YWidget * createTextEntry( YWidget * parent,
+ const string & label,
+ bool passwordMode );
+
+ /**
+ * Creates a selection box
+ */
+ virtual YWidget * createSelectionBox( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label );
+
+ /**
+ * Creates a multi selection box
+ */
+ virtual YWidget * createMultiSelectionBox( YWidget *parent, YWidgetOpt & opt,
+ const YCPString & label );
+
+ /**
+ * Creates a combo box
+ */
+ virtual YWidget * createComboBox( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label );
+
+ /**
+ * Creates a tree
+ */
+ virtual YWidget * createTree( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label );
+
+ /**
+ * Creates a table widget
+ */
+ virtual YWidget * createTable( YWidget * parent, YWidgetOpt & opt,
+ vector<string> header );
+
+ /**
+ * Creates a progress bar
+ */
+ virtual YWidget * createProgressBar( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label,
+ const YCPInteger & maxprogress,
+ const YCPInteger & progress);
+
+ /**
+ * Creates an image widget from a YCP byteblock
+ */
+ virtual YWidget * createImage( YWidget * parent, YWidgetOpt & opt,
+ YCPByteblock imagedata,
+ YCPString defaulttext);
+
+ /**
+ * Creates an image widget from a YCP byteblock
+ */
+ virtual YWidget * createImage( YWidget * parent, YWidgetOpt & opt,
+ YCPString filename,
+ YCPString defaulttext);
+
+ /**
+ * Creates an IntField widget.
+ */
+ virtual YWidget * createIntField( YWidget * parent, YWidgetOpt & opt,
+ const YCPString & label,
+ int minValue, int maxValue,
+ int initialValue );
+
+ /**
+ * Creates the PackageSelector widget (i.e. a widget tree).
+ */
+ virtual YWidget * createPackageSelector( YWidget *parent,
+ YWidgetOpt &opt,
+ const YCPString & floppyDevice );
+
+
+ /**
+ * Creates a special subwidget used for Package Selection (which doesn't exist in QT-UI).
+ */
+ virtual YWidget * createPkgSpecial( YWidget *parent,
+ YWidgetOpt &opt,
+ const YCPString &subwidget );
+
+
+};
+
+#endif // NCWidgetFactory_h
+
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39064 - /branches/tmp/sh/mod-ui/ncurses/src/Makefile.am
by gs@svn.opensuse.org 28 Jun '07
by gs@svn.opensuse.org 28 Jun '07
28 Jun '07
Author: gs
Date: Thu Jun 28 10:27:33 2007
New Revision: 39064
URL: http://svn.opensuse.org/viewcvs/yast?rev=39064&view=rev
Log:
add new classes
Modified:
branches/tmp/sh/mod-ui/ncurses/src/Makefile.am
Modified: branches/tmp/sh/mod-ui/ncurses/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/Mak…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/Makefile.am (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/Makefile.am Thu Jun 28 10:27:33 2007
@@ -33,6 +33,10 @@
tnode.h \
position.h \
YNCursesUI.h \
+ NCApplication.h \
+ NCWidgetFactory.h \
+ NCOptionalWidgetFactory.h \
+ \
NCPackageSelectorPlugin.h \
NCPackageSelectorStart.h \
NCPkgTable.h \
@@ -68,7 +72,7 @@
NCMenuButton.h \
NCPushButton.h \
NCRadioButton.h \
- NCTextEntry.h \
+ NCInputField.h \
NCIntField.h \
NCComboBox.h \
NCPadWidget.h \
@@ -98,6 +102,9 @@
Y2Log.cc \
position.cc \
YNCursesUI.cc \
+ NCApplication.cc \
+ NCWidgetFactory.cc \
+ NCOptionalWidgetFactory.cc \
\
NCPackageSelectorPlugin.cc \
NCPackageSelectorStart.cc \
@@ -136,7 +143,7 @@
NCMenuButton.cc \
NCPushButton.cc \
NCRadioButton.cc \
- NCTextEntry.cc \
+ NCInputField.cc \
NCIntField.cc \
NCComboBox.cc \
NCPadWidget.cc \
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39063 - in /branches/tmp/sh/mod-ui/ncurses/src: NCInputField.cc NCInputField.h
by gs@svn.opensuse.org 28 Jun '07
by gs@svn.opensuse.org 28 Jun '07
28 Jun '07
Author: gs
Date: Thu Jun 28 10:07:31 2007
New Revision: 39063
URL: http://svn.opensuse.org/viewcvs/yast?rev=39063&view=rev
Log:
widget NCTextEntry is renamed to NCInputField
Added:
branches/tmp/sh/mod-ui/ncurses/src/NCInputField.cc
branches/tmp/sh/mod-ui/ncurses/src/NCInputField.h
Added: branches/tmp/sh/mod-ui/ncurses/src/NCInputField.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCI…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCInputField.cc (added)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCInputField.cc Thu Jun 28 10:07:31 2007
@@ -0,0 +1,665 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: NCInputField.cc
+
+ Author: Michael Andres <ma(a)suse.de>
+ Maintainer: Michael Andres <ma(a)suse.de>
+
+/-*/
+#include <climits>
+
+#include "Y2Log.h"
+#include "NCurses.h"
+#include "NCInputField.h"
+
+#include <wctype.h> // iswalnum()
+
+#if 0
+#undef DBG_CLASS
+#define DBG_CLASS "_NCInputField_"
+#endif
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::NCInputField
+// METHOD TYPE : Constructor
+//
+// DESCRIPTION :
+//
+NCInputField::NCInputField( NCWidget * parent,
+ const string & nlabel,
+ bool passwordMode )
+ : YInputField( dynamic_cast<YWidget *>(parent), nlabel, passwordMode )
+ , NCWidget( parent )
+ , mayedit( true )
+ , passwd( passwordMode )
+ , lwin( 0 )
+ , twin( 0 )
+ , maxFldLength ( 0 )
+ , maxInputLength( 0 )
+ , fldstart ( 0 )
+ , fldlength( 0 )
+ , curpos ( 0 )
+ , fldtype ( PLAIN )
+ , returnOnReturn_b( false )
+ , InputMaxLength( -1 )
+{
+ WIDDBG << endl;
+ if ( maxInputLength &&
+ ( !maxFldLength || maxFldLength > maxInputLength ) ) {
+ maxFldLength = maxInputLength;
+ }
+#if 0
+ if ( opt.isEditable.defined() )
+ mayedit = opt.isEditable.value();
+#endif
+ setLabel( nlabel );
+ hotlabel = &label;
+ // not longer on params
+ //setText( ntext );
+
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::~NCInputField
+// METHOD TYPE : Destructor
+//
+// DESCRIPTION :
+//
+NCInputField::~NCInputField()
+{
+ delete lwin;
+ delete twin;
+ WIDDBG << endl;
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::nicesize
+// METHOD TYPE : long
+//
+// DESCRIPTION :
+//
+long NCInputField::nicesize( YUIDimension dim )
+{
+ return dim == YD_HORIZ ? wGetDefsze().W : wGetDefsze().H;
+}
+
+int NCInputField::preferredWidth()
+{
+ return wGetDefsze().W;
+}
+
+int NCInputField::preferredHeight()
+{
+ return wGetDefsze().H;
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::setSize
+// METHOD TYPE : void
+//
+// DESCRIPTION :
+//
+void NCInputField::setSize( int newwidth, int newheight )
+{
+ wRelocate( wpos( 0 ), wsze( newheight, newwidth ) );
+ YInputField::setSize( newwidth, newheight );
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::setDefsze
+// METHOD TYPE : void
+//
+// DESCRIPTION :
+//
+void NCInputField::setDefsze()
+{
+ unsigned defwidth = maxFldLength ? maxFldLength : 5;
+ if ( label.width() > defwidth )
+ defwidth = label.width();
+ defsze = wsze( label.height() + 1, defwidth );
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::wCreate
+// METHOD TYPE : void
+//
+// DESCRIPTION :
+//
+void NCInputField::wCreate( const wrect & newrect )
+{
+ NCWidget::wCreate( newrect );
+
+ if ( !win )
+ return;
+
+ wrect lrect( 0, wsze::min( newrect.Sze,
+ wsze( label.height(), newrect.Sze.W ) ) );
+ if ( lrect.Sze.H == newrect.Sze.H )
+ lrect.Sze.H -= 1;
+
+ wrect trect( 0, wsze( 1, newrect.Sze.W ) );
+ trect.Pos.L = lrect.Sze.H > 0 ? lrect.Sze.H : 0;
+
+ lwin = new NCursesWindow( *win,
+ lrect.Sze.H, lrect.Sze.W,
+ lrect.Pos.L, lrect.Pos.C,
+ 'r' );
+ twin = new NCursesWindow( *win,
+ trect.Sze.H, trect.Sze.W,
+ trect.Pos.L, trect.Pos.C,
+ 'r' );
+ if ( maxFldLength && maxFldLength < (unsigned)newrect.Sze.W )
+ trect.Sze.W = maxFldLength;
+ fldlength=trect.Sze.W;
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::wDelete
+// METHOD TYPE : void
+//
+// DESCRIPTION :
+//
+void NCInputField::wDelete()
+{
+ delete lwin;
+ delete twin;
+ lwin = 0;
+ twin = 0;
+ NCWidget::wDelete();
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::setLabel
+// METHOD TYPE : void
+//
+// DESCRIPTION :
+//
+void NCInputField::setLabel( const string & nlabel )
+{
+ label = NCstring( nlabel );
+ label.stripHotkey();
+ YInputField::setLabel( nlabel );
+ setDefsze();
+ Redraw();
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::setText
+// METHOD TYPE : void
+//
+// DESCRIPTION :
+//
+void NCInputField::setText( const YCPString & ntext )
+{
+ buffer = NCstring( ntext ).str();
+ if ( maxInputLength && buffer.length() > maxInputLength ) {
+ buffer = buffer.erase( maxInputLength );
+ }
+ fldstart = 0;
+ curpos = buffer.length();
+ tUpdate();
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::setValue
+// METHOD TYPE : void
+//
+// DESCRIPTION :
+//
+void NCInputField::setValue( const std::string & ntext )
+{
+ buffer = NCstring( ntext ).str();
+ if ( maxInputLength && buffer.length() > maxInputLength ) {
+ buffer = buffer.erase( maxInputLength );
+ }
+ fldstart = 0;
+ curpos = buffer.length();
+ tUpdate();
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::value
+// METHOD TYPE : void
+//
+// DESCRIPTION :
+//
+string NCInputField::value( )
+{
+ NCstring text ( buffer );
+
+ return text.Str();
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::getText
+// METHOD TYPE : YCPString
+//
+// DESCRIPTION :
+//
+YCPString NCInputField::getText()
+
+{
+ NCstring text( buffer );
+
+ return text.YCPstr();
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::setValidChars
+// METHOD TYPE : void
+//
+// DESCRIPTION :
+//
+void NCInputField::setValidChars( const string & validchars )
+{
+ validChars = NCstring( validchars );
+ YInputField::setValidChars( validchars );
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::validKey
+// METHOD TYPE : bool
+//
+// DESCRIPTION :
+//
+bool NCInputField::validKey( wint_t key ) const
+{
+ // private: NCstring validChars;
+ const wstring vwch( validChars.str() );
+
+ if ( vwch.empty() )
+ return true;
+
+ if ( key < 0 || WCHAR_MAX < key )
+ return false;
+
+ return( vwch.find( (wchar_t)key ) != wstring::npos );
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::wRedraw
+// METHOD TYPE : void
+//
+// DESCRIPTION :
+//
+void NCInputField::wRedraw()
+{
+ if ( !win )
+ return;
+
+ // label
+ const NCstyle::StWidget & style( widgetStyle( true ) );
+ lwin->bkgd( style.plain );
+ lwin->clear();
+ label.drawAt( *lwin, style );
+ tUpdate();
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::bufferFull
+// METHOD TYPE : bool
+//
+// DESCRIPTION :
+//
+inline bool NCInputField::bufferFull() const
+{
+ return( maxInputLength && buffer.length() == maxInputLength );
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::maxCursor
+// METHOD TYPE : unsigned
+//
+// DESCRIPTION :
+//
+inline unsigned NCInputField::maxCursor() const
+{
+ return( bufferFull() ? buffer.length() - 1 : buffer.length() );
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::tUpdate
+// METHOD TYPE : void
+//
+// DESCRIPTION :
+//
+void NCInputField::tUpdate()
+{
+ if ( !win )
+ return;
+
+ unsigned maxc = maxCursor();
+
+ // adjust cursor
+ if ( curpos > maxc ) {
+ curpos = maxc;
+ }
+
+ // adjust fldstart that cursor is visible
+ if ( maxc < fldlength ) {
+ fldstart = 0;
+ } else {
+ if ( curpos <= fldstart ) {
+ fldstart = curpos ? curpos - 1 : 0;
+ }
+ if ( curpos >= fldstart + fldlength - 1 ) {
+ fldstart = curpos + (curpos == maxc ? 1 : 2) - fldlength;
+ }
+ }
+
+ const NCstyle::StWidget & style( widgetStyle() );
+ twin->bkgd( widgetStyle( true ).plain );
+ twin->move( 0, 0 );
+
+ unsigned i = 0;
+ unsigned end = fldlength;
+ const wchar_t * cp = buffer.data() + fldstart;
+
+ // draw left scrollhint if
+ if ( *cp && fldstart ) {
+ twin->bkgdset( style.scrl );
+ twin->addch( ACS_LARROW );
+ ++i;
+ ++cp;
+ }
+
+ // check for right scrollhint
+ if ( fldstart + fldlength <= maxc ) {
+ --end;
+ }
+
+ // draw field
+ twin->bkgdset( style.data );
+ for ( /*adjusted i*/; *cp && i < end; ++i )
+ {
+ if ( passwd )
+ {
+ twin->addwstr( L"*" );
+ }
+ else
+ {
+ twin->addwstr( cp, 1 );
+ }
+ ++cp;
+ }
+ twin->bkgdset( style.plain );
+ for ( /*adjusted i*/; i < end; ++i ) {
+ twin->addch( ACS_CKBOARD );
+ }
+
+ // draw right scrollhint if
+ if ( end < fldlength ) {
+ twin->bkgdset( style.scrl );
+ twin->addch( ACS_RARROW );
+ }
+
+ // reverse curpos
+ if ( GetState() == NC::WSactive ) {
+ twin->move( 0, curpos - fldstart );
+ twin->bkgdset( wStyle().cursor );
+
+ if ( curpos < buffer.length() )
+ twin->add_attr_char( );
+ else
+ twin->addch( ACS_CKBOARD );
+ }
+
+ Update();
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCInputField::wHandleInput
+// METHOD TYPE : NCursesEvent
+//
+// DESCRIPTION :
+//
+NCursesEvent NCInputField::wHandleInput( wint_t key )
+{
+ NCursesEvent ret;
+ bool beep = false;
+ bool update = true;
+
+ if ( !mayedit )
+ {
+ return NCursesEvent::none;
+ }
+
+ switch ( key ) {
+
+ case KEY_BACKSPACE:
+ if ( bufferFull() && curpos == maxCursor() ) {
+ // if we're on the last char in a full buffer delete this char
+ // and not the previous one.
+ buffer.erase( curpos, 1 );
+ } else if ( curpos ) {
+ buffer.erase( --curpos, 1 );
+ } else {
+ update = false;
+ beep = true;
+ }
+ break;
+
+ case KEY_DC:
+ if ( curpos < buffer.length() ) {
+ buffer.erase( curpos, 1 );
+ } else {
+ update = false;
+ beep = true;
+ }
+ break;
+
+ case KEY_HOME:
+ if ( curpos ) {
+ curpos = 0;
+ } else {
+ update = false;
+ beep = true;
+ }
+ break;
+
+ case KEY_END:
+ if ( curpos < maxCursor() ) {
+ curpos = maxCursor();
+ } else {
+ update = false;
+ beep = true;
+ }
+ break;
+
+ case KEY_LEFT:
+ if ( curpos ) {
+ --curpos;
+ } else {
+ update = false;
+ beep = true;
+ }
+ break;
+
+ case KEY_RIGHT:
+ if ( curpos < maxCursor() ) {
+ ++curpos;
+ } else {
+ update = false;
+ beep = true;
+ }
+ break;
+
+ case KEY_RETURN:
+ if ( getNotify() || returnOnReturn_b )
+ ret = NCursesEvent::Activated;
+ break;
+
+ case KEY_HOTKEY:
+ update = false;
+ break;
+
+ default:
+ bool is_special = false;
+ if ( key > 0xFFFF )
+ {
+ is_special = true;
+ key -= 0xFFFF;
+ }
+
+ if ( (!is_special && KEY_MIN < key && KEY_MAX > key )
+ ||
+ !iswprint( key )
+ ||
+ // if we are at limit of input
+ (InputMaxLength >= 0 && InputMaxLength <= (int)buffer.length()) )
+ {
+ update = false;
+ beep = true;
+ }
+ else if ( fldtype == NUMBER )
+ {
+ if ( bufferFull() && key != L'+' )
+ {
+ update = false;
+ beep = true;
+ }
+ else
+ {
+ switch ( key ) {
+ case L'0':
+ case L'1':
+ case L'2':
+ case L'3':
+ case L'4':
+ case L'5':
+ case L'6':
+ case L'7':
+ case L'8':
+ case L'9':
+ if ( curpos || buffer.empty() || buffer[0] != L'-' ) {
+ buffer.insert(wstring::size_type(curpos), 1, key );
+ if ( curpos < maxCursor() )
+ ++curpos;
+ } else {
+ update = false;
+ beep = true;
+ }
+ break;
+
+ case L'+':
+ if ( !buffer.empty() && buffer[0] == L'-' ) {
+ buffer.erase(wstring::size_type(0), 1);
+ if ( curpos )
+ --curpos;
+ } else {
+ update = false;
+ }
+ break;
+
+ case L'-':
+ if ( buffer.empty() || buffer[0] != L'-' ) {
+ buffer.insert(wstring::size_type(0), 1, L'-');
+ if ( curpos < maxCursor() )
+ ++curpos;
+ } else {
+ update = false;
+ }
+ break;
+
+ default:
+ update = false;
+ beep = true;
+ break;
+ }
+ }
+
+ }
+ else // PLAIN
+ {
+
+ if ( bufferFull() || !validKey( key ) ) {
+ update = false;
+ beep = true;
+ } else {
+ buffer.insert( wstring::size_type(curpos), 1, key );
+ if ( curpos < maxCursor() )
+ ++curpos;
+ }
+
+ }
+ break;
+ }
+
+ if ( update ) {
+ tUpdate();
+ if ( getNotify() )
+ ret = NCursesEvent::ValueChanged;
+ }
+
+ if ( beep )
+ ::beep();
+
+ return ret;
+
+}
+
+
+void NCInputField::setInputMaxLength( int numberOfChars)
+{
+ int nr = numberOfChars;
+
+ // if there is more text then the maximum number of chars,
+ // truncate the text and update the buffer
+ if ( nr >= 0 && (int)buffer.length() > nr ) {
+ buffer.erase( nr, maxCursor() - nr );
+ tUpdate();
+ curpos = buffer.length();
+ }
+
+ InputMaxLength = nr;
+
+ YInputField::setInputMaxLength( numberOfChars );
+}
Added: branches/tmp/sh/mod-ui/ncurses/src/NCInputField.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCI…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCInputField.h (added)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCInputField.h Thu Jun 28 10:07:31 2007
@@ -0,0 +1,142 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: NCInputField.h
+
+ Author: Michael Andres <ma(a)suse.de>
+ Maintainer: Michael Andres <ma(a)suse.de>
+
+/-*/
+#ifndef NCInputField_h
+#define NCInputField_h
+
+#include <iosfwd>
+
+#include "YInputField.h"
+#include "NCWidget.h"
+
+class NCInputField;
+
+///////////////////////////////////////////////////////////////////
+//
+// CLASS NAME : NCInputField
+//
+// DESCRIPTION :
+//
+class NCInputField : public YInputField, public NCWidget {
+
+ friend std::ostream & operator<<( std::ostream & STREAM, const NCInputField & OBJ );
+
+ NCInputField & operator=( const NCInputField & );
+ NCInputField ( const NCInputField & );
+
+ public:
+
+ enum FTYPE {
+ PLAIN,
+ NUMBER
+ };
+
+ private:
+
+ bool mayedit;
+ bool passwd;
+ NClabel label;
+ wstring buffer;
+
+ NCursesWindow * lwin;
+ NCursesWindow * twin;
+
+ unsigned maxFldLength;
+ unsigned maxInputLength;
+
+ unsigned fldstart;
+ unsigned fldlength;
+ unsigned curpos;
+
+ FTYPE fldtype;
+ NCstring validChars;
+
+ bool returnOnReturn_b;
+
+ void setDefsze();
+ void tUpdate();
+
+ bool bufferFull() const;
+ unsigned maxCursor() const;
+
+ // specifies how much characters can be inserted. -1 for unlimited input
+ int InputMaxLength;
+
+ protected:
+
+ virtual const char * location() const { return "NCInputField"; }
+
+ virtual void wCreate( const wrect & newrect );
+ virtual void wDelete();
+
+ virtual void wRedraw();
+
+ bool validKey( wint_t key ) const;
+
+ public:
+
+ NCInputField( NCWidget * parent,
+ const string & label,
+ bool passwordMode );
+ virtual ~NCInputField();
+
+ void setFldtype( FTYPE t ) { fldtype = t; }
+ void setReturnOnReturn( bool on_br ) { returnOnReturn_b = on_br; }
+
+ virtual long nicesize( YUIDimension dim );
+
+ virtual int preferredWidth();
+ virtual int preferredHeight();
+
+ /**
+ * Set the new size of the widget.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual void setSize( int newWidth, int newHeight );
+
+ virtual void setLabel( const string & nlabel );
+
+ virtual void setText( const YCPString & ntext );
+ virtual YCPString getText();
+
+ virtual void setValue( const std::string & ntext ); // new for setText()
+ virtual string value(); // new for getText()
+
+ virtual void setValidChars( const string & validchars );
+
+ virtual NCursesEvent wHandleInput( wint_t key );
+
+ virtual void setEnabling( bool do_bv ) { NCWidget::setEnabling( enabled=do_bv ); }
+
+ virtual bool setKeyboardFocus() {
+ if ( !grabFocus() )
+ return YWidget::setKeyboardFocus();
+ return true;
+ }
+
+ // limits the input to numberOfChars characters and truncates the text
+ // if appropriate
+ void setInputMaxLength( const YCPInteger & numberOfChars);
+
+ void setCurPos( unsigned pos ) { curpos = pos; }
+};
+
+///////////////////////////////////////////////////////////////////
+
+#endif // NCInputField_h
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39062 - /trunk/core/libycp/src/YCPBuiltinMisc.cc
by mvidner@svn.opensuse.org 28 Jun '07
by mvidner@svn.opensuse.org 28 Jun '07
28 Jun '07
Author: mvidner
Date: Thu Jun 28 10:03:29 2007
New Revision: 39062
URL: http://svn.opensuse.org/viewcvs/yast?rev=39062&view=rev
Log:
Fixed docs for the "random" builtin.
Modified:
trunk/core/libycp/src/YCPBuiltinMisc.cc
Modified: trunk/core/libycp/src/YCPBuiltinMisc.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/YCPBuiltinMisc.c…
==============================================================================
--- trunk/core/libycp/src/YCPBuiltinMisc.cc (original)
+++ trunk/core/libycp/src/YCPBuiltinMisc.cc Thu Jun 28 10:03:29 2007
@@ -78,11 +78,11 @@
/**
* @builtin random
* @short Random number generator.
- * @description Returns random integer in the interval (0,MAX).
+ * @description Returns a random integer in the interval [0,MAX).
* <tt>srandom</tt> must be activated to get really random
* numbers.
* @param integer MAX
- * @return integer Returns integer in the interval (0,MAX).
+ * @return integer Returns integer in the interval [0,MAX).
* @usage random(100) -> 82
* @usage random(100) -> 36
*/
@@ -90,6 +90,7 @@
if (max.isNull ())
return YCPNull ();
+ // see NOTES in man 3 rand,
// <1,10> 1+(int) (10.0*rand()/(RAND_MAX+1.0));
int ret = (int) (max->value () * rand () / (RAND_MAX + 1.0));
return YCPInteger (ret);
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0