summaryrefslogtreecommitdiff
authorzecke <zecke>2003-08-28 14:45:00 (UTC)
committer zecke <zecke>2003-08-28 14:45:00 (UTC)
commit5665c2c773a82b6c8a13ae7019a1d60bc0ab7778 (patch) (side-by-side diff)
tree0cdb4eb43c9bab11c9be3ed02c5349f3480435fd
parent20c41310c4669bb0e349dc14745f42a9241a7f1c (diff)
downloadopie-5665c2c773a82b6c8a13ae7019a1d60bc0ab7778.zip
opie-5665c2c773a82b6c8a13ae7019a1d60bc0ab7778.tar.gz
opie-5665c2c773a82b6c8a13ae7019a1d60bc0ab7778.tar.bz2
rotation and docking fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/serverinterface.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/core/launcher/serverinterface.cpp b/core/launcher/serverinterface.cpp
index 7002243..9eb7f75 100644
--- a/core/launcher/serverinterface.cpp
+++ b/core/launcher/serverinterface.cpp
@@ -43,147 +43,149 @@ private:
void layout();
Item *findWidget( const QWidget *w ) const;
QList<Item> docked;
};
LayoutManager::LayoutManager()
{
docked.setAutoDelete( TRUE );
qApp->desktop()->installEventFilter( this );
}
void LayoutManager::addDocked( QWidget *w, ServerInterface::DockArea placement )
{
Item *i = new Item;
i->w = w;
i->p = placement;
w->installEventFilter( this );
docked.append(i);
layout();
}
bool LayoutManager::eventFilter( QObject *object, QEvent *event )
{
if ( object == qApp->desktop() ) {
if ( event->type() == QEvent::Resize )
layout();
return QObject::eventFilter( object, event );
}
Item *item;
switch ( event->type() ) {
case QEvent::Destroy:
item = findWidget( (QWidget *)object );
if ( item ) {
docked.removeRef( item );
layout();
}
break;
case QEvent::Hide:
case QEvent::Show:
item = findWidget( (QWidget *)object );
if ( item )
layout();
break;
default:
break;
}
return QObject::eventFilter( object, event );
}
void LayoutManager::layout()
{
QRect mwr( qApp->desktop()->geometry() );
QListIterator<Item> it( docked );
Item *item;
for ( ; (item = it.current()); ++it ) {
QWidget *w = item->w;
if ( !w->isVisible() )
continue;
+
+ QSize sh = w->sizeHint();
switch ( item->p ) {
case ServerInterface::Top:
- w->resize( mwr.width(), w->sizeHint().height() );
- w->move( mwr.topLeft() );
+ w->setGeometry( mwr.left(), mwr.top(),
+ mwr.width(), sh.height() );
mwr.setTop( w->geometry().bottom() + 1 );
break;
case ServerInterface::Bottom:
- w->resize( mwr.width(), w->sizeHint().height() );
- w->move( mwr.left(), mwr.bottom()-w->height()+1 );
+ w->setGeometry( mwr.left(), mwr.bottom() - sh.height(),
+ mwr.width(), sh.height() );
mwr.setBottom( w->geometry().top() - 1 );
break;
case ServerInterface::Left:
- w->resize( w->sizeHint().width(), mwr.height() );
- w->move( mwr.topLeft() );
+ w->setGeometry( mwr.left(), mwr.top(),
+ sh.width(), mwr.height() );
mwr.setLeft( w->geometry().right() + 1 );
break;
case ServerInterface::Right:
- w->resize( w->sizeHint().width(), mwr.height() );
- w->move( mwr.right()-w->width()+1, mwr.top() );
+ w->setGeometry( mwr.right() - sh.width(), mwr.top(),
+ sh.width(), mwr.height() );
mwr.setRight( w->geometry().left() - 1 );
break;
}
}
#ifdef Q_WS_QWS
# if QT_VERSION < 0x030000
QWSServer::setMaxWindowRect( qt_screen->mapToDevice(mwr,
QSize(qt_screen->width(),qt_screen->height())) );
# else
QWSServer::setMaxWindowRect( mwr );
# endif
#endif
}
LayoutManager::Item *LayoutManager::findWidget( const QWidget *w ) const
{
QListIterator<Item> it( docked );
Item *item;
for ( ; (item = it.current()); ++it ) {
if ( item->w == w )
return item;
}
return 0;
}
//---------------------------------------------------------------------------
/*! \class ServerInterface serverinterface.h
\brief The ServerInterface class provides an interface for Qtopia
custom launchers.
The ServerInterface allows the user interface of the launcher to be
customized to suit the device. For a PDA style device, the default
launcher is strongly recommended, however specialist devices may
choose to provide a launcher better suited to the application.
The launcher is fixed for any particular device and is not loaded
as a plugin. Launcher interfaces must
be compilied into the server by editing server.pro and server.cpp.
*/
/*!
\fn ServerInterface::createGUI()
Implement this function to create the custom launcher UI.
*/
/*!
\fn ServerInterface::destroyGUI()
Implement this function to destroy the custom launcher UI. All resources
allocated by createGUI() must be released.
*/
/*!
\enum ServerInterface::ApplicationState
The ApplicationState enum type specifies the state of an application.
The possible values are: <ul>
<li> \c Launching - the application has been requested, but is not yet running.
<li> \c Running - the application is running.