Author: kmachalkova
Date: Fri Dec 14 17:02:04 2007
New Revision: 43089
URL: http://svn.opensuse.org/viewcvs/yast?rev=43089&view=rev
Log:
Set dialog's default button in showDialog() routine
(no further magic, 'last one wins' approach)
Modified:
trunk/ncurses/src/NCDialog.cc
trunk/ncurses/src/NCDialog.h
trunk/ncurses/src/NCPushButton.cc
trunk/ncurses/src/NCPushButton.h
Modified: trunk/ncurses/src/NCDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCDialog.cc?rev=43089&r1=43088&r2=43089&view=diff
==============================================================================
--- trunk/ncurses/src/NCDialog.cc (original)
+++ trunk/ncurses/src/NCDialog.cc Fri Dec 14 17:02:04 2007
@@ -62,7 +62,6 @@
: YDialog ( dialogType, colorMode )
, pan ( 0 )
, dlgstyle ( 0 )
- , defaultButton( 0 )
, inMultiDraw_i( 0 )
, active ( false )
, wActive ( this )
@@ -85,7 +84,6 @@
: YDialog ( dialogType, YDialogNormalColor )
, pan ( 0 )
, dlgstyle ( 0 )
- , defaultButton( 0 )
, inMultiDraw_i( 0 )
, active ( false )
, wActive ( this )
@@ -227,40 +225,10 @@
void NCDialog::setSize( int newwidth, int newheight )
{
wRelocate( wpos( 0 ), wsze( newheight, newwidth ) );
- NCMIL << "setSize() called: width: " << newwidth << " height: " << newheight << endl;
+ NCDBG << "setSize() called: width: " << newwidth << " height: " << newheight << endl;
YDialog::setSize( newwidth, newheight );
}
-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : NCDialog::setDefaultButton
-// METHOD TYPE : void
-//
-// DESCRIPTION : Set default button of this dialog (move keyboard
-// focus on it)
-//
-void NCDialog::setDefaultButton( NCPushButton *newButton )
-{
- if ( newButton && defaultButton && (newButton != defaultButton ))
- {
- UIWAR << "Too many default push buttons: " <<
- " only one allowed." << endl;
- defaultButton->setDefaultButton( false );
- }
-
- defaultButton = newButton;
-
- if (defaultButton)
- {
- UIDBG << "New default button: " << endl;
- defaultButton->setKeyboardFocus();
- }
-
- YDialog::setDefaultButton( 0 );
- YDialog::setDefaultButton( defaultButton );
-
-}
///////////////////////////////////////////////////////////////////
//
@@ -274,7 +242,7 @@
{
NCMIL << "initDialog()" << endl;
if ( !pan ) {
- NCMIL << "setInitialSize() called!" << endl;
+ NCDBG << "setInitialSize() called!" << endl;
setInitialSize();
}
}
@@ -291,9 +259,14 @@
{
IODBG << "sd+ " << this << endl;
if ( pan && pan->hidden() ) {
+ YPushButton *defaultB = YDialog::defaultButton();
+ if ( defaultB )
+ {
+ defaultB->setKeyboardFocus();
+ }
getVisible();
doUpdate();
- DumpOn( NCMIL, " " );
+ DumpOn( NCDBG, " " );
}
else if ( !pan )
{
Modified: trunk/ncurses/src/NCDialog.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCDialog.h?rev=43089&r1=43088&r2=43089&view=diff
==============================================================================
--- trunk/ncurses/src/NCDialog.h (original)
+++ trunk/ncurses/src/NCDialog.h Fri Dec 14 17:02:04 2007
@@ -62,7 +62,6 @@
NCursesUserPanel<NCDialog> * pan;
NCstyle::StyleSet mystyleset;
const NCstyle::Style * dlgstyle;
- NCPushButton *defaultButton;
unsigned inMultiDraw_i;
@@ -149,8 +148,6 @@
**/
virtual void setSize( int newWidth, int newHeight );
- virtual void setDefaultButton( NCPushButton *newButton );
-
protected:
enum NCDopts {
Modified: trunk/ncurses/src/NCPushButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCPushButton.cc?rev=43089&r1=43088&r2=43089&view=diff
==============================================================================
--- trunk/ncurses/src/NCPushButton.cc (original)
+++ trunk/ncurses/src/NCPushButton.cc Fri Dec 14 17:02:04 2007
@@ -144,32 +144,6 @@
Redraw();
}
-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : NCPushButton::setDefaultButton
-// METHOD TYPE : void
-//
-// DESCRIPTION : Mark this button as default within current dialog
-//
-void NCPushButton::setDefaultButton( bool def )
-{
- YDialog *ydialog = findDialog();
- NCDialog *dlg = 0;
-
- if (ydialog)
- {
- dlg = dynamic_cast