Author: gs
Date: Tue Jul 10 15:23:37 2007
New Revision: 39283
URL: http://svn.opensuse.org/viewcvs/yast?rev=39283&view=rev
Log:
call setSize() of YWidgetClass for container widgets,
add preferredSize() to NCFrame, NCDialog
Removed:
branches/tmp/sh/mod-ui/ncurses/src/NCWeight.cc
branches/tmp/sh/mod-ui/ncurses/src/NCWeight.h
Modified:
branches/tmp/sh/mod-ui/ncurses/src/NCAlignment.cc
branches/tmp/sh/mod-ui/ncurses/src/NCCheckBoxFrame.cc
branches/tmp/sh/mod-ui/ncurses/src/NCDialog.cc
branches/tmp/sh/mod-ui/ncurses/src/NCDialog.h
branches/tmp/sh/mod-ui/ncurses/src/NCFrame.cc
branches/tmp/sh/mod-ui/ncurses/src/NCFrame.h
branches/tmp/sh/mod-ui/ncurses/src/NCLayoutBox.cc
branches/tmp/sh/mod-ui/ncurses/src/NCPushButton.cc
branches/tmp/sh/mod-ui/ncurses/src/NCPushButton.h
branches/tmp/sh/mod-ui/ncurses/src/NCRadioButtonGroup.cc
branches/tmp/sh/mod-ui/ncurses/src/NCReplacePoint.cc
branches/tmp/sh/mod-ui/ncurses/src/NCSquash.cc
branches/tmp/sh/mod-ui/ncurses/src/NCWidget.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
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCAlignment.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCAlignment.cc?rev=39283&r1=39282&r2=39283&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCAlignment.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCAlignment.cc Tue Jul 10 15:23:37 2007
@@ -62,6 +62,7 @@
void NCAlignment::setSize( int newwidth, int newheight )
{
wRelocate( wpos( 0 ), wsze( newheight, newwidth ) );
+ YAlignment::setSize( newwidth, newheight);
}
///////////////////////////////////////////////////////////////////
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCCheckBoxFrame.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCCheckBoxFrame.cc?rev=39283&r1=39282&r2=39283&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCCheckBoxFrame.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCCheckBoxFrame.cc Tue Jul 10 15:23:37 2007
@@ -100,8 +100,6 @@
wsze csze( newheight, newwidth );
wRelocate( wpos( 0 ), csze );
csze = wsze::max( 0, csze - framedim.Sze );
- // FIXME
- //YContainerWidget::child(0)->setSize( csze.W, csze.H );
firstChild()->setSize( csze.W, csze.H );
}
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCDialog.cc?rev=39283&r1=39282&r2=39283&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCDialog.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCDialog.cc Tue Jul 10 15:23:37 2007
@@ -120,7 +120,6 @@
dlgstyle = &NCurses::style()[mystyleset];
helpPopup = 0;
-
WIDDBG << "+++ " << this << endl;
}
@@ -186,7 +185,7 @@
delete helpPopup;
}
}
-
+#if 0
///////////////////////////////////////////////////////////////////
//
//
@@ -210,6 +209,32 @@
return dim == YD_HORIZ ? csze.W : csze.H;
}
+#endif
+
+int NCDialog::preferredWidth()
+{
+ if ( hasDefaultSize() || !childrenCount() )
+ return wGetDefsze().W;
+ wsze csze( firstChild()->preferredHeight(),
+ firstChild()->preferredWidth() );
+ csze = wsze::min( wGetDefsze(),
+ wsze::max( csze, wsze( 1 ) ) );
+
+ return csze.W;
+}
+
+int NCDialog::preferredHeight()
+{
+ if ( hasDefaultSize() || !childrenCount() ) {
+ return wGetDefsze().H;
+ }
+ wsze csze( firstChild()->preferredHeight(),
+ firstChild()->preferredWidth() );
+ csze = wsze::min( wGetDefsze(),
+ wsze::max( csze, wsze( 1 ) ) );
+
+ return csze.H;
+}
///////////////////////////////////////////////////////////////////
//
@@ -222,6 +247,7 @@
void NCDialog::setSize( int newwidth, int newheight )
{
wRelocate( wpos( 0 ), wsze( newheight, newwidth ) );
+ YDialog::setSize( newwidth, newheight );
}
///////////////////////////////////////////////////////////////////
@@ -234,7 +260,8 @@
//
void NCDialog::initDialog()
{
- if ( !pan ) {
+ NCMIL << "initDialog()" << endl;
+ if ( !pan ) {
setInitialSize();
}
}
@@ -249,12 +276,18 @@
//
void NCDialog::showDialog()
{
+ NCMIL << "SHOW" << endl;
IODBG << "sd+ " << this << endl;
if ( pan && pan->hidden() ) {
getVisible();
doUpdate();
- DumpOn( NCDBG, " " );
+ DumpOn( NCMIL, " " );
+ }
+ else if ( !pan )
+ {
+ NCMIL << "no pan" << endl;
}
+
activate( true );
IODBG << "sd- " << this << endl;
}
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCDialog.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCDialog.h?rev=39283&r1=39282&r2=39283&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCDialog.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCDialog.h Tue Jul 10 15:23:37 2007
@@ -136,8 +136,10 @@
NCursesEvent userInput( int timeout_millisec = -1 );
NCursesEvent pollInput();
- virtual long nicesize( YUIDimension dim );
-
+ //virtual long nicesize( YUIDimension dim );
+ virtual int preferredWidth();
+ virtual int preferredHeight();
+
/**
* Set the new size of the widget.
*
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCFrame.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCFrame.cc?rev=39283&r1=39282&r2=39283&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCFrame.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCFrame.cc Tue Jul 10 15:23:37 2007
@@ -76,6 +76,24 @@
return dim == YD_HORIZ ? defsze.W : defsze.H;
}
+int NCFrame::preferredWidth()
+{
+ defsze.W = firstChild()->preferredWidth();
+
+ if ( label.width() > (unsigned)defsze.W )
+ defsze.W = label.width();
+ defsze.W += framedim.Sze.W;
+
+ return defsze.W;
+}
+
+int NCFrame::preferredHeight()
+{
+ defsze.H = firstChild()->preferredHeight() + framedim.Sze.H;
+
+ return defsze.H;
+}
+
///////////////////////////////////////////////////////////////////
//
//
@@ -89,8 +107,6 @@
wsze csze( newheight, newwidth );
wRelocate( wpos( 0 ), csze );
csze = wsze::max( 0, csze - framedim.Sze );
- // FIXME
- //YContainerWidget::child(0)->setSize( csze.W, csze.H );
firstChild()->setSize( csze.W, csze.H );
}
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCFrame.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCFrame.h?rev=39283&r1=39282&r2=39283&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCFrame.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCFrame.h Tue Jul 10 15:23:37 2007
@@ -58,6 +58,9 @@
virtual long nicesize( YUIDimension dim );
+ virtual int preferredWidth();
+ virtual int preferredHeight();
+
/**
* Set the new size of the widget.
*
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCLayoutBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCLayoutBox.cc?rev=39283&r1=39282&r2=39283&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCLayoutBox.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCLayoutBox.cc Tue Jul 10 15:23:37 2007
@@ -61,6 +61,7 @@
void NCLayoutBox::setSize( int newwidth, int newheight )
{
wRelocate( wpos( 0 ), wsze( newheight, newwidth ) );
+ YLayoutBox::setSize( newwidth, newheight );
}
///////////////////////////////////////////////////////////////////
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPushButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPushButton.cc?rev=39283&r1=39282&r2=39283&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCPushButton.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCPushButton.cc Tue Jul 10 15:23:37 2007
@@ -33,6 +33,8 @@
, NCWidget( parent )
{
WIDDBG << endl;
+ setWidgetRep(this);
+ NCMIL << "PushBUtton constructor" << endl;
setLabel( nlabel );
hotlabel = &label;
if ( isDefaultButton() )
@@ -54,6 +56,7 @@
WIDDBG << endl;
}
+#if 0
///////////////////////////////////////////////////////////////////
//
//
@@ -66,14 +69,19 @@
{
return dim == YD_HORIZ ? wGetDefsze().W : wGetDefsze().H;
}
+#endif
int NCPushButton::preferredWidth()
{
+ wsze defsize = wGetDefsze();
+ int width = defsize.W;
+ NCMIL << "preferedW: " << width << endl;
return wGetDefsze().W;
}
int NCPushButton::preferredHeight()
{
+ NCMIL << "preferedH: " << wGetDefsze().H << endl;
return wGetDefsze().H;
}
@@ -87,6 +95,7 @@
//
void NCPushButton::setSize( int newwidth, int newheight )
{
+ NCMIL << "SetSize called" << endl;
wRelocate( wpos( 0 ), wsze( newheight, newwidth ) );
}
@@ -137,11 +146,10 @@
//
void NCPushButton::wRedraw()
{
- NCMIL << "Redraw" << endl;
if ( !win )
return;
- NCMIL << "Redraw - danach" << endl;
+ NCMIL << "NCPushButton::wRedraw" << endl;
const NCstyle::StWidget & style( widgetStyle() );
win->bkgd( style.plain );
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPushButton.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPushButton.h?rev=39283&r1=39282&r2=39283&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCPushButton.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCPushButton.h Tue Jul 10 15:23:37 2007
@@ -54,8 +54,6 @@
NCPushButton( YWidget * parent, const string & label );
virtual ~NCPushButton();
- virtual long nicesize( YUIDimension dim );
-
virtual int preferredWidth();
virtual int preferredHeight();
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCRadioButtonGroup.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCRadioButtonGroup.cc?rev=39283&r1=39282&r2=39283&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCRadioButtonGroup.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCRadioButtonGroup.cc Tue Jul 10 15:23:37 2007
@@ -61,6 +61,7 @@
void NCRadioButtonGroup::setSize( int newwidth, int newheight )
{
wRelocate( wpos( 0 ), wsze( newheight, newwidth ) );
+ YRadioButtonGroup::setSize( newwidth, newheight );
}
///////////////////////////////////////////////////////////////////
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCReplacePoint.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCReplacePoint.cc?rev=39283&r1=39282&r2=39283&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCReplacePoint.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCReplacePoint.cc Tue Jul 10 15:23:37 2007
@@ -60,4 +60,5 @@
void NCReplacePoint::setSize( int newwidth, int newheight )
{
wRelocate( wpos( 0 ), wsze( newheight, newwidth ) );
+ YReplacePoint::setSize( newwidth, newheight);
}
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCSquash.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCSquash.cc?rev=39283&r1=39282&r2=39283&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCSquash.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCSquash.cc Tue Jul 10 15:23:37 2007
@@ -61,4 +61,5 @@
void NCSquash::setSize( int newwidth, int newheight )
{
wRelocate( wpos( 0 ), wsze( newheight, newwidth ) );
+ YSquash::setSize( newwidth, newheight );
}
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCWidget.cc?rev=39283&r1=39282&r2=39283&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCWidget.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCWidget.cc Tue Jul 10 15:23:37 2007
@@ -24,10 +24,10 @@
#include "YWidget.h"
#include "YContainerWidget.h"
-#if 0
+//#if 0
#undef DBG_CLASS
#define DBG_CLASS "_NCWidget_"
-#endif
+//#endif
///////////////////////////////////////////////////////////////////
//
@@ -52,6 +52,7 @@
, hotfkey( 0 )
{
NCWidget * myparent = dynamic_cast