1 /////////////////////////////////////////////////////////////////////////////
3 // File : qworkspaceP.h
4 // Description : the patch for Qt's QWorkspace class (qworkspace.h)
5 /////////////////////////////////////////////////////////////////////////////
7 /****************************************************************************
10 ** Definition of the QWorkspace class
14 ** Copyright (C) 1999-2000 Trolltech AS. All rights reserved.
16 ** This file is part of the workspace module of the Qt GUI Toolkit.
18 ** This file may be distributed under the terms of the Q Public License
19 ** as defined by Trolltech AS of Norway and appearing in the file
20 ** LICENSE.QPL included in the packaging of this file.
22 ** This file may be distributed and/or modified under the terms of the
23 ** GNU General Public License version 2 as published by the Free Software
24 ** Foundation and appearing in the file LICENSE.GPL included in the
25 ** packaging of this file.
27 ** Licensees holding valid Qt Enterprise Edition licenses may use this
28 ** file in accordance with the Qt Commercial License Agreement provided
31 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
32 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
34 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
35 ** information about Qt Commercial License Agreements.
36 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
37 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
39 ** Contact info@trolltech.com if any conditions of this licensing are
42 **********************************************************************/
50 #include <qwidgetlist.h>
52 #include <qguardedptr.h>
57 class QWorkspacePChild;
59 class QWorkspacePPrivate;
61 class QWidgetResizeHandlerP;
64 class Q_EXPORT QWorkspaceP : public QWidget
67 Q_PROPERTY( bool scrollBarsEnabled READ scrollBarsEnabled WRITE setScrollBarsEnabled )
69 QWorkspaceP( QWidget* parent=0, const char* name=0 );
72 QWidget* activeWindow() const;
73 QWidgetList windowList() const;
75 QSize sizeHint() const;
77 bool scrollBarsEnabled() const;
78 void setScrollBarsEnabled( bool enable );
80 void setPaletteBackgroundColor( const QColor & );
81 void setPaletteBackgroundPixmap( const QPixmap & );
84 void windowActivated( QWidget* w);
92 void styleChange( QStyle& );
94 void childEvent( QChildEvent * );
95 void resizeEvent( QResizeEvent * );
96 bool eventFilter( QObject *, QEvent * );
97 void showEvent( QShowEvent *e );
98 void hideEvent( QHideEvent *e );
99 #ifndef QT_NO_WHEELEVENT
100 void wheelEvent( QWheelEvent *e );
104 void closeActiveWindow();
105 void closeAllWindows();
106 void normalizeActiveWindow();
107 void minimizeActiveWindow();
108 void showOperationMenu();
109 void popupOperationMenu( const QPoint& );
110 void operationMenuActivated( int );
111 void operationMenuAboutToShow();
112 void toolMenuAboutToShow();
113 void scrollBarChanged();
115 void activateNextWindow();
116 void activatePreviousWindow();
119 void activateWindow( QWidget* w, bool change_focus = TRUE );
122 void insertIcon( QWidget* w);
123 void removeIcon( QWidget* w);
124 void place( QWidget* );
126 QWorkspacePChild* findChild( QWidget* w);
127 void showMaximizeControls();
128 void hideMaximizeControls();
129 void showWindow( QWidget* w);
130 void maximizeWindow( QWidget* w);
131 void minimizeWindow( QWidget* w);
132 void normalizeWindow( QWidget* w);
134 QRect updateWorkspace();
137 QWorkspacePPrivate* d;
139 friend class QWorkspacePChild;
141 private: // Disabled copy constructor and operator=
142 #if defined(Q_DISABLE_COPY)
143 QWorkspaceP( const QWorkspaceP & );
144 QWorkspaceP& operator=( const QWorkspaceP & );
148 class QWorkspacePChild : public QFrame
152 friend class QWorkspaceP;
153 friend class QTitleBarP;
156 QWorkspacePChild( QWidget* window,
157 QWorkspaceP* parent=0, const char* name=0 );
160 void setActive( bool );
161 bool isActive() const;
163 void adjustToFullscreen();
166 QWidget* windowWidget() const;
167 QWidget* iconWidget() const;
172 QSize sizeHint() const;
173 QSize minimumSizeHint() const;
175 QSize baseSize() const;
178 void showOperationMenu();
179 void popupOperationMenu( const QPoint& );
183 void showMinimized();
184 void showMaximized();
187 void setCaption( const QString& );
188 void internalRaise();
189 void titleBarDoubleClicked();
191 void move( int x, int y );
194 void enterEvent( QEvent * );
195 void leaveEvent( QEvent * );
196 void childEvent( QChildEvent* );
197 void resizeEvent( QResizeEvent * );
198 void moveEvent( QMoveEvent * );
199 bool eventFilter( QObject *, QEvent * );
201 bool focusNextPrevChild( bool );
203 void drawFrame( QPainter * );
204 void styleChange( QStyle & );
207 QWidget* childWidget;
209 QWidgetResizeHandlerP *widgetResizeHandler;
210 QTitleBarP* titlebar;
211 QGuardedPtr<QTitleBarP> iconw;
214 QSize shadeRestoreMin;
217 bool snappedRight :1;
226 class Q_EXPORT QWidgetResizeHandlerP : public QObject
231 QWidgetResizeHandlerP( QWidget *parent, QWidget *cw = 0, const char *name = 0 );
232 void setActive( bool b ) { active = b; if ( !active ) setMouseCursor( Nowhere ); }
233 bool isActive() const { return active; }
234 void setMovingEnabled( bool b ) { moving = b; }
235 bool isMovingEnabled() const { return moving; }
237 bool isButtonDown() const { return buttonDown; }
239 void setExtraHeight( int h ) { extrahei = h; }
240 void setSizeProtection( bool b ) { sizeprotect = b; }
249 bool eventFilter( QObject *o, QEvent *e );
250 void mouseMoveEvent( QMouseEvent *e );
251 void keyPressEvent( QKeyEvent *e );
256 TopLeft, BottomRight, BottomLeft, TopRight,
257 Top, Bottom, Left, Right,
262 QWidget *childWidget;
264 QPoint invertedMoveOffset;
269 uint moveResizeMode :1;
274 void setMouseCursor( MousePosition m );
275 bool isMove() const {
276 return moveResizeMode && mode == Center;
278 bool isResize() const {
279 return moveResizeMode && !isMove();
282 private: // Disabled copy constructor and operator=
283 #if defined(Q_DISABLE_COPY)
284 QWidgetResizeHandlerP( const QWidgetResizeHandlerP & );
285 QWidgetResizeHandlerP& operator=( const QWidgetResizeHandlerP & );
291 class QTitleBarPPrivate;
294 class Q_EXPORT QTitleBarP : public QWidget
297 Q_PROPERTY( bool autoRaise READ autoRaise WRITE setAutoRaise )
298 Q_PROPERTY( bool movable READ isMovable WRITE setMovable )
301 QTitleBarP (QWidget* w, QWidget* parent, const char* name=0);
304 bool isActive() const;
305 bool usesActiveColor() const;
306 virtual QString visibleText() const;
308 bool isMovable() const;
309 void setMovable(bool);
311 bool autoRaise() const;
312 void setAutoRaise(bool);
314 QWidget *window() const;
316 QSize sizeHint() const;
319 void setActive( bool );
320 void setCaption( const QString& title );
321 void setIcon( const QPixmap& icon );
330 void showOperationMenu();
331 void popupOperationMenu( const QPoint& );
332 void doubleClicked();
335 bool event( QEvent *);
336 void resizeEvent( QResizeEvent *);
337 void contextMenuEvent( QContextMenuEvent * );
338 void mousePressEvent( QMouseEvent * );
339 void mouseDoubleClickEvent( QMouseEvent * );
340 void mouseReleaseEvent( QMouseEvent * );
341 void mouseMoveEvent( QMouseEvent * );
342 void enterEvent( QEvent *e );
343 void leaveEvent( QEvent *e );
344 void paintEvent( QPaintEvent *p );
346 virtual void cutText();
351 QTitleBarPPrivate *d;
354 #endif // QWORKSPACEP_H