1 /************************************************************************
3 * Copyright 2010-2011 Jakob Leben (jakob.leben@gmail.com)
5 * This file is part of SuperCollider Qt GUI.
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ************************************************************************/
22 #ifndef QC_WIDGET_PROXY_H
23 #define QC_WIDGET_PROXY_H
25 #include "QObjectProxy.h"
31 namespace QtCollider
{
33 struct SetAlwaysOnTopEvent
;
34 struct StartDragEvent
;
37 class QWidgetProxy
: public QObjectProxy
50 static void setGlobalEventEnabled ( GlobalEvent ev
, bool b
) {
51 int mask
= _globalEventMask
;
56 _globalEventMask
= mask
;
61 QWidgetProxy( QWidget
*w
, PyrObject
*po
);
63 void setKeyEventWidget( QWidget
* );
65 void setMouseEventWidget( QWidget
* );
71 void setLayout ( QObjectProxy
*layoutProxy
);
73 virtual bool setParent( QObjectProxy
*parent
);
75 inline QWidget
*widget() { return static_cast<QWidget
*>( object() ); }
79 virtual void customEvent( QEvent
* );
81 virtual bool filterEvent( QObject
*, QEvent
*, EventHandlerData
&, QList
<QVariant
> & args
);
85 void customPaint( QPainter
* );
88 bool interpretMouseEvent( QObject
*, QEvent
*, QList
<QVariant
> &args
);
89 bool interpretMouseWheelEvent( QObject
*, QEvent
*, QList
<QVariant
> &args
);
90 bool interpretKeyEvent( QObject
*, QEvent
*, QList
<QVariant
> &args
);
91 bool interpretDragEvent( QObject
*, QEvent
*, QList
<QVariant
> &args
);
93 void bringFrontEvent();
94 void setFocusEvent( QtCollider::SetFocusEvent
* );
95 void setAlwaysOnTopEvent( QtCollider::SetAlwaysOnTopEvent
* );
96 void startDragEvent( QtCollider::StartDragEvent
* );
98 static void sendRefreshEventRecursive( QWidget
*w
);
100 QWidget
*_keyEventWidget
;
101 QWidget
*_mouseEventWidget
;
102 static QAtomicInt _globalEventMask
;
105 namespace QtCollider
{
107 struct SetFocusEvent
: public QEvent
109 SetFocusEvent( bool b
)
110 : QEvent( (QEvent::Type
) QtCollider::Event_Proxy_SetFocus
),
116 struct SetAlwaysOnTopEvent
: public QEvent
118 SetAlwaysOnTopEvent( bool b
)
119 : QEvent( (QEvent::Type
) QtCollider::Event_Proxy_SetAlwaysOnTop
),
125 struct StartDragEvent
: public QEvent
127 StartDragEvent( const QString
&label_
, QMimeData
*data_
)
128 : QEvent( (QEvent::Type
) QtCollider::Event_Proxy_StartDrag
),
129 label( label_
), data( data_
)
131 ~StartDragEvent() { delete data
; }
138 #endif //QC_WIDGET_PROXY_H