diff options
author | Philipp Lohmann <pl@openoffice.org> | 2002-10-31 14:14:38 +0000 |
---|---|---|
committer | Philipp Lohmann <pl@openoffice.org> | 2002-10-31 14:14:38 +0000 |
commit | 9d821432ead992b3ffd113155a7a91db4bcc3de4 (patch) | |
tree | e69d55d9bf584038d4ef761124b70dd65f0fa392 /vcl/unx/source | |
parent | ffca441f1c317744fd4264a0650c7146f64b3bef (diff) |
#104055# ImplShowNativeMessageBox for Unix
Diffstat (limited to 'vcl/unx/source')
-rw-r--r-- | vcl/unx/source/app/salsys.cxx | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/vcl/unx/source/app/salsys.cxx b/vcl/unx/source/app/salsys.cxx index 32334ce65d3c..67feda9374c8 100644 --- a/vcl/unx/source/app/salsys.cxx +++ b/vcl/unx/source/app/salsys.cxx @@ -2,9 +2,9 @@ * * $RCSfile: salsys.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: pl $ $Date: 2002-07-30 17:32:52 $ + * last change: $Author: pl $ $Date: 2002-10-31 15:14:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,6 +68,7 @@ #include <saldisp.hxx> #include <dtint.hxx> #include <msgbox.hxx> +#include <button.hxx> // ----------------------------------------------------------------------- @@ -188,3 +189,58 @@ int ImplShowNativeDialog( const String& rTitle, const String& rMessage, const st return nRet; } + +int ImplShowNativeMessageBox(const String& rTitle, const String& rMessage, int nButtonCombination, int nDefaultButton) +{ + int nDefButton = 0; + std::list< String > aButtons; + int nButtonIds[5], nBut = 0; + + if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK || + nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL ) + { + aButtons.push_back( Button::GetStandardText( BUTTON_OK ) ); + nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK; + } + if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL || + nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO ) + { + aButtons.push_back( Button::GetStandardText( BUTTON_YES ) ); + nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES; + aButtons.push_back( Button::GetStandardText( BUTTON_NO ) ); + nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO; + if( nDefaultButton == SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO ) + nDefButton = 1; + } + if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL || + nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL || + nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL ) + { + if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL ) + { + aButtons.push_back( Button::GetStandardText( BUTTON_RETRY ) ); + nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY; + } + aButtons.push_back( Button::GetStandardText( BUTTON_CANCEL ) ); + nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL; + if( nDefaultButton == SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL ) + nDefButton = aButtons.size()-1; + } + if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE ) + { + aButtons.push_back( Button::GetStandardText( BUTTON_ABORT ) ); + nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT; + aButtons.push_back( Button::GetStandardText( BUTTON_RETRY ) ); + nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY; + aButtons.push_back( Button::GetStandardText( BUTTON_IGNORE ) ); + nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE; + switch( nDefaultButton ) + { + case SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY: nDefButton = 1;break; + case SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE: nDefButton = 2;break; + } + } + int nResult = ImplShowNativeDialog( rTitle, rMessage, aButtons, nDefButton ); + + return nResult != -1 ? nButtonIds[ nResult ] : 0; +} |