Mailinglist Archive: yast-commit (870 mails)
| < Previous | Next > |
[yast-commit] r48785 - in /branches/tmp/jdsn/registration/src: Makefile.am RegWizard.cc WizardEmulation.cc WizardEmulation.h
- From: gs@xxxxxxxxxxxxxxxx
- Date: Wed, 02 Jul 2008 13:02:48 -0000
- Message-id: <20080702130248.8A70C2BD97@xxxxxxxxxxxxxxxx>
Author: gs
Date: Wed Jul 2 15:02:48 2008
New Revision: 48785
URL: http://svn.opensuse.org/viewcvs/yast?rev=48785&view=rev
Log:
class WizardEmulation added (only basic layout is created so far)
Added:
branches/tmp/jdsn/registration/src/WizardEmulation.cc
branches/tmp/jdsn/registration/src/WizardEmulation.h
Modified:
branches/tmp/jdsn/registration/src/Makefile.am
branches/tmp/jdsn/registration/src/RegWizard.cc
Modified: branches/tmp/jdsn/registration/src/Makefile.am
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/Makefile.am?rev=48785&r1=48784&r2=48785&view=diff
==============================================================================
--- branches/tmp/jdsn/registration/src/Makefile.am (original)
+++ branches/tmp/jdsn/registration/src/Makefile.am Wed Jul 2 15:02:48 2008
@@ -10,7 +10,8 @@
RegMain.cc \
RegWizard.cc \
RegWizardPage.cc \
- RegUpdateRepoPage.cc
+ RegUpdateRepoPage.cc \
+ WizardEmulation.cc
yast2_registration_LDADD = -L$(top_srcdir)/src -lyui
Modified: branches/tmp/jdsn/registration/src/RegWizard.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/RegWizard.cc?rev=48785&r1=48784&r2=48785&view=diff
==============================================================================
--- branches/tmp/jdsn/registration/src/RegWizard.cc (original)
+++ branches/tmp/jdsn/registration/src/RegWizard.cc Wed Jul 2 15:02:48 2008
@@ -17,6 +17,7 @@
#include "RegWizardPage.h"
#include "Reg_i18n.h"
+#include "WizardEmulation.h"
RegWizard *
RegWizard::regWizard()
@@ -71,10 +72,13 @@
}
else
{
- // TO DO: Use wizard emulation as fallback
- // regWizard()->_wizard = new WizardEmulation(...);
+ // Use wizard emulation as fallback
+ regWizard()->_wizard = new WizardEmulation( dialog,
+ _( "&Back" ),
+ _( "&Abort" ),
+ _( "&Next" ) );
- yuiError() << "No support for wizard widget" << endl;
+ yuiMilestone() << "Using wizard emulation" << endl;
}
}
Added: branches/tmp/jdsn/registration/src/WizardEmulation.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/WizardEmulation.cc?rev=48785&view=auto
==============================================================================
--- branches/tmp/jdsn/registration/src/WizardEmulation.cc (added)
+++ branches/tmp/jdsn/registration/src/WizardEmulation.cc Wed Jul 2 15:02:48
2008
@@ -0,0 +1,242 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (c) SuSE Linux AG |
+\----------------------------------------------------------------------/
+
+ File: WizardEmulation.cc
+
+ Author: Gabriele Mohr <gs@xxxxxxx>
+
+ Textdomain "wizard"
+
+/-*/
+
+#include "WizardEmulation.h"
+#define YUILogComponent "wizard-emulation"
+#include "YUILog.h"
+
+#include <string>
+#include <YShortcut.h>
+
+
+#include "YUI.h"
+#include "YLayoutBox.h"
+#include "YApplication.h"
+#include "YDialog.h"
+#include "YAlignment.h"
+#include "YReplacePoint.h"
+#include "YEmpty.h"
+#include "YLabel.h"
+#include "YPushButton.h"
+#include "YWidgetFactory.h"
+#include "YEvent.h"
+
+using std::string;
+
+WizardEmulation *WizardEmulation::main_wizard = 0;
+
+WizardEmulation::WizardEmulation( YWidget * dialog,
+ const string & backButtonLabel,
+ const string & abortButtonLabel,
+ const string & nextButtonLabel,
+ YWizardMode wizardMode )
+ : YWizard( dialog,
+ backButtonLabel,
+ abortButtonLabel,
+ nextButtonLabel,
+ wizardMode )
+ , _backButtonLabel( backButtonLabel )
+ , _abortButtonLabel( abortButtonLabel )
+ , _nextButtonLabel( nextButtonLabel )
+ , _helpDlg ( NULL )
+{
+ yuiMilestone() << "Creating widgets" << endl;
+
+ YLayoutBox* vbox = YUI::widgetFactory()->createVBox( this );
+
+ _contents = 0;
+ _backButton = 0;
+ _abortButton = 0;
+ _nextButton = 0;
+ _sendButtonEvents = true;
+ _contentsReplacePoint = 0;
+
+ _contentsReplacePoint = YUI::widgetFactory()->createReplacePoint( vbox );
+
+ layoutButtonBox( vbox );
+
+ //
+ // Initial YEmpty widget contents of replace point
+ //
+
+ YUI::widgetFactory()->createEmpty( _contentsReplacePoint );
+
+ _contentsReplacePoint->showChild();
+
+ YDialog::currentDialog()->dumpWidgetTree();
+
+}
+
+
+WizardEmulation::~WizardEmulation()
+{
+ if ( this == main_wizard )
+ main_wizard = 0;
+
+ if ( _helpDlg )
+ YDialog::deleteTopmostDialog();
+}
+
+bool WizardEmulation::isSecondary() const
+{
+ return this != main_wizard;
+}
+
+YLayoutBox *WizardEmulation::layoutButtonBox( YWidget * parent )
+{
+ //
+ // QHBoxLayout for the buttons
+ //
+
+ YLayoutBox * hbox = YUI::widgetFactory()->createHBox( parent );
+ YUI_CHECK_NEW( hbox );
+
+ hbox->setStretchable( YD_HORIZ, true );
+
+ // Help button - intentionally without keyboard shortcut
+ _helpButton = YUI::widgetFactory()->createPushButton( hbox, "Help" );
+ YUI_CHECK_NEW( _helpButton );
+ //_helpButton->setShortcut( Qt::Key_F1 );
+
+ //
+ // "Abort" button
+ //
+
+ _abortButton = YUI::widgetFactory()->createPushButton( hbox,
_abortButtonLabel );
+ YUI_CHECK_NEW( _abortButton );
+
+ YUI::widgetFactory()->createHSpacing( hbox, 10 );
+ //
+ // "Back" button
+ //
+
+ _backButton = YUI::widgetFactory()->createPushButton( hbox,
_backButtonLabel );
+ YUI_CHECK_NEW( _backButton );
+
+ // if ( _backButton->text().isEmpty() )
+ // _backButton->hide();
+
+ //
+ // "Next" button
+ //
+
+ _nextButton = YUI::widgetFactory()->createPushButton( hbox,
_nextButtonLabel );
+ YUI_CHECK_NEW( _nextButton );
+
+ return hbox;
+}
+
+
+void WizardEmulation::destroyButtons()
+{
+ delete _backButton;
+ _backButton = 0;
+
+ delete _abortButton;
+ _abortButton = 0;
+
+ delete _nextButton;
+ _nextButton = 0;
+}
+
+void WizardEmulation::setDialogHeading( const string & headingText )
+{
+ if ( _dialogHeading )
+ {
+ if ( ! headingText.empty() )
+ _dialogHeading->setText( headingText );
+ else
+ _dialogHeading->setText( "" );
+ }
+}
+
+string WizardEmulation::debugLabel() const
+{
+ if ( _dialogHeading )
+ {
+ string label = _dialogHeading->text();
+
+ if ( ! label.empty() )
+ {
+ return label;
+ }
+ }
+
+ return "untitled WizardEmulation";
+}
+
+
+void WizardEmulation::setHelpText( const string & helpText )
+{
+ _helpText = helpText;
+ // FIXME
+ //_helpText.replace( "&product;", YUI::app()->productName() );
+}
+
+
+void WizardEmulation::showHelp()
+{
+ // TODO - create a class for the help dialog
+#if 0
+ if (!_helpDlg)
+ _helpDlg = new YHelpDialog ( _helpText, NULL );
+ else
+ _helpDlg->setHelpText( _helpText );
+
+ _helpDlg->show();
+ _helpDlg->raise();
+ _helpDlg->activateWindow();
+#endif
+}
+
+#if 0
+bool WizardEmulation::eventFilter( QObject * obj, QEvent * ev )
+{
+ if ( ev->type() == QEvent::Resize && obj == _contents )
+ {
+ resizeClientArea();
+ return true; // Event handled
+ }
+
+ if ( ev->type() == QEvent::Resize && obj == _sideBar && main_wizard ==
this && _stepsPanel )
+ {
+ YQMainWinDock::mainWinDock()->setSideBarWidth( _sideBar->width() );
+ return true; // Event handled
+ }
+
+ return QWidget::eventFilter( obj, ev );
+}
+#endif
+
+void WizardEmulation::setSize( int newWidth, int newHeight )
+{
+ // don't call YDialog::currentDialog()->setSize() - leads to endless loop
+}
+
+void WizardEmulation::setButtonLabel( YPushButton * button, const string &
newLabel )
+{
+ button->setLabel( newLabel );
+ YDialog::currentDialog()->checkShortcuts();
+
+}
+
+
+
+
Added: branches/tmp/jdsn/registration/src/WizardEmulation.h
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/WizardEmulation.h?rev=48785&view=auto
==============================================================================
--- branches/tmp/jdsn/registration/src/WizardEmulation.h (added)
+++ branches/tmp/jdsn/registration/src/WizardEmulation.h Wed Jul 2 15:02:48
2008
@@ -0,0 +1,299 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (c) SuSE Linux AG |
+\----------------------------------------------------------------------/
+
+ File: WizardEmulation.h
+
+ Author: Gabriele Mohr <gs@xxxxxxx>
+
+/-*/
+
+
+#ifndef WizardEmulation_h
+#define WizardEmulation_h
+
+#include <string>
+#include <vector>
+
+#include <YWizard.h>
+#include "YPushButton.h"
+
+using std::vector;
+
+
+class YReplacePoint;
+class YAlignment;
+class YLayout;
+class YFrame;
+class YLabel;
+class YLayoutBox;
+
+class WizardEmulation : public YWizard
+{
+
+public:
+ /**
+ * Constructor.
+ **/
+ WizardEmulation( YWidget * parent,
+ const string & backButtonLabel,
+ const string & abortButtonLabel,
+ const string & nextButtonLabel,
+ YWizardMode wizardMode = YWizardMode_Standard );
+
+ /**
+ * Destructor.
+ **/
+ virtual ~WizardEmulation();
+
+ /**
+ * Returns a descriptive label of this dialog instance for debugging.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual string debugLabel() const;
+
+ enum Direction { Forward, Backward };
+
+ /**
+ * Returns the current direction of wizard operations - going forward or
+ * going backward. This can be used to maintain a consistent direction when
+ * assigning default buttons to a dialog.
+ **/
+ Direction direction() const { return _direction; }
+
+ //
+ // Wizard basics
+ //
+
+ /**
+ * Return internal widgets.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual YPushButton * backButton() const { return _backButton; }
+ virtual YPushButton * abortButton() const { return _abortButton; }
+ virtual YPushButton * nextButton() const { return _nextButton; }
+
+ virtual YReplacePoint * contentsReplacePoint() const { return
_contentsReplacePoint; }
+
+ /**
+ * Set the label of one of the wizard buttons (backButton(), abortButton(),
+ * nextButton() ) if that button is non-null.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void setButtonLabel( YPushButton * button, const string & newLabel
);
+
+ /**
+ * Set the help text.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void setHelpText( const string & helpText );
+
+ /**
+ * Set the dialog heading.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void setDialogHeading( const string & headingText );
+
+
+ //
+ // Steps handling
+ // Required to be implemented from YWizard - but doesn't do anything here
+ //
+ //
+ virtual void addStep( const string & text, const string & id ) { return; }
+
+ virtual void addStepHeading( const string & text ) { return; }
+
+ virtual void deleteSteps() { return; }
+
+ virtual void setCurrentStep( const string & id ) { return; }
+
+ virtual void updateSteps() { return; }
+
+
+ //
+ // Tree handling
+ // Required to be implemented from YWizard - but doesn't do anything here
+ //
+ //
+ virtual void addTreeItem( const string & parentID,
+ const string & text,
+ const string & id ) { return; }
+
+ virtual void selectTreeItem( const string & id ) { return; }
+
+ virtual std::string currentTreeSelection() { return ""; }
+
+ virtual void deleteTreeItems() { return; }
+
+
+ //
+ // Menu handling
+ //
+ //
+ virtual void addMenu( const string & text,
+ const string & id ) { return; }
+
+ virtual void addSubMenu( const string & parentMenuID,
+ const string & text,
+ const string & id ) { return; }
+
+ virtual void addMenuEntry( const string & parentMenuID,
+ const string & text,
+ const string & id ) { return; }
+
+ virtual void addMenuSeparator( const string & parentMenuID ) { return; }
+
+ virtual void deleteMenus() { return; }
+
+
+ //
+ // Misc
+ //
+
+ /**
+ * Show a "Release Notes" button above the "Help" button in the steps panel
+ * with the specified label that will return the specified id to
+ * UI::UserInput() when clicked.
+ *
+ * The button (or the wizard) will assume ownership of the id and delete it
+ * in the destructor.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void showReleaseNotesButton( const string & label,
+ const string & id ) { return; }
+
+ /**
+ * Hide an existing "Release Notes" button.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void hideReleaseNotesButton() { return; }
+
+ /**
+ * Retranslate internal buttons that are not accessible from the outside:
+ * - [Help]
+ * - [Steps]
+ * - [Tree]
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void retranslateInternalButtons() { return; }
+
+ /**
+ * Set the dialog icon. An empty icon name clears the current icon.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void setDialogIcon( const string & iconName ) { return; }
+
+ //
+ // Geometry management
+ //
+
+ /**
+ * Preferred width of the widget.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual int preferredWidth() { return 80; }
+
+ /**
+ * Preferred height of the widget.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual int preferredHeight() { return 25; };
+
+ /**
+ * Set the new size of the widget.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual void setSize( int newWidth, int newHeight );
+
+ /**
+ * Returns true if the wizard should follow the first wizard with steps
+ **/
+ bool isSecondary() const;
+
+ void showHelp();
+
+protected:
+
+ // Layout functions
+ // TODO - more layout functions required (like YQWizard) ???
+
+ YLayoutBox *layoutButtonBox ( YWidget * parent );
+
+ /**
+ * Destroy the button box's buttons
+ **/
+ void destroyButtons();
+
+ /**
+ * Send a wizard event with the specified ID.
+ **/
+ // FIXME - needed here ????
+ // void sendEvent( const string & id );
+
+ /**
+ * Enable or disable a button.
+ **/
+ void enableButton( YPushButton * button, bool enabled );
+
+ /**
+ * Set the keyboard focus to a button.
+ **/
+ void setButtonFocus( YPushButton * button );
+
+ //
+ // Data members
+ //
+
+ string _backButtonLabel;
+ string _abortButtonLabel;
+ string _nextButtonLabel;
+
+ bool _sendButtonEvents;
+
+ Direction _direction;
+
+ string _releaseNotesButtonId;
+ string _helpText;
+
+ YPushButton * _helpButton;
+ YDialog * _helpDlg;
+ YFrame * _workArea;
+ YWidget * _clientArea;
+ YLabel * _dialogHeading;
+ YAlignment * _contents;
+ YPushButton * _backButton;
+ YPushButton * _abortButton;
+ YPushButton * _nextButton;
+
+ YReplacePoint * _contentsReplacePoint;
+
+private:
+ static WizardEmulation *main_wizard;
+
+
+}; // class WizardEmulation
+
+
+
+#endif // WizardEmulation_h
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
Date: Wed Jul 2 15:02:48 2008
New Revision: 48785
URL: http://svn.opensuse.org/viewcvs/yast?rev=48785&view=rev
Log:
class WizardEmulation added (only basic layout is created so far)
Added:
branches/tmp/jdsn/registration/src/WizardEmulation.cc
branches/tmp/jdsn/registration/src/WizardEmulation.h
Modified:
branches/tmp/jdsn/registration/src/Makefile.am
branches/tmp/jdsn/registration/src/RegWizard.cc
Modified: branches/tmp/jdsn/registration/src/Makefile.am
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/Makefile.am?rev=48785&r1=48784&r2=48785&view=diff
==============================================================================
--- branches/tmp/jdsn/registration/src/Makefile.am (original)
+++ branches/tmp/jdsn/registration/src/Makefile.am Wed Jul 2 15:02:48 2008
@@ -10,7 +10,8 @@
RegMain.cc \
RegWizard.cc \
RegWizardPage.cc \
- RegUpdateRepoPage.cc
+ RegUpdateRepoPage.cc \
+ WizardEmulation.cc
yast2_registration_LDADD = -L$(top_srcdir)/src -lyui
Modified: branches/tmp/jdsn/registration/src/RegWizard.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/RegWizard.cc?rev=48785&r1=48784&r2=48785&view=diff
==============================================================================
--- branches/tmp/jdsn/registration/src/RegWizard.cc (original)
+++ branches/tmp/jdsn/registration/src/RegWizard.cc Wed Jul 2 15:02:48 2008
@@ -17,6 +17,7 @@
#include "RegWizardPage.h"
#include "Reg_i18n.h"
+#include "WizardEmulation.h"
RegWizard *
RegWizard::regWizard()
@@ -71,10 +72,13 @@
}
else
{
- // TO DO: Use wizard emulation as fallback
- // regWizard()->_wizard = new WizardEmulation(...);
+ // Use wizard emulation as fallback
+ regWizard()->_wizard = new WizardEmulation( dialog,
+ _( "&Back" ),
+ _( "&Abort" ),
+ _( "&Next" ) );
- yuiError() << "No support for wizard widget" << endl;
+ yuiMilestone() << "Using wizard emulation" << endl;
}
}
Added: branches/tmp/jdsn/registration/src/WizardEmulation.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/WizardEmulation.cc?rev=48785&view=auto
==============================================================================
--- branches/tmp/jdsn/registration/src/WizardEmulation.cc (added)
+++ branches/tmp/jdsn/registration/src/WizardEmulation.cc Wed Jul 2 15:02:48
2008
@@ -0,0 +1,242 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (c) SuSE Linux AG |
+\----------------------------------------------------------------------/
+
+ File: WizardEmulation.cc
+
+ Author: Gabriele Mohr <gs@xxxxxxx>
+
+ Textdomain "wizard"
+
+/-*/
+
+#include "WizardEmulation.h"
+#define YUILogComponent "wizard-emulation"
+#include "YUILog.h"
+
+#include <string>
+#include <YShortcut.h>
+
+
+#include "YUI.h"
+#include "YLayoutBox.h"
+#include "YApplication.h"
+#include "YDialog.h"
+#include "YAlignment.h"
+#include "YReplacePoint.h"
+#include "YEmpty.h"
+#include "YLabel.h"
+#include "YPushButton.h"
+#include "YWidgetFactory.h"
+#include "YEvent.h"
+
+using std::string;
+
+WizardEmulation *WizardEmulation::main_wizard = 0;
+
+WizardEmulation::WizardEmulation( YWidget * dialog,
+ const string & backButtonLabel,
+ const string & abortButtonLabel,
+ const string & nextButtonLabel,
+ YWizardMode wizardMode )
+ : YWizard( dialog,
+ backButtonLabel,
+ abortButtonLabel,
+ nextButtonLabel,
+ wizardMode )
+ , _backButtonLabel( backButtonLabel )
+ , _abortButtonLabel( abortButtonLabel )
+ , _nextButtonLabel( nextButtonLabel )
+ , _helpDlg ( NULL )
+{
+ yuiMilestone() << "Creating widgets" << endl;
+
+ YLayoutBox* vbox = YUI::widgetFactory()->createVBox( this );
+
+ _contents = 0;
+ _backButton = 0;
+ _abortButton = 0;
+ _nextButton = 0;
+ _sendButtonEvents = true;
+ _contentsReplacePoint = 0;
+
+ _contentsReplacePoint = YUI::widgetFactory()->createReplacePoint( vbox );
+
+ layoutButtonBox( vbox );
+
+ //
+ // Initial YEmpty widget contents of replace point
+ //
+
+ YUI::widgetFactory()->createEmpty( _contentsReplacePoint );
+
+ _contentsReplacePoint->showChild();
+
+ YDialog::currentDialog()->dumpWidgetTree();
+
+}
+
+
+WizardEmulation::~WizardEmulation()
+{
+ if ( this == main_wizard )
+ main_wizard = 0;
+
+ if ( _helpDlg )
+ YDialog::deleteTopmostDialog();
+}
+
+bool WizardEmulation::isSecondary() const
+{
+ return this != main_wizard;
+}
+
+YLayoutBox *WizardEmulation::layoutButtonBox( YWidget * parent )
+{
+ //
+ // QHBoxLayout for the buttons
+ //
+
+ YLayoutBox * hbox = YUI::widgetFactory()->createHBox( parent );
+ YUI_CHECK_NEW( hbox );
+
+ hbox->setStretchable( YD_HORIZ, true );
+
+ // Help button - intentionally without keyboard shortcut
+ _helpButton = YUI::widgetFactory()->createPushButton( hbox, "Help" );
+ YUI_CHECK_NEW( _helpButton );
+ //_helpButton->setShortcut( Qt::Key_F1 );
+
+ //
+ // "Abort" button
+ //
+
+ _abortButton = YUI::widgetFactory()->createPushButton( hbox,
_abortButtonLabel );
+ YUI_CHECK_NEW( _abortButton );
+
+ YUI::widgetFactory()->createHSpacing( hbox, 10 );
+ //
+ // "Back" button
+ //
+
+ _backButton = YUI::widgetFactory()->createPushButton( hbox,
_backButtonLabel );
+ YUI_CHECK_NEW( _backButton );
+
+ // if ( _backButton->text().isEmpty() )
+ // _backButton->hide();
+
+ //
+ // "Next" button
+ //
+
+ _nextButton = YUI::widgetFactory()->createPushButton( hbox,
_nextButtonLabel );
+ YUI_CHECK_NEW( _nextButton );
+
+ return hbox;
+}
+
+
+void WizardEmulation::destroyButtons()
+{
+ delete _backButton;
+ _backButton = 0;
+
+ delete _abortButton;
+ _abortButton = 0;
+
+ delete _nextButton;
+ _nextButton = 0;
+}
+
+void WizardEmulation::setDialogHeading( const string & headingText )
+{
+ if ( _dialogHeading )
+ {
+ if ( ! headingText.empty() )
+ _dialogHeading->setText( headingText );
+ else
+ _dialogHeading->setText( "" );
+ }
+}
+
+string WizardEmulation::debugLabel() const
+{
+ if ( _dialogHeading )
+ {
+ string label = _dialogHeading->text();
+
+ if ( ! label.empty() )
+ {
+ return label;
+ }
+ }
+
+ return "untitled WizardEmulation";
+}
+
+
+void WizardEmulation::setHelpText( const string & helpText )
+{
+ _helpText = helpText;
+ // FIXME
+ //_helpText.replace( "&product;", YUI::app()->productName() );
+}
+
+
+void WizardEmulation::showHelp()
+{
+ // TODO - create a class for the help dialog
+#if 0
+ if (!_helpDlg)
+ _helpDlg = new YHelpDialog ( _helpText, NULL );
+ else
+ _helpDlg->setHelpText( _helpText );
+
+ _helpDlg->show();
+ _helpDlg->raise();
+ _helpDlg->activateWindow();
+#endif
+}
+
+#if 0
+bool WizardEmulation::eventFilter( QObject * obj, QEvent * ev )
+{
+ if ( ev->type() == QEvent::Resize && obj == _contents )
+ {
+ resizeClientArea();
+ return true; // Event handled
+ }
+
+ if ( ev->type() == QEvent::Resize && obj == _sideBar && main_wizard ==
this && _stepsPanel )
+ {
+ YQMainWinDock::mainWinDock()->setSideBarWidth( _sideBar->width() );
+ return true; // Event handled
+ }
+
+ return QWidget::eventFilter( obj, ev );
+}
+#endif
+
+void WizardEmulation::setSize( int newWidth, int newHeight )
+{
+ // don't call YDialog::currentDialog()->setSize() - leads to endless loop
+}
+
+void WizardEmulation::setButtonLabel( YPushButton * button, const string &
newLabel )
+{
+ button->setLabel( newLabel );
+ YDialog::currentDialog()->checkShortcuts();
+
+}
+
+
+
+
Added: branches/tmp/jdsn/registration/src/WizardEmulation.h
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/WizardEmulation.h?rev=48785&view=auto
==============================================================================
--- branches/tmp/jdsn/registration/src/WizardEmulation.h (added)
+++ branches/tmp/jdsn/registration/src/WizardEmulation.h Wed Jul 2 15:02:48
2008
@@ -0,0 +1,299 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (c) SuSE Linux AG |
+\----------------------------------------------------------------------/
+
+ File: WizardEmulation.h
+
+ Author: Gabriele Mohr <gs@xxxxxxx>
+
+/-*/
+
+
+#ifndef WizardEmulation_h
+#define WizardEmulation_h
+
+#include <string>
+#include <vector>
+
+#include <YWizard.h>
+#include "YPushButton.h"
+
+using std::vector;
+
+
+class YReplacePoint;
+class YAlignment;
+class YLayout;
+class YFrame;
+class YLabel;
+class YLayoutBox;
+
+class WizardEmulation : public YWizard
+{
+
+public:
+ /**
+ * Constructor.
+ **/
+ WizardEmulation( YWidget * parent,
+ const string & backButtonLabel,
+ const string & abortButtonLabel,
+ const string & nextButtonLabel,
+ YWizardMode wizardMode = YWizardMode_Standard );
+
+ /**
+ * Destructor.
+ **/
+ virtual ~WizardEmulation();
+
+ /**
+ * Returns a descriptive label of this dialog instance for debugging.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual string debugLabel() const;
+
+ enum Direction { Forward, Backward };
+
+ /**
+ * Returns the current direction of wizard operations - going forward or
+ * going backward. This can be used to maintain a consistent direction when
+ * assigning default buttons to a dialog.
+ **/
+ Direction direction() const { return _direction; }
+
+ //
+ // Wizard basics
+ //
+
+ /**
+ * Return internal widgets.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual YPushButton * backButton() const { return _backButton; }
+ virtual YPushButton * abortButton() const { return _abortButton; }
+ virtual YPushButton * nextButton() const { return _nextButton; }
+
+ virtual YReplacePoint * contentsReplacePoint() const { return
_contentsReplacePoint; }
+
+ /**
+ * Set the label of one of the wizard buttons (backButton(), abortButton(),
+ * nextButton() ) if that button is non-null.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void setButtonLabel( YPushButton * button, const string & newLabel
);
+
+ /**
+ * Set the help text.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void setHelpText( const string & helpText );
+
+ /**
+ * Set the dialog heading.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void setDialogHeading( const string & headingText );
+
+
+ //
+ // Steps handling
+ // Required to be implemented from YWizard - but doesn't do anything here
+ //
+ //
+ virtual void addStep( const string & text, const string & id ) { return; }
+
+ virtual void addStepHeading( const string & text ) { return; }
+
+ virtual void deleteSteps() { return; }
+
+ virtual void setCurrentStep( const string & id ) { return; }
+
+ virtual void updateSteps() { return; }
+
+
+ //
+ // Tree handling
+ // Required to be implemented from YWizard - but doesn't do anything here
+ //
+ //
+ virtual void addTreeItem( const string & parentID,
+ const string & text,
+ const string & id ) { return; }
+
+ virtual void selectTreeItem( const string & id ) { return; }
+
+ virtual std::string currentTreeSelection() { return ""; }
+
+ virtual void deleteTreeItems() { return; }
+
+
+ //
+ // Menu handling
+ //
+ //
+ virtual void addMenu( const string & text,
+ const string & id ) { return; }
+
+ virtual void addSubMenu( const string & parentMenuID,
+ const string & text,
+ const string & id ) { return; }
+
+ virtual void addMenuEntry( const string & parentMenuID,
+ const string & text,
+ const string & id ) { return; }
+
+ virtual void addMenuSeparator( const string & parentMenuID ) { return; }
+
+ virtual void deleteMenus() { return; }
+
+
+ //
+ // Misc
+ //
+
+ /**
+ * Show a "Release Notes" button above the "Help" button in the steps panel
+ * with the specified label that will return the specified id to
+ * UI::UserInput() when clicked.
+ *
+ * The button (or the wizard) will assume ownership of the id and delete it
+ * in the destructor.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void showReleaseNotesButton( const string & label,
+ const string & id ) { return; }
+
+ /**
+ * Hide an existing "Release Notes" button.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void hideReleaseNotesButton() { return; }
+
+ /**
+ * Retranslate internal buttons that are not accessible from the outside:
+ * - [Help]
+ * - [Steps]
+ * - [Tree]
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void retranslateInternalButtons() { return; }
+
+ /**
+ * Set the dialog icon. An empty icon name clears the current icon.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void setDialogIcon( const string & iconName ) { return; }
+
+ //
+ // Geometry management
+ //
+
+ /**
+ * Preferred width of the widget.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual int preferredWidth() { return 80; }
+
+ /**
+ * Preferred height of the widget.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual int preferredHeight() { return 25; };
+
+ /**
+ * Set the new size of the widget.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual void setSize( int newWidth, int newHeight );
+
+ /**
+ * Returns true if the wizard should follow the first wizard with steps
+ **/
+ bool isSecondary() const;
+
+ void showHelp();
+
+protected:
+
+ // Layout functions
+ // TODO - more layout functions required (like YQWizard) ???
+
+ YLayoutBox *layoutButtonBox ( YWidget * parent );
+
+ /**
+ * Destroy the button box's buttons
+ **/
+ void destroyButtons();
+
+ /**
+ * Send a wizard event with the specified ID.
+ **/
+ // FIXME - needed here ????
+ // void sendEvent( const string & id );
+
+ /**
+ * Enable or disable a button.
+ **/
+ void enableButton( YPushButton * button, bool enabled );
+
+ /**
+ * Set the keyboard focus to a button.
+ **/
+ void setButtonFocus( YPushButton * button );
+
+ //
+ // Data members
+ //
+
+ string _backButtonLabel;
+ string _abortButtonLabel;
+ string _nextButtonLabel;
+
+ bool _sendButtonEvents;
+
+ Direction _direction;
+
+ string _releaseNotesButtonId;
+ string _helpText;
+
+ YPushButton * _helpButton;
+ YDialog * _helpDlg;
+ YFrame * _workArea;
+ YWidget * _clientArea;
+ YLabel * _dialogHeading;
+ YAlignment * _contents;
+ YPushButton * _backButton;
+ YPushButton * _abortButton;
+ YPushButton * _nextButton;
+
+ YReplacePoint * _contentsReplacePoint;
+
+private:
+ static WizardEmulation *main_wizard;
+
+
+}; // class WizardEmulation
+
+
+
+#endif // WizardEmulation_h
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
| < Previous | Next > |