--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File: QtxWorkspace.cxx
+// Author: Sergey TELKOV
+
+#include "QtxWorkspace.h"
+
+#include <QWidgetList>
+
+/*!
+ \brief Constructor.
+ \param parent parent widget
+*/
+QtxWorkspace::QtxWorkspace( QWidget* parent )
+: QWorkspace( parent )
+{
+}
+
+/*!
+ \brief Destructor.
+*/
+QtxWorkspace::~QtxWorkspace()
+{
+}
+
+/*!
+ \brief Performs tile vertical action
+*/
+void QtxWorkspace::tileVertical()
+{
+ QWidgetList winList = windowList();
+ if ( winList.isEmpty() )
+ return;
+
+ int count = 0;
+ for ( QWidgetList::const_iterator itr = winList.begin(); itr != winList.end(); ++itr )
+ if ( !( (*itr)->windowState() & Qt::WindowMinimized ) )
+ count++;
+
+ if ( !count )
+ return;
+
+ if ( activeWindow() && ( activeWindow()->windowState() & Qt::WindowMaximized ) )
+ activeWindow()->showNormal();
+
+ int y = 0;
+ int heightForEach = height() / count;
+ for ( QWidgetList::iterator it = winList.begin(); it != winList.end(); ++it )
+ {
+ QWidget* win = *it;
+ if ( win->windowState() & Qt::WindowMinimized )
+ continue;
+
+ if ( win->windowState() & Qt::WindowMaximized )
+ {
+ win->hide();
+ win->showNormal();
+ }
+
+// QApplication::sendPostedEvents( 0, QEvent::ShowNormal );
+
+ int prefH = win->minimumHeight() + win->parentWidget()->baseSize().height();
+ int actualH = qMax( heightForEach, prefH );
+
+ win->parentWidget()->setGeometry( 0, y, width(), actualH );
+ y += actualH;
+ }
+}
+
+/*!
+ \brief Performs tile horizontal action
+*/
+void QtxWorkspace::tileHorizontal()
+{
+ QWidgetList winList = windowList();
+ if ( winList.isEmpty() )
+ return;
+
+ int count = 0;
+ for ( QWidgetList::const_iterator itr = winList.begin(); itr != winList.end(); ++itr )
+ if ( !( (*itr)->windowState() & Qt::WindowMinimized ) )
+ count++;
+
+ if ( !count )
+ return;
+
+ if ( activeWindow() && activeWindow()->windowState() & Qt::WindowMaximized )
+ activeWindow()->showNormal();
+
+ int x = 0;
+ int widthForEach = width() / count;
+ for ( QWidgetList::iterator it = winList.begin(); it != winList.end(); ++it )
+ {
+ QWidget* win = *it;
+ if ( win->windowState() & Qt::WindowMinimized )
+ continue;
+
+ if ( win->windowState() & Qt::WindowMaximized )
+ {
+ win->hide();
+ win->showNormal();
+ }
+
+// QApplication::sendPostedEvents( 0, QEvent::ShowNormal );
+
+ int prefW = win->minimumWidth();
+ int actualW = qMax( widthForEach, prefW );
+
+ win->parentWidget()->setGeometry( x, 0, actualW, height() );
+ x += actualW;
+ }
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File: QtxWorkspace.h
+// Author: Sergey TELKOV
+
+#ifndef QTXWORKSPACE_H
+#define QTXWORKSPACE_H
+
+#include "Qtx.h"
+
+#include <QWorkspace>
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+class QTX_EXPORT QtxWorkspace : public QWorkspace
+{
+ Q_OBJECT
+
+public:
+ QtxWorkspace( QWidget* = 0 );
+ virtual ~QtxWorkspace();
+
+public slots:
+ void tileVertical();
+ void tileHorizontal();
+};
+
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
+#endif