Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

widget_showing.cpp

Go to the documentation of this file.
00001 /*
00002                              This file is part of the OPIE Project
00003                              Copyright (c) 2004 Andreas Richter <ar@handhelds.org>
00004                              Copyright (c) 2004 Holger Hans Peter Freyther <freyther@handhelds.org>
00005                =.
00006              .=l.
00007            .>+-=
00008  _;:,     .>    :=|.         This library is free software; you can
00009 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00010 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00011 .="- .-=="i,     .._         License as published by the Free Software
00012  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00013      ._= =}       :          or (at your option) any later version.
00014     .%`+i>       _;_.
00015     .i_,=:_.      -<s.       This library is distributed in the hope that
00016      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00017     : ..    .:,     . . .    without even the implied warranty of
00018     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00019   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00020 ..}^=.=       =       ;      Library General Public License for more
00021 ++=   -.     .`     .:       details.
00022  :     =  ...= . :.=-
00023  -.   .:....=;==+<;          You should have received a copy of the GNU
00024   -_. . .   )=.  =           Library General Public License along with
00025     --        :-=`           this library; see the file COPYING.LIB.
00026                              If not, write to the Free Software Foundation,
00027                              Inc., 59 Temple Place - Suite 330,
00028                              Boston, MA 02111-1307, USA.
00029 
00030 */
00031 
00032 #include <qtopia/qpeapplication.h>
00033 
00034 #ifdef Q_WS_QWS
00035 extern Q_EXPORT QRect qt_maxWindowRect;
00036 #endif
00037 
00038 void QPEApplication::showDialog( QDialog* d, bool nomax )
00039 {
00040     showWidget( d, nomax );
00041 }
00042 
00043 int QPEApplication::execDialog( QDialog* d, bool nomax )
00044 {
00045     showDialog( d, nomax );
00046     return d->exec();
00047 }
00048 
00049 void QPEApplication::showWidget( QWidget* wg, bool nomax ) {
00050     if ( wg->isVisible() ) {
00051         wg->show();
00052         return;
00053     }
00054 
00055 #ifdef OPIE_NO_WINDOWED
00056     Q_UNUSED( nomax )
00057     if ( TRUE ) {
00058 #else
00059     if ( !nomax
00060          && ( qApp->desktop()->width() <= 320 ) ){
00061 #endif
00062         wg->showMaximized();
00063     } else {
00064 #ifdef Q_WS_QWS
00065         QSize desk = QSize( qApp->desktop()->width(), qApp->desktop()->height() );
00066 #else
00067         QSize desk = QSize( qt_maxWindowRect.width(), qt_maxWindowRect.height() );
00068 #endif
00069 
00070         QSize sh = wg->sizeHint();
00071         int w = QMAX( sh.width(), wg->width() );
00072         int h = QMAX( sh.height(), wg->height() );
00073 //              desktop                              widget-frame                      taskbar
00074         w = QMIN( w, ( desk.width() - ( wg->frameGeometry().width() - wg->geometry().width() ) - 25 ) );
00075         h = QMIN( h, ( desk.height() - ( wg->frameGeometry().height() - wg->geometry().height() ) - 25 ) );
00076         wg->resize( w, h );
00077         wg->show();
00078     }
00079 }

Generated on Sat Nov 5 16:16:41 2005 for OPIE by  doxygen 1.4.2