source/ui/msgdlg.cxx

Go to the documentation of this file.
00001 /*************************************************************************
00002  *
00003  *  The Contents of this file are made available subject to
00004  *  the terms of GNU Lesser General Public License Version 2.1.
00005  *
00006  *
00007  *    GNU Lesser General Public License Version 2.1
00008  *    =============================================
00009  *    Copyright 2005 by Kohei Yoshida.
00010  *    1039 Kingsway Dr., Apex, NC 27502, USA
00011  *
00012  *    This library is free software; you can redistribute it and/or
00013  *    modify it under the terms of the GNU Lesser General Public
00014  *    License version 2.1, as published by the Free Software Foundation.
00015  *
00016  *    This library is distributed in the hope that it will be useful,
00017  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  *    Lesser General Public License for more details.
00020  *
00021  *    You should have received a copy of the GNU Lesser General Public
00022  *    License along with this library; if not, write to the Free Software
00023  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00024  *    MA  02111-1307  USA
00025  *
00026  ************************************************************************/
00027 
00028 #include <com/sun/star/awt/XFixedText.hpp>
00029 #include <msgdlg.hxx>
00030 #include <memory>
00031 
00032 namespace scsolver {
00033 
00034 MessageDialog::MessageDialog( SolverImpl* p, const rtl::OUString& sMsg ) 
00035                 : BaseDialog( p ), m_sMessage( sMsg )
00036 {
00037         initialize();
00038 }
00039 
00040 MessageDialog::~MessageDialog() throw()
00041 {
00042 }
00043 
00044 void MessageDialog::setVisible( bool bVisible )
00045 {
00046         if ( bVisible )
00047                 toFront();
00048 
00049         setVisibleDefault( bVisible );
00050 }
00051 
00052 void MessageDialog::close()
00053 {
00054         setVisible(false);
00055 }
00056 
00057 void MessageDialog::setMessage( const rtl::OUString& sMsg )
00058 {
00059         m_sMessage = sMsg;
00060         Reference< uno::XInterface > oWgt = getWidgetByName( ascii( "ftMessage" ) );
00061         Reference< awt::XFixedText > xTxt( oWgt, UNO_QUERY );
00062         xTxt->setText( sMsg );
00063 }
00064 
00065 void MessageDialog::initialize()
00066 {
00067         const sal_Int16 nBtnWidth = 30, nBtnHeight = 14, nMargin = 3;
00068         sal_Int16 nWidth = 120, nHeight = 40;
00069 
00070         initializeDefault( nWidth, nHeight, ascii_i18n( "Message Dialog" ) );
00071 
00072         addFixedText( 5, 5, nWidth - 10, 10, ascii( "ftMessage" ), m_sMessage );
00073         addButton( (nWidth - nBtnWidth)/2, nHeight - nBtnHeight - nMargin, nBtnWidth, nBtnHeight, 
00074                         ascii( "btnOk" ), ascii( "OK" ), awt::PushButtonType_OK );
00075 
00076         registerListeners();
00077 }
00078 
00079 void MessageDialog::registerListeners()
00080 {
00081 }
00082 
00083 
00084 }
00085 
00086 
00087 
00088 
00089 
00090 

Generated on Mon Jul 28 09:13:20 2008 for scsolver by  doxygen 1.5.3