diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-12-01 11:57:05 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-09-28 08:48:06 +0100 |
commit | e333c62699d29143d2fdec631a42e109eb729500 (patch) | |
tree | 58ca017759fee52e8a2381c579e763bf0f29e330 | |
parent | adf8e434ae7b03ba24041bb7308e8f1f3fd55f25 (diff) |
find buttons in 'action area'
-rw-r--r-- | vcl/source/window/dialog.cxx | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 033fe514ccd2..70105e6a7c4d 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -168,11 +168,26 @@ void ImplWindowAutoMnemonic( Window* pWindow ) } } +static Window* getActionAreaButtonList(Dialog *pDialog) +{ + Window* pChild; + if (pDialog->isLayoutEnabled()) + { + Box *pBox = dynamic_cast<Box*>(pDialog->GetWindow(WINDOW_FIRSTCHILD)); + HButtonBox *pButtonBox = pBox ? + dynamic_cast<HButtonBox*>(pBox->GetWindow(WINDOW_LASTCHILD)) : 0; + pChild = pButtonBox ? pButtonBox->GetWindow(WINDOW_FIRSTCHILD) : 0; + } + else + pChild = pDialog->GetWindow( WINDOW_FIRSTCHILD ); + return pChild; +} + // ======================================================================= static PushButton* ImplGetDefaultButton( Dialog* pDialog ) { - Window* pChild = pDialog->GetWindow( WINDOW_FIRSTCHILD ); + Window* pChild = getActionAreaButtonList(pDialog); while ( pChild ) { if ( pChild->ImplIsPushButton() ) @@ -192,7 +207,7 @@ static PushButton* ImplGetDefaultButton( Dialog* pDialog ) static PushButton* ImplGetOKButton( Dialog* pDialog ) { - Window* pChild = pDialog->GetWindow( WINDOW_FIRSTCHILD ); + Window* pChild = getActionAreaButtonList(pDialog); while ( pChild ) { if ( pChild->GetType() == WINDOW_OKBUTTON ) @@ -208,7 +223,8 @@ static PushButton* ImplGetOKButton( Dialog* pDialog ) static PushButton* ImplGetCancelButton( Dialog* pDialog ) { - Window* pChild = pDialog->GetWindow( WINDOW_FIRSTCHILD ); + Window* pChild = getActionAreaButtonList(pDialog); + while ( pChild ) { if ( pChild->GetType() == WINDOW_CANCELBUTTON ) @@ -963,7 +979,6 @@ Size Dialog::GetOptimalSize(WindowSizeType eType) const void Dialog::Resize() { - fprintf(stderr, "Dialog::Resize\n"); if (isLayoutEnabled()) { Size aSize = GetSizePixel(); |