summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opieui/big-screen/owidgetstack.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opieui/big-screen/owidgetstack.cpp b/libopie2/opieui/big-screen/owidgetstack.cpp
index b14a643..00194b4 100644
--- a/libopie2/opieui/big-screen/owidgetstack.cpp
+++ b/libopie2/opieui/big-screen/owidgetstack.cpp
@@ -1,51 +1,51 @@
/*
               =. This file is part of the OPIE Project
-             .=l. Copyright (c) 2003 hOlgAr <zecke@handhelds.org>
+             .=l. Copyright (c) 2003,2004,2005 Holger Hans Peter Freyther <zecke@handhelds.org>
           .>+-=
 _;:,     .>    :=|. This library is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This library is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "owidgetstack.h"
/* OPIE */
#include <opie2/odebug.h>
/* QT */
#include <qapplication.h>
#include <qwidgetstack.h>
namespace Opie {
namespace Ui {
const int mode_size = 330;
/**
* This is the standard widget. For simple usage see the example. Normally this widget
* is the central widget of a QMainWindow.
* Use removeWidget before you delete a widget yourself. OWidgetStack does not
* yet recognize removal of children.
*
* @param parent The parent widget. It maybe 0 but then you need to take care of deletion.
* Or you use QPEApplication::showMainWidget().
@@ -265,97 +265,97 @@ void OWidgetStack::raiseWidget( int id) {
/**
* This is an overloaded function and only differs in its parameters.
* @see raiseWidget( int )
*/
void OWidgetStack::raiseWidget( QWidget* wid) {
m_last = wid;
if (m_mode == SmallScreen )
m_stack->raiseWidget( wid );
else {
int ide;
emit aboutToShow( wid );
/* if someone is connected and the widget is actually available */
if ( receivers( SIGNAL(aboutToShow(int) ) ) &&
( (ide = id( wid ) ) != -1 ) )
emit aboutToShow( ide );
/* ### FIXME PLACE THE WIDGET right */
wid->show();
}
}
/**
* This will hide the currently visible widget
* and raise the widget specified by the parameter.
* Note that this method does not use visibleWIdget but remembers
* the last raisedWidget
*/
void OWidgetStack::hideWidget( int id) {
/* hiding our main widget wouldn't be smart */
if ( m_mode == BigScreen && m_last != m_mWidget )
m_last->hide();
raiseWidget( id );
}
/**
* This is overloaded and only differs in the parameters
* it takes.
*/
void OWidgetStack::hideWidget( QWidget* wid) {
/* still not smart */
if ( m_mode == BigScreen && m_last != m_mWidget )
m_last->hide();
raiseWidget( wid );
}
bool OWidgetStack::eventFilter( QObject* obj, QEvent* e) {
- if ( e->type() == QEvent::Resize ) {
+ if ( e->type() == QEvent::Resize && !m_forced ) {
QResizeEvent *res = static_cast<QResizeEvent*>( e );
QSize size = res->size();
if ( size.width() >= mode_size )
switchTop();
else
switchStack();
}
return false;
}
/**
* @internal_resons
*/
void OWidgetStack::resizeEvent( QResizeEvent* ev ) {
QFrame::resizeEvent( ev );
if (m_mode == SmallScreen )
m_stack->setGeometry( frameRect() );
else
if (m_mWidget )
m_mWidget->setGeometry( frameRect() );
}
/**
* setMainWindow gives the OWidgetStack a hint which
* window should always stay inside the stack.
* Normally the first added widget is considered to be
* the mainwindow but you can change this with this
* function.
* If in BigScreen mode the current mainwindow will be reparented
* and hidden. The position will be taken by the new one.
* If the old MainWindow was hidden the new window will
* also be hidden. If the window was visible the new mainwindow
* will be made visible too and the old one hidden. If there
* was no mainwindow it will be hidden as well.
*
* @param wid The new mainwindow
*/
void OWidgetStack::setMainWindow( QWidget* wid ) {
if (m_mode == BigScreen ) {
bool wasVisible = false;
if (m_mWidget ) {
wasVisible = !m_mWidget->isHidden();
/* hidden by default */
m_mWidget->reparent(0, WType_TopLevel, QPoint(10, 10) );
}
wid->reparent(this, 0, frameRect().topLeft() );