VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/QIApplication.h@ 16174

Last change on this file since 16174 was 9091, checked in by vboxsync, 17 years ago

FE/Qt4: Cosmetically changes and OSE export.

  • Property svn:eol-style set to native
File size: 2.4 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VirtualBox Qt extensions: QIApplication class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19 * Clara, CA 95054 USA or visit http://www.sun.com if you need
20 * additional information or have any questions.
21 */
22
23#ifndef __QIApplication_h__
24#define __QIApplication_h__
25
26/* Qt includes */
27#include <QApplication>
28
29typedef bool (*QIFilterCallback)(EventRef inEvent, void *inUserArg);
30
31
32/** Sligtly modified QApplication class.
33 *
34 * The sole purpose of this class (ATM) is to hook the macEventFilter
35 * in order to intercept Command-Q, Command-H and similar menu hot-keys
36 * before the HI Manager translate them into (menu) command events and
37 * start blinking menus in the menu bar.
38 *
39 * @remark
40 * A special hack in qeventloop_mac.cpp is required for this
41 * to work. Overloading QEventLoop::processEvents isn't feasable
42 * unfortunately, thus the horrible hacks. Qt 4 does seem to provide
43 * an interface similar to the one we create here.
44 *
45 * Btw. is QI* the right right way to do this? Or should it perhapse
46 * be called VBoxQApplication or something?
47 */
48class QIApplication : public QApplication
49{
50public:
51 QIApplication (int &argc, char **argv)
52 : QApplication (argc, argv)
53#ifdef Q_WS_MAC
54 , m_callback (NULL)
55 , m_callbackUserArg (NULL)
56#endif
57 {
58 }
59
60#ifdef Q_WS_MAC
61 bool macEventFilter (EventHandlerCallRef, EventRef inEvent)
62 {
63 if ( m_callback
64 && m_callback (inEvent, m_callbackUserArg))
65 return true;
66 return false;
67 }
68
69 void setEventFilter (QIFilterCallback callback, void *inUserArg)
70 {
71 m_callback = callback;
72 m_callbackUserArg = inUserArg;
73 }
74
75protected:
76 QIFilterCallback m_callback;
77 void *m_callbackUserArg;
78
79public:
80#endif
81};
82
83
84#endif // __QIApplication_h__
85
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette