Author: sh-sh-sh
Date: Fri Aug 22 12:03:41 2008
New Revision: 50324
URL: http://svn.opensuse.org/viewcvs/yast?rev=50324&view=rev
Log:
Handle some pathological cases
Modified:
trunk/libyui/src/YButtonBox.cc
trunk/libyui/src/YPushButton.cc
trunk/ycp-ui-bindings/examples/ButtonBox1.ycp
trunk/ycp-ui-bindings/src/YCPDialogParser.cc
Modified: trunk/libyui/src/YButtonBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YButtonBox.cc?rev=50324&r1=50323&r2=50324&view=diff
==============================================================================
--- trunk/libyui/src/YButtonBox.cc (original)
+++ trunk/libyui/src/YButtonBox.cc Fri Aug 22 12:03:41 2008
@@ -306,7 +306,8 @@
//
int x_pos = margins.left;
- int buttonWidth = 0;
+ int buttonWidth = 0;
+ int buttonHeight = maxChildSize( YD_VERT );
if ( equalSizeButtons )
{
@@ -334,7 +335,6 @@
}
int y_pos = margins.top;
- int buttonHeight = button->preferredHeight();
if ( buttonHeight + margins.top + margins.bottom > height )
{
Modified: trunk/libyui/src/YPushButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YPushButton.cc?rev=50324&r1=50323&r2=50324&view=diff
==============================================================================
--- trunk/libyui/src/YPushButton.cc (original)
+++ trunk/libyui/src/YPushButton.cc Fri Aug 22 12:03:41 2008
@@ -145,6 +145,7 @@
void YPushButton::setFunctionKey( int fkey_no )
{
YWidget::setFunctionKey( fkey_no );
+ YButtonRole oldRole = priv->role;
switch ( functionKey() ) // base class method might have changed it
{
@@ -153,6 +154,14 @@
case 1: priv->role = YHelpButton; break;
default: break;
}
+
+ if ( priv->role != oldRole )
+ {
+ yuiMilestone() << "Guessing button role " << priv->role
+ << " for " << this
+ << " from function key F" << functionKey()
+ << endl;
+ }
}
@@ -206,6 +215,7 @@
{
switch ( role )
{
+ case YCustomButton: stream << "YCustomButton"; break;
case YOKButton: stream << "YOKButton"; break;
case YApplyButton: stream << "YApplyButton"; break;
case YCancelButton: stream << "YCancelButton"; break;
Modified: trunk/ycp-ui-bindings/examples/ButtonBox1.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/examples/ButtonBox1.ycp?rev=50324&r1=50323&r2=50324&view=diff
==============================================================================
--- trunk/ycp-ui-bindings/examples/ButtonBox1.ycp (original)
+++ trunk/ycp-ui-bindings/examples/ButtonBox1.ycp Fri Aug 22 12:03:41 2008
@@ -6,7 +6,7 @@
),
`ButtonBox(
`PushButton(`id(`doit1), "Do &Something Very Cool" ),
- `PushButton(`id(`doit2), "Do &More" ),
+ `PushButton(`id(`doit2), `opt(`key_F10, `customButton), "Do &More" ),
`PushButton(`id(`help), "&Help" ),
`PushButton(`id(`ok), "&OK" ),
`PushButton(`id(`cancel), "&Cancel" ),
Modified: trunk/ycp-ui-bindings/src/YCPDialogParser.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/src/YCPDialogParser.cc?rev=50324&r1=50323&r2=50324&view=diff
==============================================================================
--- trunk/ycp-ui-bindings/src/YCPDialogParser.cc (original)
+++ trunk/ycp-ui-bindings/src/YCPDialogParser.cc Fri Aug 22 12:03:41 2008
@@ -349,7 +349,21 @@
if ( opt.autoShortcut.value() ) w->setAutoShortcut( true );
if ( opt.isHStretchable.value() ) w->setStretchable( YD_HORIZ, true );
if ( opt.isVStretchable.value() ) w->setStretchable( YD_VERT, true );
- if ( opt.key_Fxx.value() > 0 ) w->setFunctionKey( opt.key_Fxx.value() );
+ if ( opt.key_Fxx.value() > 0 )
+ {
+ YPushButton * button = dynamic_cast